|
- {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
- {# @var entities \EasyCorp\Bundle\EasyAdminBundle\Collection\EntityDtoCollection #}
- {# @var paginator \EasyCorp\Bundle\EasyAdminBundle\Orm\EntityPaginator #}
- {% extends ea.templatePath('layout') %}
- {% trans_default_domain ea.i18n.translationDomain %}
-
- {% block body_id entities|length > 0 ? 'ea-index-' ~ entities|first.name : '' %}
- {% block body_class 'index' ~ (entities|length > 0 ? ' index-' ~ entities|first.name : '') %}
-
- {% block content_title %}
- {{ 'sort'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
- {% endblock %}
-
- {% block content_breadcrumb %}
- {{ include('@LcSov/adminlte/block/breadcrumb.html.twig') }}
- {% endblock content_breadcrumb %}
-
- {% set has_batch_actions = batch_actions|length > 0 %}
-
- {% block page_actions %}{% endblock page_actions %}
-
- {% block main %}
- {# sort can be multiple; let's consider the sorting field the first one #}
- {% set sort_field_name = app.request.get('sort')|keys|first %}
- {% set sort_order = app.request.get('sort')|first %}
- {% set some_results_are_hidden = false %}
- {% set has_footer = entities|length != 0 %}
- {% set has_search = ea.crud.isSearchEnabled %}
- {% set has_filters = filters|length > 0 %}
- {% set has_datagrid_tools = has_search or has_filters %}
-
- {{ form_start(sortable_form) }}
-
- {% embed '@LcSov/adminlte/embed/card.html.twig' %}
- {% block css %}card-table card-outline card-primary{% endblock %}
- {% block header %}
- <span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total">
- {{ paginator.numResults }} résultats
- </span>
-
- <div class="btn-list float-sm-right">
- <a href=" {{ ea_url({crudAction: 'index'}).generateUrl() }}" class="btn btn-sm btn-info">
- <i class="fa fa-chevron-left"></i>
- Retour à la liste
- </a>
- </div>
- {% endblock %}
- {% block body %}
-
- <div class="table-responsive">
- <table class="table table-bordered table-hover table-striped sov-sortable"
- data-parent-position="{{ entity is defined and entity is not null ? entity.position : '' }}">
- <thead>
- {% block table_head %}
- <tr>
- <th></th>
- {% for field in fields ?? [] %}
- {% set field = field.getAsDto() %}
- {% if field.isDisplayedOn('index') %}
- {% set is_sorting_field = ea.search.isSortingField(field.property) %}
- <th class="{{ is_sorting_field ? 'sorted' }} {{ field.isVirtual ? 'field-virtual' }} {% if field.textAlign %}text-{{ field.textAlign }}{% endif %}"
- dir="{{ ea.i18n.textDirection }}">
- <span>{{ field.label ? field.label|raw : field.getProperty|raw }}</span>
- </th>
- {% endif %}
- {% endfor %}
-
- </tr>
- {% endblock table_head %}
- </thead>
-
- <tbody>
- {% block table_body %}
- {% for entity in entities %}
- {% if not entity.isAccessible %}
- {% set some_results_are_hidden = true %}
- {% else %}
-
- <tr class="sov-draggable" data-id="{{ entity.primaryKeyValueAsString }}">
- <td>
- <i class="fa fa-fw fa-sort"></i>
- </td>
- {% for field in entity.fields %}
- {% if field.isDisplayedOn('index') %}
- <td class="{{ field.property == sort_field_name ? 'sorted' }} text-{{ field.textAlign }} {{ field.cssClass }}"
- dir="{{ ea.i18n.textDirection }}">
- {{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
- </td>
- {% endif %}
- {% endfor %}
- </tr>
- {% endif %}
- {% else %}
- <tr>
- <td class="no-results" colspan="100">
- {{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}
- </td>
- </tr>
- {% endfor %}
-
- {% if some_results_are_hidden %}
- <tr class="datagrid-row-empty">
- <td class="text-center" colspan="{{ entities|first.fields|length + 1 }}">
- <span class="datagrid-row-empty-message"><i
- class="fa fa-lock mr-1"></i> {{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}</span>
- </td>
- </tr>
- {% endif %}
- {% endblock table_body %}
- </tbody>
- </table>
- <div style="display: none;">
- {{ form_row(sortable_form.entities) }}
-
- {{ form_rest(sortable_form) }}
- </div>
-
- </div>
- {% endblock %}
-
- {% block footer %}
- <div class="form-actions">
- <div class="button-action">
- {# <a class=" {{ _action.css_class|default('') }}" href="{{ path('easyadmin', _request_parameters|merge({ action: _action.name })) }}" target="{{ _action.target }}">
- {{ _action.label is defined and not _action.label is empty ? _action.label|trans(_trans_parameters) }}
- </a> #}
- <button type="submit" class="btn btn-primary float-right"> Sauvegarder</button>
- </div>
- </div>
- {% endblock %}
- {% endembed %}
-
-
- {{ form_end(sortable_form) }}
-
- {% endblock main %}
|