- Application FastAPI avec SQLite et Jinja2 - Gestion des véhicules (VIN, immatriculation, infos libres) - Gestion des interventions avec statut (en_attente/en_cours/termine) - Gestion des pièces détachées avec photos - Tableau de bord avec statistiques - Déploiement Docker + Traefik (HTTPS) - README complet en français
143 lines
8.9 KiB
HTML
143 lines
8.9 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Intervention #{{ intervention.id }} - GarageManager{% endblock %}
|
|
{% block content %}
|
|
<div class="mb-6">
|
|
<a href="/vehicules/{{ intervention.vid }}" class="text-slate-500 hover:text-slate-700 text-sm flex items-center gap-1 mb-4"><i class="fas fa-arrow-left"></i> Retour au véhicule</a>
|
|
<div class="flex justify-between items-start">
|
|
<div>
|
|
<h2 class="text-2xl font-bold text-slate-800">{{ intervention.description }}</h2>
|
|
<p class="text-slate-500 mt-1">{{ intervention.immatriculation }} — {{ intervention.marque }} {{ intervention.modele }}</p>
|
|
<p class="text-xs text-slate-400 mt-1">{{ intervention.created_at[:10] }}{% if intervention.technicien %} • <i class="fas fa-user-cog mr-1"></i>{{ intervention.technicien }}{% endif %}</p>
|
|
</div>
|
|
<div class="flex gap-2 items-center">
|
|
{% if intervention.statut == 'en_attente' %}<span class="bg-yellow-100 text-yellow-700 px-3 py-1 rounded-full text-sm">⏳ En attente</span>
|
|
{% elif intervention.statut == 'en_cours' %}<span class="bg-blue-100 text-blue-700 px-3 py-1 rounded-full text-sm">🔧 En cours</span>
|
|
{% else %}<span class="bg-green-100 text-green-700 px-3 py-1 rounded-full text-sm">✅ Terminé</span>{% endif %}
|
|
<a href="/interventions/{{ intervention.id }}/edit" class="border border-orange-300 text-orange-500 px-4 py-2 rounded-lg text-sm hover:bg-orange-50">Modifier</a>
|
|
<form method="post" action="/interventions/{{ intervention.id }}/delete" onsubmit="return confirm('Supprimer cette intervention ?')">
|
|
<button class="border border-red-300 text-red-500 px-4 py-2 rounded-lg text-sm hover:bg-red-50">Supprimer</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Résumé coûts -->
|
|
<div class="grid grid-cols-3 gap-4 mb-6">
|
|
<div class="bg-white rounded-xl shadow p-5">
|
|
<p class="text-xs text-slate-500">Main d'œuvre</p>
|
|
<p class="text-2xl font-bold text-slate-800 mt-1">{{ "%.2f"|format(intervention.cout_main_oeuvre) }} €</p>
|
|
</div>
|
|
<div class="bg-white rounded-xl shadow p-5">
|
|
<p class="text-xs text-slate-500">Pièces</p>
|
|
<p class="text-2xl font-bold text-slate-800 mt-1">{{ "%.2f"|format(intervention.cout_pieces) }} €</p>
|
|
</div>
|
|
<div class="bg-orange-50 rounded-xl shadow p-5 border border-orange-200">
|
|
<p class="text-xs text-orange-600">Total</p>
|
|
<p class="text-2xl font-bold text-orange-600 mt-1">{{ "%.2f"|format(intervention.cout_main_oeuvre + intervention.cout_pieces) }} €</p>
|
|
</div>
|
|
</div>
|
|
|
|
{% if intervention.notes %}
|
|
<div class="bg-white rounded-xl shadow p-5 mb-6">
|
|
<h3 class="font-semibold text-slate-800 mb-2">📋 Notes</h3>
|
|
<p class="text-sm text-slate-600 whitespace-pre-wrap">{{ intervention.notes }}</p>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Pièces -->
|
|
<div class="bg-white rounded-xl shadow">
|
|
<div class="p-5 border-b border-gray-100 flex justify-between items-center">
|
|
<h3 class="font-semibold text-slate-800">🔩 Pièces utilisées ({{ pieces|length }})</h3>
|
|
<button onclick="document.getElementById('add-piece-form').classList.toggle('hidden')" class="bg-orange-500 text-white px-4 py-2 rounded-lg text-sm hover:bg-orange-600">+ Ajouter une pièce</button>
|
|
</div>
|
|
|
|
<!-- Formulaire ajout pièce -->
|
|
<div id="add-piece-form" class="hidden p-5 border-b border-gray-100 bg-gray-50">
|
|
<form method="post" action="/interventions/{{ intervention.id }}/pieces/add" enctype="multipart/form-data">
|
|
<div class="grid grid-cols-2 gap-3 mb-3">
|
|
<div>
|
|
<label class="block text-xs font-medium text-slate-600 mb-1">Nom de la pièce *</label>
|
|
<input name="nom" required placeholder="Ex: Filtre à huile, Courroie..." class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-orange-300">
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-medium text-slate-600 mb-1">Référence</label>
|
|
<input name="reference" placeholder="Ex: OC90, 06A115561B..." class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-orange-300">
|
|
</div>
|
|
</div>
|
|
<div class="grid grid-cols-3 gap-3 mb-3">
|
|
<div>
|
|
<label class="block text-xs font-medium text-slate-600 mb-1">Marque</label>
|
|
<input name="marque" placeholder="Ex: Bosch, NGK, Valeo..." class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-orange-300">
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-medium text-slate-600 mb-1">Prix unitaire (€)</label>
|
|
<input name="prix" type="number" step="0.01" min="0" value="0" class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-orange-300">
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-medium text-slate-600 mb-1">Quantité</label>
|
|
<input name="quantite" type="number" min="1" value="1" class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-orange-300">
|
|
</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="block text-xs font-medium text-slate-600 mb-1">Photo (optionnel)</label>
|
|
<input type="file" name="photo" accept="image/*" class="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm">
|
|
</div>
|
|
<button type="submit" class="bg-orange-500 text-white px-5 py-2 rounded-lg text-sm hover:bg-orange-600">Ajouter la pièce</button>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Liste des pièces -->
|
|
{% if pieces %}
|
|
<div class="overflow-x-auto">
|
|
<table class="w-full text-sm">
|
|
<thead class="bg-gray-50 text-slate-600 text-xs uppercase">
|
|
<tr>
|
|
<th class="px-5 py-3 text-left">Photo</th>
|
|
<th class="px-5 py-3 text-left">Pièce</th>
|
|
<th class="px-5 py-3 text-left">Référence</th>
|
|
<th class="px-5 py-3 text-left">Marque</th>
|
|
<th class="px-5 py-3 text-left">Qté</th>
|
|
<th class="px-5 py-3 text-left">Prix unit.</th>
|
|
<th class="px-5 py-3 text-left">Total</th>
|
|
<th class="px-5 py-3 text-left"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
{% for p in pieces %}
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-5 py-3">
|
|
{% if p.photo %}
|
|
<img src="{{ p.photo }}" alt="{{ p.nom }}" class="w-12 h-12 object-cover rounded-lg cursor-pointer border" onclick="window.open('{{ p.photo }}','_blank')">
|
|
{% else %}
|
|
<div class="w-12 h-12 bg-gray-100 rounded-lg flex items-center justify-center text-slate-300"><i class="fas fa-cog"></i></div>
|
|
{% endif %}
|
|
</td>
|
|
<td class="px-5 py-3 font-medium text-slate-800">{{ p.nom }}</td>
|
|
<td class="px-5 py-3 text-slate-500 font-mono text-xs">{{ p.reference or '-' }}</td>
|
|
<td class="px-5 py-3 text-slate-600">{{ p.marque or '-' }}</td>
|
|
<td class="px-5 py-3 text-slate-600">{{ p.quantite }}</td>
|
|
<td class="px-5 py-3 text-slate-600">{{ "%.2f"|format(p.prix) }} €</td>
|
|
<td class="px-5 py-3 font-semibold text-slate-800">{{ "%.2f"|format(p.prix * p.quantite) }} €</td>
|
|
<td class="px-5 py-3">
|
|
<form method="post" action="/interventions/{{ intervention.id }}/pieces/{{ p.id }}/delete" onsubmit="return confirm('Supprimer cette pièce ?')">
|
|
<button class="text-red-400 hover:text-red-600 text-xs hover:underline">Supprimer</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
<tr class="bg-orange-50">
|
|
<td colspan="6" class="px-5 py-3 text-right font-semibold text-slate-700">Total pièces</td>
|
|
<td colspan="2" class="px-5 py-3 font-bold text-orange-600">{{ "%.2f"|format(intervention.cout_pieces) }} €</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="p-8 text-center text-slate-400 text-sm">
|
|
Aucune pièce enregistrée.<br>
|
|
<button onclick="document.getElementById('add-piece-form').classList.remove('hidden')" class="text-orange-500 hover:underline mt-1 inline-block">Ajouter la première →</button>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|