@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $pie = $data['pie']; $zfeBreakdown = $data['zfe_breakdown']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Pie geometry. $pieRadius = 50; $pieCx = 60; $pieCy = 60; $totalPie = array_sum(array_column($pie, 'value')); $pieSlices = []; $accAngle = -90; foreach ($pie as $p) { if ($totalPie <= 0) break; $sweep = ($p['value'] / $totalPie) * 360; if ($sweep <= 0) continue; $isFull = $sweep >= 359.999; if ($isFull) { $path = null; } else { $rad1 = deg2rad($accAngle); $rad2 = deg2rad($accAngle + $sweep); $x1 = $pieCx + $pieRadius * cos($rad1); $y1 = $pieCy + $pieRadius * sin($rad1); $x2 = $pieCx + $pieRadius * cos($rad2); $y2 = $pieCy + $pieRadius * sin($rad2); $largeArc = $sweep > 180 ? 1 : 0; $path = sprintf('M %s %s L %.2f %.2f A %s %s 0 %d 1 %.2f %.2f Z', $pieCx, $pieCy, $x1, $y1, $pieRadius, $pieRadius, $largeArc, $x2, $y2); } $pieSlices[] = ['path' => $path, 'color' => $p['color'], 'label' => $p['label'], 'value' => $p['value']]; $accAngle += $sweep; } // Stacked bar geometry. $barW = 320; $barH = 160; $barPadX = 28; $barPadY = 22; $maxV = 0; foreach ($zfeBreakdown as $z) { $maxV = max($maxV, $z['authorized'] + $z['forbidden']); } $maxV = max($maxV, 1); $bc = count($zfeBreakdown); $bs = $bc > 0 ? ($barW - 2 * $barPadX) / $bc : 0; $bw = $bs * 0.55; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Fiscalité {{ $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

Véh. non conformes
{{ $kpis['non_compliant']['value'] }}
{{ $kpis['non_compliant']['delta_label'] }}
Amendes potentielles
{{ $fmtNum($kpis['potential_fines']['value']) }}{{ $kpis['potential_fines']['unit'] }}
{{ $kpis['potential_fines']['delta_label'] }}
Crit'Air 0 / 1
{{ $kpis['low_emission']['value'] }}{{ $kpis['low_emission']['unit'] }}
{{ $kpis['low_emission']['delta_label'] }}
Mise en conformité
{{ $fmtNum($kpis['compliance_target']['value']) }}{{ $kpis['compliance_target']['unit'] }}
{{ $kpis['compliance_target']['delta_label'] }}

Répartition Crit'Air du parc

@if ($totalPie > 0)
@foreach ($pieSlices as $s) @if ($s['path'] === null) @else @endif @endforeach @foreach ($pieSlices as $s)
{{ $s['label'] }} — {{ $s['value'] }}
@endforeach
@else

Pas de véhicules.

@endif

Conformité ZFE — autorisés vs interdits

@if ($maxV > 0) @foreach ($zfeBreakdown as $i => $z) @php $hA = ($z['authorized'] / $maxV) * ($barH - 2 * $barPadY); $hF = ($z['forbidden'] / $maxV) * ($barH - 2 * $barPadY); $x = $barPadX + $i * $bs + ($bs - $bw) / 2; $yA = $barH - $barPadY - $hA; $yF = $yA - $hF; @endphp {{ $z['zone'] }} @endforeach @else

Pas de données.

@endif

Risque d'amendes par ZFE

@foreach ($zfeBreakdown as $z) @endforeach
ZFE Véh. interdits Véh. autorisés Risque amendes
{{ $z['zone'] }} (ZFE) {{ $z['forbidden'] }} {{ $z['authorized'] }} {{ $fmtNum($z['risk_amount'], '€') }}
@endsection