@section('page-title', 'Time Sheet: ' . ($timeSheet->vessel_name ?: 'MV. -')) @php $vPos = $timeSheet->vessel_positions ?? []; $resolvedSheets = $timeSheet->resolved_sheets; $sheetCount = count($resolvedSheets); $cargoRows = [ 'cars_cbu' => 'CARS / CBU', 'heavy_high' => 'HEAVY HIGH', 'truck' => 'TRUCK', 'bus' => 'BUS', 'parts_static' => 'PART', 'cargo_on_mafi' => 'CARGO ON MAFI', ]; $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'], ], ]; $fmtDate = function($val) { if (!$val) return ''; if (preg_match('/^\d{4}-\d{2}-\d{2}$/', $val)) { return date('d/m/Y', strtotime($val)); } if (preg_match('/^\d{1,2}[\/\-\.]\d{1,2}[\/\-\.]\d{4}$/', $val)) { return $val; } $ts = strtotime($val); return $ts ? date('d/m/Y', $ts) : $val; }; @endphp
Kembali ke daftar Time Sheet

Time Sheet: {{ $timeSheet->vessel_name ?: 'MV. -' }}

@if($sheetCount > 1) {{ $sheetCount }} Sheets @endif @if($timeSheet->status === 'completed') Completed @else Draft @endif

Voyage: {{ $timeSheet->voyage ?: '-' }} • Dermaga: {{ $timeSheet->berth ?: '-' }}

@if(auth()->user()?->canModule('checker', 'edit')) Edit @endif Cetak / Print
@if(session('success'))
{{ session('success') }}
@endif
@if($sheetCount > 1)
Sheets: @foreach($resolvedSheets as $idx => $s) @endforeach
@endif {{-- Main Document Card --}}
{{-- Title Header --}}

TIME SHEET

@foreach($resolvedSheets as $idx => $s) {{ $s['sheet_no'] ?? ($idx + 1) }} @endforeach
{{-- Section 1: Vessel & Voyage Header Info --}}
NAME OF VESSEL : MV. {{ $timeSheet->vessel_name ?: '-' }}
BERTH : {{ $timeSheet->berth ?: '-' }}
FLAG : {{ $timeSheet->flag ?: '-' }}
LOA / G.R.T. : {{ $timeSheet->loa ?: '-' }} METERS {{ $timeSheet->grt ?: '-' }} TONS
VOY. : {{ $timeSheet->voyage ?: '-' }}
SHIPPING LINE : {{ $timeSheet->shipping_line ?: '-' }}
SHIP AGENT : {{ $timeSheet->ship_agent ?: '-' }}
STEVEDORING : {{ $timeSheet->stevedoring ?: '-' }}
{{-- Section 2: VESSEL POSITION --}}

VESSEL POSITION

@php $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; } } } @endphp
{{ $cfg['label'] }}
AT : {{ $rawHrs ?: '-' }} HOURS DATE : {{ $fmtDate($rawDate) ?: '-' }}
@endforeach
{{-- Per-Sheet Sections (Cargo Operation, Ship's Gangs, Toyota Cargo) --}} @foreach($resolvedSheets as $sIdx => $sheet) @php $cSum = $sheet['cargo_summary'] ?? []; $sGangs = $sheet['ships_gangs'] ?? []; $tCargo = $sheet['toyota_cargo'] ?? []; @endphp
@if(!empty($sheet['date']))
Sheet: {{ $sheet['sheet_no'] ?? ($sIdx + 1) }} Tanggal Kegiatan: {{ $sheet['date'] }}
@endif {{-- Section 3: CARGO OPERATION TABLE --}}
@foreach($cargoRows as $k => $label) @php $row = $cSum['rows'][$k] ?? []; @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 @endforeach {{-- TOTAL ROW --}} @php $cTotals = $cSum['totals'] ?? []; @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 {{-- 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 {{-- 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 {{-- LOAD PORT --}} {{-- DISCH PORT --}}
TYPE CARGO DISCHARGING LOADING T O T A L
UNITS PKGS TONS M3 UNITS PKGS TONS M3 UNITS PKGS TONS M3
{{ $label }}{{ ($row['disch_'.$col] ?? '') ?: '-' }}{{ ($row['load_'.$col] ?? '') ?: '-' }}{{ ($row['total_'.$col] ?? '') ?: '-' }}
TOTAL{{ $cTotals['disch_'.$col] ?? '0' }}{{ $cTotals['load_'.$col] ?? '0' }}{{ $cTotals['total_'.$col] ?? '0' }}
LADEN MAFI{{ ($laden['disch_'.$col] ?? '') ?: '-' }}{{ ($laden['load_'.$col] ?? '') ?: '-' }}{{ ($laden['total_'.$col] ?? '') ?: '-' }}
EMPTY MAFI{{ ($emptyMafi['disch_'.$col] ?? '') ?: '-' }}{{ ($emptyMafi['load_'.$col] ?? '') ?: '-' }}{{ ($emptyMafi['total_'.$col] ?? '') ?: '-' }}
LOAD PORT {{ $cSum['load_port'] ?? '-' }}
DISCH PORT {{ $cSum['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 @endforeach

ANUGRAH PERMATA SAMUDRA CO., LTD.

SHIP'S GANGS

{{ $ll }}
: {{ $sGangs[$lk] ?? '-' }} PERSON
{{ $rl }}
: @if($isTotal) {{ $sGangs['total'] ?? '-' }} @else {{ $sGangs[$rk] ?? '-' }} @endif PERSON
{{-- Section 5: TOYOTA / DAIHATSU CARGO (Only for MITSUI O.S.K CO., LTD) --}} @if($timeSheet->isMitsuiOsk())

TOYOTA / DAIHATSU CARGO

@php $tCbu = $tCargo['rows']['cars_cbu'] ?? []; $tHh = $tCargo['rows']['hh_truck_bus'] ?? []; $tParts = $tCargo['rows']['parts_static'] ?? []; $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 @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach @foreach(['units', 'pkgs', 'tons'] as $col) @endforeach {{-- Toyota Totals --}} @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{{ ($tCbu['disch_'.$col] ?? '') ?: '-' }}{{ ($tCbu['load_'.$col] ?? '') ?: '-' }}{{ ($tCbu['total_'.$col] ?? '') ?: '-' }}{{ $tCbu['remarks'] ?? '-' }}
HH / TRUCK / BUS{{ ($tHh['disch_'.$col] ?? '') ?: '-' }}{{ ($tHh['load_'.$col] ?? '') ?: '-' }}{{ ($tHh['total_'.$col] ?? '') ?: '-' }} @if(!empty($tHh['comm_loading'])) COMM LOADING: {{ $tHh['comm_loading'] }} @else - @endif
PART{{ ($tParts['disch_'.$col] ?? '') ?: '-' }}{{ ($tParts['load_'.$col] ?? '') ?: '-' }}{{ ($tParts['total_'.$col] ?? '') ?: '-' }} @if(!empty($tParts['complt_loading'])) COMPLT LOADING: {{ $tParts['complt_loading'] }} @else - @endif
TOTAL{{ $tTotals['disch_'.$col] ?? '0' }}{{ $tTotals['load_'.$col] ?? '0' }}{{ $tTotals['total_'.$col] ?? '0' }}
@endif
@endforeach
@if($timeSheet->keterangan)

Catatan Tambahan:

{{ $timeSheet->keterangan }}

@endif