@extends('layouts.app') @section('title', $shipment->reference) @section('heading', $shipment->reference) @section('content') @php $s = $shipment; $statuses = \App\Enums\ShipmentStatus::cases(); @endphp

{{ $s->status->label() }} {{ $s->supplier?->name ?? 'No supplier' }} @if ($s->is_overdue)ETA passed {{ abs($s->days_to_eta) }} days ago@endif @if ($s->demurrage_risk)Free storage ends {{ $s->port_free_until->format('d M Y') }}@endif

@can('shipments.manage')
Edit @if (in_array($s->status, [\App\Enums\ShipmentStatus::Cleared, \App\Enums\ShipmentStatus::Delivered]) && $s->vehicles->where('status', \App\Enums\VehicleStatus::InTransit)->count())
@csrf
@endif
@endcan
@can('shipments.manage') @unless ($s->status->isFinal())
@csrf
@endunless @endcan

Shipping details

@foreach ([ 'Method' => config('inventory.shipping_methods')[$s->shipping_method] ?? $s->shipping_method, 'Route' => trim(($s->origin_port ?: (config('inventory.countries')[$s->origin_country] ?? 'Origin not set')).' → '.$s->destination_port), 'Bill of Lading' => $s->bill_of_lading_no ?: 'Not set', 'Container' => $s->container_no ?: ($s->shipping_method === 'roro' ? 'RoRo, none' : 'Not set'), 'Shipping line' => $s->shipping_line ?: 'Not set', 'Vessel / voyage' => trim(($s->vessel_name ?: 'Not set').' '.($s->voyage_no ? '· '.$s->voyage_no : '')), 'Clearing agent' => trim(($s->clearing_agent ?: 'Not set').' '.($s->clearing_agent_phone ? '· '.$s->clearing_agent_phone : '')), 'Booked' => $s->booked_on?->format('d M Y') ?? 'Not set', 'ETD' => $s->etd?->format('d M Y') ?? 'Not set', 'ETA' => $s->eta?->format('d M Y') ?? 'Not set', 'Arrived at port' => $s->arrived_at?->format('d M Y') ?? 'Not yet', 'Cleared' => $s->cleared_at?->format('d M Y') ?? 'Not yet', 'Free port days' => $s->port_free_days !== null ? $s->port_free_days.' days'.($s->port_free_until ? ' (to '.$s->port_free_until->format('d M').')' : '') : 'Not set', ] as $label => $value)
{{ $label }}
{{ $value }}
@endforeach

Vehicles on this shipment ({{ $s->vehicles->count() }})

@can('vehicles.view_cost')@endcan @forelse ($s->vehicles as $v) @can('vehicles.view_cost')@endcan @empty @endforelse
Vehicles
Stock IDVehicleStatusLanded cost
{{ $v->stock_id }}{{ $v->display_name }}{{ $v->vin }} @include('partials.kes', ['amount' => $v->landed_cost])
No vehicles yet. Choose this shipment on a vehicle's form to add it.
@can('shipments.manage_charges')

Shipment charges (freight, port, clearing, duty)

Total: KSh {{ number_format((float) $s->totalChargesKes(), 2) }}

@forelse ($s->charges as $c) @empty @endforelse
Charges
DateTypeDescriptionOriginalKESSplitAllocatedActions
{{ $c->incurred_on->format('d M Y') }}{{ $c->charge_type->label() }}{{ $c->description }} {{ $c->currency_code }} {{ number_format($c->amount, 2) }}{{ number_format($c->amount_kes, 2) }} {{ $c->allocation_method === 'value' ? 'By value' : 'Equally' }} {{ $c->allocated_at ? $c->allocated_at->format('d M, H:i') : 'Not yet' }}
@csrf @method('DELETE')
No charges recorded.
@if ($s->charges->count())
@csrf Run again after adding or removing vehicles or charges. Earlier allocations are replaced.
@endif
@csrf
@endcan @endsection