@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $monthly = $data['monthly']; $byType = $data['by_type']; $analysis = $data['analysis']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Bar chart geometry (cost vs premium per month). $barW = 320; $barH = 160; $barPadX = 30; $barPadY = 22; $maxV = 0; foreach ($monthly as $m) { $maxV = max($maxV, (float) $m['cost'], (float) $m['premium']); } $maxV = max($maxV, 1); $barCount = count($monthly); $barSlot = $barCount > 0 ? ($barW - 2 * $barPadX) / $barCount : 0; $barWidth = $barSlot * 0.30; // Horizontal bar geometry. $maxByType = 0; foreach ($byType as $b) { $maxByType = max($maxByType, (float) $b['total']); } $maxByType = max($maxByType, 1); @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Sinistres {{ $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

Coût total
{{ $fmtNum($kpis['total_cost']['value']) }}{{ $kpis['total_cost']['unit'] }}
{{ $kpis['total_cost']['delta_label'] }}
Coût moyen / sinistre
{{ $fmtNum($kpis['avg_cost']['value']) }}{{ $kpis['avg_cost']['unit'] }}
{{ $kpis['avg_cost']['delta_label'] }}
Ratio coûts/primes
{{ $kpis['claims_premium_ratio']['value'] !== null ? number_format($kpis['claims_premium_ratio']['value'], 1, ',', ' ') : '—' }}{{ $kpis['claims_premium_ratio']['unit'] }}
{{ $kpis['claims_premium_ratio']['delta_label'] }}
Coût le + élevé
{{ $fmtNum($kpis['most_expensive']['value']) }}{{ $kpis['most_expensive']['unit'] }}
{{ $kpis['most_expensive']['delta_label'] }}

Coûts sinistres vs primes (€/mois)

@if ($maxV > 0 && !empty($monthly)) @foreach ($monthly as $i => $m) @php $hCost = $maxV > 0 ? ($m['cost'] / $maxV) * ($barH - 2 * $barPadY) : 0; $hPrem = $maxV > 0 ? ($m['premium'] / $maxV) * ($barH - 2 * $barPadY) : 0; $xCost = $barPadX + $i * $barSlot + ($barSlot - 2 * $barWidth) / 2; $xPrem = $xCost + $barWidth + 1; $yCost = $barH - $barPadY - $hCost; $yPrem = $barH - $barPadY - $hPrem; @endphp {{ $m['label'] }} @endforeach
Coût sinistres Primes versées
@else

Pas de données sur la période.

@endif

Coût et fréquence par type de sinistre

@if ($maxByType > 0) @foreach ($byType as $b) @php $pct = $maxByType > 0 ? ($b['total'] / $maxByType) * 100 : 0; @endphp
{{ $b['label'] }} — {{ $fmtNum($b['total']) }} € ({{ $b['count'] }} sinistres · Moy. {{ $fmtNum($b['avg']) }} €)
@endforeach @else

Aucun sinistre sur la période.

@endif

Analyse assurance (6 mois)

@foreach ($analysis as $a) @endforeach
Indicateur Montant
{{ $a['label'] }} {{ $fmtNum($a['amount'], '€') }}
@endsection