{% extends "layout.html" %}
{% load currency_filters %}

{% block breadcrumbs %}
<ul class="breadcrumb">
    <li>
        <a href="{% url promotions:home %}">Home</a>
        <span class="divider">/</span>
    </li>
    <li>
        <a href="{% url customer:summary %}">Account</a>
        <span class="divider">/</span>
    </li>
	<li class="active"><a href=".">Order history</a></li>
</ul>
{% endblock %}

{% block title %}
Order history | {{ block.super }}
{% endblock %}

{% block header %}
<div class="page-header">
    <h2>Order history</h2>
</div>
{% endblock header %}

{% block content %}

<h3>Search in orders</h3>
<form action="." method="get">
	{% include "partials/form_fields.html" with form=form %}
	<button type="submit" class="btn btn-primary">Filter results</button>
	<a href="{% url customer:order-list %}" class="btn">Reset</a>
</form>

<h3>{{ form.description }}</h3>
{% if orders %}
<table class="table table-striped table-bordered">
    <tr>
        <th>Order number</th>
        <th>Total inc tax</th>
        <th>Date submitted</th>
        <th></th>
    </tr>
    {% for order in orders %}
    <tr>
        <td>{{ order.number }}</td>
        <td>{{ order.total_incl_tax|currency }}</td>
        <td>{{ order.date_placed }}</td>
        <td>
            <a class="btn btn-info" href="{% url customer:order order.number %}">View</a>
			<form action="{% url customer:order order.number %}" method="post">
				{% csrf_token %}
				<input type="hidden" name="order_id" value="{{ order.id }}" />
				<input type="hidden" name="action" value="reorder" />
				<button type="submit" class="btn btn-success">Re-order</button>
			</form>
        </td>
    </tr>
    {% endfor %}
</table>
{% else %}
<p>No orders found</p>
{% endif %}

{% if page_obj %}
{% include "catalogue/partials/pagination.html" %}
{% endif %}

{% endblock content %}

