@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')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Conducteurs {{ $meta['code'] }} Période : {{ $meta['period']['label'] }} · {{ $meta['site_label'] }} · {{ $meta['total_drivers'] }} conducteurs · Généré le {{ $meta['generated_at']->locale('fr')->isoFormat('D MMMM YYYY') }}

Indicateurs clés

Permis valides
{{ $fmtNum($kpis['valid']['value']) }}
{{ $kpis['valid']['delta_label'] }}
Permis expirés
{{ $fmtNum($kpis['expired']['value']) }}
{{ $kpis['expired']['delta_label'] }}
Expirant < 30 jours
{{ $fmtNum($kpis['expiring_30d']['value']) }}
{{ $kpis['expiring_30d']['delta_label'] }}
Catégories manquantes
{{ $fmtNum($kpis['missing_categories']['value']) }}
{{ $kpis['missing_categories']['delta_label'] }}

Suivi des permis par conducteur

@if (!empty($rows)) @foreach ($rows as $r) @php $b = $statusBadge[$r['status']] ?? $statusBadge['unknown']; @endphp @endforeach
Conducteur Cat. Expiration Restant Véhicule Statut
{{ $r['driver'] }} {{ $r['category'] }} {{ $r['expiration'] }} {{ $r['remaining'] }} {{ $r['vehicle'] }} {{ $b['label'] }}
@else

Aucun conducteur correspondant.

@endif

Répartition par statut

@if (!empty($pieSlices))
@foreach ($pieSlices as $s) @if ($s['path'] === null) @else @endif @endforeach @foreach ($pieSlices as $s)
{{ $s['label'] }} — {{ $s['count'] }} ({{ number_format($s['percent'], 1, ',', ' ') }} %)
@endforeach
@else

Aucune donnée de permis.

@endif @if ($kpis['expired']['value'] > 0)
Action immédiate requise

Permis expiré détecté : véhicule à immobiliser immédiatement. Risque pénal pour l'entreprise.

@endif
@endsection