@extends('reports.pdf.layout')
@section('title', $data['meta']['title'])
@php
$meta = $data['meta'];
$kpis = $data['kpis'];
$weekly = $data['weekly'];
$scenarios = $data['scenarios'];
$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 = 480; $barH = 160; $barPadX = 30; $barPadY = 22;
$maxV = 0;
foreach ($weekly as $w) { $maxV = max($maxV, ($w['fulfilled'] + $w['refused'])); }
$maxV = max($maxV, 1);
$barCount = count($weekly);
$barSlot = $barCount > 0 ? ($barW - 2 * $barPadX) / $barCount : 0;
$barWidth = $barSlot * 0.55;
@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
Demandes refusées
{{ $kpis['refused_reservations']['value'] }}
{{ $kpis['refused_reservations']['delta_label'] }}
Taux d'occupation
{{ $kpis['avg_occupancy_q']['value'] }}{{ $kpis['avg_occupancy_q']['unit'] }}
{{ $kpis['avg_occupancy_q']['delta_label'] }}
Sous-utilisés
{{ $kpis['underused']['value'] }}{{ $kpis['underused']['unit'] }}
{{ $kpis['underused']['delta_label'] }}
Recommandation
{{ $kpis['recommendation']['value'] }}
{{ $kpis['recommendation']['delta_label'] }}
Demandes satisfaites vs refusées
@if ($maxV > 0)
Satisfaites
Refusées
@else
Pas de données.
@endif
Analyse des scénarios de dimensionnement
@if (!empty($scenarios))
| Scénario |
Coût mensuel |
Taux d'occupation prévu |
Verdict |
@foreach ($scenarios as $s)
@php
$tone = $s['gap']['tone'] ?? 'neutral';
$bg = $toneBg[$tone] ?? $toneBg['neutral'];
$fg = $toneColor[$tone] ?? $toneColor['neutral'];
@endphp
| {{ $s['label'] }} |
{{ $s['budget'] }} |
{{ $s['actual'] }} |
{{ $s['gap']['value'] ?? '' }} |
@endforeach
@else
Pas de scénarios calculables.
@endif
@endsection