@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $evolution = $data['evolution']; $distribution = $data['distribution']; $impact = $data['impact']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; $barW = 320; $barH = 140; $barPadX = 28; $barPadY = 22; // Evolution bars. $maxE = 100; $barCount = count($evolution); $barSlot = $barCount > 0 ? ($barW - 2 * $barPadX) / $barCount : 0; $barWidth = $barSlot * 0.55; // Distribution bars. $maxD = 0; foreach ($distribution as $d) { $maxD = max($maxD, (int) $d['value']); } $maxD = max($maxD, 1); $bcD = count($distribution); $bsD = $bcD > 0 ? ($barW - 2 * $barPadX) / $bcD : 0; $bwD = $bsD * 0.55; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Durabilité ESG {{ $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 moyen
{{ $kpis['avg_eco_score']['value'] }}
{{ $kpis['avg_eco_score']['delta_label'] }}
Conducteurs < 60
{{ $kpis['low_score_drivers']['value'] }}
{{ $kpis['low_score_drivers']['delta_label'] }}
Carburant économisé
{{ $fmtNum($kpis['fuel_saved']['value']) }}{{ $kpis['fuel_saved']['unit'] }}
{{ $kpis['fuel_saved']['delta_label'] }}
CO₂ évité
{{ $kpis['co2_avoided_eco']['value'] !== null ? number_format($kpis['co2_avoided_eco']['value'], 1, ',', ' ') : '—' }}{{ $kpis['co2_avoided_eco']['unit'] }}
{{ $kpis['co2_avoided_eco']['delta_label'] }}

Évolution du score éco-conduite vs objectif

@foreach ($evolution as $i => $e) @php $h = $maxE > 0 ? (($e['score'] / $maxE) * ($barH - 2 * $barPadY)) : 0; $x = $barPadX + $i * $barSlot + ($barSlot - $barWidth) / 2; $y = $barH - $barPadY - $h; @endphp {{ $e['score'] }} {{ $e['label'] }} @endforeach @php $objY = $barH - $barPadY - (($evolution[0]['objective'] ?? 85) / $maxE) * ($barH - 2 * $barPadY); @endphp

Distribution des scores

@foreach ($distribution as $i => $d) @php $h = $maxD > 0 ? (($d['value'] / $maxD) * ($barH - 2 * $barPadY)) : 0; $x = $barPadX + $i * $bsD + ($bsD - $bwD) / 2; $y = $barH - $barPadY - $h; $color = $d['label'] === '<60' ? '#EF4444' : ($d['label'] === '90-100' ? '#10B981' : '#3B82F6'); @endphp {{ $d['value'] }} {{ $d['label'] }} @endforeach

Impact environnemental et financier (mensuel)

@foreach ($impact as $r) @endforeach
Indicateur Valeur
{{ $r['metric'] }} {{ $r['value'] }}
@endsection