@extends('pdf.reports.base') @section('content')
1. Master Consolidated Fleet Summary by Vehicle (Combined Period)
@forelse($summary as $index => $row) @empty @endforelse @if($summary->count() > 0) @endif
# Vehicle Reg. No. Category & Type Assigned Operators Days Run Shifts Total Distance Run Hours Status
{{ $index + 1 }} {{ $row['vehicle_number'] }} {{ $row['category_name'] }} {{ $row['drivers'] ?: 'Unassigned / Float' }} {{ $row['operating_days'] }} Days {{ $row['shifts_worked'] }} {{ number_format((float) $row['total_distance_km'], 3) }} KM {{ $row['formatted_duration'] }} @if($row['status'] === 'active') Active @elseif($row['status'] === 'maintenance') Service @else {{ ucfirst($row['status']) }} @endif
No vehicle records found matching the selected parameters.
CONSOLIDATED FLEET TOTALS ({{ $grandTotals['total_vehicles'] ?? 0 }} VEHICLES): {{ $grandTotals['unique_drivers_count'] ?? 0 }} Drivers Active {{ $grandTotals['unique_dates_count'] ?? 0 }} Days {{ $grandTotals['total_tours'] ?? 0 }} Shifts {{ number_format((float) ($grandTotals['total_distance_km'] ?? 0), 3) }} KM {{ $grandTotals['formatted_duration'] ?? '0h 00m' }} ALL UNITS
2. Detailed Operational Tour Logs by Vehicle
@forelse($groups as $vehicleId => $group)
{{ $group['vehicle_number'] }} {{ $group['category_name'] }}
Function: {{ $group['primary_function'] }} • Drivers: {{ $group['drivers_list']->implode(', ') ?: 'N/A' }}
Operating Days: {{ $group['operating_days_count'] }} • Total Shifts: {{ $group['tours_count'] }} • Avg KM/Day: {{ number_format((float) $group['avg_km_per_day'], 2) }} KM
Total Distance: {{ number_format((float) $group['total_distance_km'], 3) }} KM • Duration: {{ $group['formatted_duration'] }}
@foreach($group['tours'] as $tour) @endforeach
Duty / Tour Ref Date Driver / Operator Assigned Route Shift Timing Start End Duration Distance Status
{{ $tour->driverDuty?->duty_code ?? ('#TOUR-' . str_pad((string) $tour->id, 5, '0', STR_PAD_LEFT)) }} {{ $tour->start_time ? $tour->start_time->format('d M Y') : 'N/A' }} {{ $tour->employee?->full_name ?? ($tour->user?->name ?? 'Unassigned') }} {{ $tour->route?->name ?? ($tour->driverDuty?->route?->name ?? 'Municipal Sector Route') }} @php $shiftHelper = app(\App\Services\ConsolidatedReportService::class); $sInfo = $shiftHelper->resolveShiftInfo($tour); @endphp {{ $sInfo['name'] }}
{{ $sInfo['window'] }}
{{ $tour->start_time ? $tour->start_time->format('H:i') : '--:--' }} {{ $tour->end_time ? $tour->end_time->format('H:i') : 'Active' }} {{ $tour->formatted_duration }} {{ number_format((float) $tour->total_distance_km, 3) }} KM @if($tour->status === 'completed') Done @elseif($tour->status === 'in_progress') Active @else {{ ucfirst($tour->status) }} @endif
SUBTOTAL FOR {{ $group['vehicle_number'] }} ({{ $group['tours_count'] }} SHIFTS): {{ $group['operating_days_count'] }} Days Run {{ $group['formatted_duration'] }} {{ number_format((float) $group['total_distance_km'], 3) }} KM OK
@empty
No detailed vehicle tours found for the selected filter parameters.
@endforelse @endsection