@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $top = $data['top10']; $rows = $data['rows']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Stacked horizontal bar — pixel widths. $chartW = 480; $chartH = 220; $padL = 110; $padR = 12; $rowH = 18; $rowsTop = $top; $maxTotal = !empty($rowsTop) ? max(array_column($rowsTop, 'total') ?: [0]) : 0; if ($maxTotal <= 0) $maxTotal = 1; $available = $chartW - $padL - $padR; $colors = [ 'fuel' => '#3B82F6', 'maintenance' => '#8B5CF6', 'fines' => '#F59E0B', 'other' => '#6B7280', ]; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

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

Indicateurs clés

Coût total flotte
{{ $fmtNum($kpis['total_fleet']['value']) }}{{ $kpis['total_fleet']['unit'] }}
{{ $kpis['total_fleet']['delta_label'] }}
Coût moyen / conducteur
{{ $fmtNum($kpis['avg_per_driver']['value']) }}{{ $kpis['avg_per_driver']['unit'] }}
{{ $kpis['avg_per_driver']['delta_label'] }}
Conducteur le plus coûteux
{{ $fmtNum($kpis['top_driver_cost']['value']) }}{{ $kpis['top_driver_cost']['unit'] }}
{{ $kpis['top_driver_cost']['delta_label'] }}
Total amendes
{{ $fmtNum($kpis['total_fines']['value']) }}{{ $kpis['total_fines']['unit'] }}
{{ $kpis['total_fines']['delta_label'] }}

Top 10 — Coût total des coûts par poste

@if (!empty($rowsTop)) @foreach ($rowsTop as $i => $r) @php $y = $i * $rowH + 8; $cursor = $padL; @endphp {{ \Illuminate\Support\Str::limit($r['driver'], 20) }} @foreach (['fuel','maintenance','fines','other'] as $b) @php $w = ($r[$b] / $maxTotal) * $available; @endphp @if ($w > 0) @php $cursor += $w; @endphp @endif @endforeach {{ number_format($r['total'], 0, ',', ' ') }} € @endforeach {{-- legend --}} @foreach (['fuel' => 'Carburant', 'maintenance' => 'Maintenance', 'fines' => 'Amendes', 'other' => 'Autres'] as $k => $lbl) @php $offset = array_search($k, ['fuel','maintenance','fines','other']) * 80; @endphp {{ $lbl }} @endforeach @else

Aucun coût enregistré sur la période.

@endif

Détail par conducteur — Coût par catégorie

@if (!empty($rows)) @foreach ($rows as $r) @endforeach
Conducteur Carburant Maintenance Amendes Autres Sinistres Total
{{ $r['driver'] }} {{ $fmtNum($r['fuel'], '€') }} {{ $fmtNum($r['maintenance'], '€') }} {{ $fmtNum($r['fines'], '€') }} {{ $fmtNum($r['other'], '€') }} {{ $r['claims_count'] }} {{ $fmtNum($r['total'], '€') }}

La colonne "Sinistres" remonte le compte des sinistres déclarés sur la période — le coût monétaire associé n'est pas stocké à ce jour.

@else

Aucune dépense rattachée à un conducteur sur la période.

@endif @endsection