@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $days = $data['km_by_day']; $zones = $data['top_zones']; $trips = $data['recent_trips']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, is_float($v) && fmod($v, 1) !== 0.0 ? 1 : 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Bar chart "Km par jour" — pixel-fixed SVG (wkhtmltopdf 0.12.x). $chartW = 510; $chartH = 150; $padX = 28; $padY = 22; $barCount = count($days); $maxKm = $barCount > 0 ? max(array_map(fn ($d) => (float) $d['km'], $days)) : 0; if ($maxKm <= 0) { $maxKm = 1; } $bars = []; if ($barCount > 0) { $slot = ($chartW - 2 * $padX) / $barCount; $bw = max(4, $slot * 0.7); foreach ($days as $i => $d) { $x = $padX + $i * $slot + ($slot - $bw) / 2; $h = (($d['km']) / $maxKm) * ($chartH - 2 * $padY); $y = $chartH - $padY - $h; $bars[] = ['x' => $x, 'y' => $y, 'w' => $bw, 'h' => $h, 'label' => $d['label'], 'km' => $d['km']]; } } @endphp @section('content')
Aucun trajet enregistré sur la période.
@endif| Zone | Priorité | Boîtiers attachés |
|---|---|---|
| {{ $z['name'] }} | {{ $z['priority'] !== null ? $z['priority'] : '—' }} | {{ $z['devices_attached'] }} |
Aucune zone définie pour cette entreprise.
@endif| Date | Heure | Véhicule | Origine | Destination | Km | Durée |
|---|---|---|---|---|---|---|
| {{ $t['date'] }} | {{ $t['time'] }} | {{ $t['plate'] }} {{ $t['vehicle'] }} |
{{ $t['origin'] }} | {{ $t['destination'] }} | {{ $t['km'] !== null ? number_format($t['km'], 1, ',', ' ') . ' km' : '—' }} | {{ $t['duration_min'] !== null ? $t['duration_min'] . ' min' : '—' }} |
Aucun trajet à afficher sur la période.
@endif @if (empty($data['flags']['trips_available']))Note : la table car_trips n'est pas disponible — les indicateurs trajets resteront à venir tant qu'aucune donnée n'est ingérée.