{% load i18n %}
{% load lfs_tags %}

<table class="lfs-manage-table" style="margin-top:20px">
    <tr>
        <th class="small">
            {% trans 'ID' %}
        </th>
        <th class="middle" nowrap="nowrap">
            {% trans 'Creation date' %}
        </th>
        <th class="middle" nowrap="nowrap">
            {% trans 'Modification date' %}
        </th>
        <th style="small">
            {% trans 'User' %}
        </th>
        <th class="small right-padding">
            {% trans 'Total' %}
        </th>
        <th class="small right-padding">
            {% trans 'Items' %}
        </th>
        <th>
            {% trans 'Products' %}
        </th>
    </tr>

    {% for cart in carts %}
        <tr class="clickable"
            onclick="window.location='{% url lfs_manage_cart cart.id %}'">
            <td>
                {{ cart.id }}
            </td>
            <td nowrap="nowrap">
                {{ cart.creation_date|date:_("DATETIME_FORMAT") }}
            </td>
            <td nowrap="nowrap">
                {{ cart.modification_date|date:_("DATETIME_FORMAT") }}
            </td>
            <td>
                {% if cart.customer.selected_invoice_address %}
                    {{ cart.customer.selected_invoice_address.firstname }}
                    {{ cart.customer.selected_invoice_address.lastname }}
                {% else %}
                    ---
                {% endif %}
            </td>
            <td class="number" nowrap="nowrap">
                {{ cart.total|currency:request }}
            </td>
            <td class="right-padding">
                {{ cart.get_amount_of_items }}
            </td>
            <td>
                {{ cart.products }}
            </td>
        </tr>
    {% endfor %}
</table>
