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

<h2>{% trans "Customers" %}</h2>
<table class="lfs-manage-table">
    <tr>
        <th class="tiny right-padding">
			<a class="ajax-link"
			   href='{% url lfs_set_customer_ordering "id" %}'>
            	{% trans 'ID' %}
           	</a>
        </th>
        <th>
			<a class="ajax-link"
			   href='{% url lfs_set_customer_ordering "firstname" %}'>
            	{% trans 'Firstname' %}
			</a>
        </th>
        <th>
			<a class="ajax-link"
			   href='{% url lfs_set_customer_ordering "lastname" %}'>
            	{% trans 'Lastname' %}
			</a>
        </th>
        <th class="middle">
			<a class="ajax-link"
			   href='{% url lfs_set_customer_ordering "email" %}'>
            	{% trans 'E-Mail' %}
			</a>
        </th>
        <th class="tiny right-padding">
            {% trans 'Orders' %}
        </th>
        <th class="number right-padding">
            {% trans 'Cart' %}
        </th>
    </tr>

    {% for customer in customers %}
        <tr class="clickable"
            onclick="window.location='{% url lfs_manage_customer customer.customer.id %}'">
            <td class="tiny right-padding">
               	{{ customer.customer.id }}
            </td>
            <td>
				{{ customer.customer.selected_invoice_address.firstname }}
            </td>
            <td>
                {{ customer.customer.selected_invoice_address.lastname  }}
            </td>
            <td>
				{{ customer.customer.get_email_address }}
            </td>
            <td class="right-padding">
				{{ customer.orders }}
            </td>
            <td class="right-padding">
				{% if customer.cart_price %}
					{{ customer.cart_price|currency:request }}
				{% endif %}
            </td>
        </tr>
    {% endfor %}
</table>
