{% extends "pretixpresale/event/checkout_base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block inner %}
    <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.cartpos.pk }}">
                                <strong>{{ form.item.name }}{% if form.variation %}
                                    – {{ form.variation }}
                                {% endif %}</strong>
                                <i class="fa fa-angle-down collapse-indicator"></i>
                            </a>
                        </h4>
                    </div>
                    <div id="cp{{ form.cartpos.pk }}"
                            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 count min_count=c.min_count %}
                                                You need to choose exactly one option from this category.
                                            {% plural %}
                                                You need to choose {{ min_count }} options from this category.
                                            {% endblocktrans %}
                                        {% elif c.min_count == 0 %}
                                            {% blocktrans trimmed count max_count=c.max_count %}
                                                You can choose at most one option from this category.
                                            {% plural %}
                                                You can 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 %}
