@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $monthly = $data['monthly_histogram']; $rows = $data['status_table']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, is_float($v) && fmod($v, 1) !== 0.0 ? 1 : 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Bar chart geometry $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 ?: [['count' => 0]]))); $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') }}

Indicateurs d'immobilisation

Véhicules immobilisés
{{ $fmtNum($kpis['immobilized_count']['value']) }}
{{ $kpis['immobilized_count']['delta_label'] }}
Durée moyenne
{{ $fmtNum($kpis['avg_duration']['value']) }}{{ $kpis['avg_duration']['unit'] }}
{{ $kpis['avg_duration']['delta_label'] }}
Coût total immobilisation
{{ $fmtNum($kpis['total_cost']['value']) }}{{ $kpis['total_cost']['unit'] }}
{{ $kpis['total_cost']['delta_label'] }}
% du parc immobilisé
{{ $fmtNum($kpis['percent_fleet']['value']) }}{{ $kpis['percent_fleet']['unit'] }}
{{ $kpis['percent_fleet']['delta_label'] }}

Véhicules actuellement immobilisés

@if (!empty($rows)) @foreach ($rows as $r) @endforeach
Immatriculation Marque / Modèle Site Cause Durée
{{ $r['plate'] }} {{ $r['model'] }} {{ $r['site'] }} {{ $r['cause'] }} {{ $r['duration'] }}
@else

Aucun véhicule immobilisé.

@endif

Mises hors service par mois (6 derniers mois)

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

Pas d'historique de statut disponible.

@endif @endsection