{% extends "pretixpresale/event/checkout_base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load rich_text %}
{% block inner %}
    <p>{% trans "Some of the products in your cart can only be purchased if there is an active membership on your account." %}</p>
    <form class="form-horizontal" method="post">
        {% csrf_token %}
        {% for form in forms %}
            <details class="panel panel-default" open>
                <summary class="panel-heading">
                    <h4 class="panel-title">
                        <strong>{{ form.position.item.name }}{% if form.position.variation %}
                            – {{ form.position.variation }}
                        {% endif %}</strong>
                    </h4>
                </summary>
                <div>
                    <div class="panel-body questions-form">
                        {% if form.position.seat %}
                            <div class="form-group">
                                <div class="col-md-3 control-label">
                                    <strong role="heading" aria-level="5">{% trans "Seat" %}</strong>
                                </div>
                                <div class="col-md-9 form-control-text">
                                    {% include "icons/seat.svg" with cls="svg-icon" %}
                                    {{ form.position.seat }}
                                </div>
                            </div>
                        {% endif %}
                        {% if form.position.addons.all %}
                            <div class="form-group">
                                <div class="col-md-3 control-label">
                                    <strong role="heading" aria-level="5">{% trans "Selected add-ons" %}</strong>
                                </div>
                                <div class="col-md-9 form-control-text">
                                    <ul class="addon-list">
                                        {% for a in form.position.addons.all %}
                                            <li>{{ a.item.name }}{% if a.variation %} – {{ a.variation.value }}{% endif %}</li>
                                        {% endfor %}
                                    </ul>
                                </div>
                            </div>
                        {% endif %}
                        {% if form.position.subevent %}
                            <div class="form-group">
                                <div class="col-md-3 control-label">
                                    <strong role="heading" aria-level="5">{% trans "Date" context "subevent" %}</strong>
                                </div>
                                <div class="col-md-9 form-control-text">
                                    <p class="addon-list">
                                        {{ form.position.subevent.name }} &middot; {{ form.position.subevent.get_date_range_display_with_times_as_html }}
                                    </p>
                                </div>
                            </div>
                        {% endif %}
                        {% if form.is_empty %}
                            <div class="alert alert-danger">
                                {% trans "This product can only be purchased when you are logged in with a customer account that includes a valid membership or authorization for this type of product." %}
                            </div>
                            <div class="sr-only">
                                {% bootstrap_form form layout="checkout" %}
                            </div>
                        {% else %}
                            {% bootstrap_form form layout="checkout" %}
                        {% endif %}
                    </div>
                </div>
            </details>
        {% endfor %}
        <div class="row checkout-button-row">
            <div class="col-md-4 col-sm-6">
                <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 col-sm-6">
                <button class="btn btn-block btn-primary btn-lg" type="submit">
                    {% trans "Continue" %}
                </button>
            </div>
            <div class="clearfix"></div>
        </div>
    </form>
{% endblock %}
