@php /** @var \App\Models\TimeSheet $timeSheet */ $vPos = old('vessel_positions', $timeSheet->vessel_positions ?? \App\Models\TimeSheet::getDefaultVesselPositions()); $sheets = old('sheets', $timeSheet->resolved_sheets ?? []); if (empty($sheets)) { $sheets = [ [ 'sheet_no' => old('sheet_no', $timeSheet->sheet_no ?? '1'), 'date' => null, 'cargo_summary' => old('cargo_summary', $timeSheet->cargo_summary ?? \App\Models\TimeSheet::getDefaultCargoSummary()), 'ships_gangs' => old('ships_gangs', $timeSheet->ships_gangs ?? \App\Models\TimeSheet::getDefaultShipsGangs()), 'toyota_cargo' => old('toyota_cargo', $timeSheet->toyota_cargo ?? \App\Models\TimeSheet::getDefaultToyotaCargo()), ] ]; } $cargoRows = [ 'cars_cbu' => 'CARS / CBU', 'heavy_high' => 'HEAVY HIGH', 'truck' => 'TRUCK', 'bus' => 'BUS', 'parts_static' => 'PART', 'cargo_on_mafi' => 'CARGO ON MAFI', ]; $toyotaRows = [ 'cars_cbu' => 'CARS / CBU', 'hh_truck_bus' => 'HH / TRUCK / BUS', 'parts_static' => 'PART', ]; $pairedGangs = [ [ 'left' => ['key' => 'superintendent', 'label' => '- SUPERINTENDENT'], 'right' => ['key' => 'manager_logistic', 'label' => '- MANAGER LOGISTIC'], ], [ 'left' => ['key' => 'chief_foreman', 'label' => '- CHIEF FOREMAN'], 'right' => ['key' => 'ass_manager_logistic', 'label' => '- ASS. MANAGER LOGISTIC'], ], [ 'left' => ['key' => 'chief_checker', 'label' => '- CHIEF CHECKER'], 'right' => ['key' => 'signalman', 'label' => '- SIGNALMAN'], ], [ 'left' => ['key' => 'checker', 'label' => '- CHECKER'], 'right' => ['key' => 'head_yard', 'label' => '- HEAD YARD'], ], [ 'left' => ['key' => 'hatch_boss', 'label' => '- HATCH BOSS'], 'right' => ['key' => 'yard_cbu', 'label' => '- YARD CBU'], ], [ 'left' => ['key' => 'leadman', 'label' => '- LEADMAN'], 'right' => ['key' => 'yard_hh', 'label' => '- YARD HH'], ], [ 'left' => ['key' => 'operator', 'label' => '- OPERATOR'], 'right' => ['key' => 'yard_document', 'label' => '- YARD DOCUMENT'], ], [ 'left' => ['key' => 'parking_drivers', 'label' => '- PARKING DRIVERS'], 'right' => ['key' => 'yard_key_man', 'label' => '- YARD KEY MAN'], ], [ 'left' => ['key' => 'shifting_drivers', 'label' => '- SHIFTING DRIVERS'], 'right' => ['key' => 'hatch_boss_lashing', 'label' => '- HATCH BOSS LASHING'], ], [ 'left' => ['key' => 'junior_drivers', 'label' => '- JUNIOR DRIVERS'], 'right' => ['key' => 'total', 'label' => '- TOTAL'], ], ]; @endphp @if($errors->any())

Periksa kembali isian formulir:

@endif
@csrf @if($method !== 'POST') @method($method) @endif @include('partials.vessel-berthing-pull-bar') {{-- Top Card: Sheet No & Status --}}

No lembar default.

Draft atau Selesai.

{{-- Main Document Card (Formatted like the Paper Sheet) --}}
{{-- Document Header --}}

TIME SHEET

{{ old('sheet_no', $timeSheet->sheet_no ?? '1') }}
{{-- Section 1: Vessel & Voyage Header Info (Unified 2-Column Grid) --}}
{{-- Left Column --}}
NAME OF VESSEL : MV.
BERTH :
FLAG :
L.O.A / G.R.T. : M / TONS
{{-- Right Column --}}
VOY. NO :
SHIPPING LINE :
SHIP AGENT :
STEVEDORING :
{{-- Section 2: VESSEL POSITION --}}

VESSEL POSITION

