| {{__('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')}}) |
@forelse($jobs as $job)
|---|---|---|---|---|---|---|
| {{ $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')}} |