You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
6.7KB

  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {# @var entities \EasyCorp\Bundle\EasyAdminBundle\Collection\EntityDtoCollection #}
  3. {# @var paginator \EasyCorp\Bundle\EasyAdminBundle\Orm\EntityPaginator #}
  4. {% extends ea.templatePath('layout') %}
  5. {% trans_default_domain ea.i18n.translationDomain %}
  6. {% block body_id entities|length > 0 ? 'ea-index-' ~ entities|first.name : '' %}
  7. {% block body_class 'index' ~ (entities|length > 0 ? ' index-' ~ entities|first.name : '') %}
  8. {% block content_title %}
  9. Tri position
  10. {# {%- apply spaceless -%}
  11. {% set default_title = ea.crud.defaultPageTitle('index')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %}
  12. {{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('index')|trans(ea.i18n.translationParameters)|raw }}
  13. {%- endapply -%} #}
  14. {% endblock %}
  15. {% set has_batch_actions = batch_actions|length > 0 %}
  16. {% block page_actions %}
  17. {# {% block global_actions %}
  18. <div class="global-actions">
  19. {% for action in global_actions %}
  20. {{ include(action.templatePath, { action: action }, with_context = false) }}
  21. {% endfor %}
  22. </div>
  23. {% endblock global_actions %}
  24. {% block batch_actions %}
  25. {% if has_batch_actions %}
  26. <div class="batch-actions" style="display: none">
  27. {% for action in batch_actions %}
  28. {{ include(action.templatePath, { action: action }, with_context = false) }}
  29. {% endfor %}
  30. </div>
  31. {% endif %}
  32. {% endblock %} #}
  33. {% endblock page_actions %}
  34. {% block main %}
  35. {# sort can be multiple; let's consider the sorting field the first one #}
  36. {% set sort_field_name = app.request.get('sort')|keys|first %}
  37. {% set sort_order = app.request.get('sort')|first %}
  38. {% set some_results_are_hidden = false %}
  39. {% set has_footer = entities|length != 0 %}
  40. {% set has_search = ea.crud.isSearchEnabled %}
  41. {% set has_filters = filters|length > 0 %}
  42. {% set has_datagrid_tools = has_search or has_filters %}
  43. {{ form_start(sortable_form) }}
  44. {% embed '@LcSov/adminlte/embed/card.html.twig' %}
  45. {% block css %}card-table card-outline card-primary{% endblock %}
  46. {% block header %}
  47. <span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total">
  48. {{ paginator.numResults }} résultats
  49. </span>
  50. {% endblock %}
  51. {% block body %}
  52. <div class="table-responsive">
  53. <table class="table table-bordered table-hover table-striped sov-sortable"
  54. data-parent-position="{{ entity is defined and entity is not null ? entity.position : '' }}">
  55. <thead>
  56. {% block table_head %}
  57. <tr>
  58. <th></th>
  59. {% for field in fields ?? [] %}
  60. {% set field = field.getAsDto() %}
  61. {% set is_sorting_field = ea.search.isSortingField(field.property) %}
  62. <th class="{{ is_sorting_field ? 'sorted' }} {{ field.isVirtual ? 'field-virtual' }} {% if field.textAlign %}text-{{ field.textAlign }}{% endif %}"
  63. dir="{{ ea.i18n.textDirection }}">
  64. <span>{{ field.label|raw }}</span>
  65. </th>
  66. {% endfor %}
  67. </tr>
  68. {% endblock table_head %}
  69. </thead>
  70. <tbody>
  71. {% block table_body %}
  72. {% for entity in entities %}
  73. {% if not entity.isAccessible %}
  74. {% set some_results_are_hidden = true %}
  75. {% else %}
  76. <tr class="sov-draggable" data-id="{{ entity.primaryKeyValueAsString }}">
  77. <td>
  78. <i class="fa fa-fw fa-sort"></i>
  79. </td>
  80. {% for field in entity.fields %}
  81. <td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}"
  82. dir="{{ ea.i18n.textDirection }}">
  83. {{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
  84. </td>
  85. {% endfor %}
  86. </tr>
  87. {% endif %}
  88. {% else %}
  89. <tr>
  90. <td class="no-results" colspan="100">
  91. {{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}
  92. </td>
  93. </tr>
  94. {% endfor %}
  95. {% if some_results_are_hidden %}
  96. <tr class="datagrid-row-empty">
  97. <td class="text-center" colspan="{{ entities|first.fields|length + 1 }}">
  98. <span class="datagrid-row-empty-message"><i
  99. class="fa fa-lock mr-1"></i> {{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}</span>
  100. </td>
  101. </tr>
  102. {% endif %}
  103. {% endblock table_body %}
  104. </tbody>
  105. </table>
  106. <div style="display: none;">
  107. {{ form_row(sortable_form.entities) }}
  108. {{ form_rest(sortable_form) }}
  109. </div>
  110. </div>
  111. {% endblock %}
  112. {% endembed %}
  113. {% embed '@LcSov/adminlte/embed/card.html.twig' %}
  114. {% block footer %}
  115. <div class="form-actions">
  116. <div class="button-action">
  117. {# <a class=" {{ _action.css_class|default('') }}" href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}" target="{{ _action.target }}">
  118. {{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }}
  119. </a> #}
  120. <button type="submit" class="btn btn-primary float-right"> Sauvegarder</button>
  121. </div>
  122. </div>
  123. {% endblock %}
  124. {% endembed %}
  125. {{ form_end(sortable_form) }}
  126. {% endblock main %}