@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $items = $data['items']; $pie = $data['pie']; $taxes = $data['taxes']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; $toneBg = ['danger' => '#FEE2E2', 'warning' => '#FEF3C7', 'info' => '#DBEAFE', 'success' => '#D1FAE5', 'neutral' => '#F3F4F6']; $toneColor = ['danger' => '#991B1B', 'warning' => '#92400E', 'info' => '#1E3A8A', 'success' => '#065F46', 'neutral' => '#374151']; $toneBar = ['danger' => '#EF4444', 'warning' => '#F59E0B', 'info' => '#3B82F6', 'success' => '#10B981', 'neutral' => '#6B7280']; $barTrackW = 220; // Pie geometry. $pieRadius = 50; $pieCx = 60; $pieCy = 60; $totalPie = array_sum(array_column($pie, 'value')); $pieSlices = []; $accAngle = -90; foreach ($pie as $i => $p) { if ($totalPie <= 0) break; $sweep = ((float) $p['value'] / $totalPie) * 360; $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; } @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

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

Vignettes valides
{{ $kpis['valid_vignettes']['value'] }}
{{ $kpis['valid_vignettes']['delta_label'] }}
Vignettes expirées
{{ $kpis['expired_vignettes']['value'] }}
{{ $kpis['expired_vignettes']['delta_label'] }}
TVS annuelle estimée
{{ $fmtNum($kpis['tvs_estimated']['value']) }}{{ $kpis['tvs_estimated']['unit'] }}
{{ $kpis['tvs_estimated']['delta_label'] }}
Véhicules ZCR compatibles
{{ $kpis['zcr_compatible']['value'] }}
{{ $kpis['zcr_compatible']['delta_label'] }}

État des vignettes Crit'Air par catégorie

@if (!empty($items)) @foreach ($items as $i) @php $w = $i['percentage'] !== null ? min($barTrackW, ($i['percentage'] / 100) * $barTrackW) : 0; $color = $toneBar[$i['tone']] ?? $toneBar['neutral']; @endphp
{{ $i['label'] }}
{{ $i['sublabel'] }}
{{ number_format($i['percentage'], 1, ',', ' ') }} %
@endforeach @else

Aucune donnée Crit'Air.

@endif

Répartition Crit'Air

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

Aucune répartition disponible.

@endif

Taxes & redevances annuelles

@if (!empty($taxes)) @foreach ($taxes as $t) @php $tone = $t['status']['tone'] ?? 'neutral'; $bg = $toneBg[$tone]; $fg = $toneColor[$tone]; @endphp @endforeach
Taxe Description Montant Statut
{{ $t['tax'] }} {{ $t['description'] }} {{ $t['amount'] }} {{ $t['status']['label'] ?? '' }}
Coût total fiscal {{ $fmtNum($data['total_fiscal'], '€') }}
@else

Aucune taxe pour les filtres choisis.

@endif @endsection