{% extends "base.html" %}

{% block content %}
<h2>Facture N°{{ invoice.number }}</h2>
<p>Émise le {{ invoice.date }}</p>

<table id="invoice_details" class="full-width">
    <thead>
        <tr>
            <th></th>
            <th>Quantité</th>
            <th>PU</th>
            <th>Total</th>
        </tr>
    </thead>
    <tbody>
        {% for detail in invoice.details.all %}
        <tr>
            <td>{{ detail.label }}
                {% if detail.period_from and detail.period_to %}<br/><span class="period">Pour la période du {{ detail.period_from }} au {{ detail.period_to }}{% endif %}</span></td>
            <td>{{ detail.quantity }}</td>
            <td>{{ detail.amount }}€</td>
            <td>{{ detail.total }}€</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<a href="{% url 'billing:invoice_pdf' id=invoice.number %}" target="_blank" class="button">Télécharger en PDF</a>

{% endblock %}
