@extends('layouts.appmin')

@section('tajuk')
Pemeriksaan Tapak Permohonan Lesen Penjaja
@endsection

@section('css')

    <!-- Select2 -->
    <link rel="stylesheet" href="{{ asset('plugins/select2/css/select2.min.css') }}">
    <link rel="stylesheet" href="{{ asset('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css') }}">
<link href="{{ asset('css/jsapi-template-main.css') }}" rel="stylesheet" type="text/css"/>
<link href="https://js.arcgis.com/4.25/esri/css/main.css" rel="stylesheet" type="text/css" />
<style>
#viewDiv {
  padding: 0;
  margin: 0;
  height: 500px;
  width: 100%;
}
</style>
@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="#">Pemeriksaan Tapak</a>
    </li>
    <li class="separator">
        <i class="icon-arrow-right"></i>
    </li>
    <li class="nav-item">
        <a href="#">Papar Permohonan</a>
    </li>
</ul>
@endsection

@section('content')

    @if (session('success'))
        <div class="alert alert-success" role="alert">
            {{ session('success') }}
        </div>
    @endif  
    <div class="row mb-3">
        <div class="col-md-12">
            <a href="" class="btn btn-primary mx-2">Permohonan</a><a href="{{route('ik.papar-pemeriksaan-map', [$permohonan->id])}}" class="btn btn-primary mx-2">Peta Lokasi</a><a href="{{route('ik.papar-pemeriksaan-ulasan', [$permohonan->id])}}" class="btn btn-primary mx-2">Borang Ulasan</a>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6">
          <div class="card card-round">
            <div class="card-header">
              <div class="card-head-row card-tools-still-right">
                <h4 class="card-title">Maklumat Peribadi Pemohon</h4>
              </div>
            </div> <!-- /.card-header -->
            <div class="card-body">
                <div class="row">
                    <div class="col-md-12"> 
                        <div class="form-group">
                          <label for="nokp">No KP</label>
                          <input type="text" class="form-control" id="nokp" disabled
                            value="{{ old('nokp', $permohonan?->user->nokp) }}" />
                        </div> 
                        <div class="form-group">
                          <label for="name">Name</label>
                          <input type="text" class="form-control" id="name" disabled
                            value="{{ old('name', $permohonan?->user->name) }}" />
                        </div> 
                        <div class="row">
                            <div class="col-md-7">
                                <div class="form-group">
                                <label for="email">Email</label>
                                <input type="text" class="form-control" id="email" disabled
                                    value="{{ old('email', $permohonan?->user->email) }}" />
                                </div> 
                            </div>
                            <div class="col-md-5">
                                <div class="form-group">
                                <label for="notelefon">No Telefon</label>
                                <input type="text" class="form-control" id="notelefon" disabled
                                    value="{{ old('notelefon', $permohonan?->user->notelefon) }}" />
                                </div> 
                            </div>
                        </div>
                        <div class="form-group">
                          <label for="alamat">Alamat</label>
                          <textarea class="form-control" id="alamat" rows="4" disabled>{{ old('alamat', $permohonan?->user->alamat) }}</textarea>
                          
                        </div> 
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                  <label for="jantina">Jantina</label>
                                  <input type="text" class="form-control" id="jantina" disabled
                                    value="{{ old('jantina', $permohonan?->user->jantina) }}" />
                                </div> 
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                  <label for="bangsa">Bangsa</label>
                                  <input type="text" class="form-control" id="bangsa" disabled
                                    value="{{ old('bangsa', $permohonan?->user->bangsa) }}" />
                                </div> 
                            </div>
                        </div>  
                    </div>
                </div>
            </div> <!-- /.card-body -->  
          </div>
        </div> 
        <div class="col-md-6">
            <div class="card card-round">
                <div class="card-header">
                    <div class="card-head-row card-tools-still-right">
                    <h4 class="card-title">Maklumat Perniagaan(SSM)</h4>
                    </div>
                </div> <!-- /.card-header -->
                <div class="card-body">
                    <div class="row">
                        <div class="col-md-12"> 
                            <div class="form-group">
                                <label for="nossm">No SSM</label>
                                <input type="text" class="form-control" id="nossm" disabled
                                value="{{ old('nossm', $permohonan?->syarikat->nossm) }}" />
                            </div> 
                            <div class="form-group">
                                <label for="nama_perniagaan">Nama Perniagaan</label>
                                <input type="text" class="form-control" id="nama_perniagaan" disabled
                                value="{{ old('nama_perniagaan', $permohonan?->syarikat->name) }}" />
                            </div> 
                            <div class="form-group">
                                <label for="jenis_perniagaan">Jenis Perniagaan</label>
                                <input type="text" class="form-control" id="jenis_perniagaan" disabled
                                value="{{ old('jenis_perniagaan', $permohonan?->syarikat->jenis_perniagaan) }}" />
                            </div> 
                            <div class="form-group">
                                <label for="alamat_perniagaan">Alamat Perniagaan</label>                                
                                <textarea class="form-control" id="alamat_perniagaan" rows="4" disabled>{{ old('alamat_perniagaan', $permohonan?->syarikat->alamat) }}</textarea>
                            </div> 
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="notelefon_perniagaan">No Telefon</label>
                                        <input type="text" class="form-control" id="notelefon_perniagaan" disabled
                                        value="{{ old('notelefon_perniagaan', $permohonan?->syarikat->notelefon) }}" />
                                    </div> 
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="bil_cawangan">Bil Cawangan</label>
                                        <input type="text" class="form-control" id="bil_cawangan" disabled
                                        value="{{ old('bil_cawangan', $permohonan?->syarikat->bil_cawangan) }}" />
                                    </div> 
                                </div>
                            </div>  
                        </div>
                    </div>
                </div>      
            </div>
        </div>              
    </div> <!--end::Row-->
    <div class="row">
      <div class="col-md-12">
        <div class="card card-round">
          <div class="card-header">
            <div class="card-head-row card-tools-still-right">
              <h4 class="card-title">Maklumat Permohonan Lesen Penjaja</h4>
            </div>
          </div>
          <div class="card-body">
            <div class="row">
              <div class="col-md-6 col-sm-12">
                <div class="form-group">
                    <label for="jenis_penjaja">Jenis Penjaja</label>
                    <input type="text" class="form-control" id="jenis_penjaja" disabled
                    value="{{ old('jenis_penjaja', $permohonan?->syarikat->jenis) }}" />
                </div> 
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="jenis_kenderaan">Jenis Kenderaan</label>
                            <input type="text" class="form-control" id="jenis_kenderaan" disabled
                            value="{{ old('jenis_kenderaan', $permohonan?->jenis_kenderaan) }}" />
                        </div> 
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="no_pendaftaran">No Pendaftaran Kenderaan</label>
                            <input type="text" class="form-control" id="no_pendaftaran" disabled
                            value="{{ old('no_pendaftaran', $permohonan?->no_pendaftaran) }}" />
                        </div> 
                    </div>
                </div>
                <div class="form-group">
                    <label for="status_tanah">Status Tanah</label>
                    <input type="text" class="form-control" id="status_tanah" disabled
                    value="{{ old('status_tanah', $permohonan?->status_tanah) }}" />
                </div> 
                <div class="form-group">
                    <label for="alamat_penjajaan">Alamat Aktiviti Penjajaan</label>
                    <textarea class="form-control" id="alamat_penjajaan" rows="4" disabled>{{ old('alamat_perniagaan', $permohonan?->alamat_penjajaan) }}</textarea>
                </div> 
              </div>    
              <div class="col-md-6 col-sm-12">
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="masa_jualan_mula">Masa Mula Jualan</label>
                            <input type="text" class="form-control" id="masa_jualan_mula" disabled
                            value="{{ old('masa_jualan_mula', $permohonan?->masa_jualan_mula) }}" />
                        </div> 
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="masa_jualan_tamat">Masa Tamat Jualan</label>
                            <input type="text" class="form-control" id="masa_jualan_tamat" disabled
                            value="{{ old('masa_jualan_tamat', $permohonan?->masa_jualan_tamat) }}" />
                        </div> 
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="makanan">Makanan</label>
                            <textarea class="form-control" id="makanan" rows="4" disabled>{{ old('makanan', $permohonan?->makanan) }}</textarea>
                        </div> 
                    </div>
                    <div class="col-md-6">
                        <div class="form-group">
                            <label for="minuman">Minuman</label>
                            <textarea class="form-control" id="minuman" rows="4" disabled>{{ old('minuman', $permohonan?->minuman) }}</textarea>
                        </div> 
                    </div>
                </div>
                <div class="form-group">
                    <label for="lain">Lain-lain</label>
                    <input type="text" class="form-control" id="lain" disabled
                    value="{{ old('lain', $permohonan?->lain) }}" />
                </div>

              </div> 
            </div>   
          </div> 
        </div>   
      </div> 
    </div>   
    <div class="row">
        <div class="col-md-12">
            <div class="card card-round">
                <div class="card-header">
                    <div class="card-head-row card-tools-still-right">
                        <h4 class="card-title">Dokumen Permohonan Lesen Penjaja</h4>
                    </div>
                </div>
                <div class="card-body">
                    <div class="row">        
                        <div class="col-md-6">
                            @if(!is_null($doc_gambar))
                                <h6>Gambar Berukuran Passport</h6>
                                @if ($doc_gambar->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_gambar->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_gambar->pivot->path) }}" alt="Gambar Passport" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                        <div class="col-md-6">
                            @if(!is_null($doc_lokasi))
                                <h6>Gambar Lokasi / Pelan</h6>
                                @if ($doc_lokasi->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_lokasi->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_lokasi->pivot->path) }}" alt="Gambar Lokasi" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                        <div class="col-md-6">
                            @if(!is_null($doc_kebenaran))
                                <h6>Surat kebenaran pemilik tanah / pemegang rezab /perjanjian yang sah</h6>
                                @if ($doc_kebenaran->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_kebenaran->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_kebenaran->pivot->path) }}" alt="Surat Kebenaran" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                        <div class="col-md-6">
                            @if(!is_null($doc_kenderaan))
                                <h6>Gambar Kenderaan</h6>
                                @if ($doc_kenderaan->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_kenderaan->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_kenderaan->pivot->path) }}" alt="Gambar Kenderaan" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                        <div class="col-md-6">
                            @if(!is_null($doc_kenderaan_geran))
                                <h6>Salinan Geran Kenderaan</h6>
                                @if ($doc_kenderaan_geran->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_kenderaan_geran->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_kenderaan_geran->pivot->path) }}" alt="Gambar Kenderaan" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                        <div class="col-md-6">
                            @if(!is_null($doc_suntikan_ty2))
                                <h6>Salinan Sijil Suntikan TY2 (Pengendali makanan sahaja)</h6>
                                @if ($doc_suntikan_ty2->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_suntikan_ty2->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_suntikan_ty2->pivot->path) }}" alt="Salinan Suntikan" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                        <div class="col-md-6">
                            @if(!is_null($doc_kursus_makanan))
                                <h6>Salinan Sijil Kursus Pengendalian Makanan</h6>
                                @if ($doc_kursus_makanan->pivot->jenis_dokumen === 'pdf')
                                    <a href="{{ asset('storage/documents/' . $doc_kursus_makanan->pivot->path) }}" target="_blank">View PDF</a>
                                @else
                                    <img src="{{ asset('storage/documents/' . $doc_kursus_makanan->pivot->path) }}" alt="Salinan Sijil Kursus Pengendalian Makanan" style="max-width: 100px;">
                                @endif
                            @endif
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
      <div class="col-md-6">
        <div class="card card-round">
          <div class="card-header">
            <div class="card-head-row card-tools-still-right">
              <h4 class="card-title">Wang Proses</h4>
            </div>
          </div>
          <div class="card-body">
                    <div class="row">
                        <div class="col-12">
                            <table class="table">
                                <?php 
                                $i = 0;
                                ?>
                                <tr>
                                    <th>#</th>
                                    <th>No Akaun BP</th>
                                    <th>No Resit<br />(Tarikh Bayar)</th>
                                    <th>Bayaran<br />(RM)</th>
                                </tr>
                                @foreach($permohonan?->bilpelbagais as $bp)
                                <?php $i++; ?>
                                <tr>
                                    <td><?php echo $i; ?>.</td>
                                    <td>{{$bp->no_akaun_bilpelbagai}}</td>
                                    <td>{{$bp->no_resit}}<br />{{$bp->dt_bayar}}</td>
                                    <td>{{$bp->amaun_bayar}}</td>
                                </tr>
                                @endforeach
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div> <!-- /.col -->   
        <div class="col-md-6">
            <div class="card card-round">
                <div class="card-header">
                    <div class="card-head-row card-tools-still-right">
                    <h4 class="card-title">Maklumat Fail</h4>
                    </div>
                </div>        
                <div class="card-body">
                    <div class="form-group">
                        <label for="no_fail_lesen">No Fail Lesen</label>
                        <input type="text" class="form-control" id="no_fail_lesen" disabled
                        value="{{ old('no_fail_lesen', $permohonan->no_fail_lesen) }}" />
                    </div> 
                    <div class="form-group">
                        <label for="no_akaun_lesen">No Akaun Lesen</label>
                        <input type="text" class="form-control" id="no_akaun_lesen" disabled
                        value="{{ old('no_akaun_lesen', $permohonan->no_akaun_permohonan) }}" />
                    </div> 
                </div>
            </div>
        </div> <!-- /.col -->         
    </div> <!--end::Row-->
@endsection

@section('js')
  <!-- Select2 -->
    <script src="{{ asset('plugins/select2/js/select2.full.min.js') }}"></script>

@endsection