2021-05-12 10:18:34 +02:00
|
|
|
{% extends '@Core/admin/layout.html.twig' %}
|
|
|
|
|
|
|
|
{% block title %}{{ configuration.pageTitle('index')|trans }} - {{ parent() }}{% endblock %}
|
|
|
|
|
|
|
|
{% block body %}
|
|
|
|
{% block header %}
|
2021-05-12 11:55:19 +02:00
|
|
|
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.paginationData.pageCount < 2 %}{% if filters.show %}pb-3{% else %}pb-5{% endif %}{% endif %}">
|
2021-05-12 10:18:34 +02:00
|
|
|
<div class="crud-header">
|
|
|
|
{% block header_title %}
|
|
|
|
<h1 class="crud-header-title">{{ configuration.pageTitle('index')|trans }}</h1>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block header_actions %}
|
|
|
|
<div class="crud-header-actions">
|
|
|
|
<div class="btn-group">
|
|
|
|
{% if configuration.action('index', 'new', true) %}
|
|
|
|
<a href="{{ path(configuration.pageRoute('new')) }}" class="btn btn-primary">
|
|
|
|
<span class="fa fa-plus pr-1"></span>
|
|
|
|
{{ configuration.actionTitle('index', 'new', 'New')|trans }}
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
</div>
|
|
|
|
|
2021-05-12 11:59:13 +02:00
|
|
|
{% block header_filter_pager %}
|
|
|
|
{% if filters.show %}
|
|
|
|
<div class="row pb-3">
|
|
|
|
<div class="col-auto ml-auto {% if pager.getPaginationData.pageCount > 1 %}mr-3{% endif %}">
|
|
|
|
<button data-modal="{{ path(configuration.pageRoute('filter')) }}" class="btn btn-sm btn-secondary">
|
|
|
|
{{ 'Filter'|trans }} {% if not filters.isEmpty %}({{ 'yes'|trans }}){% endif %}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
|
|
{{ knp_pagination_render(pager) }}
|
|
|
|
</div>
|
2021-05-12 11:55:19 +02:00
|
|
|
</div>
|
2021-05-12 11:59:13 +02:00
|
|
|
{% else %}
|
|
|
|
{{ knp_pagination_render(pager) }}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
2021-05-12 10:18:34 +02:00
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block list %}
|
|
|
|
<div class="table-responsive">
|
|
|
|
<table class="table">
|
|
|
|
{% block list_header %}
|
|
|
|
<thead class="thead-light">
|
|
|
|
<tr>
|
|
|
|
{% for label, config in configuration.fields('index') %}
|
|
|
|
{% set attr = config.options.attr is defined ? config.options.attr : [] %}
|
2021-05-15 17:21:50 +02:00
|
|
|
{% set isSortable = config.options.sort ?? false %}
|
2021-05-12 10:18:34 +02:00
|
|
|
|
|
|
|
<th {% for key, value in attr %}{{ key }}="{{ value }}"{% endfor %}>
|
2021-05-15 17:21:50 +02:00
|
|
|
{% if isSortable %}
|
|
|
|
{% if sort %}
|
|
|
|
{% if sort.label == label %}
|
|
|
|
{% if sort.direction == 'asc' %}
|
|
|
|
{% set newDirection = 'desc' %}
|
|
|
|
{% set icon = 'fa fa-sort-amount-down-alt' %}
|
|
|
|
{% else %}
|
|
|
|
{% set newDirection = 'asc' %}
|
|
|
|
{% set icon = 'fa fa-sort-amount-up-alt' %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% set url = path(configuration.getPageRoute('index'), {
|
|
|
|
_sort: config.options.sort[0],
|
|
|
|
_sort_direction: newDirection,
|
|
|
|
}) %}
|
|
|
|
{% else %}
|
|
|
|
{% set url = path(configuration.getPageRoute('index'), {
|
|
|
|
_sort: config.options.sort[0],
|
|
|
|
_sort_direction: 'asc',
|
|
|
|
}) %}
|
|
|
|
|
|
|
|
{% set icon = null %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<a href="{{ url }}">
|
|
|
|
{% if icon is defined %}
|
|
|
|
<span class="{{ icon }}"></span>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{{ label|trans }}
|
|
|
|
</a>
|
|
|
|
{% else %}
|
|
|
|
{{ label|trans }}
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
{{ label|trans }}
|
|
|
|
{% endif %}
|
2021-05-12 10:18:34 +02:00
|
|
|
</th>
|
|
|
|
{% endfor %}
|
2021-05-15 17:21:50 +02:00
|
|
|
<th class="col-2 miw-100 text-right">
|
|
|
|
{{ 'Actions'|trans }}
|
|
|
|
</th>
|
2021-05-12 10:18:34 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block list_items %}
|
|
|
|
<tbody>
|
|
|
|
{% for item in pager %}
|
|
|
|
{% block list_item %}
|
2021-05-13 17:49:19 +02:00
|
|
|
{%- set dbClick %}
|
|
|
|
{% if configuration.action('index', 'show', true) %}
|
|
|
|
{{ path(configuration.pageRoute('show'), {entity: item.id}) }}
|
|
|
|
{% elseif configuration.action('index', 'edit', true) %}
|
|
|
|
{{ path(configuration.pageRoute('edit'), {entity: item.id}) }}
|
|
|
|
{% endif %}
|
|
|
|
{% endset -%}
|
|
|
|
|
|
|
|
<tr data-dblclick="{{ dbClick }}">
|
2021-05-12 10:18:34 +02:00
|
|
|
{% for config in configuration.fields('index') %}
|
|
|
|
{% set attr = config.options.attr is defined ? config.options.attr : [] %}
|
|
|
|
{% set action = config.options.action is defined ? config.options.action : null %}
|
|
|
|
|
|
|
|
<td {% for key, value in attr %}{{ key }}="{{ value }}"{% endfor %}>
|
|
|
|
{% if action == 'show' %}
|
|
|
|
<a href="{{ path(configuration.pageRoute('show'), {entity: item.id}) }}">
|
2021-05-13 17:49:19 +02:00
|
|
|
{{ render_field(item, config, configuration.defaultLocale) }}
|
2021-05-12 10:18:34 +02:00
|
|
|
</a>
|
|
|
|
{% elseif action == 'edit' %}
|
|
|
|
<a href="{{ path(configuration.pageRoute('edit'), {entity: item.id}) }}">
|
2021-05-13 17:49:19 +02:00
|
|
|
{{ render_field(item, config, configuration.defaultLocale) }}
|
2021-05-12 10:18:34 +02:00
|
|
|
</a>
|
|
|
|
{% else %}
|
2021-05-13 17:49:19 +02:00
|
|
|
{{ render_field(item, config, configuration.defaultLocale) }}
|
2021-05-12 10:18:34 +02:00
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
{% endfor %}
|
|
|
|
|
2021-05-12 12:44:36 +02:00
|
|
|
{% if configuration.action('index', 'show', true) or configuration.action('index', 'edit', true) or configuration.action('index', 'delete', true) %}
|
2021-05-12 10:18:34 +02:00
|
|
|
<td class="col-2 miw-100 text-right">
|
2021-05-12 12:44:36 +02:00
|
|
|
{% if configuration.action('index', 'show', true) %}
|
|
|
|
<a href="{{ path(configuration.pageRoute('show'), {entity: item.id}) }}" class="btn btn-sm btn-secondary mr-1">
|
|
|
|
<span class="fa fa-eye"></span>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
2021-05-12 10:18:34 +02:00
|
|
|
{% if configuration.action('index', 'edit', true) %}
|
|
|
|
<a href="{{ path(configuration.pageRoute('edit'), {entity: item.id}) }}" class="btn btn-sm btn-primary mr-1">
|
|
|
|
<span class="fa fa-edit"></span>
|
|
|
|
</a>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if configuration.action('index', 'delete', true) %}
|
|
|
|
<button type="submit" form="form-delete-{{ item.id }}" class="btn btn-sm btn-danger">
|
|
|
|
<span class="fa fa-trash"></span>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<form method="post" action="{{ path(configuration.pageRoute('delete'), {entity: item.id}) }}" id="form-delete-{{ item.id }}" data-form-confirm>
|
|
|
|
<input type="hidden" name="_method" value="DELETE">
|
|
|
|
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ item.id) }}">
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
</td>
|
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
{% endblock %}
|
|
|
|
{% else %}
|
|
|
|
<tr>
|
2021-05-12 10:49:38 +02:00
|
|
|
<td class="col-12 text-center p-4 text-black-50" colspan="{{ configuration.fields('index')|length + 1 }}">
|
2021-05-12 10:18:34 +02:00
|
|
|
<div class="display-1">
|
|
|
|
<span class="fa fa-search"></span>
|
|
|
|
</div>
|
|
|
|
<div class="display-5 mt-3">
|
|
|
|
Aucun résultat
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
{% endblock %}
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% endblock %}
|