{% load static %}
<div class="header_container">
    <header>
        <div class="header_row">
            <img src="{% static 'img/logo.jpg' %}" class="header_icon col-4">
            <ul class="nav nav-pills">
                {% with request.resolver_match.view_name as view_name %}
                <li class="nav-item">
                    <a class="nav-link {% if view_name == 'home:homepage' %} active {% endif %}"
                       href="{% url 'home:homepage' %}">Главная</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if view_name == 'films:main' %} active {% endif %}"
                       href="{% url 'films:main' %}">Фильмы</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link {% if view_name == 'time_table:main' %} active {% endif %}"
                       href="{% url 'time_table:main' %}">Расписание</a>
                </li>
                {% if user.is_authenticated %}
                <li class="nav-item">
                    <a class="nav-link {% if view_name == 'tickets:my_orders' %} active {% endif %}"
                       href="{% url 'tickets:my_orders' %}">Мои заказы</a>
                </li>
                {% endif %}
                {% endwith %}
            </ul>
        </div>
        <div class="auth_row">
            {% if user.is_authenticated %}
            <a class="user_link" href="{% url 'users:profile' %}">{{ user }}</a>
            <a class="user_link" href="{% url 'users:profile' %}">
                {% if user.profile.image %}
                <img src="{{ user.profile.image.url }}" class="header_icon col-4">
                {% else %}
                <img src="{% static 'img/user.png' %}" class="header_icon col-4">
                {% endif %}
            </a>
            {% if user.is_staff %}
            <a class="btn btn-primary" href="/admin">Админка</a>
            {% endif %}
            {% else %}
            <ul class="nav nav-pills">
                <li class="nav-item">
                    <a class="btn btn-primary" href="{% url 'users:signup' %}">Регистрация</a>
                </li>
                <li class="nav-item">
                    <a class="btn btn-secondary" href="{% url 'users:login' %}">Вход</a>
                </li>
            </ul>
            {% endif %}
        </div>
    </header>
</div>
<div class="header_hole"></div>