{% load i18n %}
{% if request.user.is_authenticated %}
<div class="dropdown nav-item">
    <button class="dropdown-toggle nav-link user-email" aria-label="User toggler" data-bs-toggle="dropdown" title="{% trans "User dashboard button" %}">
        <i class="fa fa-user-solid nav-icon"></i>
        {% if num_unread_notifications %}<span class="icon-label notification">{{ num_unread_notifications }}</span>{% endif %}
    </button>
    <div class="dropdown-menu user-dropdown dropdown-menu-end">
        {% block user_dropdown %}
        <div class="login-header">
            <span class="h4">{% trans "Welcome" %}, {{ request.user.first_name }}</span>
        </div>
        {% if request.user.is_staff or perms.partner.dashboard_access %}
        <a href="{% url 'dashboard:index' %}" class="dropdown-item">
            <i class="fa fa-cog-solid"></i>{% trans 'Dashboard' %}
        </a>
        {% endif %}
        <a href="{% url 'customer:summary' %}" class="dropdown-item">
            <i class="fa fa-user-solid"></i>{% trans 'Account overview' %}
        </a>
        <a href="{% url 'customer:order-list' %}" class="dropdown-item">
            <i class="fa fa-tags-solid"></i>{% trans 'Orders' %}
        </a>
        <a href="{% url 'customer:address-list' %}" class="dropdown-item">
            <i class="fa fa-address-book-solid"></i>{% trans 'Addresses' %}
        </a>
        <a href="{% url 'customer:logout' %}" class="dropdown-item" id="logout_link">
            {% trans 'Logout' %}
        </a>
        {% endblock %}
    </div>
</div>
{% else %}
<div class="dropdown nav-item">
    <button class="dropdown-toggle nav-link user-login" data-bs-toggle="dropdown" aria-label="User toggle" title="{% trans "User login button" %}">
        <i class="fa fa-user-solid nav-icon"></i>
    </button>
    <div class="dropdown-menu login-dropdown dropdown-menu-end">
        <div class="login_form">
            <div class="login-header">
                <span class="h4">{% trans 'Log in' %}</span>
            </div>
            <form id="login_form" action="{% url 'customer:login' %}" method="post" class="well" novalidate >
                {% csrf_token %}
                <div class="input-wrapper">
                    <div class="input-group">
                        <input type="email" name="login-username" class="form-control" required="" id="id_login-username" placeholder="{% trans 'E-mailadres' %}" autocomplete="username">
                        <span class="input-group-text"><i class="fa fa-user-solid"></i></span>
                    </div>
                    <div class="input-group">
                        <input type="password" name="login-password" class="form-control" required="" id="id_login-password" placeholder="{% trans 'Password' %}" autocomplete="password">
                        <span class="input-group-text"><i class="fa fa-lock-solid"></i></span>
                    </div>
                </div>
                <a href="{% url 'password-reset' %}" class="password-reset">{% trans "I've forgotten my password" %}</a>
                <button name="login_submit" type="submit" value="Log In" class="btn btn-primary" data-loading-text="{% trans "Logging in..." %}">{% trans 'Log In' %}</button>
                {% block register %}
                    <a href="{% url 'customer:login' %}" class="btn btn-outline-primary">
                        {% trans 'Register' %}
                    </a>
                {% endblock %}
            </form>
        </div>
    </div>
</div>
{% endif %}
