{% load i18n lfs_tags %}

{# Voucher #}
<h2 class="padding-top-large">
    {% trans "Voucher code" %}
</h2>
<input data="{% url lfs_check_voucher %}"
       type="text"
       id="voucher"
       name="voucher"
       value="{{ voucher_number }}"
       size="30" />

{% if voucher_number and voucher_message %}
    <span class="voucher-message">
        {{ voucher_message }}
    </span>
{% endif %}

<h2>{% trans 'Your cart' %}</h2>
<table class="lfs-default cart">
    <tr>
        <th colspan="2">
            {% trans 'Product' %}
        </th>
        <th class="number">
            {% trans 'Amount' %}
        </th>
        <th class="number">
            {% trans 'Price' %}
        </th>
        <th class="number">
            {% trans 'Included VAT' %}
        </th>
        <th class="number">
            {% trans 'Total' %}
        </th>
    </tr>
    {% for cart_item in cart.items %}
        <tr>
            <td class="image">
                <a href="{{cart_item.product.get_absolute_url}}">
                    <img src="{{cart_item.product.get_image.url_60x60}}"
                         alt="{{cart_item.product.get_name}}"/>
                </a>
            </td>
            <td>
                {{cart_item.product.get_name}}
                {% for option in cart_item.product.get_options %}
                    {% if option.property.display_on_product %}
                        <div>
                            {{option.property.name}} : {{option.value|option_name}} {{option.property.unit|safe}}
                        </div>
                    {% endif %}
                {% endfor %}
            </td>
            <td class="number">
                {{cart_item.amount}}
            </td>
            <td class="number">
                {{cart_item.get_price|currency}}
            </td>
            <td class="number">
                ({{cart_item.get_tax|currency}})
            </td>
            <td class="number">
                {{cart_item.get_price|currency}}
            </td>
        </tr>
    {% endfor %}

    {% if display_voucher %}
        <tr id="voucher-display">
            <td></td>
            <td class="left">
                {% trans "Voucher" %}
            </td>
            <td class="number">
                1
            </td>
            <td class="number">
                - {{ voucher_value|currency }}
            </td>
            <td class="number">
                ({{ voucher_tax|currency }})
            </td>
            <td class="number">
                - {{ voucher_value|currency }}
            </td>
        </tr>
    {% endif %}

    <tr>
        <td></td>
        <td>
            {% trans 'Shipping' %} ({{selected_shipping_method.name}})
        </td>
        <td class="number">
            1
        </td>
        <td class="number">
            {{shipping_price|currency}}
        </td>
        <td></td>
        <td class="number">
            {{shipping_price|currency}}
        </td>
    </tr>

    <tr>
        <td></td>
        <td>
            {% trans 'Payment' %} ({{selected_payment_method.name}})
        </td>
        <td class="number">
            1
        </td>
        <td class="number">
            {{payment_price|currency}}
        </td>
        <td></td>
        <td class="number">
            {{payment_price|currency}}
        </td>
    </tr>

    <tr>
        <td colspan="6"
            class="total number padding-top">
            <span class="total-label">{% trans 'Total' %}:</span>
            {{cart_price|currency}}
        </td>
    </tr>
    <tr>
        <td colspan="6"
            class="discreet number">
            <span class="total-label">{% trans 'Inclusive VAT' %}:</span>
            {{cart_tax|currency}}
        </td>
    </tr>
</table>
