@forelse($jobs as $job) @empty @endforelse
{{__('app.jobs.job_id')}} {{__('app.locations.loading_location')}} {{__('app.locations.offloading_location')}} {{__('app.vehicles.title')}} {{__('app.jobs.job_status')}} {{__('app.jobs.delivery')}} {{__('app.jobs.load_weight')}}
({{__('app.jobs.tons')}})
{{ $job->id }} {{ $job->loadingLocation->name ?? '' }} {{ $job->offloadingLocation->name ?? '' }} @php $tripsForUser = $job->trips->where('transport_id', auth()->id()); $vehiclesFromTrips = $tripsForUser->map(function($trip){ try { return $trip->vehicle; } catch (Exception $e) { return null; } })->filter()->unique('id'); $vehicleCount = $vehiclesFromTrips->count(); @endphp {{ $vehicleCount }} @php $status = $job->status ?? 1; $class = match ($status) { 1 => 'pending-tag', 2 => 'in-progress-tag', 3 => 'completed-tag', default => 'pending-tag' }; @endphp {{ ucwords($job->status_label) }} @if($job->delivery_status) {{ $job->delivery_status['text'] }} @else - @endif {{ number_format($job->load_weight, 0) }} {{__('app.jobs.tons')}}
@foreach($jobs as $job)
@php $tripsForUser = $job->trips->where('transport_id', auth()->id()); $vehiclesFromTrips = $tripsForUser->map(function($trip){ try { return $trip->vehicle; } catch (Exception $e) { return null; } })->filter()->unique('id'); $vehicleCount = $vehiclesFromTrips->count(); @endphp @if($vehicleCount > 0) @else
No vehicles found for this job.
@endif
@endforeach