feat: redesign dark futuriste (Luca) — thème cyan/volt, sidebar dark, JetBrains Mono + README
This commit is contained in:
@@ -1,142 +1,203 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Intervention #{{ intervention.id }} - GarageManager{% endblock %}
|
||||
{% block title %}Intervention — 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>
|
||||
|
||||
<a href="/vehicules/{{ intervention.vid }}" class="back-link"><i class="fas fa-arrow-left"></i> Retour au véhicule</a>
|
||||
|
||||
<!-- Header -->
|
||||
<div class="flex justify-between items-start mb-8">
|
||||
<div>
|
||||
<h1 class="page-title" style="max-width:600px">{{ intervention.description }}</h1>
|
||||
<p class="page-subtitle" style="margin-top:0.4rem">
|
||||
<a href="/vehicules/{{ intervention.vid }}" class="mono" style="color:var(--accent-electric);text-decoration:none;font-size:0.95rem">{{ intervention.immatriculation }}</a>
|
||||
<span class="text-muted"> — {{ intervention.marque }} {{ intervention.modele }}</span>
|
||||
</p>
|
||||
<div class="flex gap-4 mt-2" style="flex-wrap:wrap">
|
||||
{% if intervention.date_intervention %}
|
||||
<span class="text-xs text-secondary"><i class="fas fa-calendar mr-1"></i>{{ intervention.date_intervention }}</span>
|
||||
{% endif %}
|
||||
{% if intervention.kilometrage_intervention %}
|
||||
<span class="text-xs text-secondary mono"><i class="fas fa-tachometer-alt mr-1"></i>{{ intervention.kilometrage_intervention }} km</span>
|
||||
{% endif %}
|
||||
{% if intervention.technicien %}
|
||||
<span class="text-xs text-secondary"><i class="fas fa-user-cog mr-1"></i>{{ intervention.technicien }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<a href="/interventions/{{ intervention.id }}/edit" class="btn-secondary btn-sm">
|
||||
<i class="fas fa-edit"></i> Modifier
|
||||
</a>
|
||||
<form method="post" action="/interventions/{{ intervention.id }}/delete" onsubmit="return confirm('Supprimer cette intervention ?')">
|
||||
<button class="btn-danger btn-sm">
|
||||
<i class="fas fa-trash"></i> Supprimer
|
||||
</button>
|
||||
</form>
|
||||
</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 class="grid grid-3 mb-6">
|
||||
<div class="card" style="cursor:default">
|
||||
<div class="stat-label mb-2">Main d'œuvre</div>
|
||||
<div class="stat-value" style="color:var(--accent-electric)">{{ "%.2f"|format(intervention.cout_main_oeuvre) }} €</div>
|
||||
</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 class="card" style="cursor:default">
|
||||
<div class="stat-label mb-2">Pièces</div>
|
||||
<div class="stat-value" style="color:var(--text-secondary)">{{ "%.2f"|format(intervention.cout_pieces) }} €</div>
|
||||
</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 class="card" style="cursor:default;border-color:rgba(250,204,21,0.25)">
|
||||
<div class="stat-label mb-2" style="color:var(--accent-volt)">Total</div>
|
||||
<div class="stat-value" style="color:var(--accent-volt)">{{ "%.2f"|format(intervention.cout_main_oeuvre + intervention.cout_pieces) }} €</div>
|
||||
</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 class="card mb-6">
|
||||
<h3 class="card-title mb-3"><i class="fas fa-clipboard-list text-secondary" style="margin-right:0.4rem"></i>Notes</h3>
|
||||
<p class="text-sm" style="white-space:pre-wrap;color:var(--text-secondary)">{{ 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>
|
||||
<!-- ── Pièces utilisées ── -->
|
||||
<div class="card" style="padding:0">
|
||||
<div class="card-header">
|
||||
<span class="card-title">
|
||||
<i class="fas fa-cog text-volt" style="margin-right:0.4rem"></i>
|
||||
Pièces utilisées
|
||||
<span class="badge badge-warning ml-2">{{ pieces_utilisees|length }}</span>
|
||||
</span>
|
||||
<button onclick="toggleAddPiece()" class="btn-primary btn-sm">
|
||||
<i class="fas fa-plus"></i> 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 ajout pièce -->
|
||||
<div id="add-piece-form" style="display:none;background:var(--bg-secondary);border-bottom:1px solid var(--border);padding:1.25rem 1.5rem">
|
||||
<form method="post" action="/interventions/{{ intervention.id }}/pieces/add" enctype="multipart/form-data">
|
||||
<div class="grid grid-cols-2 gap-3 mb-3">
|
||||
|
||||
{% if pieces_connues %}
|
||||
<div class="mb-4">
|
||||
<p class="text-xs font-semibold uppercase" style="color:var(--text-muted);letter-spacing:0.06em;margin-bottom:0.5rem">
|
||||
🔄 Réutiliser une pièce connue sur ce véhicule
|
||||
</p>
|
||||
<div class="scroll-list">
|
||||
{% for p in pieces_connues %}
|
||||
<label class="scroll-list-item">
|
||||
<input type="radio" name="_prefill" value="{{ loop.index0 }}"
|
||||
data-nom="{{ p.nom }}" data-ref="{{ p.reference or '' }}" data-marque="{{ p.marque or '' }}" data-prix="{{ p.prix }}"
|
||||
onchange="prefillPiece(this)"
|
||||
style="width:auto;background:none;border:none;padding:0">
|
||||
<span class="font-medium text-sm" style="flex:1">{{ p.nom }}</span>
|
||||
{% if p.reference %}<span class="mono text-xs text-muted">{{ p.reference }}</span>{% endif %}
|
||||
{% if p.marque %}<span class="text-xs text-secondary">{{ p.marque }}</span>{% endif %}
|
||||
<span class="font-semibold text-sm text-electric mono">{{ "%.2f"|format(p.prix) }} €</span>
|
||||
</label>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<p class="text-xs text-muted mt-1">Les infos se pré-remplissent automatiquement, tu peux les modifier.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="grid grid-2 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">
|
||||
<label>Nom *</label>
|
||||
<input id="p-nom" name="nom" required placeholder="Nom de la pièce">
|
||||
</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">
|
||||
<label>Référence</label>
|
||||
<input id="p-ref" name="reference" placeholder="Ex: 06A115561B…" style="font-family:'JetBrains Mono',monospace">
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-3 gap-3 mb-3">
|
||||
<div class="grid grid-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">
|
||||
<label>Marque</label>
|
||||
<input id="p-marque" name="marque" placeholder="Bosch, NGK…">
|
||||
</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">
|
||||
<label>Prix unitaire (€)</label>
|
||||
<input id="p-prix" name="prix" type="number" step="0.01" min="0" value="0" class="mono">
|
||||
</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">
|
||||
<label>Quantité</label>
|
||||
<input name="quantite" type="number" min="1" value="1" class="mono">
|
||||
</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">
|
||||
<label>Photo (optionnel)</label>
|
||||
<input type="file" name="photo" accept="image/*" style="background:none;border:none;padding:0.25rem 0;color:var(--text-secondary)">
|
||||
</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>
|
||||
<button type="submit" class="btn-primary btn-sm">
|
||||
<i class="fas fa-plus"></i> Ajouter la pièce
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Liste des pièces -->
|
||||
{% if pieces %}
|
||||
{% if pieces_utilisees %}
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-sm">
|
||||
<thead class="bg-gray-50 text-slate-600 text-xs uppercase">
|
||||
<table>
|
||||
<thead>
|
||||
<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>
|
||||
<th>Photo</th>
|
||||
<th>Pièce</th>
|
||||
<th>Référence</th>
|
||||
<th>Marque</th>
|
||||
<th class="text-center">Qté</th>
|
||||
<th class="text-right">Prix unit.</th>
|
||||
<th class="text-right">Total</th>
|
||||
<th></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">
|
||||
<tbody>
|
||||
{% for p in pieces_utilisees %}
|
||||
<tr>
|
||||
<td>
|
||||
{% 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')">
|
||||
<img src="{{ p.photo }}" class="photo-thumb" style="width:48px;height:48px" 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>
|
||||
<div class="photo-placeholder" style="width:48px;height:48px"><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">
|
||||
<td class="font-medium">{{ p.nom }}</td>
|
||||
<td class="mono text-xs text-muted">{{ p.reference or '—' }}</td>
|
||||
<td class="text-secondary text-sm">{{ p.marque or '—' }}</td>
|
||||
<td class="text-center text-secondary mono">{{ p.quantite }}</td>
|
||||
<td class="text-right mono text-sm">{{ "%.2f"|format(p.prix) }} €</td>
|
||||
<td class="text-right font-semibold mono" style="color:var(--accent-volt)">{{ "%.2f"|format(p.prix * p.quantite) }} €</td>
|
||||
<td>
|
||||
<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>
|
||||
<button class="link-danger">✕</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 style="background:var(--bg-secondary)">
|
||||
<td colspan="6" class="text-right font-semibold text-secondary text-sm">Total pièces</td>
|
||||
<td class="text-right font-bold mono" style="color:var(--accent-volt)">{{ "%.2f"|format(intervention.cout_pieces) }} €</td>
|
||||
<td></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 class="empty-state">
|
||||
<i class="fas fa-cog"></i>
|
||||
<p>Aucune pièce pour cette intervention</p>
|
||||
<button onclick="toggleAddPiece()" class="link-action">Ajouter →</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function toggleAddPiece() {
|
||||
const f = document.getElementById('add-piece-form');
|
||||
f.style.display = f.style.display === 'none' ? 'block' : 'none';
|
||||
}
|
||||
function prefillPiece(radio) {
|
||||
document.getElementById('p-nom').value = radio.dataset.nom;
|
||||
document.getElementById('p-ref').value = radio.dataset.ref;
|
||||
document.getElementById('p-marque').value = radio.dataset.marque;
|
||||
document.getElementById('p-prix').value = radio.dataset.prix;
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user