{% set isLoggedin = is_granted("IS_AUTHENTICATED_REMEMBERED") %}
{% set isUserActivityEnabled = isEnabledFeature('web.activity.app') %}
{% set userId = null %}
{% set isUserExist = isLoggedin and app.user %}
{% set showDashboardSection = false %}
{% set showManagementSection = false %}
{% set userType = null %}
{% if isUserExist %}
{% set userType = app.user.userType %}
{% set userId = 'ng::userInfo.id::' %}
{% set userCreatedAt = 'ng::userInfo.created_at::' %}
{% set isPersonalPhoto = 'ng::personal_photo::' %}
{% set isValidLogo = 'ng::is_valid_logo::' %}
{% set isValidPersonalPhoto = 'ng::is_valid_personal_photo::' %}
{% set showDashboardSection = userType in [
constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::COMPOUND_DEVELOPER'),
constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::SMALL_DEVELOPER'),
constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::BROKER')
] ? true :false
%}
{% set hideManagemenetSection = userType == constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::BUYER')%}
{% endif %}
{% macro listElement(imageIcon, title, routeName, count = null, activityName = null, slugName = null, clickActionFunction = null) %}
{% set isLoggedin = is_granted("IS_AUTHENTICATED_REMEMBERED") %}
{% set isUserExist = isLoggedin and app.user %}
{% set isMobile = isMobileAgent(app.request.headers.get('User-Agent')) %}
{% set isActiveRouteName = app.request.get('_route') == routeName and app.request.get('step') == activityName %}
{% set isActiveSlugName = app.request.get('_route') == routeName and app.request.get('slug') == slugName %}
{% if activityName %}
{% set routeUrl = path(routeName, {'step': isMobile ? 'home' : activityName} ) %}
{% set activeClass = isActiveRouteName ? "active": "" %}
{% elseif slugName %}
{% set routeUrl = path(routeName, {'slug': slugName } ) %}
{% set activeClass = isActiveSlugName ? "active": "" %}
{% else %}
{% set routeUrl = path(routeName)%}
{% set activeClass = app.request.get('_route') == routeName ? "active" : "" %}
{% endif %}
<a
href="{{ isUserExist ? routeUrl : "" }}" class="icon-btn simple-navbar__icon-btn icon-btn_baby-blue-hover p-0 w-100 h-100 {{activeClass}}" {% if clickActionFunction %} ng-click="{{ clickActionFunction }}($event)" {% endif %}>
<div class="menu-content__list-icon icon">
<img src=" {{ imageIcon }}"></img>
</div>
<p class="menu-content__list-label m-0">{{ title|trans }}</p>
</a>
{% if count %}
<span class="badge badge-blue badge-rounded simple-navbar__icon-btn_badge badge">{{ count }}</span>
{% endif %}
{% endmacro %}
<div class="menu-content menu-content__header ds-px_2x ds-py_3x" ng-init="showDashboardSection={{showDashboardSection}}">
{% if isLoggedin %}
<div class="d-flex mt-0 justify-content-between">
<div class="d-flex flex-column justify-content-center menu-content__info menu-content__info_w-65 p-0">
<div class="menu-content__info-title menu-content__info-title_disable-hover">
{{userName}}
</div>
<div
class="menu-content__info-descritpion menu-content__info-descritpion_disable-hover">
{{ 'user_control.joined'|trans({'%date%': userCreatedAt}) }}
</div>
</div>
<a class="menu-content__edit-info" href="{{path('alias_my_account')}}">
{{'user_settings.edit_profile'|trans}}
</a>
</div>
{% else %}
<h3 class="menu-content__title"> {{'user_control.login_intro'|trans}} </h3>
<p class="menu-content__text menu-content__header-text"> {{'user_control.description'|trans}} </p>
<a
id="te-login-button"
class="icon-btn simple-navbar__action-btn simple-navbar__action-btn_blue-btn"
href="{{ path('app_login') }}"
rel="nofollow"
>
{{ 'home_page.login'|trans }}
</a>
<a
id="te-login-button"
class="icon-btn simple-navbar__action-btn simple-navbar__action-btn_gray-btn"
href="{{ path('app_register') }}"
rel="nofollow">
{{ 'home_page.signup'|trans }}
</a>
{% endif %}
</div>
<div class="menu-content menu-content_pb-sm ds-px_2x ds-py_3x">
<label class="menu-content__text menu-content__text-style ds-mb_2x">{{'user_control.activity'|trans}}</label>
<ul class="simple-navbar__dropdown-menu_list" >
{% if isUserActivityEnabled and isEgyptSite %}
{% if isEnabledFeature('web.user.activity.favourite')%}
<li>
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_heart_strok.svg',
'user_control.favorites'|trans,
'user_activity',
'ng::userFavouritesCount::',
'favorites')}}
</li>
{% endif %}
{% if isEnabledFeature('web.user.activity.note') %}
<li>
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_note.svg',
'user_control.notes'|trans,
'user_activity',
'ng::userMotesCount::',
'note')}}
</li>
{% endif %}
{% endif %}
{% if isLoggedin %}
<li>
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_bell_notifications.svg',
'layout.my_notifications'|trans,
'aqarmap_my_notifications',
'ng::userNotificationCount::') }}
</li>
<li>
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_bullet_list.svg',
'layout.my_notifiers'|trans,
'aqarmap_my_alerts') }}
</li>
{% endif %}
</ul>
</div>
{% if isLoggedin %}
{% if showDashboardSection %}
<div class="menu-content menu-content_pb-sm ds-px_2x ds-py_3x">
<div class="menu-content__dashboard">
<div class="menu-content__dashboard-container ds-mb_2x">
<img class="menu-content__dashboard-container__img" src="/images/Navbar/ic_dashboard.svg"></img>
<div class="menu-content__dashboard-container__text">
<h3 class="menu-content__dashboard-title"> {{'home_page.dashboard.title'|trans}} </h3>
<p ng-if="hasValidAccessToLiveApp()" class="menu-content__dashboard-description"> {{'home_page.dashboard.description'|trans}} </p>
</div>
</div>
<img ng-if="!hasValidAccessToLiveApp()" class="menu-content__dashboard__lock-img" src="/images/Navbar/ic_dashboard_lock.svg"></img>
</div>
<p ng-if="!hasValidAccessToLiveApp()" class="menu-content__dashboard__recharge-text ds-mb_2x ds-px_x ds-py_x">
{{ 'home_page.dashboard.recharge_message'|trans }}
</p>
<button
id="te-login-button"
class="btn-block icon-btn simple-navbar__action-btn simple-navbar__action-btn_blue-btn m-0"
ng-disabled="!hasValidAccessToLiveApp()"
onclick="window.location.href='{{ app.request.getSchemeAndHttpHost() }}/dashboard/'"
rel="nofollow">
{{ 'home_page.dashboard.button'|trans }}
<span ng-show="hasValidAccessToLiveApp()" class="home-image-container__header-wrapper_link_badge badge expo-badge simple-navbar__icon-btn_new-badge">{{ 'home_page.dashboard.new_badge'|trans }}</span>
</button>
</div>
{% endif %}
{% if not hideManagemenetSection %}
<div class="menu-content ds-pt_3x ds-pb_2x ds-px_2x" >
<label class="menu-content__text menu-content__text-style ds-mb_1x"> {{'user_control.management'|trans}} </label>
<ul class="simple-navbar__dropdown-menu_list" >
<li ng-show="showDashboardModules()" ng-cloak>
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_listing.svg',
'layout.my_listings.title'|trans,
'aqarmap_listing_default_mylistings') }}
</li>
{% if get_setting('features', 'credit') or isEnabledFeature('web.my_credit') or not showDashboardSection %}
<li ng-show="showDashboardModules()" ng-cloak>
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_credit_card.svg',
'layout.my_credits'|trans,
'aqarmap_credit') }}
</li>
{% endif %}
<li>
{% if get_setting('features', 'payments')%}
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_contactless_card.svg',
'credit.buy_credit'|trans ,
'aqarmap_buy_credit') }}
{% else %}
{{ _self.listElement(
'/images/Navbar/UserMenu/ic_contactless_card.svg',
'credit.buy_credit'|trans ,
'page_view', null , null , 'buy-credit') }}
{% endif %}
</li>
</ul>
</div>
{% endif %}
<div class="menu-content ds-py_2x ds-px_2x">
<ul class="simple-navbar__dropdown-menu_list" >
<li>
<a href="{{ oauth_logout_url ~ "?returnTo=" ~ url('app_logout') }}" class="icon-btn simple-navbar__icon-btn icon-btn_baby-blue-hover p-0 w-100 h-100">
<div class="menu-content__list-icon icon">
<img src="/images/Navbar/UserMenu/ic_sign_out.svg"></img>
</div>
<p class="menu-content__list-label m-0">{{ 'layout.logout'|trans }}</p>
</a>
</li>
</ul>
</div>
{% endif %}