@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $monthly = $data['monthly']; $byEnergy = $data['by_energy']; $bySite = $data['by_site']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 1, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; $toneBg = ['danger' => '#FEE2E2', 'warning' => '#FEF3C7', 'success' => '#D1FAE5', 'neutral' => '#F3F4F6']; $toneColor = ['danger' => '#991B1B', 'warning' => '#92400E', 'success' => '#065F46', 'neutral' => '#374151']; $barW = 320; $barH = 140; $barPadX = 28; $barPadY = 22; $maxV = 0; foreach ($monthly as $m) { $maxV = max($maxV, (float) $m['emissions'], (float) $m['objective']); } $maxV = max($maxV, 1); $barCount = count($monthly); $barSlot = $barCount > 0 ? ($barW - 2 * $barPadX) / $barCount : 0; $barWidth = $barSlot * 0.55; $maxEnergy = 0; foreach ($byEnergy as $b) { $maxEnergy = max($maxEnergy, (float) $b['co2_t']); } $maxEnergy = max($maxEnergy, 1); @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Durabilité ESG {{ $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 clés

Émissions totales
{{ $fmtNum($kpis['total_emissions']['value']) }}{{ $kpis['total_emissions']['unit'] }}
{{ $kpis['total_emissions']['delta_label'] }}
Émissions moyennes
{{ $kpis['avg_emissions']['value'] !== null ? number_format($kpis['avg_emissions']['value'], 0, ',', ' ') : '—' }}{{ $kpis['avg_emissions']['unit'] }}
{{ $kpis['avg_emissions']['delta_label'] }}
Projection 2026
{{ $fmtNum($kpis['projection_2026']['value']) }}{{ $kpis['projection_2026']['unit'] }}
{{ $kpis['projection_2026']['delta_label'] }}
CO₂ évité
{{ $fmtNum($kpis['co2_avoided']['value']) }}{{ $kpis['co2_avoided']['unit'] }}
{{ $kpis['co2_avoided']['delta_label'] }}

Émissions CO₂ vs objectif (T/mois)

@if ($maxV > 0) @foreach ($monthly as $i => $m) @php $h = $maxV > 0 ? (($m['emissions'] / $maxV) * ($barH - 2 * $barPadY)) : 0; $x = $barPadX + $i * $barSlot + ($barSlot - $barWidth) / 2; $y = $barH - $barPadY - $h; @endphp {{ number_format($m['emissions'], 1, ',', ' ') }} {{ $m['label'] }} @endforeach @php $objY = $barH - $barPadY - ($maxV > 0 ? (($monthly[0]['objective'] ?? 0) / $maxV) * ($barH - 2 * $barPadY) : 0); @endphp @else

Pas de données.

@endif

Émissions par énergie

@if ($maxEnergy > 0) @foreach ($byEnergy as $b) @php $pct = $maxEnergy > 0 ? ($b['co2_t'] / $maxEnergy) * 100 : 0; @endphp
{{ $b['label'] }} — {{ number_format($b['co2_t'], 1, ',', ' ') }} T ({{ $b['count'] }} véh. · {{ $b['g_km'] }} g/km)
@endforeach @else

Pas de données.

@endif

Émissions CO₂ par site

@if (!empty($bySite)) @foreach ($bySite as $r) @php $tone = $r['status']['tone'] ?? 'neutral'; $bg = $toneBg[$tone]; $fg = $toneColor[$tone]; @endphp @endforeach
Site CO₂ total (T) Émissions moy. (g/km) Statut
{{ $r['site'] }} {{ number_format($r['co2_t'], 1, ',', ' ') }} {{ $r['avg_g_km'] }} {{ $r['status']['label'] ?? '' }}
@else

Aucun site avec données.

@endif @endsection