@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $series = $data['monthly_series']; $rows = $data['rows']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; $fmtDelta = function ($v, $unit = '%') { if ($v === null) return null; $sign = $v > 0 ? '+' : ''; return $sign . number_format((float) $v, 1, ',', ' ') . $unit; }; // Bar chart geometry — fixed pixel size (wkhtmltopdf 0.12.x renders // width="100%" SVGs at 0×0, see SG-01 for the same caveat). $chartW = 480; $chartH = 140; $padX = 30; $padY = 18; $values = array_map(fn ($r) => $r['value'], $series); $maxV = !empty($values) ? max($values) : 1; if ($maxV <= 0) $maxV = 1; $barW = count($series) > 0 ? (($chartW - 2 * $padX) / count($series)) * 0.6 : 20; $stepX = count($series) > 0 ? ($chartW - 2 * $padX) / count($series) : 0; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Conducteurs {{ $meta['code'] }} Période : {{ $meta['period']['label'] }} · {{ $meta['site_label'] }} · {{ $meta['total_drivers'] }} conducteurs · Généré le {{ $meta['generated_at']->locale('fr')->isoFormat('D MMMM YYYY') }}

Indicateurs clés

Score sécurité moyen
{{ $fmtNum($kpis['avg_safety_score']['value']) }}{{ $kpis['avg_safety_score']['unit'] }}
{{ $kpis['avg_safety_score']['delta_label'] }}
Score éco-conduite moyen
{{ $fmtNum($kpis['avg_eco_score']['value']) }}{{ $kpis['avg_eco_score']['unit'] }}
{{ $kpis['avg_eco_score']['delta_label'] }}
Conducteurs à risque
{{ $fmtNum($kpis['at_risk_drivers']['value']) }}
{{ $kpis['at_risk_drivers']['delta_label'] }}
Incidents
{{ $fmtNum($kpis['incidents']['value']) }}
@if (!empty($kpis['incidents']['delta']))
{{ $fmtDelta($kpis['incidents']['delta']) }} {{ $kpis['incidents']['delta_label'] }}
@else
{{ $kpis['incidents']['delta_label'] }}
@endif

Évolution mensuelle des incidents (6 mois)

@if (!empty($series)) @foreach ($series as $i => $r) @php $h = $r['value'] > 0 ? (($r['value'] / $maxV) * ($chartH - 2 * $padY)) : 0; $x = $padX + $i * $stepX + ($stepX - $barW) / 2; $y = $chartH - $padY - $h; @endphp {{ $r['label'] }} @if ($r['value'] > 0) {{ $r['value'] }} @endif @endforeach @else

Pas de données.

@endif

Détail individuel — Scores & Incidents

@if (!empty($rows)) @foreach ($rows as $r) @endforeach
Conducteur Score séc. Score éco Frein. Vitesse Choc Ralenti Total
{{ $r['driver'] }} {{ $r['safety_score'] === null ? '—' : $r['safety_score'] }} {{ $r['eco_score'] === null ? '—' : $r['eco_score'] }} {{ $r['braking'] }} {{ $r['speed'] }} {{ $r['shock'] }} {{ $r['idle'] }} {{ $r['total'] }}

Scores sécurité et éco-conduite — source télématique à venir. Les colonnes événementielles agrégent les alertes télématiques de la période rattachées au conducteur via son affectation véhicule.

@else

Aucun conducteur sur la période.

@endif @endsection