<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}Dashboard{% endblock %}</title>
    <link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/toastr.min.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/bootstrap-icons-1.11.3/font/bootstrap-icons.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='css/styles.css') }}" rel="stylesheet">
    {# Блок для подключения дополнительных стилей на страницах #}
    {% block styles %}{% endblock %}
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container-fluid">
        <a class="navbar-brand">Dashboard</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
                aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
            {% if request.endpoint != 'auth.login' %}
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'dashboard.dashboard' %}active{% endif %}" href="{{ url_for('dashboard.dashboard') }}">Главная</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'dashboard.users_page' %}active{% endif %}" href="{{ url_for('dashboard.users_page') }}">Пользователи</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'dashboard.regions_page' %}active{% endif %}" href="{{ url_for('dashboard.regions_page') }}">Регионы и системы</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if request.endpoint == 'dashboard.logs_page' %}active{% endif %}" href="{{ url_for('dashboard.logs_page') }}">Логи</a>
                </li>
            {% endif %}
            </ul>
        </div>
        {% if request.endpoint != 'auth.login' %}
            <div class="d-flex justify-content-end">
            <span class="navbar-text me-3">
                {% if session['display_name'] %}
                    {{ session['display_name'] }}
                {% else %}
                    Пользователь
                {% endif %}
            </span>
                <a class="btn btn-outline-danger" href="{{ url_for('auth.logout') }}">Выход</a>
            </div>
        {% endif %}
    </div>
</nav>

<div class="container mt-4">
    {% block content %}{% endblock %}
</div>

{% block scripts %}
    <script src="{{ url_for('static', filename='js/jquery-3.6.0.js') }}"></script>
    <script src="{{ url_for('static', filename='js/bootstrap.bundle.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/toastr.min.js') }}"></script>
    <script src="{{ url_for('static', filename='js/utils.js') }}"></script>
{% endblock %}

</body>
</html>