templates/sonata/CRUD/list.html.twig line 1

Open in your IDE?
  1. {% extends '@SonataAdmin/CRUD/base_list.html.twig' %}
  2. {% block javascripts %}
  3.     {{ parent() }}
  4.     <script>
  5.         document.addEventListener('DOMContentLoaded', function() {
  6.             const rows = document.querySelectorAll('table tbody tr');
  7.             rows.forEach(row => {
  8.                 const span = row.querySelector('a[data-hide-entreprise]');
  9.                 
  10.                 if (span && span.getAttribute('data-hide-entreprise') === 'true') {
  11.                     row.classList.add('entreprise-hidden');
  12.                 }
  13.             });
  14.         });
  15.     </script>
  16. {% endblock %}
  17. {% block list_footer %}
  18.     {% if datagrid_has_results %}
  19.         <div class="box-footer">
  20.             <div class="form-inline clearfix">
  21.                 {% if not app.request.isXmlHttpRequest %}
  22.                     <div class="pull-left">
  23.                         {% if admin.hasRoute('batch') and batchactions|length > 0 %}
  24.                             {% block batch %}
  25.                                 <script>
  26.                                     {% block batch_javascript %}
  27.                                         jQuery(document).ready(function ($) {
  28.                                             // Toggle individual checkboxes when the batch checkbox is changed
  29.                                             $('#list_batch_checkbox').on('ifChanged change', function () {
  30.                                                 var checkboxes = $(this)
  31.                                                     .closest('table')
  32.                                                     .find('td.sonata-ba-list-field-batch input[type="checkbox"], div.sonata-ba-list-field-batch input[type="checkbox"]')
  33.                                                 ;
  34.                                                 if (Admin.get_config('USE_ICHECK')) {
  35.                                                     checkboxes.iCheck($(this).is(':checked') ? 'check' : 'uncheck');
  36.                                                 } else {
  37.                                                     checkboxes.prop('checked', this.checked);
  38.                                                 }
  39.                                             });
  40.                                             // Add a CSS class to rows when they are selected
  41.                                             $('td.sonata-ba-list-field-batch input[type="checkbox"], div.sonata-ba-list-field-batch input[type="checkbox"]')
  42.                                                 .on('ifChanged change', function () {
  43.                                                     $(this)
  44.                                                         .closest('tr, div.sonata-ba-list-field-batch')
  45.                                                         .toggleClass('sonata-ba-list-row-selected', $(this).is(':checked'))
  46.                                                     ;
  47.                                                 })
  48.                                                 .trigger('ifChanged')
  49.                                             ;
  50.                                         });
  51.                                     {% endblock %}
  52.                                 </script>
  53.                                 <label class="checkbox" for="{{ admin.uniqid }}_all_elements">
  54.                                     <input type="checkbox" name="all_elements" id="{{ admin.uniqid }}_all_elements">
  55.                                     {{ 'all_elements'|trans({}, 'SonataAdminBundle') }}
  56.                                     ({{ admin.datagrid.pager.countResults() }})
  57.                                 </label>
  58.                                 <label class="action-on-selection-label">Action sélection :</label>
  59.                                 <div class="action-on-selection-dropdown">
  60.                                     <select name="action" style="width: auto; height: auto" class="form-control">
  61.                                         {% for action, options in batchactions %}
  62.                                             <option value="{{ action }}">
  63.                                                 {% if options.translation_domain is defined and options.translation_domain is same as(false) %}
  64.                                                     {{ options.label }}
  65.                                                 {% else %}
  66.                                                     {{ options.label|trans({}, options.translation_domain ?? admin.translationDomain) }}
  67.                                                 {% endif %}
  68.                                             </option>
  69.                                         {% endfor %}
  70.                                     </select>
  71.                                     <input type="submit" class="btn btn-small btn-primary" value="{{ 'btn_batch'|trans({}, 'SonataAdminBundle') }}">
  72.                                 </div>
  73.                             {% endblock %}
  74.                         {% endif %}
  75.                     </div>
  76.                     <div class="pull-right">
  77.                         {% if admin.hasRoute('export') and admin.hasAccess('export') and export_formats|length %}
  78.                             <div class="btn-group">
  79.                                 <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
  80.                                     <i class="fas fa-share-square" aria-hidden="true"></i>
  81.                                     {{ "label_export_download"|trans({}, "SonataAdminBundle") }}
  82.                                     <span class="caret"></span>
  83.                                 </button>
  84.                                 <ul class="dropdown-menu">
  85.                                     {% for format in export_formats %}
  86.                                     <li>
  87.                                         <a href="{{ admin.generateUrl('export', admin.datagrid.paginationparameters(0) + {'format' : format}) }}">
  88.                                             <i class="fas fa-arrow-circle-o-down" aria-hidden="true"></i>
  89.                                             {{ ("export_format_" ~ format)|trans({}, 'SonataAdminBundle') }}
  90.                                         </a>
  91.                                     </li>
  92.                                     {% endfor %}
  93.                                 </ul>
  94.                             </div>&nbsp;
  95.                         {% endif %}
  96.                         {% block pager_results %}
  97.                             {% include get_admin_template('pager_results', admin.code) %}
  98.                         {% endblock %}
  99.                     </div>
  100.                 {% endif %}
  101.             </div>
  102.             {% block pager_links %}
  103.                 {% if admin.datagrid.pager.haveToPaginate() %}
  104.                     <hr/>
  105.                     {% include get_admin_template('pager_links', admin.code) %}
  106.                 {% endif %}
  107.             {% endblock %}
  108.         </div>
  109.     {% endif %}
  110. {% endblock %}
  111. {% block tab_menu_navbar_header %}
  112.     {% if admin.code == 'admin.lot' and action == 'list' %}
  113.         <div class="navbar-header">
  114.             <a class="navbar-brand" href="#">Lots du programme "{{ admin.parent.subject.nom }}"</a>
  115.         </div>
  116.     {% else %}
  117.         {{ parent() }}
  118.     {% endif %}
  119. {% endblock %}