{% load i18n %}
{% load lfs_tags %}
<table class="order lfs-default">
    <tr>
        <td>
            {% trans 'Ordernumber' %}
        </td>
        <td>
            {{ current_order.uuid }}
        </td>
    </tr>
    <tr>
        <th colspan="4">
            {% trans 'General' %}
        </th>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Customer name' %}:
        </td>
        <td>
            {{ current_order.customer_firstname }} {{ current_order.customer_lastname }}
        </td>
        <td class="label">
            {% trans 'Date' %}:
        </td>
        <td>
            {{ current_order.created|date:_("DATETIME_FORMAT") }}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'E-mail' %}:
        </td>
        <td>
            <a href="mailto:{{ current_order.customer_email }}">
                {{ current_order.customer_email }}
            </a>                
        </td>
        <td class="label">
            {% trans 'State' %}:
        </td>
        <td>
            {{ current_order.get_state_display }}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Phone' %}:
        </td>
        <td>
            {{ current_order.shipping_phone }}
        </td>
        <td class="label">
            {% trans 'Total' %}:
        </td>
        <td>
            {{ current_order.price|currency }}
        </td>
    </tr>
    
</table>
<table class="order">
    <tr>
        <th width="25%">
            {% trans 'Invoice address' %}
        </th>
        <th width="25%">
            {% trans 'Shipping address' %}
        </th>
        <th width="25%">
            {% trans 'Shipping method' %}
        </th>
        <th width="25%">
            {% trans 'Payment method' %}
        </th>
    </tr>
    <tr>
        <td>
            <div>
                {{ current_order.invoice_firstname }}
            </div>
            <div>
                {{ current_order.invoice_lastname }}
            </div>
            <div>
                {{ current_order.invoice_line1 }}
            </div>
            <div>
                {{ current_order.invoice_line2 }}
            </div>
            <div>
                {{ current_order.invoice_city }}
            </div>
            <div>
                {{ current_order.invoice_state }}
            </div>
            <div>
                {{ current_order.invoice_code }}
            </div>
            <div>
                {{ current_order.invoice_country }}
            </div>
            <div>
                {{ current_order.invoice_phone }}
            </div>
        </td>
        <td>
            <div>
                {{ current_order.shipping_firstname }}
            </div>
            <div>
                {{ current_order.shipping_lastname }}
            </div>
            <div>
                {{ current_order.shipping_line1 }}
            </div>
            <div>
                {{ current_order.shipping_line2 }}
            </div>
            <div>
                {{ current_order.shipping_city }}
            </div>
            <div>
                {{ current_order.shipping_state }}
            </div>
            <div>
                {{ current_order.shipping_code }}
            </div>
            <div>
                {{ current_order.shipping_country }}
            </div>                
            <div>
                {{ current_order.shipping_phone }}
            </div>
        </td>        
        <td>
            <div>
                {{ current_order.shipping_method }}
            </div>
        </td>
        <td>
            <div>
                {{ current_order.payment_method.name }}
            </div>
            {% ifequal current_order.payment_method.id 1 %}
                <div>
                    {{ current_order.account_number }}
                </div>
                <div>
                    {{ current_order.bank_identification_code }}
                </div>
                <div>
                    {{ current_order.bank_name }}
                </div>
                <div>
                    {{ current_order.depositor }}
                </div>
            {% endifequal %}
        </td>
    </tr>

</table>

<table class="order">
    <tr>
        <th width="25%">
            {% trans 'SKU' %}
        </th>
        <th>
            {% trans 'Name' %}
        </th>
        <th class="number">
            {% trans 'Amount' %}
        </th>
        <th class="number">
            {% trans 'Price' %}
        </th>
        <th class="number">
            {% trans 'Total' %}
        </th>
    </tr>
    {% for item in current_order.items.all %}
        <tr>
            <td>
               {{ item.product_sku }} 
            </td>
            <td>
                {{ item.product_name }} 
                {% for property in item.product.get_variant_properties %}
                    <div>
                        {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
                    </div>
                {% endfor %}

                {% for property in item.product.get_displayed_properties %}
                    <div>
                        {{ property.title }} : {{ property.value }} {{ property.unit|safe }}
                    </div>
                {% endfor %}
                
                {% if item.product.is_configurable_product %}
                    {% for property in item.get_properties %}
                        <div>
                            {{ property.title }} : {{ property.value }} {{ property.unit|safe }} ({{ property.price|currency }})
                        </div>
                    {% endfor %}
                {% endif %}
                
            </td>
            <td class="number">
               {{ item.product_amount }} 
            </td>
            <td class="number">
               {{ item.product_price_gross|currency }} 
            </td>
            <td class="number">
               {{ item.price_gross|currency }}
            </td>
        </tr>
    {% endfor %}        
    <tr>
        <td></td>
        <td>
            {% trans 'Shipping' %} ({{ current_order.shipping_method }})
        </td>
        <td class="number">
            1
        </td>
        <td class="number">
            {{ current_order.shipping_price|currency }}
        </td>
        <td class="number">
            {{ current_order.shipping_price|currency }}
        </td>
    </tr>
    <tr>
        <td></td>
        <td>
            {% trans 'Payment' %} ({{ current_order.payment_method }})
        </td>
        <td class="number">
            1
        </td>
        <td class="number">
            {{ current_order.payment_price|currency }}
        </td>
        <td class="number">
            {{ current_order.payment_price|currency }}
        </td>
    </tr>
    <tr class="total">
        <td colspan="5"
            class="number total">
            {{ current_order.price|currency }}
        </td>
    </tr>
    <tr>
        <td colspan="5"
            class="number tax">
            <span class="total-label">{% trans 'Inclusive VAT' %}:</span>
            {{ current_order.tax|currency }}
        </td>
    </tr>        
</table>
{% if current_order.message %}
    <table class="order">
        <tr>
            <th colspan="5">
                {% trans 'Message from the customer' %}
            </th>
        </tr>
        <tr>
            <td colspan="5">
                {{ current_order.message }}
            </td>
        </tr>
    </table>
{% endif %}
