@extends('pdf.reports.base') @section('content')
1. Master Consolidated Summary by Shift (Combined Period)
@forelse($summary as $index => $row) @empty @endforelse @if($summary->count() > 0) @endif
# Shift Designation & Schedule Operating Days Active Vehicles Active Drivers Shifts Run Total Swept (KM) Duty Hours Avg KM/Shift
{{ $index + 1 }} {{ $row['shift_name'] }}
Timing: {{ $row['shift_window'] }}
{{ $row['operating_days'] }} Days {{ $row['vehicles_count'] }} Units {{ $row['drivers_count'] }} Drivers {{ $row['shifts_run'] }} Shifts {{ number_format((float) $row['total_distance_km'], 3) }} KM {{ $row['formatted_duration'] }} {{ number_format((float) $row['avg_km_per_tour'], 2) }} KM
No shift operational logs found matching the selected dates and filter criteria.
CONSOLIDATED GRAND TOTALS: {{ $grandTotals['unique_dates_count'] ?? 0 }} Days {{ $grandTotals['unique_vehicles_count'] ?? 0 }} Units {{ $grandTotals['unique_drivers_count'] ?? 0 }} Drivers {{ $grandTotals['total_tours'] ?? 0 }} Shifts {{ number_format((float) ($grandTotals['total_distance_km'] ?? 0), 3) }} KM {{ $grandTotals['formatted_duration'] ?? '0h 00m' }} {{ number_format((float) ($grandTotals['avg_km_per_tour'] ?? 0), 2) }} KM
2. Detailed Shift-by-Shift Operational Log Breakdown
@forelse($groups as $shiftName => $group)
{{ $group['shift_name'] }} {{ $group['shift_code'] }}
Schedule Window: {{ $group['shift_window'] }}
Operating Days: {{ $group['operating_days_count'] }} • Deployed Units: {{ $group['vehicles_count'] }} • Total Shifts: {{ $group['tours_count'] }}
Total Swept: {{ number_format((float) $group['total_distance_km'], 3) }} KM • Duration: {{ $group['formatted_duration'] }}
@foreach($group['tours'] as $tour) @endforeach
Shift Ref / ID Date Vehicle Reg No. Driver / Operator Assigned Route 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->vehicle?->vehicle_number ?? 'N/A' }} @if($tour->vehicle?->category)
{{ $tour->vehicle->category->name }}
@endif
{{ $tour->employee?->full_name ?? ($tour->user?->name ?? 'Unassigned') }} {{ $tour->route?->name ?? ($tour->driverDuty?->route?->name ?? 'Municipal Sector Route') }} {{ $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 {{ strtoupper($group['shift_name']) }} ({{ $group['tours_count'] }} SHIFTS): {{ $group['operating_days_count'] }} Days Worked {{ $group['formatted_duration'] }} {{ number_format((float) $group['total_distance_km'], 3) }} KM OK
@empty
No detailed shift tours found for the selected filter parameters.
@endforelse @endsection