{% set route = app.request.get('_route') %}


{% if (isMobile() == false) %}
    <div data-controller="menu">
{% endif %}

{% if app.user %}

    <div class="login-menu">
        <span class="login-menu__name">
            <svg width="17" height="18" viewBox="0 0 17 18" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M6.58523 12.15H10.4148V10.85H6.58523V12.15ZM10.4148 12.15C11.7597 12.15 12.85 13.2403 12.85 14.5852H14.15C14.15 12.5223 12.4777 10.85 10.4148 10.85V12.15ZM6.58523 10.85C4.52232 10.85 2.85 12.5223 2.85 14.5852H4.15C4.15 13.2403 5.24029 12.15 6.58523 12.15V10.85ZM10.35 6.5C10.35 7.52173 9.52173 8.35 8.5 8.35V9.65C10.2397 9.65 11.65 8.2397 11.65 6.5H10.35ZM8.5 8.35C7.47827 8.35 6.65 7.52173 6.65 6.5H5.35C5.35 8.2397 6.7603 9.65 8.5 9.65V8.35ZM6.65 6.5C6.65 5.47827 7.47827 4.65 8.5 4.65V3.35C6.7603 3.35 5.35 4.7603 5.35 6.5H6.65ZM8.5 4.65C9.52173 4.65 10.35 5.47827 10.35 6.5H11.65C11.65 4.7603 10.2397 3.35 8.5 3.35V4.65ZM15.35 9C15.35 12.7832 12.2832 15.85 8.5 15.85V17.15C13.0011 17.15 16.65 13.5011 16.65 9H15.35ZM8.5 15.85C4.71685 15.85 1.65 12.7832 1.65 9H0.35C0.35 13.5011 3.99888 17.15 8.5 17.15V15.85ZM1.65 9C1.65 5.21685 4.71685 2.15 8.5 2.15V0.85C3.99888 0.85 0.35 4.49888 0.35 9H1.65ZM8.5 2.15C12.2832 2.15 15.35 5.21685 15.35 9H16.65C16.65 4.49888 13.0011 0.85 8.5 0.85V2.15Z" fill="white"/>
            </svg>
            <div id="fullName">
                {{ app.user.fullName }}
            </div>
        </span>

        {# window.webSDK.data.user.represents #}

        <div class="login-menu__wrap">

            <button class="login-menu__item btn" data-controller="changePatient">Выбор пациента</button>
            <a href="{{ path('security_setting') }}" class="login-menu__item">Редактировать профиль</a>
            <a href="#chengeRegion" class="login-menu__item" data-toggle="modal" data-target="#chengeRegion">Выбрать город</a>
            <a href="{{ path('security_logout') }}" class="login-menu__item signout" data-action="menu#signOut">Выйти</a>
        </div>
        <span class="login-menu__arrow"></span>
    </div>

{% endif %}


{% if (isMobile() == false) %}
    <div class="burger">
{% else %}
    <div class="burger" data-controller="menu">
{% endif %}

    <span></span>
    <span></span>
    <span></span>
</div>

<div class="mobile-menu">
    
    {% if app.user.fullName is not defined %}
        <nav class="menu">
            <a href="{{ path('security_login') }}" class="menu__item">Авторизация/регистрация</a>
        </nav>
    {% endif %}
    
    <nav class="menu">

        {% if is_granted('ROLE_ADMIN') %}
        <div class="dropdown show">
          <a class="menu__item dropdown-toggle" href="#" role="button" id="adminMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Панель администратора</a>

          <div class="dropdown-menu" aria-labelledby="adminMenu">
            <a class="dropdown-item" href="{{ path('department_index') }}">Редактировать отделения</a>
            <a class="dropdown-item" href="{{ path('app_review_source_index') }}">Редактировать отзывы</a>
            <a class="dropdown-item" href="{{ path('admin_banner_index') }}">Настроить баннеры</a>
            <a class="dropdown-item" href="{{ path('default_price_list') }}">Сравнение цен</a>
            <a class="dropdown-item" href="{{ path('widget_form_index') }}">Виджет формы</a>
            <a class="dropdown-item" href="{{ path('page_index') }}">Статьи</a>
          </div>
        </div>
        {% endif %}
        
        <a href="{{ path('security_card') }}" class="menu__item {{ route in ['security_card'] and app.request.get('tab') != 'allTest' ? 'active' }}">Медицинская карта</a>
        <a href="{{ path('security_card', {'tab': 'allTest'}) }}" class="menu__item {{ route in ['security_card'] and app.request.get('tab') == 'allTest' ? 'active' }}">Результаты анализов</a>
        <a href="{{ path('security_case_history') }}" class="menu__item {{ route in ['security_case_history'] ? 'active' }}">Приемы <span id="countRecord" class="count d-none">0</span></a>

        <a href="{{ path('specialist_index') }}" class="menu__item {{ route in ['specialist_index'] ? 'active' }}">Записаться к врачу</a>
        
        {% if is_granted('ROLE_USER') %}
            <a href="{{ path('specialist_online_index') }}" class="menu__item {{ route in ['specialist_online_index'] ? 'active' }}">Онлайн консультация</a>
        {% endif %}

        <a href="{{ path('security_payment') }}" class="menu__item {{ route in ['security_payment'] ? 'active' }}">Финансы 
            <span id="bonus-menu" class="count d-none">0</span>
        </a>
    </nav>
    <nav class="menu">
        {% if isShowInRegion([91,92,93]) %}
        <a href="{{ path('default_doc_your_home') }}" class="menu__item {{ route in ['default_doc_your_home'] ? 'active' }}">Вызов врача на дом</a>
        {% endif %}

        <a href="{{ path('default_info') }}" class="menu__item {{ route in ['default_info'] ? 'active' }}">Налоговый вычет</a>
        <a href="{{ path('default_price') }}" class="menu__item {{ route in ['default_price'] ? 'active' }}">Услуги и цены</a>
        <a href="{{ path('default_info') }}" class="menu__item {{ route in ['default_info'] ? 'active' }}">Информация</a>
        <a href="{{ path('default_help') }}" class="menu__item {{ route in ['default_help'] ? 'active' }}">Помощь</a>
        <a id="btn-callback-clinic" href="#" class="menu__item" >Позвонить в клинику</a>
    </nav>
</div>

{% if (isMobile() == false) %}
    </div>
{% endif %}
