@forelse($job->trips ?? [] as $trip) @empty @endforelse
Trip ID Allocation Date Transporter Driver Name Driver ID Vehicle # Trailer # Quantity (Metric Tons) Creation Date Trip Status Action
{{ $trip->id }} {{ $trip->allocation_date_time ? $trip->allocation_date_time->format('d/m/Y') : null }} {{ $trip->transport->name ?? null }} {{ $trip->driver->name ?? null }} {{ $trip->driver->driver_id ?? null }} {{ $trip->vehicle->registration_number ?? null }} {{ $trip->vehicle->trailers->count() ?? null }} @php $loadTons = $trip->load_metric_tons ? rtrim(rtrim(number_format($trip->load_metric_tons, 2, '.', ''), '0'), '.') : null; $offloadTons = $trip->offload_metric_tons ? rtrim(rtrim(number_format($trip->offload_metric_tons, 2, '.', ''), '0'), '.') : null; @endphp @if ($offloadTons || $loadTons) {{ $offloadTons ?? 0 }}/{{ $loadTons ?? 0 }} @endif {{ $trip->created_at ? $trip->created_at->format('d/m/Y, h:i A') : null }} @php $tripStatus = match ($trip->status) { 1 => 'pending', 2 => 'in_progress', 3 => 'completed', default => 'pending' }; $class = match ($tripStatus) { 'pending' => 'pending-tag', 'in_progress' => 'in-progress-tag', 'completed' => 'completed-tag', default => 'pending-tag' }; @endphp {{ ucwords($trip->status_label) }}
{{-- Hidden trailers lists for each trip --}} @foreach(($job->trips ?? []) as $trip) @php $trailers = ($trip->vehicle && $trip->vehicle->trailers) ? $trip->vehicle->trailers : collect(); @endphp
@if($trailers->count()) @else
No trailers found.
@endif
@endforeach {{-- Trailers Modal --}}