{% extends 'oscar/checkout/payment_details.html' %} {% load url from future %} {% load currency_filters %} {% load i18n %} {% block payment_details %}

{% trans "Enter payment details" %}

{% if not allocation_form %} {# 1. Initial load of page - show form to look up account if they are not blocked #} {% if is_blocked %}

{% trans "You are blocked." %}

{% else %} {% if user_accounts %}

{% trans "Choose a user account" %}

{% csrf_token %} {% for account in user_accounts %} {% endfor %}
{% trans "Account" %} {% trans "Balance" %}
{{ account.name }} {{ account.balance|currency }}
{% endif %}

{% trans "Look up an account" %}

{% csrf_token %} {% include 'partials/form_fields.html' with form=account_form %}
{% endif %} {% else %} {# 2. An account has been found - choose allocation #} {% with account=allocation_form.account %}

{% trans "Account" %}

{% if account.description %} {% endif %} {% if account.end_date %} {% endif %}
{% trans "Name" %} {{ account.name }}
{% trans "Description" %} {{ account.description }}
{% trans "Expiry date" %} {{ account.end_date }}
{% trans "Balance" %} {{ account.balance|currency }}
{% endwith %}

{% trans "Choose allocation" %}

{% trans "The order total is" %} {{ order_total_incl_tax|currency }}.

{% trans "The maximum allocation from this account is" %} {{ allocation_form.max_allocation|currency }}.

{% csrf_token %} {# Include account form hidden #}
{{ account_form.as_p }}
{% include 'partials/form_fields.html' with form=allocation_form %} {% trans "or" %} {% trans "cancel" %}.
{% endif %} {% if account_allocations %}

{% trans "Allocations" %}

{% csrf_token %} {% for code, amount in account_allocations.items %} {% endfor %}
{% trans "Account code" %} {% trans "Allocation" %}
{{ code }} {{ amount|currency }}
{% endif %} {% if to_allocate == 0 %} {% trans "Continue" %} {% else %}

{% trans "Order total" %}: {{ order_total_incl_tax|currency }}. {% trans "You need to allocate another" %} {{ to_allocate|currency }}

{% endif %} {% endblock %}