您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

sort.html.twig 6.4KB

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