use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as EaAbstractCrudController; | use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController as EaAbstractCrudController; | ||||
use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | use EasyCorp\Bundle\EasyAdminBundle\Router\AdminUrlGenerator; | ||||
use Lc\SovBundle\Doctrine\Extension\TranslatableInterface; | use Lc\SovBundle\Doctrine\Extension\TranslatableInterface; | ||||
use Symfony\Component\HttpFoundation\RequestStack; | |||||
use Symfony\Component\HttpFoundation\Session\SessionInterface; | |||||
abstract class AbstractCrudController extends EaAbstractCrudController | abstract class AbstractCrudController extends EaAbstractCrudController | ||||
{ | { | ||||
protected $session; | |||||
protected $request; | |||||
public function __construct(SessionInterface $session, RequestStack $request) | |||||
{ | |||||
$this->session = $session; | |||||
$this->request = $request; | |||||
} | |||||
public function configureActions(Actions $actions): Actions | public function configureActions(Actions $actions): Actions | ||||
{ | { | ||||
/* Translatable */ | |||||
if (in_array(TranslatableInterface::class, class_implements($this->getEntityFqcn()))) { | if (in_array(TranslatableInterface::class, class_implements($this->getEntityFqcn()))) { | ||||
$actions->update( | $actions->update( | ||||
Crud::PAGE_INDEX, | Crud::PAGE_INDEX, | ||||
Action::EDIT, | Action::EDIT, | ||||
function (Action $action) { | function (Action $action) { | ||||
return $action->setTemplatePath('@LcSov/adminlte/crud/action/translatable.html.twig'); | |||||
$action->setTemplatePath('@LcSov/adminlte/crud/action/translatable.html.twig'); | |||||
return $action; | |||||
} | |||||
); | |||||
} | |||||
/* Boutons des actions dans les listes */ | |||||
$listButtonsStyleArray = [ | |||||
Action::EDIT => [ | |||||
'class' => 'btn btn-sm btn-primary', | |||||
'icon' => 'edit' | |||||
], | |||||
Action::DELETE => [ | |||||
'class' => 'btn btn-sm btn-default', | |||||
'icon' => 'trash' | |||||
] | |||||
]; | |||||
foreach($listButtonsStyleArray as $actionName => $button) { | |||||
$actions->update( | |||||
Crud::PAGE_INDEX, | |||||
$actionName, | |||||
function (Action $action) use ($button) { | |||||
$action->setCssClass($button['class']); | |||||
$action->setIcon('fa fa-'.$button['icon'])->setLabel(false); | |||||
return $action; | |||||
} | } | ||||
); | ); | ||||
} | } | ||||
public function configureCrud(Crud $crud): Crud | public function configureCrud(Crud $crud): Crud | ||||
{ | { | ||||
return $crud | |||||
->overrideTemplates( | |||||
[ | |||||
'layout' => '@LcSov/adminlte/layout.html.twig', | |||||
'main_menu' => '@LcSov/adminlte/block/menu.html.twig', | |||||
'crud/index' => '@LcSov/adminlte/crud/index.html.twig', | |||||
'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig', | |||||
'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig', | |||||
'crud/new' => '@LcSov/adminlte/crud/new.html.twig', | |||||
] | |||||
) | |||||
->setFormThemes([ | |||||
'@LcSov/adminlte/crud/form_theme.html.twig', | |||||
'@FOSCKEditor/Form/ckeditor_widget.html.twig' | |||||
]); | |||||
} | |||||
$crud = parent::configureCrud($crud);; | |||||
$this->setMaxResults($crud); | |||||
return $crud; | |||||
} | |||||
/*public function configureAssets(Assets $assets): Assets | |||||
public function setMaxResults(Crud $crud) | |||||
{ | { | ||||
return $assets | |||||
// adds the CSS and JS assets associated to the given Webpack Encore entry | |||||
// it's equivalent to calling encore_entry_link_tags('...') and encore_entry_script_tags('...') | |||||
//->addWebpackEncoreEntry('admin-app') | |||||
$entityClass = $this->getEntityFqcn(); | |||||
$paramListMaxResults = 'listMaxResults'; | |||||
$paramSessionListMaxResults = $entityClass . '-' . $paramListMaxResults; | |||||
$requestListMaxResults = $this->request->getCurrentRequest()->get($paramListMaxResults); | |||||
// the argument of these methods is passed to the asset() Twig function | |||||
// CSS assets are added just before the closing </head> element | |||||
// and JS assets are added just before the closing </body> element | |||||
->addJsFile('bundles/lc_sov/js/utils.js'); | |||||
}*/ | |||||
if ($requestListMaxResults) { | |||||
$this->session->set($paramSessionListMaxResults, $requestListMaxResults); | |||||
} | |||||
$maxResults = $this->session->get($paramSessionListMaxResults) ? $this->session->get( | |||||
$paramSessionListMaxResults | |||||
) : 30; | |||||
/* | |||||
public function configureFields(string $pageName): iterable | |||||
{ | |||||
return [ | |||||
IdField::new('id'), | |||||
TextField::new('title'), | |||||
TextEditorField::new('description'), | |||||
]; | |||||
$crud->setPaginatorPageSize($maxResults); | |||||
} | } | ||||
*/ | |||||
} | } |
->overrideTemplates( | ->overrideTemplates( | ||||
[ | [ | ||||
'layout' => '@LcSov/adminlte/layout.html.twig', | 'layout' => '@LcSov/adminlte/layout.html.twig', | ||||
'main_menu' => '@LcSov/adminlte/menu.html.twig', | |||||
'main_menu' => '@LcSov/adminlte/block/menu.html.twig', | |||||
'crud/index' => '@LcSov/adminlte/crud/index.html.twig', | 'crud/index' => '@LcSov/adminlte/crud/index.html.twig', | ||||
'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig', | 'crud/paginator' => '@LcSov/adminlte/crud/paginator.html.twig', | ||||
'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig', | 'crud/edit' => '@LcSov/adminlte/crud/edit.html.twig', |
//JQUERY | //JQUERY | ||||
import 'jquery'; | import 'jquery'; | ||||
global.$ = global.jQuery = $; | global.$ = global.jQuery = $; | ||||
//BOOTSTRAP | //BOOTSTRAP | ||||
import 'adminlte-plugin/bootstrap/js/bootstrap.min.js'; | import 'adminlte-plugin/bootstrap/js/bootstrap.min.js'; | ||||
// SELECT 2 | // SELECT 2 | ||||
import 'adminlte-plugin/select2/js/select2.min.js'; | import 'adminlte-plugin/select2/js/select2.min.js'; | ||||
import 'adminlte-plugin/select2/js/i18n/fr.js'; | import 'adminlte-plugin/select2/js/i18n/fr.js'; | ||||
import log from './utils/log.js'; | import log from './utils/log.js'; | ||||
log('ncnnc'); | |||||
$('#test22').modal('show'); | |||||
//log('ncnnc'); | |||||
//$('#test22').modal('show'); | |||||
$('[data-toggle="tooltip"]').tooltip(); | $('[data-toggle="tooltip"]').tooltip(); | ||||
}); | }); | ||||
} | } | ||||
function setSelect2($select) { | function setSelect2($select) { | ||||
if (typeof $select.data('select2-id') === 'undefined') { | if (typeof $select.data('select2-id') === 'undefined') { | ||||
} | } | ||||
} | } | ||||
//require('select2'); | //require('select2'); | ||||
//require('adminlte'); | //require('adminlte'); | ||||
//import 'adminltePlugin/bootstrap/js/bootstrap.min.js' | //import 'adminltePlugin/bootstrap/js/bootstrap.min.js' | ||||
///import 'admin-lte/dist/css/adminlte.min.css' ; | ///import 'admin-lte/dist/css/adminlte.min.css' ; | ||||
//require('admin-lte-css') ; | //require('admin-lte-css') ; | ||||
// import './common.js' ; | |||||
// import './common.js' ; |
/*CUSTOM Checkbox | |||||
/* Customize the label (the container) */ | |||||
.form-check-label {display: block; position: relative; padding-left: 26px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;} | |||||
/* Hide the browser's default checkbox */ | |||||
.form-check-label input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0;} | |||||
/* Create a custom checkbox */ | |||||
.form-check{padding-left: 0px;} | |||||
.form-sent .form-check-label input:invalid ~ .checkmark { border-color: #dc3545;} | |||||
.form-check-label input:disabled ~ .checkmark {display: none} | |||||
.form-check-label input ~ .checkmark { position: absolute; top: 0; left: 0; height: 18px; width: 18px; background-color: #eee;border: 1px solid var(--primary);} | |||||
.form-check-label.big input ~ .checkmark { height: 21px; width: 21px; } | |||||
.form-check-label input[type="checkbox"] ~ .checkmark {top: 2px;} | |||||
.form-check-label input[type="radio"] ~ .checkmark { top:3px; border-radius: 50%;} | |||||
.form-check-label:hover input ~ .checkmark { background-color: #ccc;} | |||||
/* When the checkbox is checked, add a blue background */ | |||||
.form-check-label input:checked ~ .checkmark {background-color: var(--primary);} | |||||
/* Create the checkmark/indicator (hidden when not checked) */ | |||||
.form-check-label .checkmark:after { content: ""; position: absolute; display: none;} | |||||
/* Show the checkmark when checked */ | |||||
.form-check-label input:checked ~ .checkmark:after {display: block;} | |||||
/* Style the checkmark/indicator */ | |||||
.form-check-label .checkmark:after {left: 7px; top: 3px; width: 6px; height: 11px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg);} | |||||
.form-check-label input[type="checkbox"] ~ .checkmark:after {left: 6px; top: 2px; width: 6px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg);} | |||||
.form-check-label input[type="radio"] ~ .checkmark:after {top: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: white;} | |||||
.form-check-label.big input[type="checkbox"] ~ .checkmark:after {left: 7px; top: 3px; width: 6px; height: 11px;} | |||||
/* Create a custom radio button */ | |||||
@import 'scss/_formchecboxradio.scss'; | |||||
/* card */ | |||||
.card { | |||||
&.card-table { | |||||
.card-header { | |||||
border-bottom: 0px none ; | |||||
font-size: 1.1rem ; | |||||
} | |||||
.card-body { | |||||
padding: 0px ; | |||||
table.table { | |||||
margin-bottom: 0px ; | |||||
tr { | |||||
th { | |||||
input.form-check-input { | |||||
position: relative ; | |||||
top: 0px ; | |||||
} | |||||
} | |||||
td { | |||||
padding: 3px 12px ; | |||||
input.form-batch-checkbox { | |||||
position: relative ; | |||||
top: 4px ; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
.card-footer { | |||||
background-color: white ; | |||||
padding-top: 25px ; | |||||
.nb-results { | |||||
margin-bottom: 10px; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
/*CUSTOM Checkbox | |||||
/* Customize the label (the container) */ | |||||
.form-check-label {display: block; position: relative; padding-left: 26px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;} | |||||
/* Hide the browser's default checkbox */ | |||||
.form-check-label input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0;} | |||||
/* Create a custom checkbox */ | |||||
.form-check{padding-left: 0px;} | |||||
.form-sent .form-check-label input:invalid ~ .checkmark { border-color: #dc3545;} | |||||
.form-check-label input:disabled ~ .checkmark {display: none} | |||||
.form-check-label input ~ .checkmark { position: absolute; top: 0; left: 0; height: 18px; width: 18px; background-color: #eee;border: 1px solid var(--primary);} | |||||
.form-check-label.big input ~ .checkmark { height: 21px; width: 21px; } | |||||
.form-check-label input[type="checkbox"] ~ .checkmark {top: 2px;} | |||||
.form-check-label input[type="radio"] ~ .checkmark { top:3px; border-radius: 50%;} | |||||
.form-check-label:hover input ~ .checkmark { background-color: #ccc;} | |||||
/* When the checkbox is checked, add a blue background */ | |||||
.form-check-label input:checked ~ .checkmark {background-color: var(--primary);} | |||||
/* Create the checkmark/indicator (hidden when not checked) */ | |||||
.form-check-label .checkmark:after { content: ""; position: absolute; display: none;} | |||||
/* Show the checkmark when checked */ | |||||
.form-check-label input:checked ~ .checkmark:after {display: block;} | |||||
/* Style the checkmark/indicator */ | |||||
.form-check-label .checkmark:after {left: 7px; top: 3px; width: 6px; height: 11px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg);} | |||||
.form-check-label input[type="checkbox"] ~ .checkmark:after {left: 6px; top: 2px; width: 6px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg);} | |||||
.form-check-label input[type="radio"] ~ .checkmark:after {top: 4px; left: 4px; width: 8px; height: 8px; border-radius: 50%; background: white;} | |||||
.form-check-label.big input[type="checkbox"] ~ .checkmark:after {left: 7px; top: 3px; width: 6px; height: 11px;} | |||||
/* Create a custom radio button */ | |||||
export default function log(name) { | |||||
function log(name) { | |||||
try { | try { | ||||
return console.log(name); | return console.log(name); | ||||
} catch (e) { | } catch (e) { | ||||
return null; | return null; | ||||
} | } | ||||
} | |||||
} |
//$('#test22').modal('show'); | //$('#test22').modal('show'); | ||||
$('#test22').modal('show'); | |||||
// start the Stimulus application | // start the Stimulus application |
{% if field.value %} | |||||
<div class="badge badge-success">En ligne</div> | |||||
{% else %} | |||||
<div class="badge badge-danger">Hors ligne</div> | |||||
{% endif %} |
{% set has_filters = filters|length > 0 %} | {% set has_filters = filters|length > 0 %} | ||||
{% set has_datagrid_tools = has_search or has_filters %} | {% set has_datagrid_tools = has_search or has_filters %} | ||||
<div class="card"> | |||||
<div class="card card-table card-outline card-primary"> | |||||
<div class="card-header"> | <div class="card-header"> | ||||
<div class="d-flex"> | |||||
<div class="text-muted"> | |||||
Show | |||||
<div class="mx-2 d-inline-block"> | |||||
<input type="text" class="form-control form-control-sm" value="8" size="3" | |||||
aria-label="Invoices count" data-cip-id="cIPJQ342845640"> | |||||
</div> | |||||
entries | |||||
</div> | |||||
<div class="ms-auto text-muted"> | |||||
Search: | |||||
<div class="ms-2 d-inline-block"> | |||||
<input type="text" class="form-control form-control-sm" aria-label="Search invoice" | |||||
data-cip-id="cIPJQ342845641"> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="card-body border-bottom py-3"> | |||||
<span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total"> | |||||
{{ paginator.numResults }} résultats | |||||
</span> | |||||
</div> | </div> | ||||
<div class="table-responsive"> | |||||
<table class="table card-table table-vcenter text-nowrap table-mobile-md table-striped"> | |||||
<thead> | |||||
{% block table_head %} | |||||
<tr> | |||||
{% if has_batch_actions %} | |||||
<th class="w-1"><span><input type="checkbox" | |||||
class="form-check-input m-0 align-middle form-batch-checkbox-all"></span> | |||||
</th> | |||||
{% endif %} | |||||
<div class="card-body"> | |||||
<div class="table-responsive"> | |||||
<table class="table table-bordered table-hover table-striped"> | |||||
<thead> | |||||
{% block table_head %} | |||||
{% 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' }} 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|raw }} <i class="fa fa-fw {{ column_icon }}"></i> | |||||
</a> | |||||
{% else %} | |||||
<span>{{ field.label|raw }}</span> | |||||
{% endif %} | |||||
<tr> | |||||
{% if has_batch_actions %} | |||||
<th class=""><span><input type="checkbox" | |||||
class="form-check-input m-0 align-middle form-batch-checkbox-all"></span> | |||||
</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' }} {% if field.textAlign %}text-{{ field.textAlign }}{% endif %}" | |||||
dir="{{ ea.i18n.textDirection }}"> | |||||
{% if field.isSortable %} | |||||
<a href="{{ ea_url({ page: 1, sort: { (field.property): next_sort_direction } }).includeReferrer() }}"> | |||||
{{ field.label|raw }} <i class="fa fa-fw {{ column_icon }}"></i> | |||||
</a> | |||||
{% else %} | |||||
<span>{{ field.label|raw }}</span> | |||||
{% endif %} | |||||
</th> | |||||
{% endfor %} | |||||
<th class="w-1" {% if ea.crud.showEntityActionsAsDropdown %}width="10px"{% endif %} dir="{{ ea.i18n.textDirection }}"> | |||||
<span class="sr-only">{{ 'action.entity_actions'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}</span> | |||||
</th> | </th> | ||||
{% endfor %} | |||||
<th {% if ea.crud.showEntityActionsAsDropdown %}width="10px"{% endif %} dir="{{ ea.i18n.textDirection }}"> | |||||
<span class="sr-only">{{ 'action.entity_actions'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }}</span> | |||||
</th> | |||||
</tr> | |||||
{% endblock table_head %} | |||||
</thead> | |||||
</tr> | |||||
{% endblock table_head %} | |||||
</thead> | |||||
<tbody> | |||||
{% block table_body %} | |||||
{% for entity in entities %} | |||||
{% if not entity.isAccessible %} | |||||
{% set some_results_are_hidden = true %} | |||||
{% else %} | |||||
<tr data-id="{{ entity.primaryKeyValueAsString }}"> | |||||
{% if has_batch_actions %} | |||||
<td><input type="checkbox" class="form-batch-checkbox" | |||||
value="{{ entity.primaryKeyValue }}"></td> | |||||
{% endif %} | |||||
{% for field in entity.fields %} | |||||
<td 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"> | |||||
{% if not ea.crud.showEntityActionsAsDropdown %} | |||||
{% for action in entity.actions %} | |||||
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }} | |||||
{% endfor %} | |||||
{% else %} | |||||
<div class="dropdown dropdown-actions"> | |||||
<a class="dropdown-toggle btn btn-secondary btn-sm" href="#" | |||||
role="button" data-toggle="dropdown" aria-haspopup="true" | |||||
aria-expanded="false"> | |||||
<i class="fa fa-fw fa-ellipsis-h"></i> | |||||
</a> | |||||
<div class="dropdown-menu dropdown-menu-right"> | |||||
{% for action in entity.actions %} | |||||
{{ include(action.templatePath, { action: action, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }} | |||||
{% endfor %} | |||||
</div> | |||||
</div> | |||||
{% endif %} | |||||
</td> | |||||
{% endblock entity_actions %} | |||||
</tr> | |||||
<tbody> | |||||
{% block table_body %} | |||||
{% for entity in entities %} | |||||
{% if not entity.isAccessible %} | |||||
{% set some_results_are_hidden = true %} | |||||
{% endif %} | |||||
{% else %} | {% else %} | ||||
<tr data-id="{{ entity.primaryKeyValueAsString }}"> | |||||
{% if has_batch_actions %} | |||||
<td><input type="checkbox" class="form-batch-checkbox" | |||||
value="{{ entity.primaryKeyValue }}"></td> | |||||
{% endif %} | |||||
{% for field in entity.fields %} | |||||
<td 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"> | |||||
{% if not ea.crud.showEntityActionsAsDropdown %} | |||||
{% for action in entity.actions %} | |||||
{{ include(action.templatePath, { action: action, entity: entity, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }} | |||||
{% endfor %} | |||||
{% else %} | |||||
<div class="dropdown dropdown-actions"> | |||||
<a class="dropdown-toggle btn btn-secondary btn-sm" href="#" | |||||
role="button" data-toggle="dropdown" aria-haspopup="true" | |||||
aria-expanded="false"> | |||||
<i class="fa fa-fw fa-ellipsis-h"></i> | |||||
</a> | |||||
<div class="dropdown-menu dropdown-menu-right"> | |||||
{% for action in entity.actions %} | |||||
{{ include(action.templatePath, { action: action, isIncludedInDropdown: ea.crud.showEntityActionsAsDropdown }, with_context = false) }} | |||||
{% endfor %} | |||||
</div> | |||||
</div> | |||||
{% endif %} | |||||
</td> | |||||
{% endblock entity_actions %} | |||||
<tr> | |||||
<td class="no-results" colspan="100"> | |||||
{{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }} | |||||
</td> | |||||
</tr> | </tr> | ||||
{% endfor %} | |||||
{% if some_results_are_hidden %} | |||||
<tr class="datagrid-row-empty"> | |||||
<td class="text-center" colspan="{{ entities|first.fields|length + 1 }}"> | |||||
<span class="datagrid-row-empty-message"><i | |||||
class="fa fa-lock mr-1"></i> {{ 'datagrid.hidden_results'|trans({}, 'EasyAdminBundle') }}</span> | |||||
</td> | |||||
</tr> | |||||
{% endif %} | {% endif %} | ||||
{% else %} | |||||
<tr> | |||||
<td class="no-results" colspan="100"> | |||||
{{ 'datagrid.no_results'|trans(ea.i18n.translationParameters, 'EasyAdminBundle') }} | |||||
</td> | |||||
</tr> | |||||
{% endfor %} | |||||
{% if some_results_are_hidden %} | |||||
<tr class="datagrid-row-empty"> | |||||
<td class="text-center" colspan="{{ entities|first.fields|length + 1 }}"> | |||||
<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> | |||||
</table> | |||||
{% endblock table_body %} | |||||
</tbody> | |||||
</table> | |||||
</div> | |||||
</div> | </div> | ||||
{% if entities|length > 0 %} | {% if entities|length > 0 %} | ||||
<div class="card-footer d-flex align-items-center"> | |||||
{% block paginator %} | |||||
{{ include(ea.templatePath('crud/paginator')) }} | |||||
{% endblock paginator %} | |||||
<div class="card-footer"> | |||||
<div class="row"> | |||||
{% block paginator %} | |||||
{{ include(ea.templatePath('crud/paginator')) }} | |||||
{% endblock paginator %} | |||||
</div> | |||||
</div> | </div> | ||||
{% endif %} | {% endif %} | ||||
</div> | </div> |
{# @var paginator \EasyCorp\Bundle\EasyAdminBundle\Orm\EntityPaginator #} | {# @var paginator \EasyCorp\Bundle\EasyAdminBundle\Orm\EntityPaginator #} | ||||
{% trans_default_domain 'EasyAdminBundle' %} | {% trans_default_domain 'EasyAdminBundle' %} | ||||
<p class="m-0 text-muted"> | |||||
{{ 'paginator.results'|trans({'%count%': paginator.numResults})|raw }} | |||||
</p> | |||||
<ul class="pagination m-0 ms-auto"> | |||||
<li class="page-item {{ not paginator.hasPreviousPage ? 'disabled' }}"> | |||||
<a class="page-link" href="{{ not paginator.hasPreviousPage ? '#' : paginator.generateUrlForPage(paginator.previousPage) }}" {{ not paginator.hasPreviousPage ? 'aria-disabled="true"' }}> | |||||
<i class="ti ti-arrow-left"></i> <span class="btn-label">{{ 'paginator.previous'|trans }}</span> | |||||
</a> | |||||
</li> | |||||
<div class="col-sm-12 col-md-6"> | |||||
{# <div class="nb-results"> | |||||
{{ 'paginator.results'|trans({'%count%': paginator.numResults})|raw }} | |||||
</div> #} | |||||
<div class="items-per-page btn-group"> | |||||
{% set itemsPerPage = [15,30,50,100,200] %} | |||||
{% for itemPerPage in itemsPerPage %} | |||||
{% set url = ea_url({listMaxResults: itemPerPage, page : "1"}) %} | |||||
<a href="{{ url }}" | |||||
class="btn btn-sm {{ paginator.pageSize == itemPerPage ? 'btn-secondary' : 'btn-default' }}">{{ itemPerPage }}</a> | |||||
{% endfor %} | |||||
</div> | |||||
</div> | |||||
{% for page in paginator.pageRange %} | |||||
<li class="page-item {{ page == paginator.currentPage ? 'active' }} {{ page is null ? 'disabled' }}"> | |||||
{% if page is null %} | |||||
<span class="page-link">…</span> | |||||
{% else %} | |||||
<a class="page-link" href="{{ paginator.generateUrlForPage(page) }}">{{ page }}</a> | |||||
{% endif %} | |||||
</li> | |||||
{% endfor %} | |||||
<div class="col-sm-12 col-md-6"> | |||||
<div class="float-sm-right"> | |||||
<ul class="pagination"> | |||||
<li class="page-item {{ not paginator.hasPreviousPage ? 'disabled' }}"> | |||||
<a class="page-link" href="{{ not paginator.hasPreviousPage ? '#' : paginator.generateUrlForPage(paginator.previousPage) }}" {{ not paginator.hasPreviousPage ? 'aria-disabled="true"' }}> | |||||
<i class="ti ti-arrow-left"></i> <span class="btn-label">{{ 'paginator.previous'|trans }}</span> | |||||
</a> | |||||
</li> | |||||
<li class="page-item {{ not paginator.hasNextPage ? 'disabled' }}"> | |||||
<a class="page-link" href="{{ not paginator.hasNextPage ? '#' : paginator.generateUrlForPage(paginator.nextPage) }}" {{ not paginator.hasNextPage ? 'aria-disabled="true"' }}> | |||||
<span class="btn-label">{{ 'paginator.next'|trans }}</span> <i class="ti ti-arrow-right"></i> | |||||
</a> | |||||
</li> | |||||
</ul> | |||||
{% for page in paginator.pageRange %} | |||||
<li class="page-item {{ page == paginator.currentPage ? 'active' }} {{ page is null ? 'disabled' }}"> | |||||
{% if page is null %} | |||||
<span class="page-link">…</span> | |||||
{% else %} | |||||
<a class="page-link" href="{{ paginator.generateUrlForPage(page) }}">{{ page }}</a> | |||||
{% endif %} | |||||
</li> | |||||
{% endfor %} | |||||
<li class="page-item {{ not paginator.hasNextPage ? 'disabled' }}"> | |||||
<a class="page-link" href="{{ not paginator.hasNextPage ? '#' : paginator.generateUrlForPage(paginator.nextPage) }}" {{ not paginator.hasNextPage ? 'aria-disabled="true"' }}> | |||||
<span class="btn-label">{{ 'paginator.next'|trans }}</span> <i class="ti ti-arrow-right"></i> | |||||
</a> | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
</div> |
</div><!-- /.col --> | </div><!-- /.col --> | ||||
<div class="col-sm-6"> | <div class="col-sm-6"> | ||||
{% block page_actions_wrapper %} | {% block page_actions_wrapper %} | ||||
<div class="col-auto ms-auto d-print-none"> | |||||
<div class="btn-list"> | |||||
{% block page_actions %}{% endblock %} | |||||
</div> | |||||
<div class="btn-list float-sm-right"> | |||||
{% block page_actions %}{% endblock %} | |||||
</div> | </div> | ||||
{% endblock %} | {% endblock %} | ||||
</div><!-- /.col --> | </div><!-- /.col --> |