{% extends 'oscar/dashboard/reports/index.html' %}

{% load currency_filters %}
{% load i18n %}

{% block report %}
    <table class="table table-striped table-bordered table-hover">
        {% if objects %}
            <tr>
                {% block report_headings %}
                    <th>{% trans 'Product' %}</th>
                    <th>{% trans 'UPC' %}</th>
                    <th>{% trans 'Order number' %}</th>
                    <th>{% trans 'Date placed' %}</th>
                    <th>{% trans 'Quantity' %}</th>
                    <th>{% trans 'Unit Price (excl. tax)' %}</th>
                    <th>{% trans 'Unit Price (inc. tax)' %}</th>
                    <th>{% trans 'Total excl. tax' %}</th>
                    <th>{% trans 'Tax' %}</th>
                    <th>{% trans 'Total incl. tax' %}</th>
                    <th>{% trans 'Country' %}</th>
                {% endblock %}
            </tr>

            {% for line in objects %}
                <tr>
                    {% block table_values %}
                        <td>
                            {% if line.product %}
                                <a href="{{ line.product.get_absolute_url }}">
                                    {{line.title}}
                                </a>
                            {% else %}
                                {{ line.title }}
                            {% endif %}
                        </td>
                        <td>
                            {% if line.product is not None %}
                                {{ line.product.upc }}
                            {% else %}
                                {% trans 'Unknown' %}
                            {% endif %}
                        </td>
                        <td>
                            <a href="{% url 'dashboard:order-detail' line.order.number %}">     #{{ line.order.number }}
                            </a>
                        </td>
                        <td>{{ line.order.date_placed|date }}</td>
                        <td>{{ line.quantity }}</td>
                        <td>{{ line.unit_price_excl_tax }}</td>
                        <td>{{ line.unit_price_incl_tax }}</td>
                        <td>{{ line.line_price_excl_tax|currency:line.order.currency }}</td>
                        <td>{{ line.line_price_tax|currency:line.order.currency }}</td>
                        <td>{{ line.line_price_incl_tax|currency:line.order.currency }}</td>
                        <td>{{ line.order.shipping_address.country.pk }}</td>
                    {% endblock %}
                </tr>
            {% endfor %}
        {% else %}
            <tr><td>{% trans "No results found." %}</td></tr>
        {% endif %}
    </table>
    {% include "oscar/dashboard/partials/pagination.html" %}
{% endblock %}
