@php $mileageTimeline = $mileageTimeline ?? collect(); $vehicleOdometer = $vehicleOdometer ?? null; $compact = ! empty($compact); @endphp @if($mileageTimeline->isNotEmpty() || $vehicleOdometer !== null)
Vehicle mileage history
@if($vehicleOdometer !== null) File odometer: {{ number_format((int) $vehicleOdometer) }} km @endif
@if($mileageTimeline->isEmpty())

No service mileage records yet.

@else
@foreach($mileageTimeline as $row) @endforeach
Date Reading (km) Service Source
{{ $row->service_date ? \Illuminate\Support\Carbon::parse($row->service_date)->format('d M Y') : '—' }} {{ \App\Support\GarageMeterReading::format($row->meter_reading) }} @if(!empty($row->service_name)) {{ $row->service_name }} @if(!empty($row->service_interval_km)) · every {{ number_format((int) $row->service_interval_km) }} km @endif @else @endif @php $srcType = $row->source_type ?? ''; $srcId = (int) ($row->source_id ?? 0); $docUrl = match ($srcType) { 'repair_order' => $srcId ? route('garage.repair-orders.show', $srcId) : null, 'sale' => $srcId ? route('garage.sales.show', $srcId) : null, 'estimate' => $srcId ? route('garage.estimates.show', $srcId) : null, default => null, }; @endphp {{ \App\Services\GarageVehicleMeterService::sourceTypeLabel($srcType) }} @if(!empty($row->document_number)) @if($docUrl) {{ $row->document_number }} @else {{ $row->document_number }} @endif @endif
@endif
@endif