@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $break = $data['status_breakdown']; $up = $data['upcoming_plans']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, is_float($v) && fmod((float) $v, 1) !== 0.0 ? 1 : 0, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Bar chart geometry — count of plan-vehicles per status bucket. $chartW = 480; $chartH = 170; $padX = 30; $padY = 25; $vals = array_map(fn ($r) => (int) $r['count'], $break); $maxV = !empty($vals) ? max($vals) : 0; if ($maxV <= 0) { $maxV = 1; } $barCount = count($break); $availW = $chartW - 2 * $padX; $barW = $barCount > 0 ? ($availW / $barCount) * 0.55 : 0; $stepX = $barCount > 0 ? $availW / max($barCount, 1) : 0; @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 des plans

Terminés dans les délais
{{ $fmtNum($kpis['completed_on_time']['value']) }}
{{ $kpis['completed_on_time']['delta_label'] }}
Plans en retard
{{ $fmtNum($kpis['overdue']['value']) }}
{{ $kpis['overdue']['delta_label'] }}
À planifier (30 jours)
{{ $fmtNum($kpis['upcoming_30d']['value']) }}
{{ $kpis['upcoming_30d']['delta_label'] }}
Taux de respect
{{ $fmtNum($kpis['compliance_rate']['value']) }}{{ $kpis['compliance_rate']['unit'] }}
{{ $kpis['compliance_rate']['delta_label'] }}

Plans par statut

@if ($maxV > 0 && !empty($break)) @foreach ($break as $i => $r) @php $h = ($r['count'] / $maxV) * ($chartH - 2 * $padY); $cx = $padX + $i * $stepX + $stepX / 2; $bx = $cx - $barW / 2; $by = $chartH - $padY - $h; @endphp {{ $r['label'] }} {{ $r['count'] }} @endforeach @else

Aucun plan-véhicule suivi sur la période.

@endif

Plans à venir (30 jours)

@if (!empty($up)) @foreach ($up as $r) @php $tone = $r['days_to_due'] < 8 ? '#EF4444' : ($r['days_to_due'] <= 15 ? '#F59E0B' : '#3B82F6'); @endphp @endforeach
Immat. Véhicule Plan Échéance Jours restants Statut
{{ $r['plate'] }} {{ $r['vehicle'] }} {{ $r['plan'] }} {{ $r['schedule_date'] }} {{ $r['days_to_due'] }} {{ $r['status'] }}
@else

Aucun plan à échéance dans les 30 jours.

@endif @endsection