@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => 'Edit Kedatangan Tamu']) @php // Check if user has PPICSS role $isPPICSS = session('user')->idroles === 'PPICSS'; @endphp
@csrf @method('PUT') {{-- Add hidden fields to maintain data when PPICSS role --}} @if ($isPPICSS) @endif
@php $sections = [ 'Kedatangan Barang' => [ [ 'name' => 'Nomor_Polisi', 'label' => 'Nopol (A 1234 AB)', 'type' => 'text', 'placeholder' => 'ex.: A 1234 AB', 'col' => 6, ], [ 'name' => 'TanggalMasuk', 'label' => 'Tanggal Masuk', 'type' => 'date', 'col' => 3, ], [ 'name' => 'JamMasuk', 'label' => 'Jam Masuk (hh:mm)', 'type' => 'time', 'col' => 2, ], [ 'name' => 'jeniskendaraan_id', 'label' => 'Jenis Kendaraan', 'type' => 'enum', 'query' => 'SELECT id, jenis_kendaraan FROM mst_jeniskendaraan', 'col' => 3, ], [ 'name' => 'typekendaraan_id', 'label' => 'Type Kendaraan', 'type' => 'enum', 'query' => 'SELECT id, Nama_typekendaraan FROM mst_typekendaraan', 'col' => 3, ], [ 'name' => 'TanggalKeluar', 'label' => 'Tanggal Keluar', 'type' => 'date', 'col' => 3, ], [ 'name' => 'JamKeluar', 'label' => 'Jam Keluar (hh:mm)', 'type' => 'time', 'col' => 2, ], ], 'Identitas Sopir' => [ [ 'name' => 'NamaSopir', 'label' => 'Nama Sopir', 'type' => 'text', 'placeholder' => 'Ex.: Nama Sopir', 'col' => 3, ], [ 'name' => 'SIM', 'label' => 'SIM', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], ], 'Dokumen Kendaraan' => [ [ 'name' => 'NoKontainer', 'label' => 'Nomor Kontainer', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], [ 'name' => 'NoSegel', 'label' => 'Nomor Segel', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], [ 'name' => 'NoSuratJalan', 'label' => 'Nomor Surat Jalan', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], [ 'name' => 'ekspedisi_id', 'label' => 'Perusahaan/Ekspedisi', 'type' => 'enum', 'query' => 'select id, Nama_Ekspedisi from mst_ekspedisi', 'col' => 3, ], ], 'MUAT/BONGKAR' => [ [ 'name' => 'bongkarmuat_id', 'label' => 'Keterangan Bongkar Muat', 'type' => 'enum', 'query' => 'select id, Data_Bongkar_Muat from mst_bongkarmuat', 'col' => 3, ], [ 'name' => 'JumlahPersonel', 'label' => 'Jumlah Personel', 'type' => 'number', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], [ 'name' => 'Penerima_Barang', 'label' => 'Penerima Barang', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], ], ]; // Tambahkan elemen "Bukti_Awal" dan "Bukti_Akhir" jika role sesuai if (in_array($user_login->idroles, ['featms', 'PPICSS', 'admins'])) { $sections['MUAT/BONGKAR'][] = [ 'name' => 'Bukti_Awal', 'label' => 'Bukti Awal', 'type' => 'image', 'col' => 1, ]; $sections['MUAT/BONGKAR'][] = [ 'name' => 'Bukti_Akhir', 'label' => 'Bukti Akhir', 'type' => 'image', 'col' => 1, ]; } @endphp @foreach ($sections as $title => $fields) {{-- Only show MUAT/BONGKAR section for PPICSS --}} @if (!$isPPICSS || $title === 'MUAT/BONGKAR')

{{ $title }}


@foreach ($fields as $field) {{-- Only show image fields if PPICSS --}} @if (!$isPPICSS || ($isPPICSS && $field['type'] === 'image'))
@if ($field['type'] === 'enum') @elseif ($field['type'] === 'image')
@php $imagePath = $list->{$field['name']} ? asset( 'storage/' . $list->{$field['name']}, ) : asset('/storage/noimage.png'); @endphp image

Maksimal Size : {{ 2048 }} KB

Format Image : PNG, JPG, JPEG

@elseif ($field['type'] == 'number') @php $currentValue = old( $field['name'], $list->{$field['name']} ?? ($field['default'] ?? ''), ); @endphp @else @endif @error($field['name'])
{{ $message }}
@enderror
@endif @if ($field['name'] === 'JamMasuk' && !$isPPICSS)
@endif @if ($field['name'] === 'JamKeluar' && !$isPPICSS)
@endif @endforeach
@endif @endforeach
{{-- Warning Modal --}} @endsection @push('js') @endpush