{% extends "pretixcontrol/item/base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% block inside %}
{% load static %}
<script type="text/javascript" src="{% static "pretixcontrol/js/ui/hidequota.js" %}"></script>

    <form action="" method="post" class="form-horizontal" enctype="multipart/form-data">
        {% csrf_token %}
        <fieldset>
            <legend>{% trans "General information" %}</legend>
            {% bootstrap_field form.name layout="control" %}
            <div class="internal-name-wrapper">
                {% bootstrap_field form.internal_name layout="control" %}
            </div>
            {% bootstrap_field form.copy_from layout="control" %}

            <div class="form-group">
                <label class="col-md-3 control-label">{% trans "Product type" %}</label>
                <div class="col-md-9">
                    <div class="big-radio radio">
                        <label>
                            <input type="radio" value="on" name="{{ form.admission.html_name }}" {% if form.admission.value %}checked{% endif %} id="admission_on">
                            <span class="fa fa-fw fa-user"></span>
                            <strong>{% trans "Admission product" %}</strong><br>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    Every purchase of this product represents one person who is allowed to enter your event.
                                    By default, we will only offer ticket downloads for these products.
                                {% endblocktrans %}
                            </div>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    Only purchases of such products will be considered "attendees" for most statistical
                                    purposes or within some plugins.
                                {% endblocktrans %}
                            </div>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    This option should be set for most things that you would call a "ticket". For product add-ons or bundles, this should
                                    be set on the main ticket, except if the add-on products or bundled products represent additional people (e.g. group bundles).
                                {% endblocktrans %}
                            </div>
                        </label>
                    </div>
                    <div class="big-radio radio">
                        <label>
                            <input type="radio" value="" name="{{ form.admission.html_name }}" {% if not form.admission.value %}checked{% endif %}>
                            <span class="fa fa-fw fa-cube"></span>
                            <strong>{% trans "Non-admission product" %}</strong>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    A product that does not represent a person. By default, we will not offer ticket downloads
                                    (but you can still enable ticket downloads in event settings or product settings).
                                {% endblocktrans %}
                            </div>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    Examples: Merchandise, donations, gift cards, add-ons to a main ticket.
                                {% endblocktrans %}
                            </div>
                        </label>
                    </div>
                </div>
            </div>

            <div class="form-group" data-display-dependency="#admission_on">
                <label class="col-md-3 control-label">{% trans "Personalization" %}</label>
                <div class="col-md-9">
                    <div class="big-radio radio">
                        <label>
                            <input type="radio" value="on" name="{{ form.personalized.html_name }}" {% if form.personalized.value %}checked{% endif %}>
                            <span class="fa fa-fw fa-id-card-o"></span>
                            <strong>{% trans "Personalized ticket" %}</strong><br>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    When this ticket is purchased, the system will ask for a name or other details according
                                    to your event settings.
                                {% endblocktrans %}
                                {% if not request.event.settings.attendee_names_asked and not request.event.settings.attendee_emails_asked and not request.event.settings.attendee_company_asked and not request.event.settings.attendee_addresses_asked %}
                                    <br>
                                    <span class="text-warning">
                                        <span class="fa fa-warning" aria-hidden="true"></span>
                                        {% trans "This will currently have no effect since all data fields are turned off in event settings." %}
                                    </span>
                                    <a href="{% url "control:event.settings" organizer=request.event.organizer.slug event=request.event.slug %}#tab-0-2-open"
                                       class="btn btn-default btn-xs" target="_blank">{% trans "Change settings" %}</a>
                               {% endif %}
                            </div>
                        </label>
                    </div>
                    <div class="big-radio radio">
                        <label>
                            <input type="radio" value="" name="{{ form.personalized.html_name }}" {% if not form.personalized.value %}checked{% endif %}>
                            <span class="fa fa-fw fa-circle-o"></span>
                            <strong>{% trans "Non-personalized ticket" %}</strong>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    The system will not ask for a name or other attendee details. This only affects
                                    system-provided fields, you can still add your own questions.
                                {% endblocktrans %}
                            </div>
                        </label>
                    </div>
                </div>
            </div>

            {% bootstrap_field form.category layout="control" %}

            <div class="form-group">
                <label class="col-md-3 control-label">{% trans "Product variations" %}</label>
                <div class="col-md-9">
                    <div class="big-radio radio">
                        <label>
                            <input type="radio" value="" name="{{ form.has_variations.html_name }}" {% if not form.has_variations.value %}checked{% endif %}>
                            <span class="fa fa-fw fa-square"></span>
                            <strong>{% trans "Product without variations" %}</strong><br>
                        </label>
                    </div>
                    <div class="big-radio radio">
                        <label>
                            <input type="radio" value="on" name="{{ form.has_variations.html_name }}" {% if form.has_variations.value %}checked{% endif %}>
                            <span class="fa fa-fw fa-th-large"></span>
                            <strong>{% trans "Product with multiple variations" %}</strong>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    This product exists in multiple variations which are different in either their name, price, quota, or description.
                                    All other settings need to be the same.
                                {% endblocktrans %}
                            </div>
                            <div class="help-block">
                                {% blocktrans trimmed %}
                                    Examples: Ticket category with variations for "full price" and "reduced", merchandise with variations for different sizes,
                                    workshop add-on with variations for simultaneous workshops.
                                {% endblocktrans %}
                            </div>
                        </label>
                    </div>
                </div>
            </div>

            {% if meta_forms %}
                <div class="form-group metadata-group">
                    <label class="col-md-3 control-label">{% trans "Meta data" %}</label>
                    <div class="col-md-9">
                        {% for form in meta_forms %}
                            <div class="row">
                                <div class="col-md-4">
                                    <label for="{{ form.value.id_for_label }}">
                                        {{ form.property.name }}
                                    </label>
                                </div>
                                <div class="col-md-8">
                                    {% bootstrap_form form layout="inline" error_types="all" %}
                                </div>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            {% endif %}

        </fieldset>
        {% if form.quota_option %}
            <fieldset>
                <legend>{% trans "Quota settings" %}</legend>
                {% bootstrap_field form.quota_option layout="control" %}
                <div id="existing-quota-group">
                    {% bootstrap_field form.quota_add_existing layout="control" %}
                </div>
                <div id="new-quota-group">
                    {% bootstrap_field form.quota_add_new_name layout="control" %}
                    {% bootstrap_field form.quota_add_new_size layout="control" %}
                </div>
            </fieldset>
        {% endif %}
        <fieldset>
            <legend>{% trans "Price settings" %}</legend>
            {% bootstrap_field form.default_price layout="control" %}
            {% bootstrap_field form.tax_rule layout="control" %}
        </fieldset>
        <div class="form-group submit-group">
            <button type="submit" class="btn btn-primary btn-save">
                {% trans "Save and continue with more settings" %}
            </button>
        </div>
    </form>
{% endblock %}
