@extends('reports.pdf.layout')
@section('title', $data['meta']['title'])
@php
$meta = $data['meta'];
$k = $data['kpis'];
$top = $data['top_10'];
$rows = $data['rows'];
$fmtNum = function ($v, $unit = '') {
if ($v === null) return '—';
$s = is_numeric($v) ? number_format((float) $v, (is_int($v) || ((float) $v) == (int) $v) ? 0 : 1, ',', ' ') : (string) $v;
return trim($s . ' ' . $unit);
};
$fmtCostKm = function ($v) {
if ($v === null) return '—';
return number_format((float) $v, 3, ',', ' ') . ' €/km';
};
$barW = 480; $barH = 160; $barPad = 30;
$maxBar = max(1, max(array_map(fn ($r) => (int) $r['cost'], $top ?: [['cost' => 0]])));
$barCount = max(1, count($top));
$barWidth = (int) (($barW - 2 * $barPad) / $barCount) - 6;
@endphp
@section('content')
DADYCAR FLEET MANAGER
{{ $meta['title'] }}
Maintenance
{{ $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 moyen / véhicule
{{ $fmtNum($k['avg_cost']['value']) }}{{ $k['avg_cost']['unit'] }}
{{ $k['avg_cost']['caption'] }}
Véhicules > 150% moy.
{{ $fmtNum($k['above_avg']['value']) }}
{{ $k['above_avg']['caption'] }}
Coût/km le plus élevé
{{ $k['highest_cost_per_km']['value'] !== null ? number_format((float) $k['highest_cost_per_km']['value'], 3, ',', ' ') : '—' }}{{ $k['highest_cost_per_km']['unit'] }}
{{ $k['highest_cost_per_km']['caption'] }}
Réforme recommandée
{{ $fmtNum($k['reform_recommendation']['value']) }}
{{ $k['reform_recommendation']['caption'] }}
Top {{ count($top) }} véhicules par coût cumulé
@if (!empty($top))
@else
Aucune dépense de maintenance sur la période.
@endif
Détail coût / km par véhicule
@if (!empty($rows))
| Plaque |
Véhicule |
Année |
Coût |
Km |
Coût/km |
@foreach (array_slice($rows, 0, 25) as $r)
| {{ $r['plate'] ?? '—' }} |
{{ $r['mark_model'] ?? '—' }} |
{{ $r['year'] ?? '—' }} |
{{ number_format((float) $r['cost'], 0, ',', ' ') }} € |
{{ $r['km'] !== null ? number_format($r['km'], 0, ',', ' ') : '—' }} |
{{ $fmtCostKm($r['cost_per_km']) }} |
@endforeach
@if (count($rows) > 25)
{{ count($rows) - 25 }} véhicule(s) supplémentaire(s) — voir l'export Excel pour le détail complet.
@endif
@else
Aucune dépense de maintenance sur la période.
@endif
@endsection