@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $monthly = $data['monthly_histogram']; $rows = $data['expiring_table']; $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 — pin pixel width/height (wkhtmltopdf 0.12 quirk). $chartW = 480; $chartH = 160; $padX = 30; $padY = 24; $barCount = max(count($monthly), 1); $maxVal = max(1, max(array_map(fn ($r) => (int) $r['count'], $monthly))); $barSpace = ($chartW - 2 * $padX) / $barCount; $barWidth = max(8, $barSpace * 0.6); $bars = []; foreach ($monthly as $i => $r) { $h = ($r['count'] / $maxVal) * ($chartH - 2 * $padY); $x = $padX + $i * $barSpace + ($barSpace - $barWidth) / 2; $y = $chartH - $padY - $h; $bars[] = [ 'x' => $x, 'y' => $y, 'w' => $barWidth, 'h' => $h, 'label' => $r['label'], 'value' => $r['count'], 'cx' => $x + $barWidth / 2, ]; } @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Parc & Véhicules {{ $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') }}

Vue d'ensemble — fin de contrats

Expirant ≤ 30 j
{{ $fmtNum($kpis['expiring_30']['value']) }}
{{ $kpis['expiring_30']['delta_label'] }}
Expirant ≤ 60 j
{{ $fmtNum($kpis['expiring_60']['value']) }}
{{ $kpis['expiring_60']['delta_label'] }}
Valeur résiduelle
{{ $fmtNum($kpis['residual_value']['value']) }}{{ $kpis['residual_value']['unit'] }}
{{ $kpis['residual_value']['delta_label'] }}
Pénalités potentielles
{{ $fmtNum($kpis['penalties']['value']) }}{{ $kpis['penalties']['unit'] }}
{{ $kpis['penalties']['delta_label'] }}

Échéances de contrats sur 12 mois

@if (!empty($bars)) @foreach ($bars as $b) {{ $b['label'] }} @if ($b['value'] > 0) {{ $b['value'] }} @endif @endforeach @else

Aucun contrat à analyser.

@endif

Contrats prochainement échus

@if (!empty($rows)) @foreach ($rows as $r) @endforeach
Immatriculation Marque / Modèle Type Fin Jours restants Action recommandée
{{ $r['plate'] }} {{ $r['mark_model'] }} {{ $r['type'] }} {{ $r['end_date'] }} {{ $r['days_remaining'] }} {{ $r['action'] }}
@else

Aucun contrat dans l'horizon.

@endif @endsection