@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $perDriver = $data['per_driver']; $hourly = $data['hourly_distribution']; $fmt = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Hourly bar chart geometry. $barW = 480; $barH = 150; $padX = 30; $padY = 22; if ($hourly !== null) { $labels = $hourly['labels']; $values = array_map(fn ($v) => (int) ($v ?? 0), $hourly['pro']); $maxV = max(1, max($values)); $bw = ($barW - 2 * $padX) / max(1, count($labels)); } @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Conducteurs {{ $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 total flotte
{{ $fmt($kpis['total_km']['value']) }}{{ $kpis['total_km']['unit'] }}
{{ $kpis['total_km']['delta_label'] }}
Km moyen / conducteur
{{ $fmt($kpis['avg_km']['value']) }}{{ $kpis['avg_km']['unit'] }}
{{ $kpis['avg_km']['delta_label'] }}
Jours d'utilisation moyens
{{ $fmt($kpis['avg_days']['value']) }}{{ $kpis['avg_days']['unit'] }}
{{ $kpis['avg_days']['delta_label'] }}
Conducteur le + actif
{{ $kpis['most_active']['value'] ?? '—' }}
{{ $kpis['most_active']['delta_label'] }}

Répartition des trajets par plage horaire

@if ($hourly !== null) @foreach ($labels as $i => $label) @php $val = $values[$i] ?? 0; $cx = $padX + $i * $bw + $bw / 2; $bh = $val > 0 ? (($val / $maxV) * ($barH - 2 * $padY)) : 0; $by = $barH - $padY - $bh; $w = max(8, $bw * 0.6); $bx = $cx - $w / 2; @endphp @if ($bh > 0) {{ $val }} @endif {{ $label }} @endforeach

{{ $hourly['note'] }}

@else

Source télématique (car_trips) indisponible — distribution horaire à venir.

@endif

Kilométrage et jours d'utilisation par conducteur

@if (!empty($perDriver)) @foreach ($perDriver as $d) @endforeach
Conducteur Km Jours % Pro
{{ $d['name'] }} {{ number_format((float) $d['km'], 0, ',', ' ') }} km {{ $d['days'] }} j {{ $d['pro_rate'] !== null ? $d['pro_rate'] . '%' : '—' }}
@else

Aucune affectation conducteur sur la période.

@endif @if (!empty($data['pro_vs_perso']['note']))

{{ $data['pro_vs_perso']['note'] }}

@endif @endsection