@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')
Aucune alerte sur la période.
@endif|
@foreach ($pieSlices as $s)
{{ $s['label'] }} — {{ $s['value'] }} ({{ number_format($s['pct'], 1, ',', ' ') }} %)
@endforeach
|
Aucune alerte à répartir.
@endif| Action | Volume | Échéance |
|---|---|---|
| {{ $a['label'] }} | {{ $a['count_label'] }} | {{ $a['deadline_label'] }} |
Aucune action planifiée détectée.
@endif @endsection