@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $k = $data['kpis']; $rows = $data['rows']; $series = $data['return_series']; $fmtNum = function ($v, $unit = '') { if ($v === null) return '—'; $s = is_numeric($v) ? number_format((float) $v, (is_int($v) || ((float) $v) == (int) $v) ? 0 : 1, ',', ' ') : (string) $v; return trim($s . ' ' . $unit); }; // Bar chart for the next-14-days returns. $barW = 480; $barH = 140; $barPad = 30; $maxBar = max(1, max(array_map(fn ($s) => (int) $s['count'], $series))); $barWidth = (int) (($barW - 2 * $barPad) / max(1, count($series))) - 4; @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 clés

Véhicules en atelier
{{ $fmtNum($k['in_workshop']['value']) }}
{{ $k['in_workshop']['caption'] }}
Durée moy d'immobilisation
{{ $fmtNum($k['avg_immobilization']['value']) }}{{ $k['avg_immobilization']['unit'] }}
{{ $k['avg_immobilization']['caption'] }}
Restitution prévue aujourd'hui
{{ $fmtNum($k['returning_today']['value']) }}{{ $k['returning_today']['unit'] }}
{{ $k['returning_today']['caption'] }}
Véhicules de remplacement
{{ $fmtNum($k['replacement_vehicles']['value']) }}
{{ $k['replacement_vehicles']['caption'] }}

Restitutions prévues — 14 jours

@if (!empty($series)) @foreach ($series as $i => $b) @php $h = ($b['count'] / $maxBar) * ($barH - 50); $x = $barPad + $i * (($barW - 2 * $barPad) / count($series)) + 2; $y = $barH - 24 - $h; @endphp {{ $b['label'] }} @if ($b['count'] > 0) {{ $b['count'] }} @endif @endforeach @else

Aucune restitution prévue.

@endif

Véhicules actuellement en atelier

@if (!empty($rows)) @foreach ($rows as $r) @endforeach
Plaque Véhicule Garage Entrée atelier Restitution prévue Jours
{{ $r['plate'] ?? '—' }} {{ $r['mark_model'] ?? '—' }} {{ $r['garage'] ?? '—' }} {{ $r['schedule_date'] ? \Carbon\Carbon::parse($r['schedule_date'])->locale('fr')->isoFormat('D MMM') : '—' }} {{ $r['expected_return'] ? \Carbon\Carbon::parse($r['expected_return'])->locale('fr')->isoFormat('D MMM') : '—' }} {{ $r['days_in_workshop'] ?? '—' }}

Restitution prévue estimée à entrée atelier + 3 jours (cible standard) — module de planification atelier à venir.

@else

Aucun véhicule en atelier sur la sélection.

@endif @endsection