{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #} {# @var entities \EasyCorp\Bundle\EasyAdminBundle\Collection\EntityCollection #} {# @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 : '') %} {% set ea_field_assets = ea.crud.fieldAssets(constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Crud::PAGE_INDEX')) %} {% block configured_head_contents %} {{ parent() }} {% for htmlContent in ea_field_assets.headContents %} {{ htmlContent|raw }} {% endfor %} {% endblock %} {% block configured_body_contents %} {{ parent() }} {% for htmlContent in ea_field_assets.bodyContents %} {{ htmlContent|raw }} {% endfor %} {% endblock %} {% block configured_stylesheets %} {{ parent() }} {{ include('@EasyAdmin/includes/_css_assets.html.twig', { assets: ea_field_assets.cssAssets }, with_context = false) }} {{ include('@EasyAdmin/includes/_encore_link_tags.html.twig', { assets: ea_field_assets.webpackEncoreAssets }, with_context = false) }} {% endblock %} {% block configured_javascripts %} {{ parent() }} {{ include('@EasyAdmin/includes/_js_assets.html.twig', { assets: ea_field_assets.jsAssets }, with_context = false) }} {{ include('@EasyAdmin/includes/_encore_script_tags.html.twig', { assets: ea_field_assets.webpackEncoreAssets }, with_context = false) }} {% endblock %} {% block content_title %} {%- apply spaceless -%} {% set custom_page_title = ea.crud.customPageTitle('index', null, ea.i18n.translationParameters) %} {{ custom_page_title is null ? ea.crud.defaultPageTitle('index', null, ea.i18n.translationParameters)|trans|raw : custom_page_title|trans|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 %}
{{ t('filter.title', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}{% 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 %}
{% for action in batch_actions %} {{ include(action.templatePath, { action: action }, with_context = false) }} {% endfor %}
{% 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 = entities|reduce((some_results_are_hidden, entity) => some_results_are_hidden or not entity.isAccessible, 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 entity.isAccessible %} {% 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|trans|raw }} {% else %} {{ field.label|trans|raw }} {% endif %} {{ t('action.entity_actions', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
{{ 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 %}
{{ t('datagrid.no_results', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
{{ '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 %}