{% macro navbar() -%}

<nav class="navbar navbar-expand-md navbar-oxford" aria-label="Oxford Academic Navigation">
    <div class="container-fluid">
        <a href="{{ url_for('home.pagina_de_inicio') }}" class="d-flex align-items-center mb-2 mb-lg-0 text-decoration-none">
            {% if logo_perzonalizado() %}
            <img
                height="20"
                src="{{ url_for('static', filename='/files/public/images/logotipo.jpg') }}"
                alt="NOW LMS"
                class="d-inline-block align-top"
                style="filter: brightness(0) invert(1)"
            />
            {% else %}
            <img
                height="20"
                src="{{ url_for('static', filename='/icons/logo/logo_white_large.png') }}"
                alt="NOW LMS"
                class="d-inline-block align-top"
            />
            {% endif %}
        </a>
        <button
            class="navbar-toggler"
            type="button"
            data-bs-toggle="collapse"
            data-bs-target="#navbarsNOWLMS"
            aria-controls="navbarsNOWLMS"
            aria-expanded="false"
            aria-label="Toggle navigation"
        >
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbarsNOWLMS">
            <ul class="navbar-nav me-auto mb-2 mb-md-0">
                {% if not current_user.is_authenticated %}
                <li>
                    <a href="{{ url_for('home.pagina_de_inicio') }}" class="nav-link px-2"
                        ><i class="bi bi-house-fill" aria-hidden="true"></i> {{ _('Inicio') }}</a
                    >
                </li>
                {% else %}
                <li>
                    <a href="{{ url_for('home.panel') }}" class="nav-link px-2"
                        ><i class="bi bi-house-fill" aria-hidden="true"></i> {{ _('Inicio') }}</a
                    >
                </li>
                {% endif %}
                <li>
                    <a href="{{ url_for('course.lista_cursos', page=1) }}" class="nav-link px-2"
                        ><i class="bi bi-card-checklist" aria-hidden="true"></i> {{ _('Cursos') }}</a
                    >
                </li>
                {% if is_programs_enabled() %}
                <li>
                    <a href="{{ url_for('program.lista_programas', page=1) }}" class="nav-link px-2"
                        ><i class="bi bi-diagram-3-fill" aria-hidden="true"></i> {{ _('Programas') }}</a
                    >
                </li>
                {% endif %} {% if is_resources_enabled() %}
                <li>
                    <a href="{{ url_for('resource.lista_de_recursos', page=1) }}" class="nav-link px-2"
                        ><i class="bi bi-book" aria-hidden="true"></i> {{ _('Recursos') }}</a
                    >
                </li>
                {% endif %} {% if is_masterclass_enabled() %}
                <li>
                    <a href="{{ url_for('masterclass.list_public') }}" class="nav-link px-2"
                        ><i class="bi bi-mortarboard" aria-hidden="true"></i> {{ _('Clases Magistrales') }}</a
                    >
                </li>
                {% endif %} {% if is_blog_enabled() %}
                <li>
                    <a href="{{ url_for('blog.blog_index') }}" class="nav-link px-2"
                        ><i class="bi bi-journal-text" aria-hidden="true"></i> Blog</a
                    >
                </li>
                {% endif %} {% if current_user.is_authenticated %} {% if current_user.tipo == "moderator" or current_user.tipo
                == "instructor" or current_user.tipo == "admin" %}
                <li>
                    <a href="{{ url_for('moderator_profile.pagina_moderador') }}" class="nav-link px-2"
                        ><i class="bi bi-card-checklist" aria-hidden="true"></i> {{ _('Moderación') }}</a
                    >
                </li>
                {% endif %} {% if current_user.tipo == "instructor" or current_user.tipo == "admin" %}
                <li>
                    <a href="{{ url_for('instructor_profile.pagina_instructor') }}" class="nav-link px-2"
                        ><i class="bi bi-bank2" aria-hidden="true"></i> {{ _('Docente') }}</a
                    >
                </li>
                {% endif %} {% if current_user.tipo == "admin" %}
                <li>
                    <a href="{{ url_for('admin_profile.pagina_admin') }}" class="nav-link px-2"
                        ><i class="bi bi-sliders" aria-hidden="true"></i> {{ _('Administración') }}</a
                    >
                </li>
                {% endif %} {% endif %}
            </ul>
            <div class="text-end">
                {% if not current_user.is_authenticated %}
                <a class="btn btn-oxford-primary me-2" href="{{ url_for('user.inicio_sesion') }}" role="button"
                    >{{ _('Iniciar Sesión') }}</a
                >
                <a class="btn btn-oxford-secondary me-2" href="{{ url_for('user.crear_cuenta') }}" role="button"
                    >{{ _('Crear Cuenta') }}</a
                >
                {% else %}
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a
                            class="text-decoration-none nav-link"
                            href="#"
                            role="button"
                            data-bs-toggle="dropdown"
                            data-bs-display="static"
                            aria-expanded="false"
                            style="font-weight: 600; color: var(--oxford-text-light) !important"
                            >{{ _('Bienvenido') }}: {{ current_user.nombre }} {{ current_user.apellido }}
                            <i class="bi bi-chevron-down" aria-hidden="true"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-menu-lg-end">
                            <li>
                                <a class="dropdown-item" href="{{ url_for('user_profile.perfil') }}">
                                    <i class="bi bi-person-circle" aria-hidden="true"></i> {{ _('Perfil de Usuario') }}</a
                                >
                            </li>
                            <li><a class="dropdown-item" href="#"> </a></li>
                            <li>
                                <hr class="dropdown-divider" />
                            </li>
                            <li>
                                <a
                                    class="dropdown-item text-decoration-none"
                                    href="#"
                                    data-bs-toggle="modal"
                                    data-bs-target="#exampleModal"
                                >
                                    <i class="bi bi-info-circle-fill" aria-hidden="true"></i> {{ _('Información') }}
                                </a>
                            </li>
                            <li>
                                <hr class="dropdown-divider" />
                            </li>
                            <li>
                                <a class="dropdown-item text-decoration-none" href="{{ url_for('user.cerrar_sesion') }}">
                                    <i class="bi bi-box-arrow-right" aria-hidden="true"></i> {{ _('Cerrar Sesión') }}
                                </a>
                            </li>
                        </ul>
                    </li>
                </ul>
                {% endif %}
            </div>
        </div>
    </div>
