@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $dist = $data['distribution']; $topUsers = $data['top_users']; $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); }; // Histogram geometry $chartW = 480; $chartH = 160; $padX = 30; $padY = 24; $barCount = max(count($dist), 1); $maxVal = max(1, max(array_map(fn ($r) => (int) $r['count'], $dist ?: [['count' => 0]]))); $barSpace = ($chartW - 2 * $padX) / $barCount; $barWidth = max(8, $barSpace * 0.6); $bars = []; foreach ($dist as $i => $r) { $h = ($r['count'] / $maxVal) * ($chartH - 2 * $padY); $x = $padX + $i * $barSpace + ($barSpace - $barWidth) / 2; $y = $chartH - $padY - $h; $bars[] = [ 'x' => $x, 'y' => $y, 'w' => $barWidth, 'h' => $h, 'label' => $r['label'], 'value' => $r['count'], 'cx' => $x + $barWidth / 2, ]; } @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Parc & Véhicules {{ $meta['code'] }} Période : {{ $meta['period']['label'] }} · {{ $meta['site_label'] }} · {{ $meta['total_vehicles'] }} véhicules · Généré le {{ $meta['generated_at']->locale('fr')->isoFormat('D MMMM YYYY') }}

Indicateurs d'utilisation

Km moyen / véhicule
{{ $fmtNum($kpis['avg_km']['value']) }}{{ $kpis['avg_km']['unit'] }}
{{ $kpis['avg_km']['delta_label'] }}
Jours d'utilisation
{{ $fmtNum($kpis['usage_days']['value']) }}{{ $kpis['usage_days']['unit'] }}
{{ $kpis['usage_days']['delta_label'] }}
Taux d'utilisation
{{ $fmtNum($kpis['usage_rate']['value']) }}{{ $kpis['usage_rate']['unit'] }}
{{ $kpis['usage_rate']['delta_label'] }}
Pic d'usage
{{ $fmtNum($kpis['peak_km']['value']) }}{{ $kpis['peak_km']['unit'] }}
{{ $kpis['peak_km']['delta_label'] }}

Distribution des km parcourus

@if (!empty($bars)) @foreach ($bars as $b) {{ $b['label'] }} @if ($b['value'] > 0) {{ $b['value'] }} @endif @endforeach @else

Aucune donnée de distribution.

@endif

Top utilisateurs (10 véhicules les plus parcourus)

@if (!empty($topUsers)) @foreach ($topUsers as $r) @endforeach
Immatriculation Marque / Modèle Conducteur Km Jours
{{ $r['plate'] }} {{ $r['model'] }} {{ $r['driver'] }} {{ number_format($r['km'], 0, ',', ' ') }} {{ $r['days'] }}
@else

Aucune donnée d'utilisation.

@endif @endsection