{% load static %}
<header>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <nav class="navbar navbar-light py-3" style="background-color: #113A60;">
    <a class="navbar-brand" href="{% url 'index' %}">
      <img src="{% static 'main/img/logo_real.png' %}" width="107" height="22" class="d-inline-block align-top" style="margin-left: 15px" alt="" loading="lazy">
      <t class="px-2" style="color:#FFFFFF">Access Controller</t>
    </a>
    {% if request.user.is_authenticated %}
      <div class="btn-group" role="group" aria-label="Basic example" style="margin-right: 9px">
        {% url 'profile' as profile_url %}
        <a {% if request.path == profile_url %}
            class="btn btn-primary"
          {% else %}
            class="btn btn-secondary"
          {% endif %}
        href="{{ profile_url }}">Профиль</a>
        {% if perms.main.has_control_access %}
        {% url 'control' as control_url %}
          <a {% if request.path == control_url %}
              class="btn btn-primary"
            {% else %}
              class="btn btn-secondary"
            {% endif %}
          href="{{ control_url }}">Управление</a>
          {% url 'statistic' as statistic_url %}
          <a {% if request.path == statistic_url %}
              class="btn btn-primary"
            {% else %}
              class="btn btn-secondary"
            {% endif %}
          href="{{ statistic_url }}">Статистика</a>
        {% else %}
          {% url 'work' request.user.id as work_url %}
          <a {% if request.path == work_url %}
              class="btn btn-primary"
            {% else %}
              class="btn btn-secondary"
            {% endif %}
          href="{{ work_url }}">Запрос прав</a>
        {% endif %}
        <a class="btn btn-secondary" href="{% url 'logout' %}">Выйти</a>
      </div>
    {% else %}
      <div class="btn-group" role="group" aria-label="Basic example" style="margin-right: 9px">
        {% url 'login' as login_url %}
        <a {% if request.path == login_url %}
            class="btn btn-primary"
          {% else %}
            class="btn btn-secondary"
          {% endif %}
        href="{{ login_url }}">Войти</a>
        {% url 'registration' as registration_url %}
        <a {% if request.path == registration_url %}
            class="btn btn-primary"
          {% else %}
            class="btn btn-secondary"
          {% endif %}
        href="{{ registration_url }}">Зарегистрироваться</a>
      </div>
    {% endif %}
  </nav>
</header>
