@extends('layouts.appmin')

@section('tajuk')
Senarai Menunggu Keputusan Mesyuarat
@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="#">Menunggu Keputusan Mesyuarat</a>
      </li>
    </ul>
@endsection

@section('content')                    

    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title">Mesyuarat Jawatankuasa Kesihatan dan Pelesenan (Bilangan {{$mesyuarat->bil_mesyuarat}}/{{$mesyuarat?->tahun}})</h4>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-sm-12 col-md-6">
                            <p>Tarikh : {{$mesyuarat->dt_mesyuarat}}</p>
                            <p>Bilangan Permohonan : {{$mesyuarat->lesen_penjajas->count()}}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <form action="{{route('pt.simpan-keputusan-mesyuarat')}}" method="post" id="form_pertama">
        @csrf
        <input type="hidden" name="mesyuarat_id" value="{{$mesyuarat->id}}">
    <div class="row">
        <div class="col-md-12">
            <div class="row">                
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-header">
                            <h4 class="card-title">Keputusan Mesyuarat (Bilangan {{$mesyuarat?->bil_mesyuarat}}/{{$mesyuarat?->tahun}})</h4>
                        </div>
                        <div class="card-body">
                            <div class="table-responsive">
                                <table id="senarai2" class="display table table-striped table-hover" >
                                    <thead>
                                        <tr>
                                            <th style="width: 10px">#</th>
                                            <th>Tarikh<br>Arahan</th>
                                            <th>No Fail<br />No Akaun Permohonan</th>
                                            <th>Maklumat Perniagaan</th>
                                            <th>By Law<br />Kod Lesen</th>
                                            <th>&nbsp;</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <?php $i = 0; ?>
                                        @if(!is_null($mesyuarat?->lesen_penjajas))
                                            @foreach($mesyuarat?->lesen_penjajas as $senarai)
                                            <?php $i++; ?>
                                            <tr class="align-middle text-sm">
                                                <td><?php echo $i; ?></td>
                                                <td>{{$senarai->created_at}}</td>
                                                <td>{{$senarai->no_fail_lesen}}
                                                        <br />[{{$senarai->no_akaun_lesen}}]
                                                </td>
                                                <td>{{stripslashes($senarai->user->name)}}<br>
                                                    <small>[{{$senarai->syarikat->name}}]<br />
                                                    ({{$senarai->jenis_penjaja->jenis}})<br />
                                                    {{$senarai->kawasan->nama}}</small></td>
                                                <td>{{$senarai->pivot->by_law}}<br />{{$senarai->pivot->kodlesen}}</td>
                                                <td>
                                                    <select name="keputusan[{{$senarai->id}}]" id="keputusan_{{$senarai->id}}" class="form-select">
                                                        <option value=""></option>
                                                        <option value="diluluskan" @if($senarai->status_mesyuarat == 'diluluskan') {{'selected'}} @endif>Lulus</option>
                                                        <option value="ditangguhkan" @if($senarai->status_mesyuarat == 'ditangguhkan') {{'selected'}} @endif>Tangguh</option>
                                                        <option value="ditolak" @if($senarai->status_mesyuarat == 'ditolak') {{'selected'}} @endif>Tolak</option>
                                                        <option value="dibatalkan" @if($senarai->status_mesyuarat == 'dibatalkan') {{'selected'}} @endif>Batal</option>
                                                    </select>
                                                </td>
                                            </tr>
                                            @endforeach
                                        @endif
                                    </tbody>
                                    <tfoot>
                                            <tr class="align-middle text-sm">
                                                <td colspan="5">&nbsp;</td>
                                                <td>
                                                    <input type="submit" name="keputusan_save" class="btn btn-primary" value="Kemaskini">
                                                </td>
                                            </tr>                                            
                                    <tfoot>
                                </table>                      
                            </div>              
                        </div>              
                    </div>                                                  
                </div> <!-- /.col -->    
            </div>
        </div>               
    </div> <!--end::Row-->
    </form>

@endsection
@section('js')
<script>
$(document).ready(function () {
    $('#senarai').DataTable({
        responsive: true
    });
});

</script>
@endsection