Files
BillManager/templates/factures/detail.html
2026-02-21 23:26:50 +01:00

99 lines
3.8 KiB
HTML

{% extends "base.html" %}
{% block title %}Facture {{ facture.numero }}{% endblock %}
{% block content %}
<div class="page-header">
<h1>Facture {{ facture.numero }}</h1>
<div class="btn-group">
<a href="/factures/" class="btn">← Retour</a>
{% if facture.statut.value == 'emise' %}
<a href="/factures/{{ facture.id }}/modifier" class="btn">Modifier</a>
{% endif %}
<a href="/factures/{{ facture.id }}/apercu-pdf" class="btn" target="_blank">Aperçu PDF</a>
<a href="/factures/{{ facture.id }}/pdf" class="btn btn-primary">⬇ Télécharger PDF</a>
</div>
</div>
<div class="detail-card">
<div class="detail-meta">
<div>
<label>Client</label>
<strong>{{ facture.client.nom }}</strong><br>
{{ facture.client.adresse }}<br>
{{ facture.client.code_postal }} {{ facture.client.ville }}
{% if facture.client.siret %}<br>SIRET : {{ facture.client.siret }}{% endif %}
</div>
<div>
<label>Dates</label>
Émission : {{ facture.date_emission | date_fr }}<br>
Échéance : {{ facture.date_echeance | date_fr }}<br>
{% if facture.date_paiement %}
Paiement : {{ facture.date_paiement | date_fr }}
{% endif %}
</div>
<div>
<label>Statut</label>
<span class="badge badge-{{ facture.statut.value }}">{{ facture.statut.value }}</span>
{% if facture.devis_origine %}
<br><small>Issu du devis {{ facture.devis_origine.numero }}</small>
{% endif %}
</div>
</div>
<table>
<thead>
<tr>
<th>Description</th>
<th>Qté</th>
<th>PU HT</th>
<th>Total HT</th>
</tr>
</thead>
<tbody>
{% for l in facture.lignes %}
<tr>
<td>{{ l.description }}</td>
<td>{{ l.quantite | int if l.quantite == l.quantite | int else l.quantite }}</td>
<td>{{ l.prix_unitaire_ht | montant }}</td>
<td>{{ l.total_ht | montant }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td colspan="3"><strong>Total HT</strong></td>
<td><strong>{{ facture.total_ht | montant }}</strong></td>
</tr>
<tr>
<td colspan="4" class="tva-mention">TVA non applicable — art. 293B du CGI</td>
</tr>
</tfoot>
</table>
{% if facture.conditions_reglement %}
<p><strong>Conditions de règlement :</strong> {{ facture.conditions_reglement }}</p>
{% endif %}
{% if facture.notes %}
<p><strong>Notes :</strong> {{ facture.notes }}</p>
{% endif %}
</div>
<div class="form-card">
<h2>Changer le statut</h2>
<form method="post" action="/factures/{{ facture.id }}/statut" style="display:flex; gap:1rem; align-items:flex-end; flex-wrap:wrap;">
<div class="form-group">
<label>Nouveau statut</label>
<select name="statut">
<option value="emise" {% if facture.statut.value == 'emise' %}selected{% endif %}>Émise</option>
<option value="payee" {% if facture.statut.value == 'payee' %}selected{% endif %}>Payée</option>
<option value="annulee" {% if facture.statut.value == 'annulee' %}selected{% endif %}>Annulée</option>
</select>
</div>
<div class="form-group" id="champ-date-paiement">
<label>Date de paiement</label>
<input type="date" name="date_paiement" value="{{ facture.date_paiement.isoformat() if facture.date_paiement else '' }}">
</div>
<button type="submit" class="btn btn-primary">Mettre à jour</button>
</form>
</div>
{% endblock %}