{% extends 'plans/base.html' %}
{% load i18n %}

{% block body %}
    <h1>{% trans "Confirm order" %}</h1>
    {% if FREE_ORDER %}
        {#  Free order is when user downgrades a plan and there is no additional payment it is handle by special a view. #}
        {% with object as order %}
            {% include "plans/order_detail_table.html" %}
        {% endwith %}

        <div class="alert alert-warning">
            {% blocktrans %}If you downgrade your plan please remember that new lower limits are used immediately after
                finishing the order.{% endblocktrans %}
        </div>

        <form method="post" action="{% url "change_plan" pk=plan.pk %}">
            {% csrf_token %}
            <input type="submit" class="btn btn-primary" value="{% trans "Continue" %}">
        </form>

    {% else %}

        <form method="post" action="">
            {% with object as order %}
                {% include "plans/order_detail_table.html" %}
            {% endwith %}

            <h2>{% trans "Invoice" %}</h2>
            {% url "billing_info" as billing_info_url %}
            {% if billing_info %}
                <p class="alert alert-info">
                    {% blocktrans %}
                        Invoice for this order will be issued for:
                    {% endblocktrans %}
                    <br><br><b>
                    {{ billing_info.name }}<br>
                    {{ billing_info.street }}<br>
                    {{ billing_info.zipcode }}
                    {{ billing_info.city }},
                    {{ billing_info.country }}
                    <br><br>
                    {% trans "VAT ID" %} {{ billing_info.tax_number }}
                </b>
                </p>
                <p>
            {% trans 'If this data is not correct please' %} <a href="{{ billing_info_url }}?next={{ request.path }}">{% trans 'edit billing data' %}</a> {% trans 'before making an order' %}.
                </p>
            {% else %}
                <p class="alert alert-info">
                    {% blocktrans %}
                    Invoice will <b>not</b> be issued. If you need an invoice please provide {% endblocktrans %}<a href="{{ billing_info_url }}?next={{ request.path }}">{% trans 'billing data' %}</a> {% trans 'before making an order' %}.
                </p>
            {% endif %}
            <p>
                <input type="submit" class="btn btn-primary" value="{% trans "Continue" %}">
                {{ form.as_p }}
                {% csrf_token %}
        </form>

    {% endif %}

{% endblock %}
