@extends('layouts.appmin')

@section('tajuk')
Senarai Telah Terima Wang Proses
@endsection


@section('breadcrumb')
    <ul class="breadcrumbs mb-3">
        <li class="nav-home">
            <a href="#">
            <i class="icon-home"></i>
            </a>
        </li>
        <li class="separator">
            <i class="icon-arrow-right"></i>
        </li>
        <li class="nav-item">
            <a href="#">Penjaja</a>
        </li>
        <li class="separator">
            <i class="icon-arrow-right"></i>
        </li>
        <li class="nav-item">
            <a href="#">Terima Wang Proses</a>
        </li>
    </ul>
@endsection

@section('content')                    

    <div class="row mt-4">
        <div class="col-lg-12">
            <div class="table-responsive p-0 text-sm text-secondary">
                <table class="table align-items-center mb-0"  id="senarai">
                    <thead>
                        <tr>
                            <th style="width: 10px">#</th>
                            <th>Tarikh<br>Mohon</th>
                            <th>Pemohon</th>
                            <th>Perniagaan</th>
                            <th>Jenis Penjaja</th>
                            <th>Alamat Aktiviti</th>
                            <th>No Bil Proses</th>
                            <th>Status Bayaran</th>
                            <th>&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php $i = 0; ?>
                        @foreach($senarais as $senarai)
                        <tr class="align-middle text-sm">
                            <td><?php echo ++$i; ?></td>
                            <td>{{$senarai->created_at}}</td>
                            <td>{{stripslashes($senarai->user->name)}}<br><small>{{$senarai->user->nokp}}</small></td>
                            <td>{{$senarai->syarikat->name}}<br><small>{{$senarai->syarikat->nossm}}</small></td>
                            <td>{{$senarai->jenis}}</td>
                            <td>
                                @if(!is_null($senarai->penempatan?->nama)) {{ucwords($senarai->penempatan?->nama)}},<br /> @endif
                                @if(!is_null($senarai->jalan?->nama)) {{ucwords(strtolower($senarai->jalan?->nama))}},<br /> @endif
                                @if(!is_null($senarai->taman?->nama)) {{ucwords(strtolower($senarai->taman?->nama))}},<br /> @endif
                               {{ucwords(strtolower($senarai->kawasan->nama))}}</td>
                            <td>@foreach($senarai->bilpelbagais->where('jenis_bil', 'wang proses') as $bil)
                                {{$bil->no_akaun_bilpelbagai}}
                                    @if($bil->no_resit != '')
                                        <?php $txt_bayar = 'Bayar<br />('.$bil->no_resit.')'; ?>
                                    @else 
                                        <?php $txt_bayar = 'Tiada'; ?>
                                    @endif
                                @endforeach</td>
                            <td><?php echo $txt_bayar; ?></td>
                            <td><a href="{{route('admin.papar-lesen', [$senarai->id])}}"><i class="fas fa-file-signature"></i></a></td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>                      
            </div>                        
        </div> <!-- /.col -->                   
    </div> <!--end::Row-->
@endsection
@section('js')
<script>
$(document).ready(function () {
    $('#senarai').DataTable({
        dom: '<"row mb-3"<"col-md-3 col-sm-6"f><"col-md-8 col-sm-2"><"col-md-1 col-sm-4"l>>' +
                '<"row"<"col-12"tr>>' +
                '<"row mt-3"<"col-md-5"i><"col-md-7"p>>',
        language: {
            search: '<span class="me-2">Cari:</span>',
            lengthMenu: '<span class="me-2">Show</span> _MENU_'
        },
        responsive: true
    });
});

</script>
@endsection