templates/sonata/standard_layout.html.twig line 1

Open in your IDE?
  1. {% extends '@SonataAdmin/standard_layout.html.twig' %}
  2. {% block meta_tags %}
  3.     {{ parent() }}
  4.     {% set favicon_path = '/favicon/' %}
  5.     {% if 'test.genesii.fr' in app.request.host %}
  6.         {% set favicon_path = '/favicon-test/' %}
  7.     {% endif %}
  8.     <link rel="apple-touch-icon" sizes="180x180" href="{{ favicon_path }}apple-touch-icon.png">
  9.     <link rel="icon" type="image/png" sizes="32x32" href="{{ favicon_path }}favicon-32x32.png">
  10.     <link rel="icon" type="image/png" sizes="16x16" href="{{ favicon_path }}favicon-16x16.png">
  11.     <link rel="manifest" href="/favicon/site.webmanifest">
  12.     <link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#2c2c2c">
  13.     <meta name="msapplication-TileColor" content="#2c2c2c">
  14.     <meta name="theme-color" content="#2c2c2c">
  15. {% endblock %}
  16. {% block admin_lte_skin_class %}
  17.     {{ parent() }}
  18.     {% if admin.code is defined %}
  19.         admin-view-{{ admin.code|replace({'.': '-'})|lower }}
  20.     {% endif %}
  21. {% endblock %}
  22. {% block stylesheets %}
  23.     {{ parent() }}
  24.     {{ encore_entry_link_tags('admin') }}
  25. {% endblock %}
  26. {% block javascripts %}
  27.   {{ parent() }}
  28.   {{ encore_entry_script_tags('admin') }}
  29.   <script type="text/javascript">
  30.     jQuery(function($) {
  31.         $('[data-toggle="tooltip"]').tooltip();
  32.     });
  33.     $(document).ajaxError(function() {
  34.       //$('.pop-loader').slideUp(300);
  35.       $('.pop-error-loader').slideUp(300);
  36.       // setTimeout(function() {
  37.       //   $('.pop-error-loader').slideUp(300);
  38.       // }, 3000);
  39.     });
  40.     $(document).ajaxSuccess(function() {
  41.         $('.pop-loader').slideUp(300);
  42.     });
  43.     $(document).ajaxSend(function() {
  44.       if(!$('.pop-loader').is(':visible')) $('.pop-loader').slideDown(300);
  45.     });
  46.     function isTablet() {
  47.         const userAgent = navigator.userAgent.toLowerCase();
  48.         const tabletKeys = ['tablet', 'ipad', 'kindle', 'fire', 'silk', 'android'];
  49.         const mobileKey = 'mobile';
  50.         const models = ["SM-F936B", "SM-F936B/DS", "SM-F936U", "SM-F936U1", "SM-F936N", "SM-F936W"];
  51.         const isZFold4 = models.some(model => navigator.userAgent.includes(model));
  52.         if (userAgent.includes(mobileKey)) {
  53.             return false;
  54.         }
  55.         for (const key of tabletKeys) {
  56.             if (userAgent.includes(key)) {
  57.                 if (isZFold4) {
  58.                     return false;
  59.                 }
  60.                 return true;
  61.             }
  62.         }
  63.         const touchSupported = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);
  64.         const screenSize = window.screen.width >= 600;
  65.         return touchSupported && screenSize;
  66.     }
  67.     window.addEventListener("touchstart", function (event) {
  68.         if(isTablet()){
  69.             if($(event.target).is('.iCheck-helper') || $(event.target).is('.control-label__text')){
  70.                 $(event.target).trigger('click');
  71.             }
  72.         }
  73.     });
  74.     let isDragging = false;
  75.     function simulateMouseEvent(event, simulatedType) {
  76.         if (event.target.classList.contains('sonata-ba-sortable-handler')) {
  77.             let simulatedEvent = new MouseEvent(simulatedType, {
  78.                 bubbles: true,
  79.                 cancelable: true,
  80.                 view: window,
  81.                 detail: 1,
  82.                 screenX: event.changedTouches[0].screenX,
  83.                 screenY: event.changedTouches[0].screenY,
  84.                 clientX: event.changedTouches[0].clientX,
  85.                 clientY: event.changedTouches[0].clientY,
  86.             });
  87.             event.target.dispatchEvent(simulatedEvent);
  88.             if (simulatedType === 'mousemove') {
  89.                 event.preventDefault();
  90.             }
  91.         }
  92.     }
  93.     document.addEventListener("touchstart", function(e) {
  94.         isDragging = true;
  95.         simulateMouseEvent(e, "mousedown");
  96.     }, false);
  97.     document.addEventListener("touchmove", function(e) {
  98.         if (isDragging) { 
  99.             simulateMouseEvent(e, "mousemove");
  100.         }
  101.     }, { passive: false });
  102.     document.addEventListener("touchend", function(e) {
  103.         isDragging = false;
  104.         simulateMouseEvent(e, "mouseup");
  105.     }, false);
  106.     //$('.pop-loader').slideUp(300);
  107.   </script>
  108. {% endblock %}
  109. {% block logo %}
  110.     {% apply spaceless %}
  111.         <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
  112.         {% if is_granted('ROLE_MASTER') %}
  113.             {% if 'icon' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  114.                 <img src="{{ asset(sonata_config.getOption('default_icon')) }}" alt="{{ sonata_config.title }}">
  115.             {% endif %}
  116.             {% if 'text' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  117.                 <span>{{ sonata_config.title }}</span>
  118.             {% endif %}
  119.         {% else %}
  120.             {% set logoAdmin = get_user_entreprise_logo() %}
  121.             {% if logoAdmin %}
  122.                 <img src="{{ asset('uploads/entreprises_logos/' ~ logoAdmin) }}" alt="{{ sonata_config.title }}">
  123.             {% else %}
  124.                 {% if 'icon' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  125.                     <img src="{{ asset('build/images/zada_logo_large.png') }}" alt="{{ sonata_config.title }}">
  126.                 {% endif %}
  127.                 {% if 'text' == sonata_config.getOption('logo_content') or 'all' == sonata_config.getOption('logo_content') %}
  128.                     <span>{{ sonata_config.title }}</span>
  129.                 {% endif %}
  130.             {% endif %}
  131.         {% endif %}
  132.         </a>
  133.     {% endapply %}
  134. {% endblock %}
  135. {% block sonata_top_nav_menu %}
  136.     {% if app.user %}
  137.         <div class="navbar-custom-menu">
  138.             <ul class="nav navbar-nav">
  139.                 {% block sonata_top_nav_menu_add_block %}
  140.                 {% endblock %}
  141.                 {% block sonata_top_nav_menu_user_block %}
  142.                   <li class="bonjour-nav"><a>Bonjour {{ app.user.prenom }}</a></li>
  143.                   <li class="dropdown user-menu">
  144.                     <a class="dropdown-toggle" data-toggle="tooltip" title="Dashboard" href="{{ path('sonata_admin_dashboard') }}">
  145.                         <i class="fa fa-home" aria-hidden="true" style="position: relative;">{% if app.user.infosSuivis|filter(info => not info.lu)|length %}<span class="notifs-chip"></span>{% endif %}</i>
  146.                     </a>
  147.                   </li>
  148.                   <li class="dropdown user-menu">
  149.                     <a class="dropdown-toggle" data-toggle="tooltip" title="Déconnexion" href="{{ path('login_logout') }}">
  150.                         <i class="fa fa-sign-out fa-fw" aria-hidden="true"></i>
  151.                     </a>
  152.                   </li>
  153.                 {% endblock %}
  154.             </ul>
  155.         </div>
  156.     {% endif %}
  157. {% endblock %}
  158. {% block sonata_wrapper %}
  159.   {{ parent() }}
  160.   <div class="pop-loader">
  161.     <i class="fa fa-cog" aria-hidden="true"></i> Chargement en cours...
  162.   </div>
  163.   <div class="pop-loader-manuel">
  164.     <i class="fa fa-cog" aria-hidden="true"></i> Mise à jour du tableau...
  165.   </div>
  166.   <div class="pop-error-loader">
  167.     <i class="fa fa-frown-o" aria-hidden="true"></i> Une erreur est survenue !
  168.   </div>
  169. {% endblock sonata_wrapper %}
  170. {% block sonata_admin_content_actions_wrappers %}
  171.     {% if _actions|replace({ '<li>': '', '</li>': '' })|trim is not empty %}
  172.         <ul class="nav navbar-nav {% if action == 'list' %}navbar-left{% endif %}">
  173.         {% if _actions|split('</a>')|length > 2 %}
  174.             <li class="dropdown sonata-actions">
  175.                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ 'link_actions'|trans({}, 'SonataAdminBundle') }} <b class="caret"></b></a>
  176.                 <ul class="dropdown-menu" role="menu">
  177.                     {{ _actions|raw }}
  178.                 </ul>
  179.             </li>
  180.         {% else %}
  181.             {{ _actions|raw }}
  182.         {% endif %}
  183.         </ul>
  184.     {% endif %}
  185. {% endblock sonata_admin_content_actions_wrappers %}
  186. {% block sonata_head_title %}
  187.     Zada |
  188.     {% if _title is not empty %}
  189.         {{ _title|striptags|raw }}
  190.     {% else %}
  191.         {% if action is defined %}
  192.             {{ render_breadcrumbs_for_title(admin, action) }}
  193.         {% endif %}
  194.     {% endif %}
  195. {% endblock %}