@extends('layouts.app') @section('title', 'Véhicules') @section('breadcrumb', 'Opérations / Véhicules') @section('content')
{{-- En-tête --}} @if(session('success'))
{{ session('success') }}
@endif {{-- Tabs --}}
{{-- ═══════════════════════════════════ TAB : STATISTIQUES ═══════════════════════════════════ --}}
{{-- KPI Cards --}}
{{ $stats['total'] }}
Dans le catalogue
{{ $stats['nb_affectations'] }}
Affectations chantiers
{{ $stats['entretiens_retard'] + $stats['entretiens_soon'] }}
Entretiens à traiter
{{ $stats['nb_panne'] }}
En panne
{{-- Répartition par état --}}

Répartition par état

@php $nbEtat = $stats['nb_bon'] + $stats['nb_alerte'] + $stats['nb_panne']; @endphp @if($nbEtat > 0)
Bon état {{ $stats['nb_bon'] }} affectation{{ $stats['nb_bon'] > 1 ? 's' : '' }}
Alerte {{ $stats['nb_alerte'] }} affectation{{ $stats['nb_alerte'] > 1 ? 's' : '' }}
En panne {{ $stats['nb_panne'] }} affectation{{ $stats['nb_panne'] > 1 ? 's' : '' }}
{{-- Barre composite --}}
@if($stats['nb_bon'] > 0)
@endif @if($stats['nb_alerte'] > 0)
@endif @if($stats['nb_panne'] > 0)
@endif
@else
Aucune affectation
@endif
{{-- Entretiens à traiter --}}

Entretiens à traiter

@if($entretiensAlerte->count())
@foreach($entretiensAlerte as $aff) @php $vehImmat = $aff->vehicule ? $aff->vehicule->immat : $aff->immat; $isRetard = $aff->prochain_entretien->isPast(); @endphp
{{ $vehImmat }}
@if($aff->chantier)
{{ $aff->chantier->code }} — {{ $aff->chantier->nom }}
@endif
{{ $aff->prochain_entretien->format('d/m/Y') }}
{{ $isRetard ? 'EN RETARD' : 'Bientôt' }}
@endforeach
@else
Aucun entretien en retard ou imminent
@endif
{{-- Top véhicules --}} @if($topVehicules->count())

Top véhicules par utilisation

@foreach($topVehicules as $i => $veh) @endforeach
# Immatriculation Marque / Modèle Nb chantiers
{{ $i + 1 }} {{ $veh->immat }} {{ trim($veh->marque.' '.$veh->modele) ?: '—' }} {{ $veh->chantier_vehicules_count }}
@else

Aucun véhicule affecté à un chantier pour l'instant.

@endif
{{-- ═══════════════════════════════════ TAB : CATALOGUE ═══════════════════════════════════ --}}
{{-- Formulaire d'ajout --}}

Nouveau véhicule

@csrf
@error('immat')
{{ $message }}
@enderror
{{-- Filtres --}}
{{-- Table --}}
@forelse($vehicules as $veh) @empty @endforelse
Immatriculation Marque Modèle Chantiers Notes Actions
{{ $veh->immat }} {{ $veh->marque ?: '—' }} {{ $veh->modele ?: '—' }} @if($veh->chantier_vehicules_count > 0) {{ $veh->chantier_vehicules_count }} @else @endif {{ $veh->notes ? Str::limit($veh->notes, 55) : '—' }}
@csrf @method('DELETE')
@csrf @method('PUT')

Catalogue vide

Cliquez sur « Nouveau véhicule » pour en ajouter un.

@if($vehicules->hasPages())
{{ $vehicules->links() }}
@endif
{{-- /tab catalogue --}}
{{-- /x-data --}} @endsection