templates/page/_navbar_product.html.twig line 1

Open in your IDE?
  1. {% if is_mobile() %}
  2.     {# Version mobile #}
  3.     {# Flashlearning (affiché s'il existe dans clientProducts) #}
  4.     {% for clientProduct in clientProducts %}
  5.         {% if clientProduct.product.name == 'Flashlearning' %}
  6.             <li>
  7.                 <a id="flashlearning_navbar_product_link" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_flashlearning', {'slug': client.slug}) }}">
  8.                     <span lang="en">Event & FlashLearning</span>
  9.                 </a>
  10.             </li>
  11.         {% endif %}
  12.         
  13.         {# Défi de l'inclusion (pour user connecté) #}
  14.         {% if clientProduct.product.name == "Defi-inclusion" and app.user != null %}
  15.             {% if clientProduct.endAt|date("Y-m-d H:i:s") > "now"|date("Y-m-d H:i:s") and app.user.userProducts is empty %}
  16.                 <li>
  17.                     <a id="navbar_inclusion_defi" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_defi-inclusion', {'slug': client.slug}) }}">Défi de l'inclusion</a>
  18.                 </li>
  19.             {% elseif app.user != null and app.user.userProducts is not empty %}
  20.                 {% for userProduct in app.user.userProducts %}
  21.                     {% if userProduct.hasDone is same as true %}
  22.                         <li>
  23.                             <a id="navbar_inclusion_defi" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_inclusion_defi_quizz_ranking', {'id': clientProduct.id}) }}">Défi de l'inclusion</a>
  24.                         </li>
  25.                     {% else %}
  26.                         <li>
  27.                             <a id="navbar_inclusion_defi" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_defi-inclusion', {'slug': client.slug}) }}">Défi de l'inclusion</a>
  28.                         </li>
  29.                     {% endif %}
  30.                 {% endfor %}
  31.             {% endif %}
  32.         {% endif %}
  33.     {% endfor %}
  34.     {# Lien Diagnostic, affiché si diagTools est true (le texte varie selon le nombre de produits) #}
  35.     {% if diagTools %}
  36.         {% if clientProductsCount > 1 %}
  37.             <li>
  38.                 <a id="navbar_diag_tools" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_diag_tools', {'slug': client.slug}) }}">Outils Diagnostic</a>
  39.             </li>
  40.         {% else %}
  41.             <li>
  42.                 <a id="navbar_diag_tools" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_diag_tools', {'slug': client.slug}) }}">Outil Diagnostic</a>
  43.             </li>
  44.         {% endif %}
  45.     {% endif %}
  46.     {# Mon agenda (pour user connecté et Flashlearning) #}
  47.     {% for clientProduct in clientProducts %}
  48.         {% if clientProduct.product.slug == 'flashlearning' and is_granted('ROLE_USER') %}
  49.             <li>
  50.                 <a id="navbar_my_agenda" class="d-block text-decoration-none text-graphite m-text" href="{{ path('app_my_agenda') }}">Mon agenda</a>
  51.             </li>
  52.         {% endif %}
  53.     {% endfor %}
  54. {% else %}
  55.     {# Version Desktop #}
  56.     <nav id="product-navbar" role="navigation">
  57.         <ul class="text-graphite d-flex justify-content-center align-items-end h-100">
  58.             {# Si tabToHide est false, afficher le lien Accueil #}
  59.             {% if not tabToHide %}
  60.                 <li>
  61.                     <a id="homepage_navbar_product_link" class="d-block text-decoration-none text-graphite navbar-product-link work-sans-semi-bold m-text" href="{{ path('app_main', {'clientSlug': client.slug}) }}">Accueil</a>
  62.                 </li>
  63.             {% endif %}
  64.             {# Flashlearning #}
  65.             {% for clientProduct in clientProducts %}
  66.                 {% if clientProduct.product.name == 'Flashlearning' %}
  67.                     <li>
  68.                         <a id="flashlearning_navbar_product_link" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_flashlearning', {'slug': client.slug}) }}">
  69.                             <span lang="en">Event & FlashLearning</span>
  70.                         </a>
  71.                     </li>
  72.                 {% endif %}
  73.                 
  74.                 {# Défi de l'inclusion (pour user connecté et si le produit est actif) #}
  75.                 {% if clientProduct.product.name == "Defi-inclusion" and app.user != null and clientProduct.isActive %}
  76.                     {% if clientProduct.endAt|date("Y-m-d H:i:s") > "now"|date("Y-m-d H:i:s") and app.user.userProducts is empty %}
  77.                         <li>
  78.                             <a id="navbar_inclusion_defi" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_defi-inclusion', {'slug': client.slug}) }}">Défi de l'inclusion</a>
  79.                         </li>
  80.                     {% elseif app.user != null and app.user.userProducts is not empty %}
  81.                         {% for userProduct in app.user.userProducts %}
  82.                             {% if userProduct.hasDone is same as true and userProduct.createdAt|date("Y") == "now"|date("Y") %}
  83.                                 <li>
  84.                                     <a id="navbar_inclusion_defi" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_inclusion_defi_quizz_ranking', {'id': clientProduct.id}) }}">Défi de l'inclusion</a>
  85.                                 </li>
  86.                             {% elseif userProduct.hasDone is same as false %}
  87.                                 <li>
  88.                                     <a id="navbar_inclusion_defi" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_defi-inclusion', {'slug': client.slug}) }}">Défi de l'inclusion</a>
  89.                                 </li>
  90.                             {% endif %}
  91.                         {% endfor %}
  92.                     {% endif %}
  93.                 {% endif %}
  94.             {% endfor %}
  95.             {# Lien Diagnostic #}
  96.             {% if diagTools %}
  97.                 {% if clientProductsCount > 1 %}
  98.                     <li>
  99.                         <a id="navbar_diag_tools" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_diag_tools', {'slug': client.slug}) }}">Outils diagnostic</a>
  100.                     </li>
  101.                 {% else %}
  102.                     <li>
  103.                         <a id="navbar_diag_tools" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_diag_tools', {'slug': client.slug}) }}">Outil diagnostic</a>
  104.                     </li>
  105.                 {% endif %}
  106.             {% endif %}
  107.             {# Mon agenda #}
  108.             {% for clientProduct in clientProducts %}
  109.                 {% if clientProduct.product.slug == 'flashlearning' and is_granted('ROLE_USER') %}
  110.                     <li>
  111.                         <a id="navbar_my_agenda" class="d-block text-decoration-none text-graphite navbar-product-link ms-4 work-sans-semi-bold m-text" href="{{ path('app_my_agenda') }}">Mon agenda</a>
  112.                     </li>
  113.                 {% endif %}
  114.             {% endfor %}
  115.         </ul>
  116.     </nav>
  117. {% endif %}