Files

81 lines
3.3 KiB
HTML

{% extends "base.html" %}
{% block title %}Véhicules — GarageManager{% endblock %}
{% block content %}
<div class="page-header flex justify-between items-center">
<div>
<h1 class="page-title"><i class="fas fa-car text-electric" style="margin-right:0.5rem"></i>Véhicules</h1>
<p class="page-subtitle">{{ vehicules|length }} véhicule(s) enregistré(s)</p>
</div>
<a href="/vehicules/new" class="btn-primary">
<i class="fas fa-plus"></i> Nouveau véhicule
</a>
</div>
<!-- Search -->
<div class="card mb-4" style="padding:1rem 1.25rem">
<form method="get" class="flex gap-2">
<input name="q" value="{{ q }}" placeholder="Immatriculation, marque, modèle, VIN…" style="flex:1">
<button type="submit" class="btn-secondary" style="width:auto;white-space:nowrap">
<i class="fas fa-search"></i> Rechercher
</button>
{% if q %}
<a href="/vehicules" class="btn-secondary" style="width:auto"></a>
{% endif %}
</form>
</div>
<!-- Table -->
<div class="card" style="padding:0">
<div class="overflow-x-auto">
{% if vehicules %}
<table>
<thead>
<tr>
<th>Immatriculation</th>
<th>Marque / Modèle</th>
<th>Année</th>
<th>VIN</th>
<th>Kilométrage</th>
<th>Interventions</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for v in vehicules %}
<tr>
<td>
<a href="/vehicules/{{ v.id }}" class="font-bold mono" style="color:var(--accent-electric);font-size:0.95rem;text-decoration:none">{{ v.immatriculation }}</a>
</td>
<td class="font-medium">{{ v.marque }} {{ v.modele }}</td>
<td class="text-secondary">{{ v.annee or '—' }}</td>
<td class="mono text-xs text-muted">{{ v.vin or '—' }}</td>
<td class="mono text-sm">{{ (v.kilometrage|string + ' km') if v.kilometrage else '—' }}</td>
<td>
<span class="badge badge-info">{{ v.nb_interventions }}</span>
</td>
<td>
<div class="flex gap-3">
<a href="/vehicules/{{ v.id }}" class="link-action">Voir</a>
<a href="/vehicules/{{ v.id }}/edit" class="link-edit">Modifier</a>
<form method="post" action="/vehicules/{{ v.id }}/delete" style="display:inline" onsubmit="return confirm('Supprimer ce véhicule et toutes ses données ?')">
<button class="link-danger">Supprimer</button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="empty-state">
<i class="fas fa-car"></i>
<p>Aucun véhicule trouvé</p>
<a href="/vehicules/new" class="link-action">Ajouter le premier →</a>
</div>
{% endif %}
</div>
</div>
{% endblock %}