@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $k = $data['kpis']; $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. $cx = 70; $cy = 70; $r = 60; $segs = $data['pie_segments']; $totalSeg = array_sum(array_map(fn ($s) => $s['count'], $segs)); $slices = []; $acc = -90; foreach ($segs as $s) { if ($totalSeg <= 0) break; $sweep = ($s['count'] / $totalSeg) * 360; $isFull = $sweep >= 359.999; if ($isFull) { $path = null; } else { $rad1 = deg2rad($acc); $rad2 = deg2rad($acc + $sweep); $x1 = $cx + $r * cos($rad1); $y1 = $cy + $r * sin($rad1); $x2 = $cx + $r * cos($rad2); $y2 = $cy + $r * sin($rad2); $largeArc = $sweep > 180 ? 1 : 0; $path = sprintf('M %s %s L %.2f %.2f A %s %s 0 %d 1 %.2f %.2f Z', $cx, $cy, $x1, $y1, $r, $r, $largeArc, $x2, $y2); } $slices[] = ['path' => $path, 'color' => $s['color']]; $acc += $sweep; } // Bar chart for monthly distribution. $bars = $data['monthly']; $maxBar = max(1, !empty($bars) ? max(array_map(fn ($b) => $b['count'], $bars)) : 1); $barW = 480; $barH = 140; $barPad = 30; $barWidth = !empty($bars) ? max(8, (int) (($barW - 2 * $barPad) / max(1, count($bars))) - 6) : 0; $toneBg = ['success' => '#D1FAE5', 'warning' => '#FEF3C7', 'danger' => '#FEE2E2', 'neutral' => '#F3F4F6']; $toneFg = ['success' => '#065F46', 'warning' => '#92400E', 'danger' => '#991B1B', 'neutral' => '#374151']; $toneIcon = ['success' => '✓', 'warning' => '!', 'danger' => '✕', 'neutral' => '·']; @endphp @section('content')
Pas de contrat à venir.
@endif|
@foreach ($segs as $s)
{{ $s['label'] }} — {{ $s['count'] }} ({{ number_format($s['percent'], 1, ',', ' ') }} %)
@endforeach
|
Aucun contrat actif.
@endif| Immat. | Modèle | Type | Échéance | Restant | Km contrat | Km réel | Écart | Pénalité |
|---|---|---|---|---|---|---|---|---|
| {{ $r['plate'] }} | {{ $r['label'] }} | {{ $r['type'] }} | {{ $r['end_label'] }} | {{ $r['days_remaining'] }} j | @if ($r['km_contract'] !== null){{ number_format($r['km_contract'], 0, ',', ' ') }}@else À venir@endif | @if ($r['km_real'] !== null){{ number_format($r['km_real'], 0, ',', ' ') }}@else À venir@endif | @if ($r['gap'] !== null){{ ($r['gap'] > 0 ? '+' : '') . number_format($r['gap'], 0, ',', ' ') }}@else —@endif | @if (($r['penalty'] ?? 0) > 0){{ number_format($r['penalty'], 0, ',', ' ') }} €@else 0 €@endif |
Pénalité estimée à 0,50 € / km (taux moyen — les avenants au contrat peuvent prévoir un taux différent).
@elseAucun contrat arrivant à échéance dans les 90 jours.
@endif @endsection