@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb pb-3">
                      <li class="breadcrumb-item"><a href="{{ route('home') }}">Home</a></li>
                      <li class="breadcrumb-item active" aria-current="page">Lelongan</li>
                    </ol>
                  </nav>

                <div class="card-body text-center">
                    <div class="row form-group">
                        <div class="col-md-2">
                        </div>
                        <div class="col-md-10">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">

                            <a class="btn btn-info mb-3" href="{{ route('lelongan.tuntutbaki') }}">Notis Tuntut Baki</a>
                          
                            @if(sizeof($senaraibatchfasa1) !== 0 || sizeof($senaraibatchfasa2) !== 0)
                            <table class="table table-bordered table-striped">
                                <thead class="bg-dark">
                                  <tr>
                                    <th scope="col">No.</th>
                                    <th scope="col">Batch No.</th>
                                    <th scope="col">Fasa</th>
                                    <th scope="col">Bilangan Aktif</th>
                                    <th scope="col">Tarikh Lelong</th>
                                    <th scope="col">Tindakan</th>
                                  </tr>
                                </thead>
                                <tbody>
                                    @foreach($senaraibatchfasa1 as $index=>$sb)
                                        <tr>
                                            <td>{{ $loop->iteration }}</td>
                                            <td>{{ $sb['batchno'] }}</td>
                                            <td>Fasa 1</td>
                                            <td class="text-danger font-weight-bold">{{ $sb['total'] }}</td>
                                            <td>{{ $sb['t_lelong'] }}</td>
                                            <td class="text-center">
                                                <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'cetak','batchno' => $sb['batchno'],'fasa' => 1]) }}" class="btn btn-info text-white">Cetak</a>
                                                <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'excel','batchno' => $sb['batchno'],'fasa' => 1]) }}" target="_blank" class="btn btn-success text-white">Excel</a>
                                                <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'pdf','batchno' => $sb['batchno'],'fasa' => 1]) }}" target="_blank" class="btn btn-danger text-white">PDF</a>
                                            </td>
                                        </tr>
                                    @endforeach
                                    @foreach($senaraibatchfasa2 as $index=>$sb)
                                    <tr>
                                        <td>{{ $loop->iteration }}</td>
                                        <td>{{ $sb['batchno'] }}</td>
                                        <td>Fasa 2</td>
                                        <td class="text-danger font-weight-bold">{{ $sb['total'] }}</td>
                                        <td>{{ $sb['t_lelong'] }}</td>
                                        <td class="text-center">
                                            <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'cetak','batchno' => $sb['batchno'],'fasa' => 2]) }}" class="btn btn-info text-white">Cetak</a>
                                            <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'excel','batchno' => $sb['batchno'],'fasa' => 2]) }}" target="_blank" class="btn btn-success text-white">Excel</a>
                                            <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'pdf','batchno' => $sb['batchno'],'fasa' => 2]) }}" target="_blank" class="btn btn-danger text-white">PDF</a>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                              </table>
                            @else 
                            <div class="alert alert-danger" role="alert">
                                Tiada Data dalam lelong!
                              </div>
                            @endif

                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                          
                        </div>
                    </div>
                    <div class="row">

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    // function FuncPrint(meth)
    // {
    //     let jeniscetakan = meth.value;

    //     if(jeniscetakan === 'cetak')
    //     {
    //         let urlroute = '{{ route("lelongan.laporancetak", ":id") }}';
    //         urlroute = urlroute.replace(':id', jeniscetakan);
    //         window.open(urlroute, '_blank');

    //     }else if(jeniscetakan === 'excel')
    //     {
    //         let urlroute = '{{ route("lelongan.laporancetak", ":id") }}';
    //         urlroute = urlroute.replace(':id', jeniscetakan);
    //         window.open(urlroute, '_blank');

    //     }else{
    //         console.log('tiada cetakan');
    //     }
    // }

</script>
@endsection