</nav>

{% if current_user.is_authenticated %}
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h1 class="modal-title fs-5" id="exampleModalLabel">
                    <i class="bi bi-building" aria-hidden="true"></i> Oxford - Learning Management System
                </h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <img
                    src="{{ url_for('static', filename='/icons/logo/logo_large.png') }}"
                    alt="NOW Learning Management System"
                />
                <br />
                <strong>{{ _('Versión') }}:</strong> {{ version }}
                <br />
                <strong>{{ _('Nombre de Lanzamiento') }}:</strong> {{ code_name }}
                <br />
                {% if current_user.tipo == "admin" %}
                <strong>Python:</strong> {{ pyversion }}
                <br />
                <strong>Database:</strong> {{ info["DBENGINE"] }}
                <br />
                <strong>Cache:</strong> {{ info["CACHE"] }} {% endif %}
            </div>
            <div class="modal-footer">
                <div class="d-flex justify-content-between w-100">
                    <div>
                        <img
                            width="75"
                            height="20"
                            src="{{ url_for('static', filename='/img/bmo-logo.png') }}"
                            alt="BMO Soluciones"
                        />
                    </div>
                    <div>
                        <a
                            href="https://now-lms-manual.readthedocs.io/en/latest/"
                            class="btn btn-oxford-primary btn-sm"
                            data-dismiss="modal"
                            ><i class="bi bi-book" aria-hidden="true"></i> {{ _('Manual de Usuario') }}</a
                        >
                        {% if current_user.tipo == "admin" %}
                        <a
                            href="https://bmosoluciones.github.io/now-lms/"
                            class="btn btn-oxford-secondary btn-sm"
                            data-dismiss="modal"
                            ><i class="bi bi-tools" aria-hidden="true"></i> {{ _('Manual de Administración') }}</a
                        >
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endif %} {% endmacro %}
