{% load i18n %}
{% load bootstrap3 %}
{% load rich_text %}
{% for position, addon_positions in formgroups.items %}
    <div class="panel panel-default items">
        <div class="panel-heading">
            <h3 class="panel-title">
                <strong>{{ position.item.name }}</strong>
                {% if position.variation %}
                    – {{ position.variation.value }}
                {% endif %}
            </h3>
        </div>
        <div class="panel-body addons">
            <div class="form-order-change form-horizontal">
                <div class="form-order-change-main">
                    {% if position.subevent %}
                        <div class="form-group">
                            <label class="col-md-3 control-label">
                                {% trans "Date" context "subevent" %}
                            </label>
                            <div class="col-md-9 form-control-text">
                                <ul class="addon-list">
                                    {{ position.subevent.name }} &middot; {{ position.subevent.get_date_range_display_as_html }}
                                    {% if position.event.settings.show_times %}
                                        <span class="fa fa-clock-o" aria-hidden="true"></span>
                                        {{ position.subevent.date_from|date:"TIME_FORMAT" }}
                                    {% endif %}
                                </ul>
                            </div>
                        </div>
                    {% endif %}

                    {% for p in addon_positions %}
                        {% if p.pk != position.pk %}
                            {# Add-Ons #}
                            <legend>+ {{ p.item.name }}{% if p.variation %} – {{ p.variation.value }}{% endif %}</legend>
                        {% endif %}
                        {% if p.attendee_name %}
                            <div class="form-group">
                                <label class="col-md-3 control-label">
                                    {% trans "Attendee name" %}
                                </label>
                                <div class="col-md-9 form-control-text">
                                    {{ p.attendee_name }}
                                </div>
                            </div>
                        {% endif %}
                        {% bootstrap_form p.form layout="checkout" %}
                    {% endfor %}
                </div>
            </div>
            {% if position.addon_form %}
                {% include "pretixpresale/event/fragment_addon_choice.html" with form=position.addon_form hide_prices=hide_prices %}
            {% endif %}
        </div>
    </div>
{% endfor %}
