{% comment %}
Переиспользуемый компонент навигационной панели
Использование:
    {% include 'mainapp/components/_navbar.html' %}
{% endcomment %}

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container">
        <a class="navbar-brand" href="{% url 'mainapp:home' %}">Геолокация</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            {% if user.is_authenticated %}
            <ul class="navbar-nav me-auto">
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'mainapp:objitem_list' %}">Объекты</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'mainapp:actions' %}">Действия</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'mapsapp:3dmap' %}">3D карта</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'mapsapp:2dmap' %}">2D карта</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'admin:index' %}">Админ панель</a>
                </li>
            </ul>
            <ul class="navbar-nav">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown">
                        {% if user.first_name and user.last_name %}
                            {{ user.first_name }} {{ user.last_name }}
                        {% elif user.get_full_name %}
                            {{ user.get_full_name }}
                        {% else %}
                            {{ user.username }}
                        {% endif %}
                    </a>
                    <ul class="dropdown-menu dropdown-menu-end">
                        <li><a class="dropdown-item" href="{% url 'logout' %}">Выйти</a></li>
                    </ul>
                </li>
            </ul>
            {% else %}
            <ul class="navbar-nav ms-auto">
                <li class="nav-item">
                    <a class="nav-link" href="{% url 'login' %}">Войти</a>
                </li>
            </ul>
            {% endif %}
        </div>
    </div>
</nav>
