templates/admin/index/donation_index.html.twig line 1

Open in your IDE?
  1. {# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
  2. {# @var entities \EasyCorp\Bundle\EasyAdminBundle\Collection\EntityDtoCollection #}
  3. {# @var paginator \EasyCorp\Bundle\EasyAdminBundle\Orm\EntityPaginator #}
  4. {% extends ea.templatePath('layout') %}
  5. {% trans_default_domain ea.i18n.translationDomain %}
  6. {% block body_id entities|length > 0 ? 'ea-index-' ~ entities|first.name : '' %}
  7. {% block body_class 'ea-index' ~ (entities|length > 0 ? ' ea-index-' ~ entities|first.name : '') %}
  8. {% set ea_field_assets = ea.crud.fieldAssets(constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Crud::PAGE_INDEX')) %}
  9. {% block configured_head_contents %}
  10.     {{ parent() }}
  11.     {% for htmlContent in ea_field_assets.headContents %}
  12.         {{ htmlContent|raw }}
  13.     {% endfor %}
  14. {% endblock %}
  15. {% block configured_body_contents %}
  16.     {{ parent() }}
  17.     {% for htmlContent in ea_field_assets.bodyContents %}
  18.         {{ htmlContent|raw }}
  19.     {% endfor %}
  20. {% endblock %}
  21. {% block configured_stylesheets %}
  22.     {{ parent() }}
  23.     {{ include('@EasyAdmin/includes/_css_assets.html.twig', { assets: ea_field_assets.cssAssets }, with_context = false) }}
  24.     {{ include('@EasyAdmin/includes/_encore_link_tags.html.twig', { assets: ea_field_assets.webpackEncoreAssets }, with_context = false) }}
  25. {% endblock %}
  26. {% block configured_javascripts %}
  27.     {{ parent() }}
  28.     {{ include('@EasyAdmin/includes/_js_assets.html.twig', { assets: ea_field_assets.jsAssets }, with_context = false) }}
  29.     {{ include('@EasyAdmin/includes/_encore_script_tags.html.twig', { assets: ea_field_assets.webpackEncoreAssets }, with_context = false) }}
  30. {% endblock %}
  31. {% block content_title %}
  32.     {%- apply spaceless -%}
  33.         {% set custom_page_title = ea.crud.customPageTitle('index', null, ea.i18n.translationParameters) %}
  34.         {{ custom_page_title is null
  35.             ? ea.crud.defaultPageTitle('index', null, ea.i18n.translationParameters)|trans|raw
  36.             : custom_page_title|trans|raw }}
  37.     {%- endapply -%}
  38. {% endblock %}
  39. {% set has_batch_actions = batch_actions|length > 0 %}
  40. {% block page_actions %}
  41.     {% if filters|length > 0 %}
  42.         <div class="datagrid-filters">
  43.             {% block filters %}
  44.                 {% set applied_filters = ea.request.query.all['filters']|default([])|keys %}
  45.                 <div class="btn-group action-filters">
  46.                     <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">
  47.                         <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 %}
  48.                     </a>
  49.                     {% if applied_filters %}
  50.                         <a href="{{ ea_url().unset('filters') }}" class="btn btn-secondary action-filters-reset">
  51.                             <i class="fa fa-close"></i>
  52.                         </a>
  53.                     {% endif %}
  54.                 </div>
  55.             {% endblock filters %}
  56.         </div>
  57.     {% endif %}
  58.     {% block global_actions %}
  59.         <div class="global-actions">
  60.             {% for action in global_actions %}
  61.                 {{ include(action.templatePath, { action: action }, with_context = false) }}
  62.             {% endfor %}
  63.         </div>
  64.     {% endblock global_actions %}
  65.     {% block batch_actions %}
  66.         {% if has_batch_actions %}
  67.             <div class="batch-actions" style="display: none">
  68.                 {% for action in batch_actions %}
  69.                     {{ include(action.templatePath, { action: action }, with_context = false) }}
  70.                 {% endfor %}
  71.             </div>
  72.         {% endif %}
  73.     {% endblock %}
  74. {% endblock page_actions %}
  75. {% block main %}
  76.     {# sort can be multiple; let's consider the sorting field the first one #}
  77.     {% set sort_field_name = app.request.get('sort')|keys|first %}
  78.     {% set sort_order = app.request.get('sort')|first %}
  79.     {% set some_results_are_hidden = entities|reduce((some_results_are_hidden, entity) => some_results_are_hidden or not entity.isAccessible, false) %}
  80.     {% set has_footer = entities|length != 0 %}
  81.     {% set has_search = ea.crud.isSearchEnabled %}
  82.     {% set has_filters = filters|length > 0 %}
  83.     {% set num_results = entities|length %}
  84.     {% if entities|first %}
  85.         {% set entity_name = entities|first.name %}
  86.         <div class="py-4 form-tabs donation-tabs">
  87.             <ul class="nav nav-tabs row">
  88.                 <li class="nav-item col-sm-2 p-0 text-center">
  89.                     <a href="{{ ea_url()
  90.                         .setController('App\\Controller\\Admin\\DonationCrudController')
  91.                         .setAction('index')
  92.                     }}" class="nav-link {% if entity_name == 'Donation' %}active{% endif %}">All</a>
  93.                 </li>
  94.                 <li class="nav-item col-sm-2 p-0 text-center">
  95.                     <a href="{{ ea_url()
  96.                         .setController('App\\Controller\\Admin\\RecurringDonationCrudController')
  97.                         .setAction('index')
  98.                     }}" class="nav-link {% if entity_name == 'RecurringDonation' %}active{% endif %}">Recurring Donations</a>
  99.                 </li>
  100.             </ul>
  101.         </div>
  102.     {% else %}
  103.         <div class="py-4 form-tabs donation-tabs">
  104.             <ul class="nav nav-tabs row">
  105.                 <li class="nav-item col-sm-2 p-0 text-center">
  106.                     <a href="{{ ea_url()
  107.                         .setController('App\\Controller\\Admin\\DonationCrudController')
  108.                         .setAction('index')
  109.                     }}" class="nav-link active">All</a>
  110.                 </li>
  111.                 <li class="nav-item col-sm-2 p-0 text-center">
  112.                     <a href="{{ ea_url()
  113.                         .setController('App\\Controller\\Admin\\RecurringDonationCrudController')
  114.                         .setAction('index')
  115.                     }}" class="nav-link">Recurring Donations</a>
  116.                 </li>
  117.             </ul>
  118.         </div>
  119.     {% endif %}
  120.     <table class="table datagrid {{ entities is empty ? 'datagrid-empty' }}">
  121.         {% if num_results > 0 %}
  122.             <thead>
  123.             {% block table_head %}
  124.                 <tr>
  125.                     {% if has_batch_actions %}
  126.                         <th>
  127.                             <div class="form-check">
  128.                                 <span><input type="checkbox" class="form-check-input form-batch-checkbox-all"></span>
  129.                             </div>
  130.                         </th>
  131.                     {% endif %}
  132.                     {% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %}
  133.                     {% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %}
  134.                     {% for field in entities|first.fields ?? [] %}
  135.                         {% set is_sorting_field = ea.search.isSortingField(field.property) %}
  136.                         {% set next_sort_direction = is_sorting_field ? (ea.search.sortDirection(field.property) == ea_sort_desc ? ea_sort_asc : ea_sort_desc) : ea_sort_desc %}
  137.                         {% set column_icon = is_sorting_field ? (next_sort_direction == ea_sort_desc ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}
  138.                         <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 }}">
  139.                             {% if field.isSortable %}
  140.                                 <a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}">
  141.                                     {{ field.label|trans|raw }} <i class="fa fa-fw {{ column_icon }}"></i>
  142.                                 </a>
  143.                             {% else %}
  144.                                 <span>{{ field.label|trans|raw }}</span>
  145.                             {% endif %}
  146.                         </th>
  147.                     {% endfor %}
  148.                     <th {% if ea.crud.showEntityActionsAsDropdown %}style="width: 10px"{% endif %} dir="{{ ea.i18n.textDirection }}">
  149.                         <span class="sr-only">{{ t('action.entity_actions', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}</span>
  150.                     </th>
  151.                 </tr>
  152.             {% endblock table_head %}
  153.             </thead>
  154.         {% endif %}
  155.         <tbody>
  156.         {% block table_body %}
  157.             {% for entity in entities %}
  158.                 {% if entity.isAccessible %}
  159.                     <tr data-id="{{ entity.primaryKeyValueAsString }}">
  160.                         {% if has_batch_actions %}
  161.                             <td class="batch-actions-selector">
  162.                                 <div class="form-check">
  163.                                     <input type="checkbox" class="form-check-input form-batch-checkbox" value="{{ entity.primaryKeyValue }}">
  164.                                 </div>
  165.                             </td>
  166.                         {% endif %}
  167.                         {% for field in entity.fields %}
  168.                             <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 }}">
  169.                                 {{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
  170.                             </td>
  171.                         {% endfor %}
  172.                         {% block entity_actions %}
  173.                             <td class="actions {{ ea.crud.showEntityActionsAsDropdown ? 'actions-as-dropdown' }}">
  174.                                 {% if entity.actions.count > 0 %}
  175.                                     {% if ea.crud.showEntityActionsAsDropdown %}
  176.                                         <div class="dropdown dropdown-actions">
  177.                                             <a class="dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  178.                                                 {# don't use FontAwesome 'fa-ellipsis-h' icon here because it doesn't look good #}
  179.                                                 {# this icon is 'dots-horizontal' icon from https://heroicons.com/ #}
  180.                                                 <svg xmlns="http://www.w3.org/2000/svg" height="21" width="21" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  181.                                                     <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" />
  182.                                                 </svg>
  183.                                             </a>
  184.                                             <div class="dropdown-menu dropdown-menu-right">
  185.                                                 {% for action in entity.actions %}
  186.                                                     {{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
  187.                                                 {% endfor %}
  188.                                             </div>
  189.                                         </div>
  190.                                     {% else %}
  191.                                         {% for action in entity.actions %}
  192.                                             {{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
  193.                                         {% endfor %}
  194.                                     {% endif %}
  195.                                 {% endif %}
  196.                             </td>
  197.                         {% endblock entity_actions %}
  198.                     </tr>
  199.                 {% endif %}
  200.             {% else %}
  201.                 {% block table_body_empty %}
  202.                     {% for i in 1..14 %}
  203.                         <tr class="empty-row">
  204.                             <td><span></span></td>
  205.                             <td><span></span></td>
  206.                             <td><span></span></td>
  207.                             <td><span></span></td>
  208.                             <td><span></span></td>
  209.                             <td><span></span></td>
  210.                         </tr>
  211.                         {% if 3 == loop.index %}
  212.                             <tr class="no-results">
  213.                                 <td colspan="100">
  214.                                     {{ t('datagrid.no_results', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
  215.                                 </td>
  216.                             </tr>
  217.                         {% endif %}
  218.                     {% endfor %}
  219.                 {% endblock table_body_empty %}
  220.             {% endfor %}
  221.             {% if some_results_are_hidden %}
  222.                 <tr class="datagrid-row-empty">
  223.                     <td class="text-center" colspan="100">
  224.                         <span class="datagrid-row-empty-message"><i class="fa fa-lock mr-1"></i> {{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}</span>
  225.                     </td>
  226.                 </tr>
  227.             {% endif %}
  228.         {% endblock table_body %}
  229.         </tbody>
  230.         <tfoot>
  231.         {% block table_footer %}
  232.         {% endblock table_footer %}
  233.         </tfoot>
  234.     </table>
  235.     {% if entities|length > 0 %}
  236.         <div class="content-panel-footer without-padding without-border">
  237.             {% block paginator %}
  238.                 {{ include(ea.templatePath('crud/paginator'), { render_detailed_pagination: not some_results_are_hidden }) }}
  239.             {% endblock paginator %}
  240.         </div>
  241.     {% endif %}
  242.     {% block delete_form %}
  243.         {{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', with_context = false) }}
  244.     {% endblock delete_form %}
  245.     {% if has_filters %}
  246.         {{ include('@EasyAdmin/crud/includes/_filters_modal.html.twig') }}
  247.     {% endif %}
  248.     {% if has_batch_actions %}
  249.         {{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }}
  250.     {% endif %}
  251.     <div id="custom-batch-actions" class="custom-modal fade" tabindex="-1">
  252.         <div class="modal-dialog">
  253.             <div class="modal-content">
  254.                 <div class="modal-body">
  255.                     <div class="row ">
  256.                         <div class="col-12 d-flex align-items-center flex-wrap batch-actions">
  257.                             <p class="number-selected"><span class="numberOfSelected"></span> Item(s)</p>
  258.                             {% if has_batch_actions %}
  259.                                 {% for action in batch_actions %}
  260.                                     <a href="{{ action.linkUrl }}" class="btn btn-primary custom-batch-btn {{action.cssClass}}"  
  261.                                     {% for name, value in action.htmlAttributes %}{{ name }}="{{ value|e('html_attr') }}" {% endfor %}>
  262.                                         <span class="btn-label">{{ action.label|trans|raw }}</span>
  263.                                     </a>
  264.                                 {% endfor %}
  265.                             {% endif %}
  266.                             <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"  data-bs-target="#modal-batch-action" ></button>
  267.                         </div>
  268.                     </div>
  269.                 </div>
  270.             </div>
  271.         </div>
  272.     </div>
  273.     <div id="refund-review-modal" aria-hidden="true" class="modal micromodal-slide">
  274.         <input name="data-id" id="data-id" type="hidden" />
  275.         <div class="modal__overlay" tabindex="-1" data-micromodal-close>
  276.             <div class="modal__main_content">
  277.                 <div class="icon__overlay">
  278.                     <img src="/build/images/check.png" />
  279.                 </div>
  280.                 <div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="modal-title" >
  281.                     
  282.                     <header class="modal_header">
  283.                         <h2 class="modal__title" id="modal-title">Refund Donation</h2>
  284.                     </header>
  285.                     <main class="modal__content" id="modal-content">
  286.                         Are you sure you want to refund the project?
  287.                         <p class="d-flex justify-content-center">
  288.                             <a class="btn btn-primary mt-4 mx-2 w-25 approve-refund-btn" href="javascript:void(0);">Yes</a>
  289.                             <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>
  290.                         </p>
  291.                     </main>
  292.                 </div>
  293.             </div>
  294.         </div>
  295.     </div>
  296.      <div id="partialRefund-review-modal" aria-hidden="true" class="modal micromodal-slide">
  297.         <input name="data-id" id="data-id" type="hidden" />
  298.         <div class="modal__overlay" tabindex="-1" data-micromodal-close>
  299.             <div class="modal__main_content">
  300.                 <div class="icon__overlay">
  301.                     <img src="/build/images/check.png" />
  302.                 </div>
  303.                 <div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="modal-title" >
  304.                     
  305.                     <header class="modal_header">
  306.                         <h2 class="modal__title" id="modal-title">Partial Refund Donation</h2>
  307.                     </header>
  308.                     <main class="modal__content" id="modal-content">
  309.                         Are you sure you want to partially refund the project?
  310.                         <p class="d-flex justify-content-center">
  311.                             <a class="btn btn-primary mt-4 mx-2 w-25 approve-partialRefund-btn" href="javascript:void(0);">Yes</a>
  312.                             <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>
  313.                         </p>
  314.                     </main>
  315.                 </div>
  316.             </div>
  317.         </div>
  318.     </div>
  319. {% endblock main %}