@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $rows = $data['rows']; $pie = $data['pie']; $action = $data['action']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; $toneBg = ['danger' => '#FEE2E2', 'warning' => '#FEF3C7', 'info' => '#DBEAFE', 'success' => '#D1FAE5', 'neutral' => '#F3F4F6']; $toneColor = ['danger' => '#991B1B', 'warning' => '#92400E', 'info' => '#1E3A8A', 'success' => '#065F46', 'neutral' => '#374151']; // Pie geometry. $pieRadius = 50; $pieCx = 60; $pieCy = 60; $totalPie = array_sum(array_column($pie, 'value')); $pieSlices = []; $accAngle = -90; foreach ($pie as $i => $p) { if ($totalPie <= 0) break; $sweep = ((float) $p['value'] / $totalPie) * 360; $isFull = $sweep >= 359.999; if ($isFull) { $path = null; } else { $rad1 = deg2rad($accAngle); $rad2 = deg2rad($accAngle + $sweep); $x1 = $pieCx + $pieRadius * cos($rad1); $y1 = $pieCy + $pieRadius * sin($rad1); $x2 = $pieCx + $pieRadius * cos($rad2); $y2 = $pieCy + $pieRadius * 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, $pieRadius, $pieRadius, $largeArc, $x2, $y2); } $pieSlices[] = ['path' => $path, 'color' => $p['color'], 'label' => $p['label'], 'value' => $p['value']]; $accAngle += $sweep; } $aTone = $action['tone'] ?? 'neutral'; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

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

Indicateurs clés

Dossiers ouverts
{{ $kpis['open_count']['value'] }}
{{ $kpis['open_count']['delta_label'] }}
Dossiers en retard
{{ $kpis['overdue_count']['value'] }}
{{ $kpis['overdue_count']['delta_label'] }}
Dossier le plus ancien
{{ $fmtNum($kpis['oldest_dossier']['value']) }}{{ $kpis['oldest_dossier']['unit'] }}
{{ $kpis['oldest_dossier']['delta_label'] }}
Délai moyen
{{ $fmtNum($kpis['avg_delay']['value']) }}{{ $kpis['avg_delay']['unit'] }}
{{ $kpis['avg_delay']['delta_label'] }}

Dossiers sinistres en cours

@if (!empty($rows)) @foreach (array_slice($rows, 0, 8) as $r) @php $tone = $r['status_tone'] ?? 'neutral'; $bg = $toneBg[$tone] ?? $toneBg['neutral']; $fg = $toneColor[$tone] ?? $toneColor['neutral']; @endphp
{{ $r['reference'] }} · {{ $r['vehicle'] }} · {{ $r['type_label'] }}
Ouvert le {{ $r['opened_label'] }} · {{ $r['days_open'] }} jours · Coût estimé : {{ $fmtNum($r['cost_estimate'], '€') }}
{{ $r['status_label'] }}
@endforeach @else

Aucun dossier ouvert pour les filtres choisis.

@endif

Répartition par statut

@if ($totalPie > 0)
@foreach ($pieSlices as $s) @if ($s['path'] === null) @else @endif @endforeach @foreach ($pieSlices as $s)
{{ $s['label'] }} — {{ $s['value'] }}
@endforeach
@else

Aucune répartition disponible.

@endif @if (!empty($action['label']))
Action requise : {{ $action['label'] }}
@endif
@endsection