{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Checkout" %}{% endblock %}
{% block content %}
    <h2>{% trans "Checkout" %}</h2>
    <p>{% trans "Please select how you want to pay." %}</p>
    <form method="post">
        {% csrf_token %}
        <div class="panel-group" id="payment_accordion">
            {% for p in providers %}
                <div class="panel panel-default" data-total="{{ p.total|floatformat:2 }}">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <label class="radio">
                                <strong class="pull-right">+ {{ p.fee|floatformat:2 }} {{ event.currency }}</strong>
                                <input type="radio" name="payment" value="{{ p.provider.identifier }}"
                                        data-parent="#payment_accordion"
                                        {% if selected == p.provider.identifier %}checked="checked"{% endif %}
                                        data-toggle="radiocollapse" data-target="#payment_{{ p.provider.identifier }}" />
                                <strong>{{ p.provider.verbose_name }}</strong>
                            </label>
                        </h4>
                    </div>
                    <div id="payment_{{ p.provider.identifier }}"
                         class="panel-collapse collapsed {% if selected == p.provider.identifier %}in{% endif %}">
                        <div class="panel-body form-horizontal">
                            {{ p.form }}
                        </div>
                    </div>
                </div>
            {% endfor %}
            {% if not providers %}
                <p><em>{% trans "There are no payment providers enabled." %}</em></p>
                {% if not event.live %}
                    <p>{% trans "Please go to the payment settings and activate one or more payment providers." %}</p>
                {% endif %}
            {% endif %}
        </div>
        <div class="row checkout-button-row">
            <div class="col-md-4">
                <a class="btn btn-block btn-default btn-lg"
                        href="{{ prev_url }}">
                    {% trans "Go back" %}
                </a>
            </div>
            <div class="col-md-4 col-md-offset-4">
                <button class="btn btn-block btn-primary btn-lg" type="submit">
                    {% trans "Continue" %}
                </button>
            </div>
            <div class="clearfix"></div>
        </div>
    </form>
{% endblock %}
