{% extends "checkout/checkout.html" %}

{% load currency_filters %}
{% load i18n %}

{% block title %}
    {% trans "Shipping method" %} | {{ block.super }}
{% endblock %}

{% block checkout_nav %}
    {% include 'checkout/nav.html' with step=2 %}
{% endblock %}

{% block checkout_title %}{% trans "Shipping method" %}{% endblock %}

{% block order_contents %}{% endblock %}
{% block shipping_address %}{% endblock %}
{% block payment_method %}{% endblock %}

{% block shipping_method %}
    <div class="basket-title">
        <div class="row-fluid">
            <h4 class="span8">{% trans "Method" %}</h4>
            <h4 class="span3">{% trans "Cost" %}</h4>
        </div>
    </div>
    {% for method in methods %}
        <div class="basket-items">
            <div class="row-fluid">
                <div class="span8">
                    <h4>{{ method.name }}</h4>
                    {% if method.description %}
                        <p>{{ method.description|safe }}</p>
                    {% endif %}
                    {% if method.is_discounted %}
                        <small>
                            {% with discount=method.get_discount %}
                                {% blocktrans with amount=discount.discount|currency:basket.currency name=discount.name %}
                                    This includes a discount of {{ amount }} as
                                    your basket qualifies for the '{{ name }}' offer.
                                {% endblocktrans %}
                            {% endwith %}
                        </small>
                    {% endif %}
                </div>
                <div class="span1">
                    {% if method.is_tax_known %}
                        {{ method.charge_incl_tax|currency:basket.currency }}
                    {% else %}
                        {{ method.charge_excl_tax|currency:basket.currency }}
                    {% endif %}
                </div>
                <div class="span3">
                    <form method="post" action="{% url 'checkout:shipping-method' %}">
                        {% csrf_token %}
                        <input type="hidden" name="method_code" value="{{ method.code }}" class="btn" />
                        <button type="submit" class="btn btn-large btn-primary pull-right">{% trans "Select option" %}</button>
                    </form>
                </div>    
            </div>
        </div>
    {% endfor %}
{% endblock shipping_method %}
