templates/bundles/EasyAdminBundle/layout.html.twig line 1

  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {% trans_default_domain ea.i18n.translationDomain %}
  3. <!DOCTYPE html >
  4. <html lang="{{ ea.i18n.htmlLocale }}" dir="{{ ea.i18n.textDirection }}"   >
  5.        
  6. <head>
  7.      {% set sessionLifetimeSeconds = app.session.getMetadataBag().getLifetime() %}
  8.     <style>
  9.         .session-badge {
  10.             display: inline-block;
  11.             padding: 0.25em 0.5em;
  12.             font-size: 75%;
  13.             font-weight: 700;
  14.             line-height: 1;
  15.             color: #fff;
  16.             text-align: center;
  17.             white-space: nowrap;
  18.             vertical-align: baseline;
  19.             border-radius: 0.25rem;
  20.             background-color: #007bff;
  21.         }
  22.     </style>
  23.    <!-- <script>
  24.         document.addEventListener('DOMContentLoaded', function() {
  25.             var sessionBadge = document.querySelector('.session-badge');
  26.             var sessionLifetimeSeconds = {{ sessionLifetimeSeconds }};
  27.             var updateInterval = 1000; // Mettez à jour toutes les secondes
  28.             function updateSessionCounter() {
  29.                 var minutes = Math.floor(sessionLifetimeSeconds / 60);
  30.                 var seconds = sessionLifetimeSeconds % 60;
  31.                 sessionBadge.textContent = minutes + 'm ' + seconds + 's';
  32.                 sessionLifetimeSeconds--;
  33.             }
  34.             // Mettez à jour le compteur initialement
  35.             updateSessionCounter();
  36.             // Mettez à jour le compteur toutes les secondes
  37.             setInterval(updateSessionCounter, updateInterval);
  38.         });
  39.     </script>-->
  40.      <script>
  41.         document.addEventListener("turbo:load", function() {
  42.     // Votre code existant pour le compteur de session
  43.     var sessionBadge = document.querySelector('.session-badge');
  44.     var sessionLifetimeSeconds = {{ sessionLifetimeSeconds }};
  45.     var updateInterval = 1000; // Mettez à jour toutes les secondes
  46.     function updateSessionCounter() {
  47.         if (sessionLifetimeSeconds > 0) {
  48.             var hours = Math.floor(sessionLifetimeSeconds / 3600);
  49.             var minutes = Math.floor((sessionLifetimeSeconds % 3600) / 60);
  50.             var seconds = sessionLifetimeSeconds % 60;
  51.             sessionBadge.textContent = hours + 'h ' + minutes + 'm ' + seconds + 's';
  52.             sessionLifetimeSeconds--;
  53.         } else {
  54.             // Arrêtez le compteur et effectuez toute autre action nécessaire
  55.             clearInterval(intervalId);
  56.             sessionBadge.textContent = 'Session expirée';
  57.         }
  58.     }
  59.     // Mettez à jour le compteur initialement
  60.     updateSessionCounter();
  61.     // Mettez à jour le compteur toutes les secondes
  62.     var intervalId = setInterval(updateSessionCounter, updateInterval);
  63. });
  64.     </script>
  65.     {% block head_metas %}
  66.     
  67.         <meta charset="utf-8">
  68.         <meta http-equiv="X-UA-Compatible" content="IE=edge">
  69.         <meta name="robots" content="noindex, nofollow, noarchive, nosnippet, noodp, noimageindex, notranslate, nocache" />
  70.         <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  71.         <meta name="generator" content="EasyAdmin" />
  72.          <meta name="turbo-cache-control" content="no-cache">
  73.           
  74.            {% set sessionLifetime = app.session.getMetadataBag().getLifetime() %}
  75.     <meta name="session_duration" content="{{ sessionLifetime }}">
  76.         
  77.     {% endblock head_metas %}
  78.     {% set page_title_block_output %}{% block page_title %}{{ block('content_title') }}{% endblock %}{% endset %}
  79.     <title>{{ page_title_block_output|striptags|raw }}</title>
  80.     {% block head_stylesheets %}
  81.         <link rel="stylesheet" href="{{ asset('app.css', ea.assets.defaultAssetPackageName) }}">
  82.        
  83.             {{ encore_entry_link_tags('app') }}
  84.          
  85.             
  86.         
  87.         {% if is_granted("ROLE_CUSTOMER") %}
  88.             <link rel="stylesheet" href="{{ asset('themes/'~ settings.get.assetFolderName|lower ~ '/admin/admin-customer.css') }}">
  89.         {% else %}
  90.             <link rel="stylesheet" href="{{ asset('themes/'~ settings.get.assetFolderName|lower ~ '/admin/admin.css') }}">
  91.         {% endif %}
  92.    
  93.     {% endblock %}
  94.     {% block configured_stylesheets %}
  95.         {{ include('@EasyAdmin/includes/_css_assets.html.twig', { assets: ea.assets.cssAssets ?? [] }, with_context = false) }}
  96.         {{ include('@EasyAdmin/includes/_encore_link_tags.html.twig', { assets: ea.assets.webpackEncoreAssets ?? [] }, with_context = false) }}
  97.     {% endblock %}
  98.     {% block head_favicon %}
  99.         <link rel="shortcut icon" href="{{ asset(ea.dashboardFaviconPath) }}">
  100.     {% endblock %}
  101.     {% block head_javascript %}
  102.     
  103.         
  104.         {{ encore_entry_script_tags('app') }}
  105.   
  106.     {% endblock head_javascript %}
  107.     
  108.     {% if 'rtl' == ea.i18n.textDirection %}
  109.         <link rel="stylesheet" href="{{ asset('app.rtl.css', ea.assets.defaultAssetPackageName) }}">
  110.     {% endif %}
  111.     {% block configured_head_contents %}
  112.         {% for htmlContent in ea.assets.headContents ?? [] %}
  113.             {{ htmlContent|raw }}
  114.         {% endfor %}
  115.     {% endblock %}
  116. </head>
  117. {% block body %}
  118.     <body {% block body_attr %}{% endblock %}
  119.         id="{% block body_id %}{% endblock %}"
  120.         class="ea {% block body_class %}{% endblock %} "
  121.         data-ea-content-width="{{ ea.crud.contentWidth ?? ea.dashboardContentWidth ?? 'normal' }}"
  122.         data-ea-sidebar-width="{{ ea.crud.sidebarWidth ?? ea.dashboardSidebarWidth ?? 'normal' }}"
  123.         data-ea-dark-scheme-is-enabled="{{ ea.dashboardHasDarkModeEnabled ? 'true' : 'false' }}"
  124.     >
  125.     {% block wrapper_wrapper %}
  126.         {% block flash_messages %}
  127.             {{ include(ea.templatePath('flash_messages')) }}
  128.         {% endblock flash_messages %}
  129.         {% set user_menu_avatar %}
  130.             {% if null == ea.userMenu.avatarUrl %}
  131.                 <span class="user-avatar">
  132.                     <span class="fa-stack">
  133.                         <i class="user-avatar-icon-background fas fa-square fa-stack-2x"></i>
  134.                         <i class="user-avatar-icon-foreground {{ ea.user is not null ? 'fa fa-user' : 'fas fa-user-slash' }} fa-stack-1x fa-inverse"></i>
  135.                     </span>
  136.                 </span>
  137.             {% else %}
  138.                 <img class="user-avatar" src="{{ ea.userMenu.avatarUrl }}" />
  139.             {% endif %}
  140.         {% endset %}
  141.         {% set impersonator_permission = constant('Symfony\\Component\\Security\\Core\\Authorization\\Voter\\AuthenticatedVoter::IS_IMPERSONATOR') is defined ? 'IS_IMPERSONATOR' : 'ROLE_PREVIOUS_ADMIN' %}
  142.         {% set user_menu_dropdown %}
  143.             <ul class="dropdown-menu dropdown-menu-end">
  144.                 <li class="dropdown-user-details">
  145.                     <div>{{ user_menu_avatar }}</div>
  146.                     <div>
  147.                         <span class="user-label">{{ 'user.logged_in_as'|trans(domain = 'EasyAdminBundle') }}</span>
  148.                         <span class="user-name">{{ ea.user is null ? 'user.anonymous'|trans(domain = 'EasyAdminBundle') : ea.userMenu.name }}</span>
  149.                     </div>
  150.                 </li>
  151.                 {% block user_menu %}
  152.                     {% if ea.userMenu.items|length > 0 %}
  153.                         <li><hr class="dropdown-divider"></li>
  154.                         {% for item in ea.userMenu.items %}
  155.                             <li>
  156.                                 {% if item.isMenuSection and not loop.first %}
  157.                                     <hr class="dropdown-divider">
  158.                                 {% elseif not item.isMenuSection %}
  159.                                     <a href="{{ item.linkUrl }}" class="dropdown-item user-action {{ item.cssClass }}"
  160.                                        target="{{ item.linkTarget }}" rel="{{ item.linkRel }}"
  161.                                        referrerpolicy="origin-when-cross-origin">
  162.                                         {% if item.icon is not empty %}<i class="fa fa-fw {{ item.icon }}"></i>{% endif %}
  163.                                         <span>{{ item.label|trans }}</span>
  164.                                     </a>
  165.                                 {% endif %}
  166.                             </li>
  167.                         {% endfor %}
  168.                     {% endif %}
  169.                 {% endblock user_menu %}
  170.             </ul>
  171.         {% endset %}
  172.         {% set settings_dropdown %}
  173.             {% if ea.dashboardLocales or ea.dashboardHasDarkModeEnabled %}
  174.                 <div class="dropdown dropdown-settings">
  175.                     <a class="dropdown-settings-button" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  176.                         <i class="fas fa-gear"></i>
  177.                     </a>
  178.                     <ul class="dropdown-menu dropdown-menu-end">
  179.                         {% if ea.dashboardLocales %}
  180.                             <li>
  181.                                 <span class="dropdown-header dropdown-locales-label">{{ 'settings.locale'|trans(domain = 'EasyAdminBundle') }}</span>
  182.                             </li>
  183.                             {% for localeDto in ea.dashboardLocales %}
  184.                                 <li>
  185.                                     <a href="{{ ea_url().set('_locale', localeDto.locale) }}" class="dropdown-item{% if app.request.locale == localeDto.locale %} active{% endif %}">
  186.                                         {% if localeDto.icon %}
  187.                                             <i class="{{ localeDto.icon }}"></i>
  188.                                         {% endif %}
  189.                                         {{ localeDto.name }}
  190.                                     </a>
  191.                                 </li>
  192.                             {% endfor %}
  193.                         {% endif %}
  194.                         {% if ea.dashboardHasDarkModeEnabled %}
  195.                             {% if ea.dashboardLocales %}
  196.                                 <div class="dropdown-divider"></div>
  197.                             {% endif %}
  198.                             <li>
  199.                                 <span class="dropdown-header dropdown-appearance-label">{{ 'settings.appearance.label'|trans(domain = 'EasyAdminBundle') }}</span>
  200.                             </li>
  201.                             <li>
  202.                                 <a href="#" class="dropdown-item dropdown-appearance-item" data-ea-color-scheme="light">
  203.                                     <i class="far fa-sun"></i> <span>{{ 'settings.appearance.light'|trans(domain = 'EasyAdminBundle') }}</span>
  204.                                 </a>
  205.                             </li>
  206.                             <li>
  207.                                 <a href="#" class="dropdown-item dropdown-appearance-item" data-ea-color-scheme="dark">
  208.                                     <i class="far fa-moon"></i> <span>{{ 'settings.appearance.dark'|trans(domain = 'EasyAdminBundle') }}</span>
  209.                                 </a>
  210.                             </li>
  211.                             <li>
  212.                                 <a href="#" class="dropdown-item dropdown-appearance-item active" data-ea-color-scheme="auto">
  213.                                     <i class="fas fa-desktop"></i> <span>{{ 'settings.appearance.auto'|trans(domain = 'EasyAdminBundle') }}</span>
  214.                                 </a>
  215.                             </li>
  216.                         {% endif %}
  217.                     </ul>
  218.                 </div>
  219.             {% endif %}
  220.         {% endset %}
  221.         <div class="wrapper">
  222.             {% block wrapper %}
  223.                 <div class="responsive-header">
  224.                     {% block responsive_header %}
  225.                         <button id="navigation-toggler" type="button" aria-label="Toggle navigation">
  226.                             <i class="fa fa-fw fa-bars"></i>
  227.                         </button>
  228.                         <div id="responsive-header-logo" class="text-truncate ms-auto">
  229.                             {% block responsive_header_logo %}
  230.                                 <a class="responsive-logo" title="{{ ea.dashboardTitle|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  231.                                     {{ ea.dashboardTitle|raw }}
  232.                                 </a>
  233.                             {% endblock responsive_header_logo %}
  234.                         </div>
  235.                         <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }} ms-auto">
  236.                             <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  237.                                 {# to make the site design consistent, always display the user avatar in responsive header
  238.                                    and hide the user name (because there's no space left) regardless of the user config #}
  239.                                 {% if ea.userMenu.avatarDisplayed %}
  240.                                     {{ user_menu_avatar }}
  241.                                 {% else %}
  242.                                     <i class="user-avatar fa fa-fw {{ ea.user is not null ? 'fa-user' : 'fa-user-times' }}"></i>
  243.                                 {% endif %}
  244.                             </a>
  245.                             {{ user_menu_dropdown }}
  246.                         </div>
  247.                         {{ settings_dropdown }}
  248.                     {% endblock responsive_header %}
  249.                 </div>
  250.                 <div class="sidebar-wrapper"  >
  251.                     <aside class="sidebar" >
  252.                         {% block sidebar %}
  253.                             <header class="main-header" >
  254.                                 {% block header %}
  255.                                 <nav class="navbar" role="navigation" >
  256.                                     {% block header_navbar %}
  257.                                         <div id="header-logo">
  258.                                             {% block header_logo %}
  259.                                                 <a class="logo" title="{{ ea.dashboardTitle|striptags }}" href="{{ path(ea.dashboardRouteName) }}">
  260.                                                     <span class="logo-custom">{{ ea.dashboardTitle|raw }}</span>
  261.                                                     <span class="logo-compact"><i class="fas fa-home"></i></span>
  262.                                                 </a>
  263.                                             {% endblock header_logo %}
  264.                                         </div>
  265.                                     {% endblock header_navbar %}
  266.                                 </nav>
  267.                                 {% endblock header %}
  268.                             </header>
  269.                             {% block main_menu_wrapper %}
  270.                                 {{ include(ea.templatePath('main_menu')) }}
  271.                             {% endblock main_menu_wrapper %}
  272.                         {% endblock sidebar %}
  273.                         <div id="sidebar-resizer-handler" class="resizer-handler resizer-handler-left"></div>
  274.                     </aside>
  275.                 </div>
  276.                 <section class="main-content" >
  277.                     {% set has_search = ea.crud is not null and ea.crud.isSearchEnabled %}
  278.                     <aside class="content-top {{ has_search ? 'ea-search-enabled' : 'ea-search-disabled' }}">
  279.                         {% block content_top_header %}
  280.                             <div class="content-search">
  281.                                 {% if has_search %}
  282.                                     {% block search %}
  283.                                         <form   class="form-action-search" method="get">
  284.                                             {% block search_form %}
  285.                                                 {% block search_form_filters %}
  286.                                                     {% for field, array in ea.search.appliedFilters %}
  287.                                                         {% for key, value in array %}
  288.                                                             {# This code re-applies your filters on searches, an iterable check is needed in cases we have more than one object for a filter #}
  289.                                                             {% if value is iterable %}
  290.                                                                 {% for index, iterValue in value %}
  291.                                                                     {# This sub-level iterable check is needed in cases we have more complex filters like the DateTimeFilter cf. issue #5038 #}
  292.                                                                     {% if iterValue is iterable %}
  293.                                                                         {% for subIndex, subIterValue in iterValue %}
  294.                                                                             <input type="hidden" name="filters[{{ field }}][{{ key }}][{{ index }}][{{ subIndex }}]" value="{{ subIterValue }}">
  295.                                                                         {% endfor %}
  296.                                                                     {% else %}
  297.                                                                         <input type="hidden" name="filters[{{ field }}][{{ key }}][{{ index }}]" value="{{ iterValue }}">
  298.                                                                     {% endif %}
  299.                                                                 {% endfor %}
  300.                                                             {% else %}
  301.                                                                 <input type="hidden" name="filters[{{ field }}][{{ key }}]" value="{{ value }}">
  302.                                                             {% endif %}
  303.                                                         {% endfor %}
  304.                                                     {% endfor %}
  305.                                                 {% endblock %}
  306.                                                 <input type="hidden" name="crudAction" value="index">
  307.                                                 <input type="hidden" name="crudControllerFqcn" value="{{ ea.request.query.get('crudControllerFqcn') }}">
  308.                                                 <input type="hidden" name="menuIndex" value="{{ ea.request.query.get('menuIndex') }}">
  309.                                                 <input type="hidden" name="submenuIndex" value="{{ ea.request.query.get('submenuIndex') }}">
  310.                                                 <input type="hidden" name="page" value="1">
  311.                                                 <div class="form-group">
  312.                                                     <div class="form-widget">
  313.                                                         <i class="fas fa-search content-search-icon"></i>
  314.                                                         <label class="content-search-label" data-value="{{ app.request.get('query') }}">
  315.                                                             <input class="form-control {{ app.request.get('query') is null ? 'is-blank' }}" type="search" name="query" value="{{ app.request.get('query') ?? '' }}" placeholder="{{ t('action.search', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}" spellcheck="false" autocorrect="off" onInput="this.parentNode.dataset.value=this.value"{% if ea.crud.currentAction == 'index' and ea.crud.autofocusSearch == true %} autofocus="autofocus"{% endif %}>
  316.                                                         </label>
  317.                                                         {% if app.request.get('query') %}
  318.                                                             <a href="{{ ea_url().unset('query') }}" class="content-search-reset">
  319.                                                                 <i class="fas fa-fw fa-times"></i>
  320.                                                             </a>
  321.                                                         {% endif %}
  322.                                                     </div>
  323.                                                 </div>
  324.                                             {% endblock %}
  325.                                         </form>
  326.                                     {% endblock search %}
  327.                                 {% endif %}
  328.                             </div>
  329.                             {% if is_granted("ROLE_AGENT") %}
  330.                             <div class="navbar-custom-menu p-1" >
  331.                                    
  332.                                     {% set urlSessionHistory = ea_url().setRoute("toggleSession") %}
  333.                                     {% if settings.session %}
  334.                                         {% if settings.session.endAt != null %}
  335.                                             <a href="{{urlSessionHistory}}" class="btn bg-green-dark text-white">
  336.                                             <i class="fa-solid fa-power-off"></i>
  337.                                                 Commencer ma session
  338.                                             </a>
  339.                                         {% else %}
  340.                                             <a href="{{urlSessionHistory}}" class="btn bg-pink-dark text-white">
  341.                                             <i class="fa-solid fa-power-off"></i>
  342.                                                 Fermer ma session <small style="font-size:9px;">(Commencé á {{settings.session.startAt|date("H:i:s")}})</small>
  343.                                             </a>
  344.                                         {% endif %}
  345.                                     
  346.                                     {% else %}
  347.                                     <a href="{{urlSessionHistory}}" class="btn bg-green-dark text-white">
  348.                                             <i class="fa-solid fa-power-off"></i>
  349.                                                 Commencer ma session
  350.                                             </a>
  351.                                     {% endif %}
  352.                                     
  353.                                     </a>
  354.                                 
  355.                             </div>
  356.                             {% endif %}
  357.                             <div class="navbar-custom-menu p-1" style="position:relative;">
  358.                                     <div style="position:absolute;bottom:0;left:18px;z-index:9;opacity:0.8;">
  359.                                         <span class="badge badge-primary" >1</span>
  360.                                     </div>
  361.                                       <small style="color: rgb(78, 48, 158);">La durée de la session restante : </small><span class="session-badge">0h 0m 0s</span>
  362.                                 
  363.                                     <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
  364.                                         <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  365.                                           <span class="user-avatar">
  366.                                                 <span class="fa-stack">
  367.                                                     <i class="user-avatar-icon-background fas fa-square fa-stack-2x"></i>
  368.                                                     <i class="user-avatar-icon-foreground fa fa-bell fa-stack-1x fa-inverse"></i>
  369.                                                 </span>
  370.                                             </span>
  371.                                             
  372.                                                 <span class="user-name">Notifications </span>
  373.                                                
  374.                                                 
  375.                                         </a>
  376.                                         <ul class="dropdown-menu dropdown-menu-end">
  377.                                                     <li class="dropdown-user-details">
  378.                                                         Nouveau adhérent : Ayman Bantala
  379.                                                     </li>
  380.                                                             
  381.                                         </ul>
  382.                                     </div>
  383.                                 
  384.                             </div>
  385.                             <div class="navbar-custom-menu">
  386.                             
  387.                                 {% block header_custom_menu %}
  388.                                     <div class="dropdown user-menu-wrapper {{ is_granted(impersonator_permission) ? 'user-is-impersonated' }}">
  389.                                         <a class="user-details" type="button" data-bs-toggle="dropdown" data-bs-offset="0,5" aria-expanded="false">
  390.                                             {{ user_menu_avatar }}
  391.                                             {% if ea.userMenu.isNameDisplayed %}
  392.                                                 <span class="user-name">{{ ea.userMenu.name }}</span>
  393.                                             {% endif %}
  394.                                         </a>
  395.                                         {{ user_menu_dropdown }}
  396.                                     </div>
  397.                                 {% endblock header_custom_menu %}
  398.                             </div>
  399.                             {{ settings_dropdown }}
  400.                         {% endblock content_top_header %}
  401.                     </aside>
  402.                     <div class="content-wrapper ">
  403.                         {% block content %}
  404.                             <article class="content">
  405.                                 {% block content_header_wrapper %}
  406.                                     {% set has_help_message = (ea.crud.helpMessage ?? '') is not empty %}
  407.                                     <section class="content-header">
  408.                                         {% block content_header %}
  409.                                             <div class="content-header-title">
  410.                                                 <h1 class="title">
  411.                                                     {% block content_title %}{% endblock %}
  412.                                                     {% block content_help %}
  413.                                                         {% if has_help_message %}
  414.                                                             <a tabindex="0" class="content-header-help" data-bs-toggle="popover" data-bs-custom-class="ea-content-help-popover" data-bs-animation="true" data-bs-html="true" data-bs-placement="bottom" data-bs-trigger="focus" data-bs-content="{{ ea.crud.helpMessage|trans|e('html_attr') }}">
  415.                                                                 <i class="far fa-question-circle"></i>
  416.                                                             </a>
  417.                                                         {% endif %}
  418.                                                     {% endblock %}
  419.                                                 </h1>
  420.                                             </div>
  421.                                             {% block page_actions_wrapper %}
  422.                                                 <div class="page-actions">{% block page_actions %}{% endblock %}</div>
  423.                                             {% endblock %}
  424.                                         {% endblock content_header %}
  425.                                     </section>
  426.                                 {% endblock content_header_wrapper %}
  427.                                 <section id="main" class="content-body  animate__animated animate__fadeIn">
  428.                                     {% block main %}{% endblock %}
  429.                                 </section>
  430.                                 {% block content_footer_wrapper %}
  431.                                     {% set content_footer = block('content_footer') is defined ? block('content_footer') : '' %}
  432.                                     {% if content_footer is not empty %}
  433.                                         <section class="content-footer">
  434.                                             {{ content_footer }}
  435.                                         </section>
  436.                                     {% endif %}
  437.                                 {% endblock %}
  438.                             </article>
  439.                         {% endblock content %}
  440.                         <div id="content-resizer-handler" class="resizer-handler resizer-handler-right"></div>
  441.                     </div>
  442.                 </section>
  443.             {% endblock wrapper %}
  444.         </div>
  445.     {% endblock wrapper_wrapper %}
  446.     {% block body_javascript %}
  447.     
  448.     
  449.         <script>
  450.             var notificationSound = new Audio('flexy/sounds/notification_sound.mp3');
  451.             document.addEventListener("turbo:load",function(){
  452.             
  453.             
  454.             
  455.             {% if settings.get.isMercureEnabled %}
  456.             
  457.             const eventSource = new EventSource("{{ mercure('https://hello.com/books/1')|escape('js') }}");
  458.             eventSource.onmessage = event => {
  459.                 // Will be called every time an update is published by the server
  460.                 var data = JSON.parse(event.data);
  461.                 if(data.status == "success"){
  462.                     if(data.entity == "VisitCustomer"){
  463.                         //notificationSound.loop = true;
  464.                         notificationSound.play();
  465.                         
  466.                         const flashMessages = document.getElementById('flash-messages');
  467.                         
  468.                         /*$("#flash-messages").append('<div class="alert alert-success alert-dismissible fade show" role="alert"><button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>Nouvelle commande a été crée</div>');*/
  469.                        
  470.                         {% set urlOrders = ea_url()
  471.                                 .setController('App\\Flexy\\POSBundle\\Controller\\OrderCrudController')
  472.                                 .setAction('index') %}
  473.                         Turbo.visit("{{urlOrders|escape('js')}}");
  474.                     }
  475.                 if(data.status == "success"){
  476.                     if(data.entity == "Order"){
  477.                         //notificationSound.loop = true;
  478.                         notificationSound.play();
  479.                         
  480.                         const flashMessages = document.getElementById('flash-messages');
  481.                         
  482.                         /*$("#flash-messages").append('<div class="alert alert-success alert-dismissible fade show" role="alert"><button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>Nouvelle commande a été crée</div>');*/
  483.                        
  484.                         {% set urlOrders = ea_url()
  485.                                 .setController('App\\Flexy\\POSBundle\\Controller\\OrderCrudController')
  486.                                 .setAction('index') %}
  487.                         Turbo.visit("{{urlOrders|escape('js')}}");
  488.                     }
  489.                     //alert(data.status);
  490.                     
  491.                 }
  492.                 console.log(JSON.parse(event.data));
  493.                 
  494.             }
  495.             {% endif %}
  496.             });
  497.             document.addEventListener("turbo:click",function(){
  498.                 
  499.                 notificationSound.pause();
  500.                 notificationSound.currentTime = 0;
  501.             });
  502.             </script>
  503.         
  504.     {% endblock body_javascript %}
  505.     {% block configured_body_contents %}
  506.         {% for htmlContent in ea.assets.bodyContents ?? [] %}
  507.             {{ htmlContent|raw }}
  508.         {% endfor %}
  509.     {% endblock %}
  510.     </body>
  511. {% endblock body %}
  512. </html>