{# @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 %} {%- apply spaceless -%} {% set default_title = ea.crud.defaultPageTitle('index')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %} {{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('index')|trans(ea.i18n.translationParameters)|raw }} {%- endapply -%} {% endblock %} {% set has_batch_actions = batch_actions|length > 0 %} {% block page_actions %} {% block global_actions %}
{% for action in global_actions %} {{ include(action.templatePath, { action: action }, with_context = false) }} {% endfor %}
{% endblock global_actions %} {% block batch_actions %} {% if has_batch_actions %} {% endif %} {% endblock %} {% 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 %}
{{ paginator.numResults }} résultats
{% block table_head %} {% if has_batch_actions %} {% endif %} {% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %} {% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %} {% for field in entities|first.fields ?? [] %} {% set is_sorting_field = ea.search.isSortingField(field.property) %} {% set next_sort_direction = is_sorting_field ? (ea.search.sortDirection(field.property) == ea_sort_desc ? ea_sort_asc : ea_sort_desc) : ea_sort_desc %} {% set column_icon = is_sorting_field ? (next_sort_direction == ea_sort_desc ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %} {% endfor %} {% endblock table_head %} {% block table_body %} {% for entity in entities %} {% if not entity.isAccessible %} {% set some_results_are_hidden = true %} {% else %} {% if has_batch_actions %} {% endif %} {% for field in entity.fields %} {% endfor %} {% block entity_actions %} {% endblock entity_actions %} {% endif %} {% else %} {% endfor %} {% if some_results_are_hidden %} {% endif %} {% endblock table_body %}
{% if field.isSortable %} {{ field.label|raw }} {% else %} {{ field.label|raw }} {% endif %} {{ 'action.entity_actions'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}
{{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }} {% if not ea.crud.showEntityActionsAsDropdown %} {% for action in entity.actions %} {{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }} {% endfor %} {% else %} {% endif %}
{{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}
{{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}
{% if entities|length > 0 %} {% endif %}
{% block delete_form %} {{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', with_context = false) }} {% endblock delete_form %} {% if has_filters %} {{ include('@EasyAdmin/crud/includes/_filters_modal.html.twig') }} {% endif %} {% if has_batch_actions %} {{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }} {% endif %} {% endblock main %} {% block body_javascript %} {{ parent() }} {% if app.request.get('query') is not empty %} {% endif %} {% endblock %}