@extends('layouts.app', ['class' => 'g-sidenav-show bg-gray-100']) @section('content') @include('layouts.navbars.auth.topnav', ['title' => 'Kedatangan Tamu']) @php // Check user roles $isResepsionis = session('user')->idroles === 'rspion'; $isSecurity = session('user')->idroles === 'scrity'; // Define field access by role $resepsionisAllowedFields = [ 'NamaTamu', 'KTP_SIM_IDCARD', 'Instansi', 'JumlahPersonel', 'department_id', 'subdepartment_id', 'PICYangDituju', 'qty_earplug', 'qty_shoescover', 'qty_hairnet', ]; $securityAllowedFields = [ 'Nomor_Polisi', 'jeniskendaraan_id', 'typekendaraan_id', 'TanggalMasuk', 'JamMasuk', 'TanggalKeluar', 'JamKeluar', 'KTP_SIM_IDCARD', ]; function isFieldAllowed( $fieldName, $isResepsionis, $isSecurity, $resepsionisAllowedFields, $securityAllowedFields, ) { if ($isResepsionis) { return in_array($fieldName, $resepsionisAllowedFields); } elseif ($isSecurity) { return true; // Initially allow all fields for security, will be controlled by JS } return true; } @endphp @if ($isSecurity)
Pilih Opsi Input:
@endif
@csrf
@php $sections = [ 'Kedatangan Tamu' => [ [ '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 Tamu' => [ [ 'name' => 'NamaTamu', 'label' => 'Nama Tamu', 'type' => 'text', 'placeholder' => 'Ex.: Nama Tamu', 'col' => 3, ], [ 'name' => 'KTP_SIM_IDCARD', 'label' => 'KTP/SIM/ID Card', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], [ 'name' => 'Instansi', 'label' => 'Instansi', 'type' => 'text', 'placeholder' => 'Ex.: Instansi', 'col' => 3, ], [ 'name' => 'JumlahPersonel', 'label' => 'Jumlah Personel', 'type' => 'number', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], ], 'PIC di MSJ' => [ [ 'name' => 'PICYangDituju', 'label' => 'PIC yang dituju', 'type' => 'text', 'placeholder' => 'Ex.: xxxx', 'col' => 3, ], [ 'name' => 'department_id', 'label' => 'Department', 'type' => 'enum', 'query' => 'SELECT id, nama_department FROM mst_department', 'col' => 3, ], [ 'name' => 'subdepartment_id', 'label' => 'Subdepartment', 'type' => 'enum', 'query' => 'SELECT id, nama_subdepartment FROM mst_subdepartment', 'col' => 3, ], ], 'Perlengkapan K3' => [ [ 'name' => 'qty_hairnet', 'label' => 'Hairnet', 'type' => 'number', 'placeholder' => '0', 'col' => 1, 'note' => 'Jumlah Hairnet yang dipinjam', 'default' => '0', ], [ 'name' => 'qty_shoescover', 'label' => 'Shoes Cover', 'type' => 'number', 'placeholder' => '0', 'col' => 1, 'note' => 'Jumlah Shoes Cover yang dipinjam', 'default' => '0', ], [ 'name' => 'qty_earplug', 'label' => 'Ear Plug', 'type' => 'number', 'placeholder' => '0', 'col' => 1, 'note' => 'Jumlah Ear Plug yang dipinjam', 'default' => '0', ], ], ]; @endphp @foreach ($sections as $title => $fields)

{{ $title }}


@foreach ($fields as $field)
@if ($field['type'] === 'enum') @elseif ($field['type'] === 'number' && isset($field['note']))
@else @endif @error($field['name'])
{{ $message }}
@enderror
@if ($field['name'] === 'JamMasuk')
@endif @if ($field['name'] === 'JamKeluar')
@endif @endforeach
@endforeach
@endsection @push('js') @endpush