templates/admin/index/film_project_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.     <div class="py-4 form-tabs donation-tabs">
  85.         <ul class="nav nav-tabs row">
  86.             <li class="nav-item col-sm-2 p-0 text-center">
  87.                 <a href="{{ ea_url()
  88.                     .setController('App\\Controller\\Admin\\FilmProjectCrudController')
  89.                     .setAction('index')
  90.                 }}" class="nav-link active">All Films</a>
  91.             </li>
  92.             <li class="nav-item col-sm-2 p-0 text-center">
  93.                 <a href="{{ ea_url()
  94.                     .setController('App\\Controller\\Admin\\DraftFilmProjectCrudController')
  95.                     .setAction('index')
  96.                 }}" class="nav-link">Draft Films</a>
  97.             </li>
  98.         </ul>
  99.     </div>
  100.     <table class="table datagrid {{ entities is empty ? 'datagrid-empty' }}">
  101.         {% if num_results > 0 %}
  102.             <thead>
  103.             {% block table_head %}
  104.                 <tr>
  105.                     {% if has_batch_actions %}
  106.                         <th>
  107.                             <div class="form-check">
  108.                                 <span><input type="checkbox" class="form-check-input form-batch-checkbox-all"></span>
  109.                             </div>
  110.                         </th>
  111.                     {% endif %}
  112.                     {% set ea_sort_asc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::ASC') %}
  113.                     {% set ea_sort_desc = constant('EasyCorp\\Bundle\\EasyAdminBundle\\Config\\Option\\SortOrder::DESC') %}
  114.                     {% for field in entities|first.fields ?? [] %}
  115.                         {% set is_sorting_field = ea.search.isSortingField(field.property) %}
  116.                         {% set next_sort_direction = is_sorting_field ? (ea.search.sortDirection(field.property) == ea_sort_desc ? ea_sort_asc : ea_sort_desc) : ea_sort_desc %}
  117.                         {% set column_icon = is_sorting_field ? (next_sort_direction == ea_sort_desc ? 'fa-arrow-up' : 'fa-arrow-down') : 'fa-sort' %}
  118.                         <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 }}">
  119.                             {% if field.isSortable %}
  120.                                 <a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}">
  121.                                     {{ field.label|trans|raw }} <i class="fa fa-fw {{ column_icon }}"></i>
  122.                                 </a>
  123.                             {% else %}
  124.                                 <span>{{ field.label|trans|raw }}</span>
  125.                             {% endif %}
  126.                         </th>
  127.                     {% endfor %}
  128.                     <th {% if ea.crud.showEntityActionsAsDropdown %}style="width: 10px"{% endif %} dir="{{ ea.i18n.textDirection }}">
  129.                         <span class="sr-only">{{ t('action.entity_actions', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}</span>
  130.                     </th>
  131.                 </tr>
  132.             {% endblock table_head %}
  133.             </thead>
  134.         {% endif %}
  135.         <tbody>
  136.         {% block table_body %}
  137.             {% for entity in entities %}
  138.                 {% if entity.isAccessible %}
  139.                     <tr data-id="{{ entity.primaryKeyValueAsString }}">
  140.                         {% if has_batch_actions %}
  141.                             <td class="batch-actions-selector">
  142.                                 <div class="form-check">
  143.                                     <input type="checkbox" class="form-check-input form-batch-checkbox" value="{{ entity.primaryKeyValue }}">
  144.                                 </div>
  145.                             </td>
  146.                         {% endif %}
  147.                         {% for field in entity.fields %}
  148.                             <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 }}">
  149.                                 {{ include(field.templatePath, { field: field, entity: entity }, with_context = false) }}
  150.                             </td>
  151.                         {% endfor %}
  152.                         {% block entity_actions %}
  153.                             <td class="actions {{ ea.crud.showEntityActionsAsDropdown ? 'actions-as-dropdown' }}">
  154.                                 {% if entity.actions.count > 0 %}
  155.                                     {% if ea.crud.showEntityActionsAsDropdown %}
  156.                                         <div class="dropdown dropdown-actions">
  157.                                             <a class="dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  158.                                                 {# don't use FontAwesome 'fa-ellipsis-h' icon here because it doesn't look good #}
  159.                                                 {# this icon is 'dots-horizontal' icon from https://heroicons.com/ #}
  160.                                                 <svg xmlns="http://www.w3.org/2000/svg" height="21" width="21" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  161.                                                     <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" />
  162.                                                 </svg>
  163.                                             </a>
  164.                                             <div class="dropdown-menu dropdown-menu-right">
  165.                                                 {% for action in entity.actions %}
  166.                                                     {{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
  167.                                                 {% endfor %}
  168.                                             </div>
  169.                                         </div>
  170.                                     {% else %}
  171.                                         {% for action in entity.actions %}
  172.                                             {{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }}
  173.                                         {% endfor %}
  174.                                     {% endif %}
  175.                                 {% endif %}
  176.                             </td>
  177.                         {% endblock entity_actions %}
  178.                     </tr>
  179.                 {% endif %}
  180.             {% else %}
  181.                 {% block table_body_empty %}
  182.                     {% for i in 1..14 %}
  183.                         <tr class="empty-row">
  184.                             <td><span></span></td>
  185.                             <td><span></span></td>
  186.                             <td><span></span></td>
  187.                             <td><span></span></td>
  188.                             <td><span></span></td>
  189.                             <td><span></span></td>
  190.                         </tr>
  191.                         {% if 3 == loop.index %}
  192.                             <tr class="no-results">
  193.                                 <td colspan="100">
  194.                                     {{ t('datagrid.no_results', ea.i18n.translationParameters, 'EasyAdminBundle')|trans }}
  195.                                 </td>
  196.                             </tr>
  197.                         {% endif %}
  198.                     {% endfor %}
  199.                 {% endblock table_body_empty %}
  200.             {% endfor %}
  201.             {% if some_results_are_hidden %}
  202.                 <tr class="datagrid-row-empty">
  203.                     <td class="text-center" colspan="100">
  204.                         <span class="datagrid-row-empty-message"><i class="fa fa-lock mr-1"></i> {{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}</span>
  205.                     </td>
  206.                 </tr>
  207.             {% endif %}
  208.         {% endblock table_body %}
  209.         </tbody>
  210.         <tfoot>
  211.         {% block table_footer %}
  212.         {% endblock table_footer %}
  213.         </tfoot>
  214.     </table>
  215.     {% if entities|length > 0 %}
  216.         <div class="content-panel-footer without-padding without-border">
  217.             {% block paginator %}
  218.                 {{ include(ea.templatePath('crud/paginator'), { render_detailed_pagination: not some_results_are_hidden }) }}
  219.             {% endblock paginator %}
  220.         </div>
  221.     {% endif %}
  222.     {% block delete_form %}
  223.         {{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', with_context = false) }}
  224.     {% endblock delete_form %}
  225.     {% if has_filters %}
  226.         {{ include('@EasyAdmin/crud/includes/_filters_modal.html.twig') }}
  227.     {% endif %}
  228.     {% if has_batch_actions %}
  229.         {{ include('@EasyAdmin/crud/includes/_batch_action_modal.html.twig', {}, with_context = false) }}
  230.     {% endif %}
  231.     <div id="custom-batch-actions" class="custom-modal fade" tabindex="-1">
  232.         <div class="modal-dialog">
  233.             <div class="modal-content">
  234.                 <div class="modal-body">
  235.                     <div class="row ">
  236.                         <div class="col-1 d-flex align-items-center flex-wrap batch-actions">
  237.                             <p class="number-selected"><span class="numberOfSelected"></span> Item(s)</p>
  238.                         </div>
  239.                         <div class="col-11 batch-actions justify-content-end">
  240.                             <div class="row">
  241.                                 <div class="col-11 d-flex align-items-center flex-wrap batch-actions justify-content-end">
  242.                                     {% if has_batch_actions %}
  243.                                         {% for action in batch_actions %}
  244.                                             <a href="{{ action.linkUrl }}" class="btn btn-primary custom-batch-btn {{action.cssClass}}" style="margin-bottom: 5px; margin-top: 5px;" 
  245.                                             {% for name, value in action.htmlAttributes %}{{ name }}="{{ value|e('html_attr') }}" {% endfor %}>
  246.                                                 <span class="btn-label">{{ action.label|trans|raw }}</span>
  247.                                             </a>
  248.                                         {% endfor %}
  249.                                     {% endif %}
  250.                                 </div>
  251.                                 <div class="col-1 d-flex align-items-center flex-wrap batch-actions">
  252.                                     <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"  data-bs-target="#modal-batch-action" ></button>
  253.                                 </div>
  254.                             </div>
  255.                         </div>
  256.                     </div>
  257.                 </div>
  258.             </div>
  259.         </div>
  260.     </div>
  261.     {% if app.session is not null and app.session.started %}
  262.         {% set flash_messages = app.session.flashbag.all %}
  263.         {% if flash_messages|length > 0 %}
  264.             {% for label, messages in flash_messages %}
  265.                 {% if label == 'unfollow-modal' %}
  266.                     <div id="unfollow-modal" aria-hidden="true" class="modal micromodal-slide">
  267.                         <div class="modal__overlay" tabindex="-1" data-micromodal-close>
  268.                             <div class="modal__main_content">
  269.                                 <div class="icon__overlay">
  270.                                     <img src="/build/images/check.png" />
  271.                                 </div>
  272.                                 <div class="modal__container" role="dialog" aria-modal="true" aria-labelledby="decline-modal-title" >
  273.                                      
  274.                                     <header class="modal_header">
  275.                                         <h2 class="modal__title" id="unfollow-modal-title">Project Unfollowed.</h2>
  276.                                     </header>
  277.                                     <main class="modal__content" id="unfollow-modal-content">
  278.                                         The project has been unfollowed
  279.                                         <p>
  280.                                             <a class="btn btn-primary mt-4 w-50 js-modal-close-trigger" href="#" aria-label="Close this dialog window" data-micromodal-close>OK</a>
  281.                                         </p>
  282.                                     </main>
  283.                                 </div>
  284.                             </div>
  285.                         </div>
  286.                     </div>
  287.                 {% endif %}
  288.             {% endfor %}
  289.         {% endif %}
  290.     {% endif %}
  291. {% endblock main %}