<!DOCTYPE html>
<html lang="cs">
<head>
    <meta charset="UTF-8">
    <title>Faktura {{ invoice.invoice_number }}</title>
    <style>
        body { font-family: Arial, sans-serif; font-size: 14px; }
        table { width: 100%; border-collapse: collapse; margin-top: 20px; }
        th, td { border: 1px solid #000; padding: 8px; text-align: left; }
        th { background-color: #eee; }
    </style>
</head>
<body>
    <h1>Faktura {{ invoice.invoice_number }}</h1>
    <p>Datum vystavení: {{ invoice.issue_date.strftime("%Y-%m-%d") }}</p>
    <p>Zákazník: {{ invoice.order.customer_name }}</p>

    <table>
        <thead>
            <tr>
                <th>Produkt</th>
                <th>Množství</th>
                <th>Cena</th>
                <th>Celkem</th>
            </tr>
        </thead>
        <tbody>
            {% for item in invoice.order.items.all %}
            <tr>
                <td>{{ item.product.name }}</td>
                <td>{{ item.quantity }}</td>
                <td>{{ item.price }}</td>
                <td>{{ item.price * item.quantity }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    <p><strong>Celkem k úhradě: {{ invoice.total_amount }} Kč</strong></p>
</body>
</html>
