
{% extends 'email.html' %}

{% load i18n %}


{% block content %}
    <table class="order">
        <tr>
            <td colspan="2">
                <a href="https://{{ site.domain }}{% url 'admin:orders_order_change' order.id %}" target="_blank">
                    <h2 class="title">
                        {{ title }}
                    </h2>
                </a>
            </td>
        </tr>
        <tr>
            <td>
                <b>{% trans 'Full name' %}:</b> <br />
                {{ order.full_name }}
            </td>
            <td>
                <b>{% trans 'Phone' %}:</b> <br />
                <a href="tel:{{ order.mobile }}">{{ order.mobile }}</a>
            </td>
        </tr>
        <tr><td colspan="2" class="spacer"></td></tr>
        <tr>
            <td>
                <b>{% trans 'Payment method' %}:</b> <br />
                {{ order.get_payment_method_display }}
            </td>
            <td>
                <b>{% trans 'Delivery method' %}:</b> <br />
                {{ order.delivery_method }}
            </td>
        </tr>
        <tr><td colspan="2" class="spacer"></td></tr>
        {% if order.address %}
            <tr>
                <td colspan="2">
                    <b>{% trans 'Address' %}:</b> <br />
                    {{ order.address }}
                </td>
            </tr>
        {% endif %}
        <tr><td colspan="2" class="spacer"></td></tr>
        {% if order.comment %}
            <tr>
                <td colspan="2">
                    <b>{% trans 'Comment' %}:</b> <br />
                    {{ order.comment }}
                </td>
            </tr>
        {% endif %}
        <tr><td colspan="2" class="spacer"></td></tr>
    </table>

    <table class="items-table">
        {% block products %}
            <tr>
                <td><b>{% trans 'Product' %}</b></td>
                <td style="text-align: right"><b>{% trans 'Price' %}</b></td>
            </tr>

            {% for item in order.items.all %}
                <tr style="border-top: 1px solid #b6b6b6;">
                    <td width="80%">
                        <a href="https://{{ site.domain }}{{ item.product.get_absolute_url }}" target="_blank">
                            {{ item.product_name }} ({{ item.product_code }})
                        </a>
                        {% if is_clothes_app_enabled %}
                            <br />
                            {% for size in item.clothe_sizes.all %}
                                {% for label, value in size.get_values %}
                                    <small>
                                        <b>{{ label }}</b>: {{ value }}
                                    </small>
                                    <br />
                                {% endfor %}
                                <div class="spacer"></div>
                            {% endfor %}
                        {% endif %}
                    </td>
                    <td width="20%">{{ item.qty }} x {{ item.product_printable_price }}</td>
                </tr>
            {% endfor %}

            <tr>
                <td colspan="4" align="right">
                    {% trans 'Total' %}:
                    <b>{{ order.printable_total }}</b>
                </td>
            </tr>
        {% endblock %}
    </table>
{% endblock %}
