{% extends "pretixcontrol/events/create_base.html" %}
{% load i18n %}
{% load bootstrap3 %}
{% load static %}
{% block form %}
    <fieldset>
        <legend>{% trans "General information" %}</legend>
        {% bootstrap_field form.name layout="control" %}
        <div class="form-group">
            <label class="col-md-3 control-label" for="{{ form.slug.id_for_label }}">{{ form.slug.label }}</label>
            <div class="col-md-9 form-inline">
                <button class="btn btn-default pull-right flip" type="button" id="event-slug-random-generate"
                        data-rng-url="{% url "control:events.add.slugrng" organizer=organizer.slug %}">
                    {% trans "Set to random" %}
                </button>
                {% bootstrap_field form.slug form_group_class="helper-display-inline" show_label=False layout="inline" %}
                <div class="help-block">
                    {% blocktrans trimmed %}
                        This is the address users can buy your tickets at. Should be short, only contain lowercase
                        letters and numbers, and must be unique among your events. We recommend some kind of
                        abbreviation or a date with less than 10 characters that can be easily remembered, but you
                        can also choose to use a random value.
                    {% endblocktrans %}
                </div>
                <div class="help-block">
                    {% blocktrans trimmed %}
                        We will also use this in some places like order codes, invoice numbers or bank transfer
                        references as an abbreviation to reference this event.
                    {% endblocktrans %}
                </div>
                <div class="slug-length alert alert-warning helper-display-none-soft">
                    {% blocktrans trimmed %}
                        We strongly recommend against using short forms of more then 16 characters.
                    {% endblocktrans %}
                </div>
            </div>
        </div>
        {% bootstrap_field form.date_from layout="control" %}
        {% if form.date_to %}
            {% bootstrap_field form.date_to layout="control" %}
        {% endif %}
        <div class="geodata-section">
            {% bootstrap_field form.location layout="control" %}
            <div class="form-group geodata-group" data-tiles="{{ global_settings.leaflet_tiles|default_if_none:"" }}" data-attrib="{{ global_settings.leaflet_tiles_attribution }}" data-icon="{% static "leaflet/images/marker-icon.png" %}" data-shadow="{% static "leaflet/images/marker-shadow.png" %}">
                <label class="col-md-3 control-label">
                    {% trans "Geo coordinates" %}<br>
                    <span class="optional">{% trans "Optional" %}</span>
                </label>
                <div class="col-md-4">
                    {% bootstrap_field form.geo_lat layout="inline" %}
                    {% if global_settings.opencagedata_apikey %}
                        <p class="attrib">
                            <a href="https://openstreetmap.org/" target="_blank">
                                {% trans "Geocoding data © OpenStreetMap" %}
                            </a>
                        </p>
                    {% endif %}
                </div>
                <div class="col-md-4">
                    {% bootstrap_field form.geo_lon layout="inline" %}
                </div>
                <div class="col-md-1">
                </div>
            </div>
        </div>
        {% bootstrap_field form.currency layout="control" %}
        {% bootstrap_field form.tax_rate addon_after="%" layout="control" %}
    </fieldset>
    <fieldset>
        <legend>{% trans "Display settings" %}</legend>
        {% bootstrap_field form.locale layout="control" %}
        {% bootstrap_field form.timezone layout="control" %}
    </fieldset>
    {% if form.presale_start %}
        <fieldset>
            <legend>{% trans "Timeline" %}</legend>
            {% bootstrap_field form.presale_start layout="control" %}
            {% bootstrap_field form.presale_end layout="control" %}
        </fieldset>
    {% endif %}

    {% if form.team %}
        <fieldset>
            <legend>{% trans "Team" %}</legend>
            {%  bootstrap_field form.team layout="control" %}
        </fieldset>
    {% endif %}
{% endblock %}
