@extends('reports.pdf.layout') @section('title', $data['meta']['title']) @php $meta = $data['meta']; $kpis = $data['kpis']; $split = $data['connection_split']; $listing = $data['eligible_listing']; $fmtNum = function ($v) { if ($v === null) return '—'; return is_numeric($v) ? number_format((float) $v, 0, ',', ' ') : (string) $v; }; // Pie geometry — 360° single-segment falls back to . $pieR = 60; $pieCx = 70; $pieCy = 70; $pieTotal = array_sum(array_map(fn ($s) => $s['count'], $split)); $pieSlices = []; $acc = -90; foreach ($split as $s) { if ($pieTotal <= 0 || $s['count'] <= 0) continue; $sweep = ($s['count'] / $pieTotal) * 360; $isFull = $sweep >= 359.999; if ($isFull) { $path = null; } else { $r1 = deg2rad($acc); $r2 = deg2rad($acc + $sweep); $x1 = $pieCx + $pieR * cos($r1); $y1 = $pieCy + $pieR * sin($r1); $x2 = $pieCx + $pieR * cos($r2); $y2 = $pieCy + $pieR * sin($r2); $large = $sweep > 180 ? 1 : 0; $path = sprintf('M %s %s L %.2f %.2f A %s %s 0 %d 1 %.2f %.2f Z', $pieCx, $pieCy, $x1, $y1, $pieR, $pieR, $large, $x2, $y2); } $pieSlices[] = [ 'path' => $path, 'color' => $s['color'], 'label' => $s['label'], 'count' => $s['count'], 'percent' => $pieTotal > 0 ? round(($s['count'] / $pieTotal) * 100, 1) : 0, ]; $acc += $sweep; } @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 de déploiement

Véhicules connectés
{{ $fmtNum($kpis['connected_count']['value']) }}
{{ $kpis['connected_count']['delta_label'] }}
Non connectés éligibles
{{ $fmtNum($kpis['disconnected_eligible']['value']) }}
{{ $kpis['disconnected_eligible']['delta_label'] }}
Boîtiers commandés
{{ $fmtNum($kpis['ordered_devices']['value']) }}
{{ $kpis['ordered_devices']['delta_label'] }}
Boîtiers en panne
{{ $fmtNum($kpis['broken_devices']['value']) }}
{{ $kpis['broken_devices']['delta_label'] }}

Répartition des statuts de connexion

@if (!empty($pieSlices))
@foreach ($pieSlices as $s) @if ($s['path'] === null) @else @endif @endforeach @foreach ($pieSlices as $s)
{{ $s['label'] }} — {{ $fmtNum($s['count']) }} ({{ number_format($s['percent'], 1, ',', ' ') }} %)
@endforeach
@else

Aucun véhicule sur la période.

@endif

Véhicules non connectés éligibles

@if (!empty($listing)) @foreach ($listing as $r) @endforeach
Véhicule Modèle Statut Site
{{ $r['plate'] }} {{ $r['model'] }} {{ $r['status'] }} {{ $r['site'] }}
@else

Aucun véhicule éligible non connecté.

@endif @endsection