@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $k = $data['kpis']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; return is_numeric($v) ? trim(number_format((float) $v, 0, ',', ' ') . ' ' . $unit) : (string) $v; }; // Pie geometry (single SVG slice path per segment). $cx = 70; $cy = 70; $r = 60; $segs = $data['assignment_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; } $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')
|
@foreach ($segs as $s)
{{ $s['label'] }} — {{ $s['count'] }} véh. ({{ number_format($s['percent'], 1, ',', ' ') }} %)
@endforeach
|
Aucune affectation.
@endif| Date | Immat. | Véhicule | Conducteur | Motif |
|---|---|---|---|---|
| {{ $h['date'] }} | {{ $h['plate'] }} | {{ $h['vehicle'] }} | {{ $h['driver'] }} | {{ $h['reason'] }} |
Aucun changement d'affectation sur la période.
@endif @endsection