@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('lelong') }}">Lelongan</a></li>
                      <li class="breadcrumb-item active" aria-current="page">Notis Tuntut</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($lelong) !== 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 Tuntut Baki</th>
                                    <th scope="col">Bilangan Rugi</th>
                                    <th scope="col">Tarikh Lelong</th>
                                    <th scope="col">Tindakan</th>
                                  </tr>
                                </thead>
                                <tbody>
                                    @foreach($lelong as $index=>$lel)
                                        <tr>
                                            <td>{{ $loop->iteration }}</td>
                                            <td>{{ $lel['batchno'] }}</td>
                                            <td>{{ $lel['bilangantuntutbaki'] }}</td>
                                            <td>{{ $lel['bilanganrugi'] }}</td>
                                            <td>{{ $lel['tarikhlelong'] }}</td>
                                            <td class="text-center">
                                                <a href="{{ route('lelongan.notistuntutbaki', ['jeniscetakan' => 'tuntutbaki','batchno' => $lel['batchno']]) }}" target="_blank" class="btn btn-success text-white">Notis Tuntut</a>
                                                <a href="{{ route('lelongan.notistuntutbaki', ['jeniscetakan' => 'rugi','batchno' => $lel['batchno']]) }}" target="_blank" class="btn btn-danger text-white">Notis Rugi</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

