{# @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 'ea-index' ~ (entities|length > 0 ? ' ea-index-' ~ entities|first.name : '') %} {% block content_title %} {%- apply spaceless -%} {% set custom_page_title = ea.crud.customPageTitle('index') %} {{ custom_page_title is null ? (ea.crud.defaultPageTitle('index')|trans(ea.i18n.translationParameters, 'EasyAdminBundle'))|raw : (custom_page_title|trans(ea.i18n.translationParameters))|raw }} {%- endapply -%} {% endblock %} {% set has_batch_actions = batch_actions|length > 0 %} {% block page_actions %} {% if filters|length > 0 %}
{% block filters %} {% set applied_filters = ea.request.query.all['filters']|default([])|keys %}
{{ 'filter.title'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}{% if applied_filters %} ({{ applied_filters|length }}){% endif %} {% if applied_filters %} {% endif %}
{% endblock filters %}
{% endif %} {% 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 num_results = entities|length %} {% if num_results > 0 %} {% 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 %} {% endif %} {% 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 %} {% block table_body_empty %} {% for i in 1..14 %} {% if 3 == loop.index %} {% endif %} {% endfor %} {% endblock table_body_empty %} {% endfor %} {% if some_results_are_hidden %} {% endif %} {% endblock table_body %} {% block table_footer %} {% endblock table_footer %}
{% 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 entity.actions.count > 0 %} {% if ea.crud.showEntityActionsAsDropdown %} {% else %} {% for action in entity.actions %} {{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }} {% endfor %} {% endif %} {% 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 %}