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

<table class="lfs-manage-table">
    <tr>
        <th colspan="2">
            {% trans 'General' %}
        </th>
    </tr>
    <tr>
        <td class="label"
            style="width:150px">
            {% trans 'ID' %}:
        </td>
        <td>
            {{ cart.id }}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Customer' %}:
        </td>
        <td>
			{% if customer.selected_invoice_address %}
				<div>
					{{ customer.selected_invoice_address.firstname }}
					{{ customer.selected_invoice_address.lastname }}
					(<a href="mailto:{{ customer.selected_invoice_address.email }}">{{ customer.selected_invoice_address.email }}</a>)
				</div>
				<div>
					{{ customer.selected_invoice_address.company_name }}
				</div>
				<div>
					{{ customer.selected_invoice_address.street }}
				</div>
				<div>
					{{ customer.selected_invoice_address.city }}
				</div>
				<div>
					{{ customer.selected_invoice_address.state }}
				</div>
				<div>
					{{ customer.selected_invoice_address.zip_code }}
				</div>
				<div>
					{{ customer.selected_invoice_address.country }}
				</div>
				<div>
					{{ customer.selected_invoice_address.phone }}
				</div>
			{% else %}
				---
			{% endif %}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Creation date' %}:
        </td>
        <td>
            {{ cart.creation_date|date:_("DATETIME_FORMAT") }}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Modification date' %}:
        </td>
        <td>
            {{ cart.modification_date|date:_("DATETIME_FORMAT") }}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Items' %}:
        </td>
        <td>
            {{ cart.get_amount_of_items }}
        </td>
    </tr>
    <tr>
        <td class="label">
            {% trans 'Total' %}:
        </td>
        <td>
            {{ total|currency }}
        </td>
    </tr>
</table>

{% if cart.items %}
    <table class="lfs-manage-table">
        <tr>
            <th class="small">
                {% trans 'ID' %}
            </th>
            <th class="middle">
                {% trans 'Creation date' %}
            </th>
            <th>
                {% trans 'Product' %}
            </th>
            <th class="number middle">
                {% trans 'Price' %}
            </th>
            <th class="number middle">
                {% trans 'Amount' %}
            </th>
            <th class="number middle">
                {% trans 'Total' %}
            </th>
        </tr>
        {% for item in cart.items %}
            <tr class="clickable"
                onclick="window.location='{% url lfs_manage_product item.product.id %}'">
                <td class="small-right">
                	{{ item.id }}
                </td>
                <td>
					{{ item.creation_date|date:_("DATETIME_FORMAT") }}
			    </td>
                <td>
                	{{ item.product.get_name }}
                </td>
                <td class="number">
                    {{ item.product|get_price:request|currency }}
                </td>
                <td class="number">
                    {{ item.amount }}
                </td>
                <td class="number">
                    {{ item|get_price:request|currency }}
                </td>
            </tr>
        {% endfor %}
    </table>
{% else %}
    {% trans 'This cart has no items' %}
{% endif %}
