{% extends 'dashboard.html' %}
{% load static %}

{% block head_title %}Ship Order No. {{ order.pk }} | {% endblock %}

{% block content %}
<article>
    <p>
        <a href="{% url 'dashboard:order-detail' order.pk %}">&larr; Back to order</a>
    </p>
    <header class="object-header">
        <h1><img src="{% static 'images/box.png' %}"> Order No. {{order.pk}}</h1>
    </header>
    <section class="panel">
        <header class="panel-header">
            <h3>Add Tracking</h3>
        </header>
        <div class="panel-section">
            <strong>Shipping address</strong>
            {% include 'dashboard/partials/_address.html' with address=order.shipping_address %}
        </div>
        <form method="POST">
            {% csrf_token %}
            {{ form.management_form }}
            <table>
                <tbody>
                {% for formitem in form %}
                    {{formitem}}
                {% endfor %}
                </tbody>
                <tfoot>
                    {% for dict in form.errors %}
                    <tr>
                        {% for error in dict.values %}
                        <td>{{ error }}</td>
                        {% endfor %}
                    </tr>
                    {% endfor %}
                    <tr>
                        <td colspan="2" class="text-right">
                            <button type="submit" class="btn">Ship order and send tracking info to customer <img src="{% static 'images/paper_plane.png' %}" class="inline-image"></button>
                        </td>
                    </tr>
                </tfoot>
            </table>
        </form>
    </section>
</article>
{% endblock content %}
