{% from 'utils.html.twig' import ico, imgUpload %}
{% from "website/controls/notification-icon.html.twig" import notificon %}
<div class="topo" {% if productPage is defined %} data-page-height-top="{{ productPage.showShortageControlTime ? '1':'0' }}" {% endif %}>
<button class="btn-menu-mobile js--open-menu-mobile" data-menu-mobile-open="site">
<i class="fas fa-bars"></i>
</button>
{# LOGO #}
<div class="logo">
<a href="{{ path('home') }}">{{ imgUpload(getConfig('logo'), enum('AbstractEnum::PATH_OTHERS'), '', client.brand) }}</a>
</div>
{# MENU #}
<nav class="menu-links">
{% for menuItem in menu %}
{% if menuItem.show %}
{# DROPDOWN #}
{% if menuItem.dropdown|default(false) %}
<div class="dropdown custom-client-{{ menuItem.class }}">
<a><i class="fas fa-chevron-down seta"></i> {{ menuItem.text }}</a>
<ul class="dropdown-list">
{% for i, page in pages %}
{% if page.showType == 1 %}
{% if page.useExternalLink == 1 %}
<li><a href="{{ page.externalLink }}" target="_blank" title="{{ page.title }}">
<span>{{ page.title }}</span></a>
</li>
{% else %}
<li><a href="{{ path('pageDetail', { slug:page.slug }) }}" title="{{ page.title }}">
<span>{{ page.title }}</span></a>
</li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</div>
{# URL #}
{% else %}
<a href="{{ menuItem.link }}" class="custom-client-{{ menuItem.class }}">{{ menuItem.text }}</a>
{% endif %}
{% endif %}
{% endfor %}
{# SEARCH #}
{% if isDarkTheme and (not isRestricted or user) %}
<a class="js--search-open">BUSCA <i class="ico-busca">{{ ico('search') }}</i></a>
{#
<a class="js--search-open">BUSCA</a>
#}
{% endif %}
</nav>
{# LOGIN #}
{% if user is empty %}
<nav class="login">
<a href="{{ path('login') }}" class="logar">{{ getLanguage('sign_in', 'head') }}</a>
{% if not isRestricted %}
<a href="{{ path('register') }}" class="btn-login">{{ getLanguage('create_a_user', 'head') }}</a>
{% endif %}
</nav>
{% endif %}
{% if hasProducts and not isRestricted %}
{# MOBILE BUSCA #}
<button class="btn-busca-mobile js--open-busca-mobile">
<i class="fas fa-search"></i>
</button>
{# CART #}
<div class="contem-cart">
<a href="{{ path('cart') }}">
{{ notificon('cart', getUserCartNumber()) }}
</a>
</div>
{% endif %}
{# USER #}
{% if user %}
{# NOTIFICATIONS #}
{% include 'website/includes/submenu-notifications.html.twig' %}
{# USER ACTIONS #}
<div class="contem-user">
<div class="btn-menu js--context-menu" data-context-menu=".user-menu">
<i class="fas fa-chevron-down seta"></i>
<div class="avatar">
{{ ico('user') }}
{{ imgUpload(user.photo, enum('AbstractEnum::PATH_PROFILES'), 'user-profile') }}
</div>
</div>
<div class="user-menu context-menu">
<nav>
{# ACESSO COMO ADMIN #}
{% if canAccessAdm %}
<a href="{{ path('adminEad') }}">
<i class="fas fa-cogs"></i>
<span>{{ getLanguage('admin', 'menu') }}</span>
</a>
{% endif %}
{# ADMIN LOGOUT #}
{% if session is defined and session and session.userOrigin %}
<a href="{{ path('userLogoff') }}">
<i class="fas fa-cogs"></i>
<span>{{ getLanguage('back_as_admin', 'menu') }}</span>
</a>
{% endif %}
<a href="{{ path('enrollentList') }}" class="custom-client-enrollments">
<i class="fas fa-file-alt"></i>
<span>{{ getLanguage('enrollments', 'menu') }}</span>
</a>
<a href="{{ path('transactionList') }}" class="custom-client-purchases">
<i class="fas fa-shopping-bag"></i>
<span>{{ getLanguage('purchases', 'menu') }}</span>
</a>
{# SUBSCRIPTIONS #}
{% if isModuleActive("product_subscription_module") %}
<a href="{{ path('userSubscriptionList') }}" class="custom-client-subscriptions">
<i class="far fa-credit-card"></i>
<span>{{ getLanguage('subscriptions', 'menu') }}</span>
</a>
{% endif %}
<a href="{{ path('message') }}" class="custom-client-messages">
<i class="fas fa-envelope"></i>
<span>{{ getLanguage('messages', 'menu') }}</span>
</a>
<a href="{{ path('userProfile') }}" class="custom-client-edit_profile">
<i class="fas fa-cog"></i>
<span>{{ getLanguage('edit_profile', 'menu') }}</span>
</a>
<a href="{{ path('logoff') }}" class="custom-client-sign_out">
<i class="fas fa-sign-out-alt"></i>
<span>{{ getLanguage('sign_out', 'menu') }}</span>
</a>
</nav>
</div>
</div>
{% endif %}
</div>