From 86ee4b25deacc6369dec0df5d007420397b3d314 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Metivier <jean-philippe.metivier@unicaen.fr> Date: Mon, 17 Mar 2025 17:03:00 +0100 Subject: [PATCH] Correction page des formateurs --- .../Service/Formateur/FormateurService.php | 6 +++--- .../Formation/view/formation/formateur/index.phtml | 13 ++++++++++++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/module/Formation/src/Formation/Service/Formateur/FormateurService.php b/module/Formation/src/Formation/Service/Formateur/FormateurService.php index 3ef4a168..f583dba4 100644 --- a/module/Formation/src/Formation/Service/Formateur/FormateurService.php +++ b/module/Formation/src/Formation/Service/Formateur/FormateurService.php @@ -126,12 +126,12 @@ class FormateurService public function getFormateursWithFiltre(array $params): array { $type = $params['type']??null; - $formateurId = isset($params['formateur'])?$params['formateur']['id']:null; +// $formateurId = isset($params['formateur'])?$params['formateur']['id']:null; $rattachement = isset($params['rattachement'])?$params['rattachement']['label']:null; $qb = $this->createQueryBuilder(); if ($type) $qb = $qb->andWhere('formateur.type = :type')->setParameter('type', $type); - if ($formateurId) $qb = $qb->andWhere('formateur.id = :formateurId')->setParameter('formateurId', $formateurId); +// if ($formateurId) $qb = $qb->andWhere('formateur.id = :formateurId')->setParameter('formateurId', $formateurId); if ($rattachement) $qb = $qb->andWhere('formateur.attachement = :rattachement')->setParameter('rattachement', $rattachement); $result = $qb->getQuery()->getResult(); @@ -144,7 +144,7 @@ class FormateurService public function getFormateursByTerm(?string $term): array { $qb = $this->getObjectManager()->getRepository(Formateur::class)->createQueryBuilder('formateur') - ->andWhere("LOWER(CONCAT(formateur.nom, ' ', formateur.prenom)) like :search OR LOWER(CONCAT(formateur.prenom, ' ', formateur.nom)) like :search OR LOWER(formateur.organisme) like :search") + ->andWhere("LOWER(CONCAT(formateur.nom, ' ', formateur.prenom)) like :search OR LOWER(CONCAT(formateur.prenom, ' ', formateur.nom)) like :search OR LOWER(formateur.organisme) like :search OR lower(formateur.email) like :search") ->setParameter('search', '%'.strtolower($term).'%') // ->orderBy("coalesce(formateur.organisme, concat(formateur.nom, ' ', formateur.prenom))", 'ASC') ->orderBy("concat(formateur.nom, ' ', formateur.prenom)", 'ASC') diff --git a/module/Formation/view/formation/formateur/index.phtml b/module/Formation/view/formation/formateur/index.phtml index 295ce47e..85ce40ae 100644 --- a/module/Formation/view/formation/formateur/index.phtml +++ b/module/Formation/view/formation/formateur/index.phtml @@ -36,7 +36,7 @@ $canCreerCompte = $this->isAllowed(UtilisateurPrivileges::getResourceId(Utilisat </a> <?php endif; ?> -<table class="table table-condensed datatable" id="formateur"> +<table class="table table-condensed datatable" id="formateurs"> <thead> <tr> <th class="col-md-3"> Identification </th> @@ -172,5 +172,16 @@ $canCreerCompte = $this->isAllowed(UtilisateurPrivileges::getResourceId(Utilisat event.div.modal('hide'); window.location.reload(); }); + $('table#formateurs').dataTable({ + paging: true, + autoWidth: false, + columnDefs: [{ + "targets": 4, + "orderable": false + }], + "language": { + "url": "/js/datatables_fr.json", + }, + }); }); </script> \ No newline at end of file -- GitLab