@extends('reports.pdf.layout')
@section('title', $data['meta']['title'])
@php
$meta = $data['meta'];
$kpis = $data['kpis'];
$byDay = $data['day_of_week'];
$byHour = $data['hour_of_day'];
$perVehicle = $data['per_vehicle'];
$fmtNum = function ($v, $unit = '') {
if ($v === null) return '—';
$s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v;
return trim($s . ' ' . $unit);
};
$toneBg = ['danger' => '#FEE2E2', 'warning' => '#FEF3C7', 'success' => '#D1FAE5', 'neutral' => '#F3F4F6'];
$toneColor = ['danger' => '#991B1B', 'warning' => '#92400E', 'success' => '#065F46', 'neutral' => '#374151'];
$barW = 320; $barH = 130; $barPadX = 28; $barPadY = 22;
$maxDay = 0;
foreach ($byDay as $r) { $maxDay = max($maxDay, (int) $r['value']); }
$maxDay = max($maxDay, 100);
$maxHour = 0;
foreach ($byHour as $r) { $maxHour = max($maxHour, (int) $r['value']); }
$maxHour = max($maxHour, 100);
@endphp
@section('content')
DADYCAR FLEET MANAGER
{{ $meta['title'] }}
Autopartage & Pool
{{ $meta['code'] }}
Période : {{ $meta['period']['label'] }} · {{ $meta['site_label'] }} ·
{{ $meta['pool_count'] }} véhicules pool ·
Généré le {{ $meta['generated_at']->locale('fr')->isoFormat('D MMMM YYYY') }}
Indicateurs clés
Taux d'occupation
{{ $fmtNum($kpis['avg_occupancy']['value']) }}{{ $kpis['avg_occupancy']['unit'] }}
{{ $kpis['avg_occupancy']['delta_label'] }}
Véhicules actifs
{{ $kpis['pool_count']['value'] }}{{ $kpis['pool_count']['unit'] }}
{{ $kpis['pool_count']['delta_label'] }}
Heures d'utilisation
{{ $kpis['total_hours']['value'] }}{{ $kpis['total_hours']['unit'] }}
{{ $kpis['total_hours']['delta_label'] }}
Km parcourus (pool)
{{ $fmtNum($kpis['total_km']['value']) }}{{ $kpis['total_km']['unit'] }}
{{ $kpis['total_km']['delta_label'] }}
Taux d'occupation par jour de la semaine
@php
$barCount = count($byDay);
$barSlot = $barCount > 0 ? ($barW - 2 * $barPadX) / $barCount : 0;
$barWidth = $barSlot * 0.55;
@endphp
Taux d'occupation par plage horaire
@php
$barCount2 = count($byHour);
$barSlot2 = $barCount2 > 0 ? ($barW - 2 * $barPadX) / $barCount2 : 0;
$barWidth2 = $barSlot2 * 0.55;
@endphp
Utilisation par véhicule du pool
@if (!empty($perVehicle))
| Plaque |
Modèle |
Taux d'occ. |
Rés. |
Km |
Statut |
@foreach ($perVehicle as $r)
@php
$tone = $r['status']['tone'] ?? 'neutral';
$bg = $toneBg[$tone]; $fg = $toneColor[$tone];
@endphp
| {{ $r['plate'] }} |
{{ $r['model'] }} |
{{ $r['occupancy'] }}% |
{{ $r['reservations'] }} |
{{ $fmtNum($r['km']) }} |
{{ $r['status']['label'] ?? '' }} |
@endforeach
@else
Aucun véhicule pool sur la période.
@endif
@endsection