{% load static %}

<nav class="app-header navbar navbar-expand bg-body">
    <div class="container-fluid">
        <ul class="navbar-nav">
            <li class="nav-item">
                <button class="nav-link" data-lte-toggle="sidebar">
                    <i class="bi bi-list"></i>
                </button>
            </li>

            {% block ecom_statics_header_links %}
                <li class="nav-item d-none d-md-block">
                    <a href="{% url 'home' %}" class="nav-link">Inicio</a>
                </li>

                <li class="nav-item d-none d-md-block">
                    <a href="https://api.whatsapp.com/send?phone=5493624810854" class="nav-link">Contactanos</a>
                </li>
            {% endblock %}
        </ul>

        <ul class="navbar-nav ms-auto">
            {% block ecom_statics_header_items %}
                <li class="nav-item">
                    <button class="nav-link" data-widget="navbar-search">
                        <i class="bi bi-search"></i>
                    </button>
                </li>

                <li class="nav-item">
                    <button class="nav-link" data-lte-toggle="fullscreen">
                        <i data-lte-icon="maximize" class="bi bi-arrows-fullscreen"></i>
                        <i data-lte-icon="minimize" class="bi bi-fullscreen-exit" style="display: none"></i>
                    </button>
                </li>
            {% endblock %}

            <li class="nav-item dropdown user-menu">
                <a href="#" class="nav-link dropdown-toggle py-1" data-bs-toggle="dropdown">
                    <img src="{% block ecom_statics_user_logo %}{% static 'ecom_statics/images/logos/usuario.png' %}{% endblock %}" class="user-image rounded-circle mt-0" alt="User Image">

                    <span class="d-none d-md-inline align-middle">{{ request.user.get_full_name|default:request.user.username }}</span>
                </a>

                <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-end">
                    <li class="user-header text-bg-primary">
                        <img src="{% block ecom_statics_user_logo_dropdown %}{% static 'ecom_statics/images/logos/usuario.png' %}{% endblock %}" class="rounded-circle shadow border-0" alt="User Image">

                        <p>
                            {{ request.user.get_full_name|default:request.user.username }} - {% if request.user.is_superuser %}Administrador{% else %}Usuario{% endif %}
                            <small>Miembro desde {{ request.user.date_joined|date:'M. Y' }}</small>
                        </p>
                    </li>

                    {% block ecom_statics_header_dropdown_items_extra %}
                        <li class="user-body text-center">
                            <a href="{% url 'usuarios:perfil' %}" class="btn btn-primary">
                                <i class="bi bi-person-square me-2"></i>Mi Perfil
                            </a>

                            {% if request.user.is_staff %}
                                <a href="{% url 'admin:index' %}" class="btn btn-primary">
                                    <i class="bi bi-window-desktop me-2"></i>Panel de Administracion
                                </a>
                            {% endif %}
                        </li>
                    {% endblock %}

                    {% block ecom_statics_header_dropdown_items_base %}
                        <li class="user-footer text-center">
                            <form method="post" action="{% url 'usuarios:logout' %}">
                                {% csrf_token %}

                                <button type="submit" class="btn btn-secondary">
                                    <i class="bi bi-box-arrow-left me-2"></i>Cerrar Sesión
                                </button>
                            </form>
                        </li>
                    {% endblock %}
                </ul>
            </li>
        </ul>
    </div>
</nav>
