{# @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 : '') %}
{% 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 %}
<div class="datagrid-filters">
{% block filters %}
{% set applied_filters = ea.request.query.all['filters']|default([])|keys %}
<div class="btn-group action-filters">
<a href="#" data-href="{{ ea_url().setAction('renderFilters').includeReferrer() }}" class="btn btn-secondary btn-labeled btn-labeled-right action-filters-button disabled {{ applied_filters ? 'action-filters-applied' }}" data-bs-toggle="modal" data-bs-target="#modal-filters">
<i class="fa fa-filter fa-fw"></i> {{ t('filter.title', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}{% if applied_filters %} <span class="action-filters-button-count">({{ applied_filters|length }})</span>{% endif %}
</a>
{% if applied_filters %}
<a href="{{ ea_url().unset('filters') }}" class="btn btn-secondary action-filters-reset">
<i class="fa fa-close"></i>
</a>
{% endif %}
</div>
{% endblock filters %}
</div>
{% endif %}
{% block global_actions %}
<div class="global-actions">
{% for action in global_actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
</div>
{% endblock global_actions %}
{% block batch_actions %}
{% if has_batch_actions %}
<div class="batch-actions" style="display: none">
{% for action in batch_actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
</div>
{% 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 entities|first %}
{% set entity_name = entities|first.name %}
<div class="py-4 form-tabs donation-tabs">
<ul class="nav nav-tabs row">
<li class="nav-item col-sm-2 p-0 text-center">
<a href="{{ ea_url()
.setController('App\\Controller\\Admin\\DonationCrudController')
.setAction('index')
}}" class="nav-link {% if entity_name == 'Donation' %}active{% endif %}">All</a>
</li>
<li class="nav-item col-sm-2 p-0 text-center">
<a href="{{ ea_url()
.setController('App\\Controller\\Admin\\RecurringDonationCrudController')
.setAction('index')
}}" class="nav-link {% if entity_name == 'RecurringDonation' %}active{% endif %}">Recurring Donations</a>
</li>
</ul>
</div>
{% else %}
<div class="py-4 form-tabs donation-tabs">
<ul class="nav nav-tabs row">
<li class="nav-item col-sm-2 p-0 text-center">
<a href="{{ ea_url()
.setController('App\\Controller\\Admin\\DonationCrudController')
.setAction('index')
}}" class="nav-link active">All</a>
</li>
<li class="nav-item col-sm-2 p-0 text-center">
<a href="{{ ea_url()
.setController('App\\Controller\\Admin\\RecurringDonationCrudController')
.setAction('index')
}}" class="nav-link">Recurring Donations</a>
</li>
</ul>
</div>
{% endif %}
<table class="table datagrid {{ entities is empty ? 'datagrid-empty' }}">
{% if num_results > 0 %}
<thead>
{% block table_head %}
<tr>
{% if has_batch_actions %}
<th>
<div class="form-check">
<span><input type="checkbox" class="form-check-input form-batch-checkbox-all"></span>
</div>
</th>
{% 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' %}
<th class="{{ is_sorting_field ? 'sorted' }} {{ field.isVirtual ? 'field-virtual' }} header-for-{{ field.cssClass|split(' ')|filter(class => class starts with 'field-')|join('') }} text-{{ field.textAlign }}" dir="{{ ea.i18n.textDirection }}">
{% if field.isSortable %}
<a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}">
{{ field.label|trans|raw }} <i class="fa fa-fw {{ column_icon }}"></i>
</a>
{% else %}
<span>{{ field.label|trans|raw }}</span>
{% endif %}
</th>
{% endfor %}
<th {% if ea.crud.showEntityActionsAsDropdown %}style="width: 10px"{% endif %} dir="{{ ea.i18n.textDirection }}">
<span class="sr-only">{{ t('action.entity_actions', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}</span>
</th>
</tr>
{% endblock table_head %}
</thead>
{% endif %}
<tbody>
{% block table_body %}
{% for entity in entities %}
{% if entity.isAccessible %}
<tr data-id="{{ entity.primaryKeyValueAsString }}">
{% if has_batch_actions %}
<td class="batch-actions-selector">
<div class="form-check">
<input type="checkbox" class="form-check-input form-batch-checkbox" value="{{ entity.primaryKeyValue }}">
</div>
</td>
{% endif %}
{% for field in entity.fields %}
<td data-label="{{ field.label|trans|e('html_attr') }}" 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>
{% endfor %}
{% block entity_actions %}
<td class="actions {{ ea.crud.showEntityActionsAsDropdown ? 'actions-as-dropdown' }}">
{% if entity.actions.count > 0 %}
{% if ea.crud.showEntityActionsAsDropdown %}
<div class="dropdown dropdown-actions">
<a class="dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{# don't use FontAwesome 'fa-ellipsis-h' icon here because it doesn't look good #}
{# this icon is 'dots-horizontal' icon from https://heroicons.com/ #}
<svg xmlns="http://www.w3.org/2000/svg" height="21" width="21" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h.01M12 12h.01M19 12h.01M6 12a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0zm7 0a1 1 0 11-2 0 1 1 0 012 0z" />
</svg>
</a>
<div class="dropdown-menu dropdown-menu-right">
{% for action in entity.actions %}
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
{% endfor %}
</div>
</div>
{% else %}
{% for action in entity.actions %}
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
{% endfor %}
{% endif %}
{% endif %}
</td>
{% endblock entity_actions %}
</tr>
{% endif %}
{% else %}
{% block table_body_empty %}
{% for i in 1..14 %}
<tr class="empty-row">
<td><span></span></td>
<td><span></span></td>
<td><span></span></td>
<td><span></span></td>
<td><span></span></td>
<td><span></span></td>
</tr>
{% if 3 == loop.index %}
<tr class="no-results">
<td colspan="100">
{{ t('datagrid.no_results', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
</td>
</tr>
{% endif %}
{% endfor %}
{% endblock table_body_empty %}
{% endfor %}
{% if some_results_are_hidden %}
<tr class="datagrid-row-empty">
<td class="text-center" colspan="100">
<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>
<tfoot>
{% block table_footer %}
{% endblock table_footer %}
</tfoot>
</table>
{% if entities|length > 0 %}
<div class="content-panel-footer without-padding without-border">
{% block paginator %}
{{ include(ea.templatePath('crud/paginator'), { render_detailed_pagination: not some_results_are_hidden }) }}
{% endblock paginator %}
</div>
{% 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 %}
<div id="custom-batch-actions" class="custom-modal fade" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<div class="row ">
<div class="col-12 d-flex align-items-center flex-wrap batch-actions">
<p class="number-selected"><span class="numberOfSelected"></span> Item(s)</p>
{% if has_batch_actions %}
{% for action in batch_actions %}
<a href="{{ action.linkUrl }}" class="btn btn-primary custom-batch-btn {{action.cssClass}}"
{% for name, value in action.htmlAttributes %}{{ name }}="{{ value|e('html_attr') }}" {% endfor %}>
<span class="btn-label">{{ action.label|trans|raw }}</span>
</a>
{% endfor %}
{% endif %}
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close" data-bs-target="#modal-batch-action" ></button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="refund-review-modal" aria-hidden="true" class="modal micromodal-slide">
<input name="data-id" id="data-id" type="hidden" />
<div class="modal__overlay" tabindex="-1" data-micromodal-close>
<div class="modal__main_content">
<div class="icon__overlay">
<img src="/build/images/check.png" />
</div>
<div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="modal-title" >
<header class="modal_header">
<h2 class="modal__title" id="modal-title">Refund Donation</h2>
</header>
<main class="modal__content" id="modal-content">
Are you sure you want to refund the project?
<p class="d-flex justify-content-center">
<a class="btn btn-primary mt-4 mx-2 w-25 approve-refund-btn" href="javascript:void(0);">Yes</a>
<a class="btn btn-primary mt-4 mx-2 w-25 js-modal-close-trigger" href="#" aria-label="Close this dialog window" data-micromodal-close>No</a>
</p>
</main>
</div>
</div>
</div>
</div>
<div id="partialRefund-review-modal" aria-hidden="true" class="modal micromodal-slide">
<input name="data-id" id="data-id" type="hidden" />
<div class="modal__overlay" tabindex="-1" data-micromodal-close>
<div class="modal__main_content">
<div class="icon__overlay">
<img src="/build/images/check.png" />
</div>
<div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="modal-title" >
<header class="modal_header">
<h2 class="modal__title" id="modal-title">Partial Refund Donation</h2>
</header>
<main class="modal__content" id="modal-content">
Are you sure you want to partially refund the project?
<p class="d-flex justify-content-center">
<a class="btn btn-primary mt-4 mx-2 w-25 approve-partialRefund-btn" href="javascript:void(0);">Yes</a>
<a class="btn btn-primary mt-4 mx-2 w-25 js-modal-close-trigger" href="#" aria-label="Close this dialog window" data-micromodal-close>No</a>
</p>
</main>
</div>
</div>
</div>
</div>
{% endblock main %}