{% extends "orga/settings/base.html" %}

{% load compress %}
{% load i18n %}
{% load rules %}
{% load static %}

{% block stylesheets %}
    <link rel="stylesheet" type="text/css" href="{% static "common/css/headers-uncompressed.css" %}" />
    {% compress css %}
        <link rel="stylesheet" type="text/css" href="{% static "common/css/dialog.css" %}">
    {% endcompress %}
{% endblock stylesheets %}

{% block scripts %}
    {% compress js %}
        <script defer src="{% static "vendored/vanilla-picker/vanilla-picker.min.js" %}"></script>
        <script defer src="{% static "orga/js/colorpicker.js" %}"></script>
        <script defer src="{% static "common/js/lightbox.js" %}"></script>
        <script defer src="{% static "orga/js/eventSettings.js" %}"></script>
    {% endcompress %}
{% endblock scripts %}

{% block extra_title %}{% translate "Settings" %} :: {% endblock extra_title %}

{% block settings_content %}
    <h2>{% translate "Settings" %}</h2>
    <form method="post" enctype="multipart/form-data">
        {% csrf_token %}

        {% include "orga/includes/tablist.html" %}

        <section role="tabpanel" id="tabpanel-general" aria-labelledby="tab-general" tabindex="0" aria-hidden="false">
            {% include "common/forms/errors.html" %}

            {{ form.name.as_field_group }}
            {{ form.slug.as_field_group }}
            {{ form.date_from.as_field_group }}
            {{ form.date_to.as_field_group }}
            {{ form.email.as_field_group }}
            {{ form.custom_domain.as_field_group }}
            {{ form.meta_noindex.as_field_group }}
            {{ form.imprint_url.as_field_group }}
        </section>
        <section role="tabpanel" id="tabpanel-localisation" aria-labelledby="tab-localisation" tabindex="0" aria-hidden="true">
            {{ form.locale.as_field_group }}
            {{ form.locales.as_field_group }}
            {{ form.content_locales.as_field_group }}
            {{ form.timezone.as_field_group }}
        </section>
        <section role="tabpanel" id="tabpanel-texts" aria-labelledby="tab-texts" tabindex="0" aria-hidden="true">
            {{ form.landing_page_text.as_field_group }}
            {{ form.featured_sessions_text.as_field_group }}
        </section>
        <section role="tabpanel" id="tabpanel-display" aria-labelledby="tab-display" tabindex="0" aria-hidden="true">
            {{ form.primary_color.as_field_group }}
            {{ form.logo.as_field_group }}
            {{ form.header_image.as_field_group }}
            <div id="csswrap">
                {{ form.custom_css.as_field_group }}
                <button class="btn btn-outline-info" type="button" data-toggle="collapse" data-target="#collapseCSSBox" aria-expanded="false" aria-controls="collapseCSSBox">
                    <i class="fa fa-code"></i>
                </button>
            </div>
            <div class="collapse" id="collapseCSSBox">
                {{ form.custom_css_text.as_field_group }}
            </div>
            <div {% if request.event.primary_color %}style="--color: {{ request.event.primary_color }}"{% endif %} class="colorpicker-update">
                {{ form.header_pattern.as_field_group }}
            </div>
            {{ form.show_schedule.as_field_group }}
            {{ form.schedule.as_field_group }}
            {{ form.show_featured.as_field_group }}
            {{ form.use_feedback.as_field_group }}
            {{ form.export_html_on_release.as_field_group }}
            {{ form.html_export_url.as_field_group }}
        </section>
        <div class="submit-group panel">
            <span>
                {% has_perm "person.is_administrator" request.user request.event as can_delete_event %}
                {% if can_delete_event %}
                    <a class="btn btn-outline-danger btn-lg" href="{{ request.event.orga_urls.delete }}">
                        {% translate "Delete event" %}
                    </a>
                {% endif %}
            </span>
            <span>
                <button type="submit" class="btn btn-success btn-lg">
                    <i class="fa fa-check"></i>
                    {{ phrases.base.save }}
                </button>
            </span>
        </div>
    </form>
{% endblock settings_content %}
