@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $critical = $data['critical_list']; $segments = $data['pie_segments']; $actions = $data['planned_actions']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // ── Pie geometry ─────────────────────────────────────────────────── $pieRadius = 60; $pieCx = 70; $pieCy = 70; $totalPie = array_sum(array_map(fn ($s) => $s['value'], $segments)); $pieSlices = []; $accAngle = -90; foreach ($segments as $s) { if ($totalPie <= 0) break; $sweep = ($s['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' => $s['color'], 'label' => $s['label'], 'value' => $s['value'], 'pct' => $totalPie > 0 ? round($s['value'] / $totalPie * 100, 1) : 0, ]; $accAngle += $sweep; } // Tone palette for alert chips. $toneBg = ['danger' => '#FEE2E2', 'warning' => '#FEF3C7', 'success' => '#D1FAE5', 'neutral' => '#F3F4F6']; $toneColor = ['danger' => '#991B1B', 'warning' => '#92400E', 'success' => '#065F46', 'neutral' => '#374151']; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Synthèse globale {{ $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 d'alertes

Alertes critiques
{{ $fmtNum($kpis['critical']['value']) }}
{{ $kpis['critical']['delta_label'] }}
Avertissements
{{ $fmtNum($kpis['warnings']['value']) }}
{{ $kpis['warnings']['delta_label'] }}
En cours de traitement
{{ $fmtNum($kpis['in_progress']['value']) }}
{{ $kpis['in_progress']['delta_label'] }}
Résolues 24 h
{{ $fmtNum($kpis['resolved_24h']['value']) }}
{{ $kpis['resolved_24h']['delta_label'] }}

Alertes critiques — Action immédiate

@if (!empty($critical)) @foreach ($critical as $a) @php $tone = $a['tone'] ?? 'warning'; $bg = $toneBg[$tone] ?? $toneBg['warning']; $fg = $toneColor[$tone] ?? $toneColor['warning']; @endphp
{{ $a['title'] }} @if (!empty($a['tag']['label'])) {{ $a['tag']['label'] }} @endif
{{ $a['reference'] }}
{{ $a['meta'] }}
@endforeach @else

Aucune alerte sur la période.

@endif

Répartition par criticité

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

Aucune alerte à répartir.

@endif

Avertissements — Actions planifiées

@if (!empty($actions)) @foreach ($actions as $a) @php $tone = $a['tone'] ?? 'warning'; $bg = $toneBg[$tone] ?? $toneBg['warning']; $fg = $toneColor[$tone] ?? $toneColor['warning']; @endphp @endforeach
Action Volume Échéance
{{ $a['label'] }} {{ $a['count_label'] }} {{ $a['deadline_label'] }}
@else

Aucune action planifiée détectée.

@endif @endsection