@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"><a href="{{ route('laporan') }}">Laporan</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">
                          
                            @if(sizeof($senaraibatch) !== 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">Bilangan Aktif</th>
                                    <th scope="col">Tarikh Lelong</th>
                                    <th scope="col">Action</th>
                                  </tr>
                                </thead>
                                <tbody>
                                    @foreach($senaraibatch as $index=>$sb)
                                        <tr>
                                            <td>{{ $loop->iteration }}</td>
                                            <td>{{ $sb['batchno'] }}</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']]) }}" class="btn btn-info text-white">Cetak</a>
                                                <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'excel','batchno' => $sb['batchno']]) }}" target="_blank" class="btn btn-success text-white">Excel</a>
                                                <a href="{{ route('lelongan.laporancetak', ['jeniscetakan' => 'pdf','batchno' => $sb['batchno']]) }}" 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

