{% extends "pretixpresale/base.html" %}
{% load i18n %}
{% load static %}
{% load thumb %}
{% load eventurl %}
{% load safelink %}
{% load rich_text %}
{% block thetitle %}
    {% if messages %}
        {{ messages|join:" " }} :: 
    {% endif %}
    {% block title %}{% endblock %}{% if request.resolver_match.url_name != "event.index" %} :: {% endif %}{{ event.name }}
{% endblock %}
{% block custom_header %}
    {% if event.settings.meta_noindex %}
        <meta name="robots" content="noindex, nofollow">
    {% endif %}
    <meta property="og:type" content="website" />
    {% if social_image %}
        <meta property="og:image" content="{{ social_image }}" />
    {% endif %}
    {{ block.super }}
{% endblock %}
{% block above %}
    {% if not event.live %}
        <div class="offline-banner">
            <div class="container">
                <span class="fa fa-user-secret" aria-hidden="true"></span>
                {% trans "This shop is currently only visible to you and your team." %}
                <a href="{{ site_url }}{% url "control:event.live" event=event.slug organizer=event.organizer.slug %}">
                    {% trans "Take it live now" %}
                </a>
            </div>
        </div>
    {% endif %}
    <div class="container page-header-links {% if event.settings.theme_color_background|upper != "#FFFFFF" or event_logo_image_large %}page-header-links-outside{% endif %}">
        {% if event.settings.locales|length > 1 or request.organizer.settings.customer_accounts %}
            {% if event.settings.theme_color_background|upper != "#FFFFFF" or event_logo_image_large %}
                <div class="pull-right header-part flip hidden-print">
                    {% if event.settings.locales|length > 1 %}
                        <nav class="locales" aria-label="{% trans "select language" %}">
                            <ul>
                            {% for l in languages %}
                                <li><a href="{% url "presale:locale.set" %}?locale={{ l.code }}&next={{ request.path }}{% if request.META.QUERY_STRING %}%3F{{ request.META.QUERY_STRING|urlencode }}{% endif %}" class="{% if l.code == request.LANGUAGE_CODE %}active{% endif %}" rel="nofollow" lang="{{ l.code }}" hreflang="{{ l.code }}"
                                    aria-label="{% language l.code %}{% blocktrans trimmed with language=l.name_local %}
                                        Website in {{ language }}
                                        {% endblocktrans %}{% endlanguage %}">{{ l.name_local }}</a></li>
                            {% endfor %}
                            </ul>
                        </nav>
                    {% endif %}
                    {% include "pretixpresale/fragment_login_status.html" %}
                </div>
            {% endif %}
        {% endif %}
        {% if request.event.settings.organizer_link_back %}
            <div class="pull-left header-part flip hidden-print">
                <a href="{% abseventurl request.organizer "presale:organizer.index" %}">
                    &laquo; {% blocktrans trimmed with name=request.organizer.name %}
                    Show all events of {{ name }}
                {% endblocktrans %}
                </a>
            </div>
        {% endif %}
        <div class="clearfix"></div>
    </div>
{% endblock %}
{% block page %}
    <div class="page-header{% if event_logo %} pager-header-with-logo{% endif %}{% if event_logo and event_logo_image_large %} logo-large{% endif %}">
        <div class="{% if not event_logo or not event_logo_image_large %}pull-left flip{% endif %}">
            {% if event_logo and event_logo_image_large %}
                <a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace|default_if_none:"" %}"
                   aria-label="{% trans 'Homepage' %}" title="{% trans 'Homepage' %}">
                    <img src="{{ event_logo|thumb:'1170x5000' }}" alt="" class="event-logo" />
                </a>
            {% elif event_logo %}
                <a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace|default_if_none:"" %}"
                   aria-label="{% trans 'Homepage' %}" title="{% trans 'Homepage' %}">
                    <img src="{{ event_logo|thumb:'5000x120' }}" alt="" class="event-logo" />
                </a>
            {% else %}
                <h1>
                    <a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace|default_if_none:"" %}" aria-label="{% trans 'Homepage' %}">{{ event.name }}</a>
                    {% if request.event.settings.show_dates_on_frontpage and not event.has_subevents %}
                        <small>{{ event.get_date_range_display_as_html }}</small>
                    {% endif %}
                </h1>
            {% endif %}
        </div>
        {% if event.settings.locales|length > 1 or request.organizer.settings.customer_accounts %}
            {% if event.settings.theme_color_background|upper == "#FFFFFF" and not event_logo_image_large %}
                <div class="{% if not event_logo or not event_logo_image_large %}pull-right flip{% endif %} loginbox hidden-print">
                    {% if event.settings.locales|length > 1 %}
                        <nav class="locales" aria-label="{% trans "select language" %}">
                            <ul>
                            {% for l in languages %}
                                <li><a href="{% url "presale:locale.set" %}?locale={{ l.code }}&next={{ request.path }}{% if request.META.QUERY_STRING %}%3F{{ request.META.QUERY_STRING|urlencode }}{% endif %}" class="{% if l.code == request.LANGUAGE_CODE %}active{% endif %}" rel="nofollow" lang="{{ l.code }}" hreflang="{{ l.code }}"
                                    aria-label="{% language l.code %}{% blocktrans trimmed with language=l.name_local %}
                                        Website in {{ language }}
                                        {% endblocktrans %}{% endlanguage %}">{{ l.name_local }}</a></li>
                            {% endfor %}
                            </ul>
                        </nav>
                    {% endif %}
                    {% include "pretixpresale/fragment_login_status.html" %}
                </div>
            {% endif %}
        {% endif %}
        <div class="clearfix"></div>
    </div>
    {% if request.event.testmode %}
        {% if request.sales_channel.testmode_supported %}
            <div class="alert alert-warning">
                <p><strong><span class="sr-only">{% trans "Warning" context "alert-messages" %}:</span>
                    {% trans "This ticket shop is currently in test mode. Please do not perform any real purchases as your order might be deleted without notice." %}
                </strong></p>
            </div>
        {% else %}
            <div class="alert alert-danger">
                <p><strong><span class="sr-only">{% trans "Warning" context "alert-messages" %}:</span>
                    {% trans "Orders made through this sales channel cannot be deleted - even if the ticket shop is in test mode!" %}
                </strong></p>
            </div>
        {% endif %}
    {% endif %}
    {% if messages %}
        {% for message in messages %}
            <div class="alert {{ message.tags }}"{% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %} id="error-message"{% endif %}>
                <p>
                {% if message.level == DEFAULT_MESSAGE_LEVELS.ERROR %}<span class="sr-only">{% trans "Error" context "alert-messages" %}:</span>{% endif %}
                {% if message.level == DEFAULT_MESSAGE_LEVELS.WARNING %}<span class="sr-only">{% trans "Warning" context "alert-messages" %}:</span>{% endif %}
                {% if message.level == DEFAULT_MESSAGE_LEVELS.INFO %}<span class="sr-only">{% trans "Information" context "alert-messages" %}:</span>{% endif %}
                {{ message }}
                </p>
            </div>
        {% endfor %}
    {% endif %}
    {% if request.event.settings.banner_text %}
        <div class="site-notice-top">
            {{ request.event.settings.banner_text|rich_text }}
        </div>
    {% endif %}
    {% block content %}
    {% endblock %}
{% endblock %}
{% block footer %}
    {% if request.event.settings.banner_text_bottom %}
        <div class="site-notice-bottom">
            {{ request.event.settings.banner_text_bottom|rich_text }}
        </div>
    {% endif %}
    {% if request.event.testmode %}
        {% if request.sales_channel.testmode_supported %}
            <div class="alert alert-testmode alert-warning">
                <p><strong><span class="sr-only">{% trans "Warning" context "alert-messages" %}:</span>
                    {% trans "This ticket shop is currently in test mode. Please do not perform any real purchases as your order might be deleted without notice." %}
                </strong></p>
            </div>
        {% else %}
            <div class="alert alert-testmode alert-danger">
                <p><strong><span class="sr-only">{% trans "Warning" context "alert-messages" %}:</span>
                    {% trans "Orders made through this sales channel cannot be deleted - even if the ticket shop is in test mode!" %}
                </strong></p>
            </div>
        {% endif %}
    {% endif %}
{% endblock %}
{% block footernav %}
    {% if request.event.settings.contact_mail %}
        <li><a href="mailto:{{ request.event.settings.contact_mail }}" target="_blank" rel="noopener">{% trans "Contact event organizer" %}</a></li>
    {% endif %}
    {% if request.event.settings.privacy_url %}
        <li><a href="{% safelink request.event.settings.privacy_url %}" target="_blank" rel="noopener">{% trans "Privacy policy" %}</a></li>
    {% endif %}
    {% if request.event.settings.cookie_consent and cookie_providers %}
        <li><button type="button" class="btn btn-link" id="cookie-consent-reopen">{% trans "Cookie settings" %}</button></li>
    {% endif %}
    {% if request.event.settings.imprint_url %}
        <li><a href="{% safelink request.event.settings.imprint_url %}" target="_blank" rel="noopener">{% trans "Imprint" %}</a></li>
    {% endif %}
{% endblock %}
