{% extends "pretixpresale/event/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block title %}{% trans "Checkout" %}{% endblock %}
{% block content %}
    <h2>{% trans "Checkout" %}</h2>
    <p>
        {% trans "For some of the products in your cart, you can choose additional options before you continue." %}
    </p>
    <form class="form-horizontal" method="post" data-asynctask>
        {% csrf_token %}
        <div class="panel-group" id="questions_group">
            {% for form in forms %}
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" href="#cp{{ form.pos.id }}">
                                <strong>{{ form.item.name }}</strong>
                                {% if form.variation %}
                                    – {{ form.variation }}
                                {% endif %}
                            </a>
                        </h4>
                    </div>
                    <div id="cp{{ form.pos.id }}"
                            class="panel-collapse collapsed in">
                        <div class="panel-body">
                            {% for c in form.categories %}
                                <fieldset>
                                    <legend>{{ c.category.name }}</legend>
                                    <p>
                                        {% if c.min_count == c.max_count %}
                                            {% blocktrans trimmed with min_count=c.min_count %}
                                                You need to choose {{ min_count }} options from this category.
                                            {% endblocktrans %}
                                        {% elif c.min_count == 0 %}
                                            {% blocktrans trimmed with max_count=c.max_count %}
                                                You can to choose up to {{ max_count }} options from this category.
                                            {% endblocktrans %}
                                        {% else %}
                                            {% blocktrans trimmed with min_count=c.min_count max_count=c.max_count %}
                                                You can choose between {{ min_count }} and {{ max_count }} options from
                                                this category.
                                            {% endblocktrans %}
                                        {% endif %}
                                    </p>
                                    {% bootstrap_form c.form layout="horizontal" %}
                                </fieldset>
                            {% empty %}
                                <em>
                                    {% trans "There are no add-ons available for this product." %}
                                </em>
                            {% endfor %}
                        </div>
                    </div>
                </div>
            {% endfor %}
        </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 %}
