@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $pie = $data['pie']; $rows = $data['rows']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Pie chart geometry — 360° degenerate slice fallback as in SG-01. $pieR = 60; $pieCx = 70; $pieCy = 70; $totalPie = array_sum(array_map(fn ($s) => (int) $s['count'], $pie)); $pieSlices = []; $accAngle = -90; foreach ($pie as $s) { if ($totalPie <= 0 || $s['count'] <= 0) continue; $sweep = ($s['count'] / $totalPie) * 360; $isFull = $sweep >= 359.999; if ($isFull) { $path = null; } else { $rad1 = deg2rad($accAngle); $rad2 = deg2rad($accAngle + $sweep); $x1 = $pieCx + $pieR * cos($rad1); $y1 = $pieCy + $pieR * sin($rad1); $x2 = $pieCx + $pieR * cos($rad2); $y2 = $pieCy + $pieR * 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, $pieR, $pieR, $largeArc, $x2, $y2 ); } $pieSlices[] = ['path' => $path, 'color' => $s['color'], 'label' => $s['label'], 'count' => $s['count'], 'percent' => $s['percent']]; $accAngle += $sweep; } $statusBadge = [ 'valid' => ['label' => 'Valide', 'bg' => '#D1FAE5', 'fg' => '#065F46'], 'expiring' => ['label' => 'Expire bientôt', 'bg' => '#FEF3C7', 'fg' => '#92400E'], 'expired' => ['label' => 'Expiré', 'bg' => '#FEE2E2', 'fg' => '#991B1B'], 'unknown' => ['label' => 'Non renseigné', 'bg' => '#F3F4F6', 'fg' => '#374151'], ]; @endphp @section('content')
| Conducteur | Cat. | Expiration | Restant | Véhicule | Statut |
|---|---|---|---|---|---|
| {{ $r['driver'] }} | {{ $r['category'] }} | {{ $r['expiration'] }} | {{ $r['remaining'] }} | {{ $r['vehicle'] }} | {{ $b['label'] }} |
Aucun conducteur correspondant.
@endif|
@foreach ($pieSlices as $s)
{{ $s['label'] }} — {{ $s['count'] }} ({{ number_format($s['percent'], 1, ',', ' ') }} %)
@endforeach
|
Aucune donnée de permis.
@endif @if ($kpis['expired']['value'] > 0)Permis expiré détecté : véhicule à immobiliser immédiatement. Risque pénal pour l'entreprise.