@php $parseTimeVal = function($raw) { if (!$raw) return ''; if (preg_match('/^(\d{1,2})[:.](\d{2})/', $raw, $m)) { return sprintf('%02d:%02d', (int)$m[1], (int)$m[2]); } return $raw; }; $parseDateVal = function($raw) { if (!$raw) return ''; if (preg_match('/^(\d{4})-(\d{2})-(\d{2})/', $raw)) { return substr($raw, 0, 10); } if (preg_match('/^(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{4})/', $raw, $dm)) { return sprintf('%04d-%02d-%02d', (int)$dm[3], (int)$dm[2], (int)$dm[1]); } $ts = strtotime($raw); return $ts ? date('Y-m-d', $ts) : ''; }; $vesselMilestones = [ 'vessel_arrived' => [ 'label' => 'VESSEL ARRIVED', 'aliases' => ['time_arrival'], ], 'pilot_attended_on_board' => [ 'label' => 'PILOT ATTENDED ON BOARD', 'aliases' => ['time_pob', 'time_pob_berthing'], ], 'first_lines' => [ 'label' => 'FIRST LINES', 'aliases' => ['first_line', 'time_first_line'], ], 'berthed_ikt' => [ 'label' => 'BERTHED AT IKT CAR TERMINAL 2 PORT', 'aliases' => ['time_berthed', 'berthed_terminal'], ], 'open_ramp' => [ 'label' => 'OPEN RAMP', 'aliases' => ['time_open_ramp'], ], 'commenced_discharging' => [ 'label' => 'COMMENCED OF DISCHARGING', 'aliases' => ['commenced_disch', 'commenced_operation'], ], 'completed_discharging' => [ 'label' => 'COMPLETED OF DISCHARGING', 'aliases' => ['completed_disch', 'completed_operation'], ], 'commenced_loading' => [ 'label' => 'COMMENCED OF LOADING', 'aliases' => ['commenced_load', 'commenced_of_loading'], ], 'completed_loading' => [ 'label' => 'COMPLETED OF LOADING', 'aliases' => ['completed_load', 'completed_of_loading'], ], 'close_ramp' => [ 'label' => 'CLOSE RAMP', 'aliases' => ['time_close_ramp'], ], 'pilot_on_board_sailing' => [ 'label' => 'PILOT ON BOARD FOR SAILING', 'aliases' => ['time_pob_sailing'], ], 'vessel_sailed_wharf' => [ 'label' => 'VESSEL SAILED FROM WHARF', 'aliases' => ['time_sailed', 'vessel_sailed'], ], ]; @endphp
@foreach($vesselMilestones as $key => $cfg) @php $rawHrs = $vPos[$key.'_hrs'] ?? ''; if (!$rawHrs) { foreach ($cfg['aliases'] as $al) { if (!empty($vPos[$al.'_hrs'])) { $rawHrs = $vPos[$al.'_hrs']; break; } } } $rawDate = $vPos[$key.'_date'] ?? ''; if (!$rawDate) { foreach ($cfg['aliases'] as $al) { if (!empty($vPos[$al.'_date'])) { $rawDate = $vPos[$al.'_date']; break; } } } $hrsVal = $parseTimeVal($rawHrs); $dateVal = $parseDateVal($rawDate); @endphp
{{ $cfg['label'] }}
AT :
HOURS DATE :
@endforeach
{{-- MULTI-SHEET TABS & PANES (Sections 3, 4, 5) --}}
{{-- Tabs Navigation --}}
@foreach($sheets as $sIdx => $sh) @endforeach
{{-- Panes Container --}}
@foreach($sheets as $sIdx => $sh) @php $cSum = $sh['cargo_summary'] ?? \App\Models\TimeSheet::getDefaultCargoSummary(); $sGangs = $sh['ships_gangs'] ?? \App\Models\TimeSheet::getDefaultShipsGangs(); $tCargo = $sh['toyota_cargo'] ?? \App\Models\TimeSheet::getDefaultToyotaCargo(); @endphp
{{-- Section 3: CARGO OPERATION TABLE --}}
@foreach($cargoRows as $k => $label) @php $row = $cSum['rows'][$k] ?? []; @endphp {{-- Discharging --}} @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Loading --}} @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Total (Row calculated) --}} @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach @endforeach {{-- TOTAL ROW --}} @php $cTotals = $cSum['totals'] ?? []; @endphp {{-- Disch Totals --}} @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Load Totals --}} @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Grand Totals --}} @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Attached Row: LADEN MAFI --}} @php $laden = $cSum['laden_mafi'] ?? []; @endphp @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Attached Row: EMPTY MAFI --}} @php $emptyMafi = $cSum['empty_mafi'] ?? []; @endphp @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons', 'm3'] as $col) @endforeach {{-- Attached Row: LOAD PORT --}} {{-- Attached Row: DISCH PORT --}}
TYPE CARGO DISCHARGING LOADING T O T A L
UNITS PKGS TONS M3 UNITS PKGS TONS M3 UNITS PKGS TONS M3
{{ $label }}
TOTAL
LADEN MAFI
EMPTY MAFI
LOAD PORT
DISCH PORT
{{-- Section 4: SHIP'S GANGS --}}
@foreach($pairedGangs as $pair) @php $lk = $pair['left']['key']; $ll = $pair['left']['label']; $rk = $pair['right']['key']; $rl = $pair['right']['label']; $isTotal = ($rk === 'total'); @endphp {{-- Left Role --}} {{-- Left Input --}} {{-- Right Role --}} {{-- Right Input --}} @endforeach

ANUGRAH PERMATA SAMUDRA CO., LTD.

SHIP'S GANGS

{{ $ll }}
: PERSON
{{ $rl }}
: @if($isTotal) @else @endif PERSON
{{-- Section 5: TOYOTA / DAIHATSU CARGO --}}

TOYOTA / DAIHATSU CARGO

Khusus MITSUI O.S.K CO., LTD
{{-- Row 1: CARS / CBU --}} @php $tCbu = $tCargo['rows']['cars_cbu'] ?? []; @endphp @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach {{-- Row 2: HH / TRUCK / BUS --}} @php $tHh = $tCargo['rows']['hh_truck_bus'] ?? []; @endphp @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach {{-- Row 3: PART --}} @php $tParts = $tCargo['rows']['parts_static'] ?? []; @endphp @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach {{-- Toyota Totals Row --}} @php $tTotals = $tCargo['totals'] ?? []; @endphp @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach
TYPE CARGO DISCHARGING LOADING TOTAL REMARKS
UNITS PKGS TONS UNITS PKGS TONS UNITS PKGS TONS
CARS / CBU
HH / TRUCK / BUS
COMM LOADING:
PART
COMPLT LOADING:
TOTAL
@endforeach
{{-- Keterangan Tambahan --}}
{{-- Submit Action Bar --}}
Batal
{{-- Client-Side Dynamic Calculations & Multi-Sheet Script --}}