templates/sidebar.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block stylesheets %}
  3.     <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
  4. {% endblock %}
  5. {% block body %}
  6.     <link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
  7.     <div class="flex h-screen bg-white">
  8.         <!-- Sidebar -->
  9.         <div class="sidebar">
  10.             <div class="logo_content">
  11.                 <div class="logo">
  12.                     <div class="logo_name">Administration</div>
  13.                 </div>
  14.                 <i class="bx bx-menu" id="btn"></i>
  15.             </div>
  16.             <ul class="nav_list">
  17.                 {% if is_granted('ROLE_SUPER_ADMIN') %}
  18.                     <li>
  19.                         <a href="{{ path('app_dashboard') }}">
  20.                             <i class="bx bx-grid-alt"></i>
  21.                             <span class="links_name">Dashboard</span>
  22.                         </a>
  23.                         <span class="tooltip">Dashboard</span>
  24.                     </li>
  25.                 {% endif %}
  26.                 <li>
  27.                     <a href="{{ path('app_client_admin') }}">
  28.                         <i class="bx bx-user"></i>
  29.                         <span class="links_name">Clients</span>
  30.                     </a>
  31.                     <span class="tooltip">Clients</span>
  32.                 </li>
  33.                 <li>
  34.                     <a href="{{ path('app_ticket_gratter') }}">
  35.                         <i class="bx bx-gift"></i>
  36.                         <span class="links_name">Ticket à gratter</span>
  37.                     </a>
  38.                     <span class="tooltip">Ticket à gratter</span>
  39.                 </li>
  40.                 <li class="has-submenu">
  41.                     <a href="#">
  42.                         <i class="bx bx-calculator"></i>
  43.                         <span class="links_name">Recette</span>
  44.                     </a>
  45.                     <span class="tooltip">Recette</span>
  46.                     <ul class="submenu">
  47.                         <li>
  48.                             <a href="{{ path('app_recette') }}">
  49.                                 <i class="bx bx-calculator"></i>
  50.                                 <span>Recette</span>
  51.                             </a>
  52.                         </li>
  53.                         <li>
  54.                             <a href="{{ path('app_prestation_index') }}">
  55.                                 <i class="bx bx-list-ul"></i>
  56.                                 <span>Liste des prestations</span>
  57.                             </a>
  58.                         </li>
  59.                     </ul>
  60.                 </li>
  61.                 <li class="has-submenu">
  62.                     <a href="#">
  63.                         <i class="bx bxl-instagram"></i>
  64.                         <span class="links_name">Instagram</span>
  65.                     </a>
  66.                     <span class="tooltip">Instagram</span>
  67.                     <ul class="submenu">
  68.                         <li>
  69.                             <a href="{{ path('app_instagram_upload') }}">
  70.                                 <i class="bx bx-upload"></i>
  71.                                 <span>Créer une story</span>
  72.                             </a>
  73.                         </li>
  74.                         <li>
  75.                             <a href="{{ path('app_instagram_post') }}">
  76.                                 <i class="bx bx-image-add"></i>
  77.                                 <span>Importer images</span>
  78.                             </a>
  79.                         </li>
  80.                         <li>
  81.                             <a href="{{ path('image_creator') }}">
  82.                                 <i class="bx bx-palette"></i>
  83.                                 <span>Type de publication</span>
  84.                             </a>
  85.                         </li>
  86.                         <li>
  87.                             <a href="{{ path('app_instagram_bot_message') }}">
  88.                                 <i class="bx bx-message-rounded-dots"></i>
  89.                                 <span>Message Automatique</span>
  90.                             </a>
  91.                         </li>
  92.                         <li>
  93.                             <a href="{{ path('app_instagram_post') }}">
  94.                                 <i class="bx bx-cog"></i>
  95.                                 <span>Réglages</span>
  96.                             </a>
  97.                         </li>
  98.                     </ul>
  99.                 </li>
  100.                 <li class="has-submenu">
  101.                     <a href="#">
  102.                         <i class="bx bx-broadcast"></i>
  103.                         <span class="links_name">Marketing</span>
  104.                     </a>
  105.                     <span class="tooltip">Marketing</span>
  106.                     <ul class="submenu">
  107.                         <li>
  108.                             <a href="{{ path('app_notification_apple_wallet') }}">
  109.                                 <i class="bx bxl-apple"></i>
  110.                                 <span>Notifications iOS</span>
  111.                             </a>
  112.                         </li>
  113.                         <li>
  114.                             <a href="{{ path('app_review_request') }}">
  115.                                 <i class="bx bx-star"></i>
  116.                                 <span>Avis Google</span>
  117.                             </a>
  118.                         </li>
  119.                     </ul>
  120.                 </li>
  121.                 <li>
  122.                     <a href="#">
  123.                         <i class="bx bx-folder"></i>
  124.                         <span class="links_name">Document</span>
  125.                     </a>
  126.                     <span class="tooltip">Document</span>
  127.                 </li>
  128.                 <li>
  129.                     <a href="#">
  130.                         <i class="bx bx-heart"></i>
  131.                         <span class="links_name">Saved</span>
  132.                     </a>
  133.                     <span class="tooltip">Saved</span>
  134.                 </li>
  135.                 <li>
  136.                     <a href="#">
  137.                         <i class="bx bx-cog"></i>
  138.                         <span class="links_name">Settings</span>
  139.                     </a>
  140.                     <span class="tooltip">Settings</span>
  141.                 </li>
  142.             </ul>
  143.             <div class="profile_content">
  144.                 <div class="profile">
  145.                     <div class="profile_details">
  146.                         {% set initials = app.user.firstname|slice(0, 1) ~ app.user.lastname|slice(0, 1) %}
  147.                         <div class="avatar">{{ initials }}</div>
  148.                         <div class="name_job">
  149.                             <div class="name">{{ app.user.firstname }} {{ app.user.lastname }}</div>
  150.                             <div class="job">Administrateur</div>
  151.                         </div>
  152.                     </div>
  153.                     <a href="{{ path('app_logout') }}">
  154.                         <i class="bx bx-log-out" id="log_out"></i>
  155.                     </a>
  156.                 </div>
  157.             </div>
  158.         </div>
  159.         <!-- Main Content -->
  160.         <div class="home_content">
  161.             <header class="flex items-center justify-between h-16 px-4 bg-white border-b mobile-header">
  162.                 <button class="text-gray-500 focus:outline-none lg:hidden" id="menu-toggle">
  163.                     <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  164.                         <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
  165.                     </svg>
  166.                 </button>
  167.                 <div class="flex items-center space-x-4">
  168.                     <nav class="flex mobile-breadcrumb" aria-label="Breadcrumb">
  169.                         {% block breadcrumb %}
  170.                             {{ generate_breadcrumb(app.request.attributes.get('_route'))|raw }}
  171.                         {% endblock %}
  172.                     </nav>
  173.                 </div>
  174.             </header>
  175.             <div class="container mx-auto px-4">
  176.                 <div class="mb-6 mt-4">
  177.                     <h2 class="text-3xl font-bold flex items-center"><span class="mr-2">{% block page_emoji %}{% endblock %}</span> {% block page_titre %}{% endblock %}</h2>
  178.                     <p class="text-gray-600 mb-1">{% block page_info %} {% endblock %}</p> <!-- Réduire la marge inférieure -->
  179.                 </div>
  180.             </div>
  181.             <main class="flex-grow w-full">
  182.                 <div class="px-2">
  183.                     {% block admin_content %}
  184.                     {% endblock %}
  185.                 </div>
  186.             </main>
  187.         </div>
  188.     </div>
  189.     <style>
  190.         :root {
  191.             --navbar-height: 64px; /* Ajustez cette valeur en fonction de la hauteur de votre navbar */
  192.         }
  193.         body, html {
  194.             height: 100%;
  195.             margin: 0;
  196.             padding: 0;
  197.         }
  198.         .sidebar {
  199.             position: absolute;
  200.             top: var(--navbar-height);
  201.             left: 0;
  202.             height: calc(100% - var(--navbar-height));
  203.             width: 78px;
  204.             background: #181818;
  205.             padding: 6px 14px;
  206.             transition: all 0.5s ease;
  207.             z-index: 999; /* Assurez-vous que la sidebar est en dessous de la navbar */
  208.         }
  209.         .sidebar.active {
  210.             width: 240px;
  211.         }
  212.         .sidebar.fixed {
  213.             position: fixed;
  214.             top: 0;
  215.             height: 100%;
  216.         }
  217.         .sidebar .logo_content .logo {
  218.             color: #ffffff;
  219.             height: 50px;
  220.             width: 100%;
  221.             display: flex;
  222.             align-items: center;
  223.             opacity: 0;
  224.             pointer-events: none;
  225.             transition: all 0.5s ease;
  226.         }
  227.         .sidebar.active .logo_content .logo {
  228.             opacity: 1;
  229.         }
  230.         .logo_content .logo i {
  231.             font-size: 28px;
  232.             margin-right: 5px;
  233.         }
  234.         .logo_content .logo .logo_name {
  235.             font-size: 20px;
  236.             font-weight: 400;
  237.         }
  238.         .sidebar #btn {
  239.             position: absolute;
  240.             color: #ffffff;
  241.             left: 50%;
  242.             top: 6px;
  243.             font-size: 20px;
  244.             height: 50px;
  245.             width: 50px;
  246.             text-align: center;
  247.             line-height: 50px;
  248.             transform: translateX(-50%);
  249.         }
  250.         .sidebar.active #btn {
  251.             left: 90%;
  252.         }
  253.         .sidebar ul {
  254.             margin-top: 20px;
  255.         }
  256.         .sidebar ul li {
  257.             position: relative;
  258.             height: 50px;
  259.             width: 100%;
  260.             margin: 0 5px;
  261.             list-style: none;
  262.             line-height: 50px;
  263.         }
  264.         .sidebar ul li .tooltip {
  265.             position: absolute;
  266.             left: 122px;
  267.             top: 0;
  268.             transform: translate(-50%, -50%);
  269.             border-radius: 6px;
  270.             height: 35px;
  271.             width: 122px;
  272.             background: #ffffff;
  273.             line-height: 35px;
  274.             text-align: center;
  275.             box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
  276.             transition: 0s;
  277.             opacity: 0;
  278.             pointer-events: none;
  279.             display: block;
  280.         }
  281.         .sidebar.active ul li .tooltip {
  282.             display: none;
  283.         }
  284.         .sidebar ul li:hover .tooltip {
  285.             transition: all 0.5s ease;
  286.             opacity: 1;
  287.             top: 50%;
  288.         }
  289.         .sidebar ul li a {
  290.             color: #ffffff;
  291.             display: flex;
  292.             align-items: center;
  293.             text-decoration: none;
  294.             border-radius: 12px;
  295.             transition: all 0.4s ease;
  296.             white-space: nowrap;
  297.         }
  298.         .sidebar ul li a:hover {
  299.             color: #181818;
  300.             background: #333333;
  301.         }
  302.         .sidebar ul li i {
  303.             height: 50px;
  304.             min-width: 50px;
  305.             border-radius: 12px;
  306.             line-height: 50px;
  307.             text-align: center;
  308.         }
  309.         .sidebar .links_name {
  310.             opacity: 0;
  311.             pointer-events: none;
  312.             transition: all 0.5s ease;
  313.         }
  314.         .sidebar.active .links_name {
  315.             opacity: 1;
  316.             pointer-events: auto;
  317.         }
  318.         .sidebar .profile_content {
  319.             position: absolute;
  320.             color: #ffffff;
  321.             bottom: 0;
  322.             left: 0;
  323.             width: 100%;
  324.         }
  325.         .sidebar .profile_content .profile {
  326.             position: relative;
  327.             padding: 10px 6px;
  328.             height: 60px;
  329.             background: none;
  330.             transition: all 0.5s ease;
  331.         }
  332.         .sidebar.active .profile_content .profile {
  333.             background: #282828;
  334.         }
  335.         .profile_content .profile .profile_details {
  336.             display: flex;
  337.             align-items: center;
  338.             opacity: 0;
  339.             pointer-events: none;
  340.             white-space: nowrap;
  341.         }
  342.         .sidebar.active .profile .profile_details {
  343.             opacity: 1;
  344.             pointer-events: auto;
  345.         }
  346.         .profile .profile_details img {
  347.             height: 45px;
  348.             width: 45px;
  349.             object-fit: cover;
  350.         : 12px;
  351.         }
  352.         .profile .profile_details .name_job {
  353.             margin-left: 10px;
  354.         }
  355.         .profile .profile_details .name {
  356.             font-size: 15px;
  357.             font-weight: 400;
  358.         }
  359.         .profile .profile_details .job {
  360.             font-size: 12px;
  361.         }
  362.         .profile #log_out {
  363.             position: absolute;
  364.             left: 50%;
  365.             bottom: 5px;
  366.             transform: translateX(-50%);
  367.             min-width: 50px;
  368.             line-height: 50px;
  369.             font-size: 20px;
  370.             border-radius: 12px;
  371.             text-align: center;
  372.             transition: all 0.5s ease;
  373.             background: #282828;
  374.         }
  375.         .sidebar.active .profile #log_out {
  376.             left: 88%;
  377.         }
  378.         .sidebar.active .profile #log_out {
  379.             background: none;
  380.         }
  381.         .home_content {
  382.             position: absolute;
  383.             height: calc(100% - var(--navbar-height)); /* Ajustez cette valeur en fonction de la hauteur de votre navbar */
  384.             width: calc(100% - 78px);
  385.             left: 78px;
  386.             top: var(--navbar-height); /* Ajustez cette valeur en fonction de la hauteur de votre navbar */
  387.             transition: all 0.5s ease;
  388.         }
  389.         .home_content .text {
  390.             font-size: 25px;
  391.             font-weight: 500;
  392.             color: #1d1b31;
  393.             margin: 12px;
  394.         }
  395.         .sidebar.active ~ .home_content {
  396.             width: calc(100% - 240px);
  397.             left: 240px;
  398.         }
  399.         .breadcrumb {
  400.             list-style: none; /* Supprime les puces par défaut */
  401.             padding: 0; /* Supprime le padding par défaut */
  402.             margin: 0; /* Supprime la marge par défaut */
  403.             background: none; /* Supprime le fond par défaut */
  404.             display: flex; /* Utilise flexbox pour aligner les éléments en ligne */
  405.             flex-wrap: nowrap; /* Empêche le retour à la ligne */
  406.             overflow-x: auto; /* Ajoute un défilement horizontal si nécessaire */
  407.         }
  408.         .breadcrumb li {
  409.             display: inline-flex; /* Assure que les éléments sont alignés horizontalement */
  410.             align-items: center; /* Centre verticalement les éléments */
  411.             margin-right: 0.5rem; /* Ajoute un espace après les éléments */
  412.         }
  413.         .breadcrumb li a {
  414.             text-decoration: none; /* Supprime la décoration de texte par défaut */
  415.             color: inherit; /* Utilise la couleur de texte héritée */
  416.             transition: color 0.3s; /* Ajoute une transition pour le hover */
  417.         }
  418.         .breadcrumb li a:hover {
  419.             color: #ae885a; /* Couleur de texte au survol */
  420.         }
  421.         .breadcrumb li svg {
  422.             margin-right: 0.5rem; /* Ajoute un espace après les icônes */
  423.         }
  424.         .avatar {
  425.             width: 45px;
  426.             height: 45px;
  427.             border-radius: 50%;
  428.             background-color: #333;
  429.             color: #fff;
  430.             display: flex;
  431.             align-items: center;
  432.             justify-content: center;
  433.             font-size: 1.2rem;
  434.             font-weight: bold;
  435.         }
  436.         .profile_details {
  437.             display: flex;
  438.             align-items: center;
  439.         }
  440.         .name_job {
  441.             margin-left: 10px;
  442.         }
  443.         .name {
  444.             font-size: 15px;
  445.             font-weight: 400;
  446.         }
  447.         .job {
  448.             font-size: 12px;
  449.         }
  450.         @media (max-width: 768px) {
  451.             .sidebar {
  452.                 width: 240px;
  453.                 left: -240px;
  454.                 top: auto !important;
  455.                 height: calc(100% - var(--navbar-height)); /* Ajustez cette valeur en fonction de la hauteur de votre navbar */
  456.                 transition: all 0.3s ease;
  457.                 position: fixed; /* Ajoutez cette ligne */
  458.             }
  459.             .sidebar.active {
  460.                 left: 0;
  461.             }
  462.             .home_content {
  463.                 width: 100%;
  464.                 left: 0;
  465.                 transition: all 0.3s ease;
  466.             }
  467.             .sidebar.active ~ .home_content {
  468.                 left: 240px;
  469.                 width: calc(100% - 240px);
  470.             }
  471.             .sidebar #btn {
  472.                 display: none;
  473.             }
  474.             .mobile-header {
  475.                 margin-top: -40px;
  476.             }
  477.             .breadcrumb {
  478.                 font-size: 0.8rem; /* Réduire la taille de la police */
  479.             }
  480.             .breadcrumb li {
  481.                 margin-right: 0.3rem; /* Réduire les marges entre les éléments */
  482.             }
  483.             .breadcrumb li svg {
  484.                 width: 0.6rem; /* Réduire la taille des icônes */
  485.                 height: 0.6rem;
  486.             }
  487.         }
  488.         /* Remplacez votre media query iPad actuelle par celle-ci */
  489.         @media (min-width: 769px) and (max-width: 1024px) {
  490.             .mobile-header #menu-toggle {
  491.                 display: none;
  492.             }
  493.             .sidebar {
  494.                 width: 78px; /* Commence fermée */
  495.                 left: 0;
  496.                 top: var(--navbar-height);
  497.                 height: calc(100% - var(--navbar-height));
  498.                 transition: all 0.3s ease;
  499.             }
  500.             .sidebar.active {
  501.                 width: 240px; /* S'ouvre au clic */
  502.             }
  503.             .sidebar .links_name {
  504.                 opacity: 0;
  505.             }
  506.             .sidebar.active .links_name {
  507.                 opacity: 1;
  508.             }
  509.             .home_content {
  510.                 width: calc(100% - 78px);
  511.                 left: 78px;
  512.                 transition: all 0.3s ease;
  513.             }
  514.             .sidebar.active ~ .home_content {
  515.                 width: calc(100% - 240px);
  516.                 left: 240px;
  517.             }
  518.             .sidebar #btn {
  519.                 display: block; /* Afficher le bouton sur iPad */
  520.             }
  521.             /* Gestion du profil */
  522.             .profile_content .profile .profile_details {
  523.                 opacity: 0;
  524.             }
  525.             .sidebar.active .profile_content .profile .profile_details {
  526.                 opacity: 1;
  527.             }
  528.         }
  529.         @media (min-width: 769px) and (max-width: 1024px) {
  530.             .sidebar:not(.active) ul li.has-submenu > a::after {
  531.                 display: none;
  532.             }
  533.             .sidebar:not(.active) ul li .submenu {
  534.                 position: absolute;
  535.                 left: 78px;
  536.                 background: #181818;
  537.                 width: 200px;
  538.                 padding: 10px;
  539.                 border-radius: 0 6px 6px 0;
  540.                 display: none;
  541.             }
  542.             .sidebar:not(.active) ul li.has-submenu.open .submenu {
  543.                 display: block;
  544.             }
  545.             .sidebar.active ul li .submenu {
  546.                 left: 240px;
  547.             }
  548.         }
  549.         .sidebar ul li.has-submenu > a::after {
  550.             content: '\25B6';
  551.             position: absolute;
  552.             right: 20px;
  553.             transition: transform 0.3s;
  554.             display: none; /* Masquer la flèche par défaut */
  555.         }
  556.         .sidebar.active ul li.has-submenu > a::after {
  557.             display: inline-block; /* Afficher la flèche lorsque la barre latérale est ouverte */
  558.         }
  559.         .sidebar ul li.has-submenu.open > a::after {
  560.             transform: rotate(90deg);
  561.         }
  562.         .sidebar ul li .submenu {
  563.             display: none;
  564.             padding-left: 20px;
  565.         }
  566.         .sidebar ul li.open .submenu {
  567.             display: block;
  568.         }
  569.         .sidebar.active ul li .submenu {
  570.             position: absolute;
  571.             left: 100%;
  572.             top: 0;
  573.             background: #181818;
  574.             width: 200px;
  575.             padding: 10px;
  576.             border-radius: 0 6px 6px 0;
  577.         }
  578.         .sidebar.active ul li .submenu li {
  579.             background: none;
  580.             padding: 6px 0;
  581.         }
  582.         .sidebar:not(.active) ul li.has-submenu.open .submenu {
  583.             position: absolute;
  584.             left: 78px;
  585.             top: 0;
  586.             background: #181818;
  587.             width: 200px;
  588.             padding: 10px;
  589.             border-radius: 0 6px 6px 0;
  590.             z-index: 1000;
  591.         }
  592.         .sidebar:not(.active) ul li.has-submenu.open .submenu li {
  593.             height: auto;
  594.             padding: 6px 0;
  595.         }
  596.         .sidebar:not(.active) ul li.has-submenu.open .submenu li a {
  597.             padding-left: 10px;
  598.         }
  599.         .sidebar ul li.has-submenu.open .tooltip {
  600.             display: none;
  601.         }
  602.         .sidebar.active ul li .submenu {
  603.             position: absolute;
  604.             left: 100%;
  605.             top: 0;
  606.             background: #181818;
  607.             width: 200px;
  608.             padding: 10px;
  609.             border-radius: 0 6px 6px 0;
  610.             margin-left: -14px; /* Ajoutez cette ligne pour coller le sous-menu à la sidebar */
  611.         }
  612.         .sidebar:not(.active) ul li.has-submenu.open .submenu {
  613.             position: absolute;
  614.             left: 64px; /* Ajustez cette valeur pour coller le sous-menu à la sidebar fermée */
  615.             top: 0;
  616.             background: #181818;
  617.             width: 200px;
  618.             padding: 10px;
  619.             border-radius: 0 6px 6px 0;
  620.             z-index: 1000;
  621.         }
  622.         .sidebar ul li .submenu li a {
  623.             white-space: nowrap;
  624.             overflow: hidden;
  625.             text-overflow: ellipsis;
  626.             display: block;
  627.             padding: 5px 10px;
  628.         }
  629.         .sidebar:not(.active) ul li.has-submenu.open .submenu li a {
  630.             padding-left: 10px;
  631.         }
  632.         .sidebar.active ul li .submenu,
  633.         .sidebar:not(.active) ul li.has-submenu.open .submenu {
  634.             width: auto;
  635.             min-width: 200px;
  636.             max-width: 250px;
  637.         }
  638.     </style>
  639.     <script>
  640.         document.addEventListener('DOMContentLoaded', function () {
  641.             let sidebar = document.querySelector('.sidebar');
  642.             let navbarHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--navbar-height'), 10);
  643.             let btn = document.querySelector('#btn');
  644.             let menuToggle = document.querySelector('#menu-toggle');
  645.             // Gestion du scroll
  646.             window.addEventListener('scroll', function () {
  647.                 if (window.scrollY > navbarHeight) {
  648.                     sidebar.classList.add('fixed');
  649.                     sidebar.style.top = '0';
  650.                 } else {
  651.                     sidebar.classList.remove('fixed');
  652.                     sidebar.style.top = `var(--navbar-height)`;
  653.                 }
  654.             });
  655.             // Gestion des boutons de menu
  656.             btn.addEventListener('click', () => {
  657.                 sidebar.classList.toggle('active');
  658.             });
  659.             menuToggle.addEventListener('click', () => {
  660.                 sidebar.classList.toggle('active');
  661.             });
  662.             // Gestion des sous-menus
  663.             let submenuItems = document.querySelectorAll('.has-submenu');
  664.             submenuItems.forEach(item => {
  665.                 item.addEventListener('click', function(e) {
  666.                     e.preventDefault();
  667.                     e.stopPropagation();
  668.                     // Fermer tous les autres sous-menus
  669.                     submenuItems.forEach(otherItem => {
  670.                         if (otherItem !== this && otherItem.classList.contains('open')) {
  671.                             otherItem.classList.remove('open');
  672.                             const otherTooltip = otherItem.querySelector('.tooltip');
  673.                             if (otherTooltip) {
  674.                                 otherTooltip.style.display = '';
  675.                             }
  676.                         }
  677.                     });
  678.                     // Basculer l'état du sous-menu actuel
  679.                     this.classList.toggle('open');
  680.                     // Gérer le tooltip
  681.                     const tooltip = this.querySelector('.tooltip');
  682.                     if (tooltip) {
  683.                         tooltip.style.display = this.classList.contains('open') ? 'none' : '';
  684.                     }
  685.                 });
  686.             });
  687.             // Fermer les sous-menus lors d'un clic à l'extérieur
  688.             document.addEventListener('click', function(e) {
  689.                 if (!sidebar.contains(e.target)) {
  690.                     submenuItems.forEach(item => {
  691.                         item.classList.remove('open');
  692.                         const tooltip = item.querySelector('.tooltip');
  693.                         if (tooltip) {
  694.                             tooltip.style.display = '';
  695.                         }
  696.                     });
  697.                 }
  698.             });
  699.             // Gestion des liens dans les sous-menus
  700.             let submenuLinks = document.querySelectorAll('.submenu a');
  701.             submenuLinks.forEach(link => {
  702.                 link.addEventListener('click', function(e) {
  703.                     e.stopPropagation();
  704.                 });
  705.             });
  706.             // État initial pour iPad
  707.             function setInitialState() {
  708.                 if (window.innerWidth >= 769 && window.innerWidth <= 1024) {
  709.                     sidebar.classList.remove('active');
  710.                     submenuItems.forEach(item => item.classList.remove('open'));
  711.                 }
  712.             }
  713.             setInitialState();
  714.             window.addEventListener('resize', setInitialState);
  715.         });
  716.     </script>
  717. {% endblock %}