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

{{ $meta['title'] }}

Parc & Véhicules {{ $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

Véhicules nominatifs
{{ $fmtNum($k['nominative']['value']) }}
{{ $k['nominative']['caption'] }}
Véhicules pool
{{ $fmtNum($k['pool']['value']) }}
{{ $k['pool']['caption'] }}
Non affectés
{{ $fmtNum($k['unassigned']['value']) }}
{{ $k['unassigned']['caption'] }}
Changements ce mois
{{ $fmtNum($k['changes']['value']) }}
{{ $k['changes']['caption'] }}

Répartition des affectations

@if (!empty($segs))
@foreach ($slices as $sl) @if ($sl['path'] === null) @else @endif @endforeach @foreach ($segs as $s)
{{ $s['label'] }} — {{ $s['count'] }} véh. ({{ number_format($s['percent'], 1, ',', ' ') }} %)
@endforeach
@else

Aucune affectation.

@endif

Alertes affectation

@foreach ($data['alerts'] as $p) @php $tone = $p['tone'] ?? 'neutral'; $bg = $toneBg[$tone] ?? $toneBg['neutral']; $fg = $toneFg[$tone] ?? $toneFg['neutral']; @endphp
{{ $toneIcon[$tone] ?? '·' }} {{ $p['title'] }}
@endforeach

Historique des changements d'affectation

@if (!empty($data['history'])) @foreach ($data['history'] as $h) @endforeach
Date Immat. Véhicule Conducteur Motif
{{ $h['date'] }} {{ $h['plate'] }} {{ $h['vehicle'] }} {{ $h['driver'] }} {{ $h['reason'] }}
@else

Aucun changement d'affectation sur la période.

@endif @endsection