{% load i18n %}
{% load eventurl %}

{% if request.organizer.settings.customer_accounts %}
    <nav class="loginstatus" aria-label="{% trans "customer account" %}">
        {% if request.customer %}
            <a href="{% abseventurl request.organizer "presale:organizer.customer.profile" %}"
               aria-label="{% trans "View customer account" %}" data-placement="bottom"
               title="{% trans "View user profile" %}" data-toggle="tooltip">
                <span class="fa fa-user" aria-hidden="true"></span>
                {{ request.customer.name|default:request.customer.email }}</a>
            <a href="{% if request.event_domain %}{% abseventurl request.event "presale:organizer.customer.logout" %}{% else %}{% abseventurl request.organizer "presale:organizer.customer.logout" %}{% endif %}?next={{ request.path|urlencode }}%3F{{ request.META.QUERY_STRING|urlencode }}"
               aria-label="{% trans "Log out" %}" data-toggle="tooltip" data-placement="left"
               title="{% trans "Log out" %}">
                <span class="fa fa-sign-out" aria-hidden="true"></span>
            </a>
        {% else %}
            <a href="{% abseventurl request.organizer "presale:organizer.customer.login" %}{% if request.resolver_match.url_name != "organizer.customer.login" %}?next={% if request.event_domain %}{{ request.scheme }}://{{ request.get_host }}{% endif %}{{ request.path|urlencode }}%3F{{ request.META.QUERY_STRING|urlencode }}{% endif %}{% if request.event_domain %}&request_cross_domain_customer_auth=true{% endif %}">
                {% trans "Log in" %}</a>

        {% endif %}
    </nav>
{% endif %}
