src/Aqarmap/Bundle/MainBundle/Resources/views/Navbar/userControlMenu.html.twig line 1

Open in your IDE?
  1. {% set isLoggedin = is_granted("IS_AUTHENTICATED_REMEMBERED") %}
  2. {% set isUserActivityEnabled = isEnabledFeature('web.activity.app') %}
  3. {% set userId = null %}
  4. {% set isUserExist = isLoggedin and app.user %}
  5. {% set showDashboardSection = false   %}
  6. {% set showManagementSection = false   %}
  7. {% set userType = null %}
  8. {% if isUserExist %}
  9.     {% set userType = app.user.userType %}
  10.     {% set userId = 'ng::userInfo.id::' %}
  11.     {% set userCreatedAt = 'ng::userInfo.created_at::' %}
  12.     {% set isPersonalPhoto = 'ng::personal_photo::' %}
  13.     {% set isValidLogo = 'ng::is_valid_logo::' %}
  14.     {% set isValidPersonalPhoto = 'ng::is_valid_personal_photo::' %}
  15.     {% set showDashboardSection = userType in [
  16.         constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::COMPOUND_DEVELOPER'),
  17.         constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::SMALL_DEVELOPER'),
  18.         constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::BROKER')
  19.     ] ? true :false
  20.     %}
  21.     {% set hideManagemenetSection = userType == constant('Aqarmap\\Bundle\\UserBundle\\Constant\\UserTypes::BUYER')%}
  22. {% endif %}
  23. {% macro listElement(imageIcon, title, routeName, count = null, activityName = null, slugName = null, clickActionFunction = null) %}
  24.     {% set isLoggedin = is_granted("IS_AUTHENTICATED_REMEMBERED") %}
  25.     {% set isUserExist = isLoggedin and app.user %}
  26.     {% set isMobile = isMobileAgent(app.request.headers.get('User-Agent')) %}
  27.     {% set isActiveRouteName = app.request.get('_route') == routeName and app.request.get('step') == activityName %}
  28.     {% set isActiveSlugName = app.request.get('_route') == routeName and app.request.get('slug') == slugName %}
  29.     {% if activityName %}
  30.         {% set routeUrl = path(routeName, {'step': isMobile ? 'home' : activityName} ) %}
  31.         {% set activeClass = isActiveRouteName ? "active": "" %}
  32.     {% elseif slugName %}
  33.         {% set routeUrl = path(routeName, {'slug': slugName } ) %}
  34.         {% set activeClass = isActiveSlugName  ? "active": "" %}
  35.     {% else %}
  36.         {% set routeUrl = path(routeName)%}
  37.         {% set activeClass = app.request.get('_route') == routeName ? "active" : "" %}
  38.     {% endif %}
  39.     <a
  40.     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 %}>
  41.         <div class="menu-content__list-icon icon">
  42.             <img src=" {{ imageIcon }}"></img>
  43.         </div>
  44.         <p class="menu-content__list-label m-0">{{ title|trans }}</p>
  45.     </a>
  46.     {% if count %}
  47.         <span class="badge badge-blue badge-rounded simple-navbar__icon-btn_badge badge">{{ count }}</span>
  48.     {% endif %}
  49. {% endmacro %}
  50. <div class="menu-content menu-content__header ds-px_2x ds-py_3x" ng-init="showDashboardSection={{showDashboardSection}}">
  51.     {% if isLoggedin %}
  52.         <div class="d-flex mt-0 justify-content-between">
  53.             <div class="d-flex flex-column justify-content-center menu-content__info menu-content__info_w-65 p-0">
  54.                 <div class="menu-content__info-title menu-content__info-title_disable-hover">
  55.                         {{userName}}
  56.                 </div>
  57.                 <div
  58.                     class="menu-content__info-descritpion menu-content__info-descritpion_disable-hover">
  59.                     {{ 'user_control.joined'|trans({'%date%': userCreatedAt}) }}
  60.                 </div>
  61.             </div>
  62.             <a class="menu-content__edit-info" href="{{path('alias_my_account')}}">
  63.                 {{'user_settings.edit_profile'|trans}}
  64.             </a>
  65.         </div>
  66.     {% else %}
  67.         <h3 class="menu-content__title"> {{'user_control.login_intro'|trans}} </h3>
  68.         <p class="menu-content__text menu-content__header-text"> {{'user_control.description'|trans}} </p>
  69.         <a
  70.             id="te-login-button"
  71.             class="icon-btn simple-navbar__action-btn simple-navbar__action-btn_blue-btn"
  72.             href="{{ path('app_login') }}"
  73.             rel="nofollow"
  74.             >
  75.             {{ 'home_page.login'|trans }}
  76.         </a>
  77.         <a
  78.             id="te-login-button"
  79.             class="icon-btn simple-navbar__action-btn simple-navbar__action-btn_gray-btn"
  80.             href="{{ path('app_register') }}"
  81.             rel="nofollow">
  82.             {{ 'home_page.signup'|trans }}
  83.         </a>
  84.     {% endif %}
  85. </div>
  86. <div class="menu-content menu-content_pb-sm ds-px_2x ds-py_3x">
  87.     <label class="menu-content__text menu-content__text-style ds-mb_2x">{{'user_control.activity'|trans}}</label>
  88.     <ul class="simple-navbar__dropdown-menu_list" >
  89.         {% if isUserActivityEnabled and isEgyptSite %}
  90.             {% if isEnabledFeature('web.user.activity.favourite')%}
  91.                 <li>
  92.                     {{ _self.listElement(
  93.                     '/images/Navbar/UserMenu/ic_heart_strok.svg',
  94.                     'user_control.favorites'|trans,
  95.                     'user_activity',
  96.                     'ng::userFavouritesCount::',
  97.                     'favorites')}}
  98.                 </li>
  99.             {% endif %}
  100.             {% if isEnabledFeature('web.user.activity.note') %}
  101.                 <li>
  102.                     {{ _self.listElement(
  103.                         '/images/Navbar/UserMenu/ic_note.svg',
  104.                         'user_control.notes'|trans,
  105.                         'user_activity',
  106.                         'ng::userMotesCount::',
  107.                         'note')}}
  108.                 </li>
  109.             {% endif %}
  110.         {% endif %}
  111.         {% if isLoggedin %}
  112.             <li>
  113.                 {{ _self.listElement(
  114.                     '/images/Navbar/UserMenu/ic_bell_notifications.svg',
  115.                     'layout.my_notifications'|trans,
  116.                     'aqarmap_my_notifications',
  117.                     'ng::userNotificationCount::') }}
  118.             </li>
  119.             <li>
  120.                 {{ _self.listElement(
  121.                 '/images/Navbar/UserMenu/ic_bullet_list.svg',
  122.                 'layout.my_notifiers'|trans,
  123.                 'aqarmap_my_alerts') }}
  124.             </li>
  125.         {% endif %}
  126.     </ul>
  127. </div>
  128. {% if isLoggedin %}
  129.     {% if showDashboardSection %}
  130.         <div class="menu-content menu-content_pb-sm ds-px_2x ds-py_3x">
  131.             <div class="menu-content__dashboard">
  132.                 <div class="menu-content__dashboard-container ds-mb_2x">
  133.                     <img class="menu-content__dashboard-container__img" src="/images/Navbar/ic_dashboard.svg"></img>
  134.                     <div class="menu-content__dashboard-container__text">
  135.                         <h3 class="menu-content__dashboard-title"> {{'home_page.dashboard.title'|trans}} </h3>
  136.                         <p ng-if="hasValidAccessToLiveApp()" class="menu-content__dashboard-description"> {{'home_page.dashboard.description'|trans}} </p>
  137.                     </div>
  138.                 </div>
  139.                 <img ng-if="!hasValidAccessToLiveApp()" class="menu-content__dashboard__lock-img" src="/images/Navbar/ic_dashboard_lock.svg"></img>
  140.             </div>
  141.             <p  ng-if="!hasValidAccessToLiveApp()" class="menu-content__dashboard__recharge-text ds-mb_2x ds-px_x ds-py_x">
  142.                 {{ 'home_page.dashboard.recharge_message'|trans }}
  143.             </p>
  144.             <button
  145.                 id="te-login-button"
  146.                 class="btn-block icon-btn simple-navbar__action-btn simple-navbar__action-btn_blue-btn m-0"
  147.                 ng-disabled="!hasValidAccessToLiveApp()"
  148.                 onclick="window.location.href='{{ app.request.getSchemeAndHttpHost() }}/dashboard/'"
  149.                 rel="nofollow">
  150.                 {{ 'home_page.dashboard.button'|trans }}
  151.                 <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>
  152.             </button>
  153.         </div>
  154.     {% endif %}
  155.     {% if not hideManagemenetSection %}
  156.         <div class="menu-content ds-pt_3x ds-pb_2x ds-px_2x" >
  157.             <label class="menu-content__text menu-content__text-style ds-mb_1x"> {{'user_control.management'|trans}} </label>
  158.             <ul class="simple-navbar__dropdown-menu_list" >
  159.                 <li ng-show="showDashboardModules()" ng-cloak>
  160.                     {{ _self.listElement(
  161.                         '/images/Navbar/UserMenu/ic_listing.svg',
  162.                         'layout.my_listings.title'|trans,
  163.                         'aqarmap_listing_default_mylistings') }}
  164.                 </li>
  165.                 {% if get_setting('features', 'credit') or isEnabledFeature('web.my_credit')  or not showDashboardSection %}
  166.                     <li ng-show="showDashboardModules()" ng-cloak>
  167.                             {{ _self.listElement(
  168.                             '/images/Navbar/UserMenu/ic_credit_card.svg',
  169.                             'layout.my_credits'|trans,
  170.                             'aqarmap_credit') }}
  171.                     </li>
  172.                 {% endif %}
  173.                 <li>
  174.                     {% if get_setting('features', 'payments')%}
  175.                         {{ _self.listElement(
  176.                             '/images/Navbar/UserMenu/ic_contactless_card.svg',
  177.                             'credit.buy_credit'|trans ,
  178.                             'aqarmap_buy_credit') }}
  179.                         {% else %}
  180.                         {{ _self.listElement(
  181.                             '/images/Navbar/UserMenu/ic_contactless_card.svg',
  182.                             'credit.buy_credit'|trans ,
  183.                             'page_view', null , null , 'buy-credit') }}
  184.                     {% endif %}
  185.                 </li>
  186.             </ul>
  187.         </div>
  188.     {% endif %}
  189.     <div class="menu-content ds-py_2x ds-px_2x">
  190.         <ul class="simple-navbar__dropdown-menu_list" >
  191.             <li>
  192.                 <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">
  193.                     <div class="menu-content__list-icon icon">
  194.                         <img src="/images/Navbar/UserMenu/ic_sign_out.svg"></img>
  195.                     </div>
  196.                     <p class="menu-content__list-label m-0">{{ 'layout.logout'|trans }}</p>
  197.                 </a>
  198.             </li>
  199.         </ul>
  200.     </div>
  201. {% endif %}