@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $heat = $data['heatmap']; $peaks = $data['top_peaks']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Heatmap geometry — 24 cols × 7 rows. $cellW = 18; $cellH = 18; $rowLabelW = 30; $colLabelH = 16; $heatW = $rowLabelW + 24 * $cellW + 4; $heatH = $colLabelH + 7 * $cellH + 4; $maxV = max(1, $heat['max']); $cellColor = function ($v) use ($maxV) { if ($v <= 0) return '#F3F4F6'; $ratio = $v / $maxV; // Light yellow → amber → red, à la mockup. if ($ratio < 0.25) return '#FEF3C7'; if ($ratio < 0.5) return '#FCD34D'; if ($ratio < 0.75) return '#F59E0B'; return '#EF4444'; }; @endphp @section('content')
DADYCAR FLEET MANAGER

{{ $meta['title'] }}

Télématique {{ $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'utilisation horaire

Pic d'activité
{{ $kpis['peak_activity']['value'] }}
{{ $kpis['peak_activity']['delta_label'] }}
Taux d'utilisation
{{ $fmtNum($kpis['usage_rate']['value']) }}{{ $kpis['usage_rate']['unit'] ?? '' }}
{{ $kpis['usage_rate']['delta_label'] }}
Hors heures ouvrées
{{ $fmtNum($kpis['off_hours']['value']) }}
{{ $kpis['off_hours']['delta_label'] }}
Utilisation week-end
{{ $fmtNum($kpis['weekend']['value']) }}
{{ $kpis['weekend']['delta_label'] }}

Heatmap d'activité — Jour × Heure

@if ($meta['source'] === null || $meta['samples'] === 0)

Données détaillées à venir — pas de trajets télématiques enregistrés sur la période.

@else {{-- Column labels (hours, every 2h to fit) --}} @foreach ($heat['columns'] as $h => $label) @if ($h % 2 === 0) {{ $label }} @endif @endforeach {{-- Row labels and cells --}} @foreach ($heat['rows'] as $d => $rowLabel) {{ $rowLabel }} @foreach ($heat['values'][$d] as $h => $v) @php $color = $cellColor($v); @endphp @if ($v > 0) {{ $v }} @endif @endforeach @endforeach
Échelle : faible moyenne haute pic · Source : {{ $meta['source'] }} · {{ $meta['samples'] }} échantillons
@endif

Pics d'activité (top 8)

@if (!empty($peaks)) @foreach ($peaks as $p) @endforeach
Jour Heure Démarrages
{{ $p['day'] }} {{ $p['hour'] }} {{ $fmtNum($p['count']) }}
@else

Aucun pic d'activité identifié.

@endif @endsection