
{% load i18n site_config %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">

    <style>

        .heading {
            border-bottom: 2px solid;
            margin: 5px 0;
            text-align: center;
        }

        table {
            width: 100%;
            border: 1px solid #0a0a0a;
            border-spacing: 0;
        }

        table td,
        table th {
            border: 1px solid #0a0a0a;
            font-size: 13px;
        }

        table th {
            background-color: #c0c0c0;
        }

        table td {
            padding-left: 3px;
        }

        .cell-number {
            width: 10%;
            text-align: center;
        }

        .cell-total {
            font-weight: bold;
            text-align: right;
            border: none;
        }

        .text-right {
            text-align: right;
        }

    </style>
</head>
<body style="padding: 0; margin: 0;">

    {% get_site_config as config %}

    <h3 class="heading">
        {{ sale.model_name }} {% trans '#' %}{{ sale.id }} <br />
        <span style="font-size: 13px">
            {% trans 'from' %}
            {{ sale.created|date:'d.m.Y' }}
        </span>
    </h3>

    {{ config.sale_print_text }}

    <table>
        <thead>
            <tr>
                <th class="cell-number">{% trans '#' %}</th>
                <th>{% trans 'Code' %}</th>
                <th>{% trans 'Product' %}</th>
                <th>{% trans 'Quantity' %}</th>
                <th>{% trans 'Price' %}</th>
                <th>{% trans 'Sum' %}</th>
            </tr>
        </thead>
        <tbody>
            {% for item in services %}
                <tr>
                    <td class="cell-number">{{ forloop.counter }}</td>
                    <td>{{ item.code }}</td>
                    <td>{{ item.name }}</td>
                    <td>{{ item.qty }}</td>
                    <td class="text-right">{{ item.price }}</td>
                    <td class="text-right">{{ item.subtotal }}</td>
                </tr>
            {% endfor %}
        </tbody>
        <tfoot>
            <tr>
                <td class="cell-total" colspan="6">
                    {% trans 'Total' %}: {{ sale.service_total }}
                </td>
            </tr>
        </tfoot>
    </table>

    <script>
        window.print();
    </script>
</body>
</html>
