Skip to content
Snippets Groups Projects
Commit c1c56527 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Merge branch 'laminas_migration_bs5' of https://git.unicaen.fr/lib/unicaen/utilisateur into HEAD

parents 366cef16 e12d1dff
No related branches found
No related tags found
No related merge requests found
<?php <?php
namespace UnicaenUtilisateur\Acl; namespace UnicaenUtilisateur\Acl;
use BjyAuthorize\Acl\Role;
use Laminas\Permissions\Acl\Role\RoleInterface; use Laminas\Permissions\Acl\Role\RoleInterface;
/** /**
* Rôle avec nom explicite (humainement intelligible). * Rôle avec nom explicite (humainement intelligible).
*
* @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
*/ */
class NamedRole extends \BjyAuthorize\Acl\Role class NamedRole extends Role
{ {
/** /**
* @var string * @var string
...@@ -31,11 +30,11 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -31,11 +30,11 @@ class NamedRole extends \BjyAuthorize\Acl\Role
* *
* @param string|null $id * @param string|null $id
* @param RoleInterface|string|null $parent * @param RoleInterface|string|null $parent
* @param string $name * @param string|null $name
* @param string $description * @param string|null $description
* @param bool $selectable * @param bool $selectable
*/ */
public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true) public function __construct($id = null, $parent = null, ?string $name = null, ?string $description = null, bool $selectable = true)
{ {
parent::__construct($id, $parent); parent::__construct($id, $parent);
...@@ -60,7 +59,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -60,7 +59,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role
* *
* @return string * @return string
*/ */
public function getRoleName() public function getRoleName() : string
{ {
return $this->roleName; return $this->roleName;
} }
...@@ -71,9 +70,9 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -71,9 +70,9 @@ class NamedRole extends \BjyAuthorize\Acl\Role
* @param string $roleName * @param string $roleName
* @return self * @return self
*/ */
public function setRoleName($roleName) public function setRoleName(string $roleName) : NamedRole
{ {
$this->roleName = (string) $roleName; $this->roleName = $roleName;
return $this; return $this;
} }
...@@ -82,7 +81,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -82,7 +81,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role
* *
* @return string * @return string
*/ */
public function getRoleDescription() public function getRoleDescription() : string
{ {
return $this->roleDescription; return $this->roleDescription;
} }
...@@ -90,12 +89,12 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -90,12 +89,12 @@ class NamedRole extends \BjyAuthorize\Acl\Role
/** /**
* Spécifie la description du rôle. * Spécifie la description du rôle.
* *
* @param string $roleDescription * @param string|null $roleDescription
* @return self * @return self
*/ */
public function setRoleDescription($roleDescription) public function setRoleDescription(?string $roleDescription) : NamedRole
{ {
$this->roleDescription = (string) $roleDescription; $this->roleDescription = $roleDescription;
return $this; return $this;
} }
...@@ -106,7 +105,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -106,7 +105,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role
* *
* @return bool * @return bool
*/ */
public function getSelectable() public function getSelectable() : bool
{ {
return $this->selectable; return $this->selectable;
} }
...@@ -119,7 +118,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role ...@@ -119,7 +118,7 @@ class NamedRole extends \BjyAuthorize\Acl\Role
* @param bool $selectable * @param bool $selectable
* @return NamedRole * @return NamedRole
*/ */
public function setSelectable($selectable = true) public function setSelectable(bool $selectable = true) : NamedRole
{ {
$this->selectable = $selectable; $this->selectable = $selectable;
return $this; return $this;
......
...@@ -10,7 +10,6 @@ use UnicaenUtilisateur\Entity\Db\RoleInterface; ...@@ -10,7 +10,6 @@ use UnicaenUtilisateur\Entity\Db\RoleInterface;
use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Entity\Db\UserInterface;
use UnicaenUtilisateur\Form\Role\RoleFormAwareTrait; use UnicaenUtilisateur\Form\Role\RoleFormAwareTrait;
use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait;
use Laminas\Http\Request;
use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\ViewModel; use Laminas\View\Model\ViewModel;
...@@ -29,19 +28,18 @@ class RoleController extends AbstractActionController { ...@@ -29,19 +28,18 @@ class RoleController extends AbstractActionController {
$this->identityProviders = $provider; $this->identityProviders = $provider;
} }
public function indexAction() public function indexAction() : ViewModel
{ {
/** @var RoleInterface[] $roles */ /** @var RoleInterface[] $roles */
$roles = $this->roleService->findAll(); $roles = $this->roleService->findAll();
return new ViewModel([ return new ViewModel([
'title' => "Gestion des rôles",
'roles' => $roles, 'roles' => $roles,
'identityproviders' => $this->identityProviders, 'identityproviders' => $this->identityProviders,
]); ]);
} }
public function exporterAction() public function exporterAction() : CsvModel
{ {
$role = $this->roleService->getRequestedRole($this); $role = $this->roleService->getRequestedRole($this);
...@@ -84,7 +82,7 @@ class RoleController extends AbstractActionController { ...@@ -84,7 +82,7 @@ class RoleController extends AbstractActionController {
return $CSV; return $CSV;
} }
public function ajouterAction() public function ajouterAction() : ViewModel
{ {
$role = $this->roleService->getEntityInstance(); $role = $this->roleService->getEntityInstance();
$form = $this->roleForm; $form = $this->roleForm;
...@@ -113,7 +111,7 @@ class RoleController extends AbstractActionController { ...@@ -113,7 +111,7 @@ class RoleController extends AbstractActionController {
return $view; return $view;
} }
public function modifierAction() public function modifierAction() : ViewModel
{ {
$role = $this->roleService->getRequestedRole($this); $role = $this->roleService->getRequestedRole($this);
$form = $this->roleForm; $form = $this->roleForm;
...@@ -142,8 +140,9 @@ class RoleController extends AbstractActionController { ...@@ -142,8 +140,9 @@ class RoleController extends AbstractActionController {
return $view; return $view;
} }
public function supprimerAction() public function supprimerAction() : array
{ {
$role = null;
try { try {
$role = $this->roleService->getRequestedRole($this); $role = $this->roleService->getRequestedRole($this);
$this->roleService->delete($role); $this->roleService->delete($role);
......
...@@ -3,20 +3,22 @@ ...@@ -3,20 +3,22 @@
namespace UnicaenUtilisateur\Controller; namespace UnicaenUtilisateur\Controller;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenUtilisateur\Form\Role\RoleForm; use UnicaenUtilisateur\Form\Role\RoleForm;
use UnicaenUtilisateur\Service\Role\RoleService; use UnicaenUtilisateur\Service\Role\RoleService;
class RoleControllerFactory { class RoleControllerFactory {
/** /**
* Create controller
*
* @param ContainerInterface $container * @param ContainerInterface $container
* @param string $requestedName * @param string $requestedName
* @param array|null $options * @param array|null $options
* @return RoleController|object * @return RoleController|object
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) public function __invoke(ContainerInterface $container, string $requestedName, array $options = null)
{ {
/** /**
* @var RoleService $roleService * @var RoleService $roleService
......
...@@ -4,6 +4,7 @@ namespace UnicaenUtilisateur\Controller; ...@@ -4,6 +4,7 @@ namespace UnicaenUtilisateur\Controller;
use BjyAuthorize\Provider\Identity\ProviderInterface; use BjyAuthorize\Provider\Identity\ProviderInterface;
use DateTime; use DateTime;
use Exception;
use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenApp\View\Model\CsvModel; use UnicaenApp\View\Model\CsvModel;
use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Entity\Db\UserInterface;
...@@ -13,7 +14,6 @@ use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuResultatInterf ...@@ -13,7 +14,6 @@ use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuResultatInterf
use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface; use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface;
use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait; use UnicaenUtilisateur\Service\Role\RoleServiceAwareTrait;
use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait;
use Laminas\Http\Request;
use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger; use Laminas\Mvc\Plugin\FlashMessenger\FlashMessenger;
use Laminas\View\Model\JsonModel; use Laminas\View\Model\JsonModel;
...@@ -42,24 +42,18 @@ class UtilisateurController extends AbstractActionController ...@@ -42,24 +42,18 @@ class UtilisateurController extends AbstractActionController
/** /**
* @param $searchServices * @param $searchServices
* @return self
*/ */
public function setSearchServices($searchServices) public function setSearchServices($searchServices) : void
{ {
$this->searchServices = $searchServices; $this->searchServices = $searchServices;
return $this;
} }
/** /**
* @param $provider * @param $provider
* @return self
*/ */
public function setIdentityProvider($provider) public function setIdentityProvider($provider) : void
{ {
$this->identityProvider = $provider; $this->identityProvider = $provider;
return $this;
} }
public function indexAction() public function indexAction()
...@@ -196,6 +190,7 @@ class UtilisateurController extends AbstractActionController ...@@ -196,6 +190,7 @@ class UtilisateurController extends AbstractActionController
public function changerStatutAction() public function changerStatutAction()
{ {
$utilisateur = null;
try { try {
$utilisateur = $this->userService->getRequestedUser($this); $utilisateur = $this->userService->getRequestedUser($this);
$utilisateur = $this->userService->changeStatus($utilisateur); $utilisateur = $this->userService->changeStatus($utilisateur);
...@@ -214,6 +209,7 @@ class UtilisateurController extends AbstractActionController ...@@ -214,6 +209,7 @@ class UtilisateurController extends AbstractActionController
public function supprimerAction() public function supprimerAction()
{ {
$utilisateur = null;
try { try {
$utilisateur = $this->userService->getRequestedUser($this); $utilisateur = $this->userService->getRequestedUser($this);
$this->userService->delete($utilisateur); $this->userService->delete($utilisateur);
...@@ -269,7 +265,7 @@ class UtilisateurController extends AbstractActionController ...@@ -269,7 +265,7 @@ class UtilisateurController extends AbstractActionController
return new JsonModel($result); return new JsonModel($result);
} }
public function listerAction() public function listerAction() : ViewModel
{ {
$users = $this->userService->findAll(); $users = $this->userService->findAll();
...@@ -279,7 +275,7 @@ class UtilisateurController extends AbstractActionController ...@@ -279,7 +275,7 @@ class UtilisateurController extends AbstractActionController
]); ]);
} }
public function exporterAction() public function exporterAction() : CsvModel
{ {
$users = $this->userService->findAll(); $users = $this->userService->findAll();
$headers = [ 'Identifiant de connexion', 'Nom', 'Activé', 'Rôle']; $headers = [ 'Identifiant de connexion', 'Nom', 'Activé', 'Rôle'];
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
namespace UnicaenUtilisateur\Controller; namespace UnicaenUtilisateur\Controller;
use Application\Provider\IdentityProvider;
use Doctrine\ORM\EntityManager;
use Interop\Container\ContainerInterface; use Interop\Container\ContainerInterface;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenUtilisateur\Form\User\UserForm; use UnicaenUtilisateur\Form\User\UserForm;
use UnicaenUtilisateur\Form\User\UserRechercheForm; use UnicaenUtilisateur\Form\User\UserRechercheForm;
use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface; use UnicaenUtilisateur\Service\RechercheIndividu\RechercheIndividuServiceInterface;
...@@ -15,14 +15,14 @@ class UtilisateurControllerFactory ...@@ -15,14 +15,14 @@ class UtilisateurControllerFactory
{ {
/** /**
* Create controller
*
* @param ContainerInterface $container * @param ContainerInterface $container
* @param string $requestedName * @param string $requestedName
* @param array|null $options * @param array|null $options
* @return UtilisateurController|object * @return UtilisateurController|object
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/ */
public function __invoke(ContainerInterface $container, $requestedName, array $options = null) public function __invoke(ContainerInterface $container, string $requestedName, array $options = null)
{ {
/** /**
* @var RoleService $roleService * @var RoleService $roleService
......
...@@ -19,7 +19,7 @@ abstract class AbstractRole implements RoleInterface ...@@ -19,7 +19,7 @@ abstract class AbstractRole implements RoleInterface
protected $roleId; protected $roleId;
/** /**
* @var libelle * @var string
*/ */
protected $libelle; protected $libelle;
...@@ -78,9 +78,9 @@ abstract class AbstractRole implements RoleInterface ...@@ -78,9 +78,9 @@ abstract class AbstractRole implements RoleInterface
/** /**
* Get id. * Get id.
* *
* @return int * @return int|null
*/ */
public function getId() public function getId() : ?int
{ {
return $this->id; return $this->id;
} }
......
...@@ -3,14 +3,12 @@ ...@@ -3,14 +3,12 @@
namespace UnicaenUtilisateur\Service\Role; namespace UnicaenUtilisateur\Service\Role;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\NonUniqueResultException;
use Doctrine\ORM\ORMException; use Doctrine\ORM\ORMException;
use Doctrine\ORM\QueryBuilder; use InvalidArgumentException;
use Laminas\Mvc\Controller\AbstractActionController;
use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenApp\Service\EntityManagerAwareTrait;
use UnicaenUtilisateur\Entity\Db\AbstractRole;
use UnicaenUtilisateur\Entity\Db\RoleInterface; use UnicaenUtilisateur\Entity\Db\RoleInterface;
use UnicaenUtilisateur\Exception\RuntimeException; use UnicaenUtilisateur\Exception\RuntimeException;
use Laminas\Mvc\Controller\AbstractActionController;
class RoleService class RoleService
{ {
...@@ -26,7 +24,7 @@ class RoleService ...@@ -26,7 +24,7 @@ class RoleService
* @param string $roleEntityClass * @param string $roleEntityClass
* @return void * @return void
*/ */
public function setRoleEntityClass($roleEntityClass) public function setRoleEntityClass(string $roleEntityClass)
{ {
if (! class_exists($roleEntityClass) || ! in_array(RoleInterface::class, class_implements($roleEntityClass))) { if (! class_exists($roleEntityClass) || ! in_array(RoleInterface::class, class_implements($roleEntityClass))) {
throw new InvalidArgumentException("L'entité associée aux rôles doit implémenter " . RoleInterface::class); throw new InvalidArgumentException("L'entité associée aux rôles doit implémenter " . RoleInterface::class);
...@@ -38,7 +36,7 @@ class RoleService ...@@ -38,7 +36,7 @@ class RoleService
/** /**
* @return string * @return string
*/ */
public function getEntityClass() public function getEntityClass() : string
{ {
return $this->roleEntityClass; return $this->roleEntityClass;
} }
...@@ -62,10 +60,10 @@ class RoleService ...@@ -62,10 +60,10 @@ class RoleService
} }
/** /**
* @param mixed $id * @param ?int $id
* @return RoleInterface|null * @return RoleInterface|null
*/ */
public function find($id) public function find(?int $id)
{ {
return $this->getRepo()->find($id); return $this->getRepo()->find($id);
} }
...@@ -99,7 +97,7 @@ class RoleService ...@@ -99,7 +97,7 @@ class RoleService
/** /**
* @return array * @return array
*/ */
public function getRolesAsOptions() public function getRolesAsOptions() : array
{ {
$roles = $this->findAll(); $roles = $this->findAll();
$result = []; $result = [];
...@@ -116,7 +114,7 @@ class RoleService ...@@ -116,7 +114,7 @@ class RoleService
* @param string $paramName * @param string $paramName
* @return RoleInterface * @return RoleInterface
*/ */
public function getRequestedRole(AbstractActionController $controller, string $paramName = 'role') public function getRequestedRole(AbstractActionController $controller, string $paramName = 'role') : RoleInterface
{ {
$id = $controller->params()->fromRoute($paramName); $id = $controller->params()->fromRoute($paramName);
$role = $this->find($id); $role = $this->find($id);
...@@ -128,7 +126,7 @@ class RoleService ...@@ -128,7 +126,7 @@ class RoleService
* @param RoleInterface $role * @param RoleInterface $role
* @return RoleInterface * @return RoleInterface
*/ */
public function create(RoleInterface $role) public function create(RoleInterface $role) : RoleInterface
{ {
try { try {
$this->getEntityManager()->persist($role); $this->getEntityManager()->persist($role);
...@@ -144,7 +142,7 @@ class RoleService ...@@ -144,7 +142,7 @@ class RoleService
* @param RoleInterface $role * @param RoleInterface $role
* @return RoleInterface * @return RoleInterface
*/ */
public function update(RoleInterface $role) public function update(RoleInterface $role) : RoleInterface
{ {
try { try {
$this->getEntityManager()->flush($role); $this->getEntityManager()->flush($role);
...@@ -159,7 +157,7 @@ class RoleService ...@@ -159,7 +157,7 @@ class RoleService
* @param RoleInterface $role * @param RoleInterface $role
* @return RoleInterface * @return RoleInterface
*/ */
public function delete(RoleInterface $role) public function delete(RoleInterface $role) : RoleInterface
{ {
try { try {
$this->getEntityManager()->remove($role); $this->getEntityManager()->remove($role);
......
...@@ -17,12 +17,12 @@ $canAjouter = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges: ...@@ -17,12 +17,12 @@ $canAjouter = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges:
$canModifier = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges::ROLE_MODIFIER)); $canModifier = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges::ROLE_MODIFIER));
$canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges::ROLE_EFFACER)); $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges::ROLE_EFFACER));
?> $this->headTitle("Rôles");
<?php $this->headTitle($this->translate($title)) ?> ?>
<h1 class="page-header"> <h1 class="page-header">
<?php echo $title; ?> Rôles
<span class="badge"><?php echo count($roles); ?></span> <span class="badge"><?php echo count($roles); ?></span>
</h1> </h1>
...@@ -41,7 +41,7 @@ $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges: ...@@ -41,7 +41,7 @@ $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges:
<?php endif; ?> <?php endif; ?>
<div class="card border-default mb-3"> <div class="card">
<div class="card-header bg-default"> <div class="card-header bg-default">
<h2> <h2>
Liste des rôles Liste des rôles
...@@ -166,9 +166,7 @@ $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges: ...@@ -166,9 +166,7 @@ $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges:
$("body").on("event-unicaen-role-editer", function (event) { $("body").on("event-unicaen-role-editer", function (event) {
event.div.modal('hide'); event.div.modal('hide');
window.location.reload(); window.location.reload();
}); }).on("event-unicaen-role-supprimer", function (event) {
$("body").on("event-unicaen-role-supprimer", function (event) {
window.location.reload(); window.location.reload();
}); });
...@@ -194,7 +192,7 @@ $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges: ...@@ -194,7 +192,7 @@ $canEffacer = $this->isAllowed(RolePrivileges::getResourceId(RolePrivileges:
"next": "<i class=\"fas fa-chevron-right\"></i>" "next": "<i class=\"fas fa-chevron-right\"></i>"
} }
}, },
"createdRow": function (row, data, index) { "createdRow": function (row) {
$('.pop-ajax', row).popAjax(); $('.pop-ajax', row).popAjax();
}, },
}); });
......
...@@ -4,7 +4,6 @@ use UnicaenUtilisateur\Controller\UtilisateurController; ...@@ -4,7 +4,6 @@ use UnicaenUtilisateur\Controller\UtilisateurController;
use UnicaenUtilisateur\Entity\Db\RoleInterface; use UnicaenUtilisateur\Entity\Db\RoleInterface;
use UnicaenUtilisateur\Entity\Db\UserInterface; use UnicaenUtilisateur\Entity\Db\UserInterface;
use UnicaenUtilisateur\Form\User\UserRechercheForm; use UnicaenUtilisateur\Form\User\UserRechercheForm;
use UnicaenUtilisateur\Provider\Privilege\Privileges;
use UnicaenUtilisateur\Provider\Privilege\UtilisateurPrivileges; use UnicaenUtilisateur\Provider\Privilege\UtilisateurPrivileges;
/** /**
...@@ -164,7 +163,8 @@ $canCreerLocal = $canAjouter; ...@@ -164,7 +163,8 @@ $canCreerLocal = $canAjouter;
<button type='submit' class='btn btn-success'><i class='fas fa-check'></i> Oui</button> <button type='submit' class='btn btn-success'><i class='fas fa-check'></i> Oui</button>
<button type='button' class='btn btn-danger pop-ajax-hide'><i class='fas fa-times'></i> Non</button> <button type='button' class='btn btn-danger pop-ajax-hide'><i class='fas fa-times'></i> Non</button>
</div> </div>
</div>"> </div>"
>
<i class="fas fa-user-times"></i> Suspendre <i class="fas fa-user-times"></i> Suspendre
</a> </a>
...@@ -176,15 +176,14 @@ $canCreerLocal = $canAjouter; ...@@ -176,15 +176,14 @@ $canCreerLocal = $canAjouter;
data-submit-close="true" data-submit-close="true"
data-submit-event="event-unicaen-utilisateur-changer-statut" data-submit-event="event-unicaen-utilisateur-changer-statut"
title="Activer l'utilisateur" title="Activer l'utilisateur"
data-title="Activation de l'utilisateur data-title="Activation de l'utilisateur"
data-confirm-button="" data-confirm-button="
data-cancel-button="" data-cancel-button=''
data-content="<p>Voulez-vous activer data-content='<p>Voulez-vous activer l\'utilisateur ?</p>
l'utilisateur ?</p> <div class=\'text-center\'>
<div class='text-center'> <div class=\'btn-group\'>
<div class='btn-group'> <button type=\'submit\' class=\'btn btn-success\'><i class=\'fas fa-check\'></i> Oui</button>
<button type='submit' class='btn btn-success'><i class='fas fa-check'></i> Oui</button> <button type=\'button\' class=\'btn btn-danger pop-ajax-hide\'><i class=\'fas fa-times\'></i> Non
<button type='button' class='btn btn-danger pop-ajax-hide'><i class='fas fa-times'></i> Non
</button> </button>
</div> </div>
</div>"> </div>">
...@@ -297,9 +296,7 @@ $canCreerLocal = $canAjouter; ...@@ -297,9 +296,7 @@ $canCreerLocal = $canAjouter;
function (event) { function (event) {
event.div.modal('hide'); event.div.modal('hide');
window.location.reload(); window.location.reload();
}); }).on("event-unicaen-utilisateur-changer-statut " +
$("body").on("event-unicaen-utilisateur-changer-statut " +
"event-unicaen-utilisateur-supprimer", "event-unicaen-utilisateur-supprimer",
function (event) { function (event) {
window.location.reload(); window.location.reload();
...@@ -333,13 +330,13 @@ $canCreerLocal = $canAjouter; ...@@ -333,13 +330,13 @@ $canCreerLocal = $canAjouter;
}, },
}) })
.autocomplete("instance")._renderItem = function (ul, item) { .autocomplete("instance")._renderItem = function (ul, item) {
var template = '<span id=\"{id}\">{label} <span class=\"extra\">{extra}</span></span>'; let template = '<span id=\"{id}\">{label} <span class=\"extra\">{extra}</span></span>';
var markup = template let markup = template
.replace('{id}', item.id ? item.id : '') .replace('{id}', item.id ? item.id : '')
.replace('{label}', item.label ? item.label : '') .replace('{label}', item.label ? item.label : '')
.replace('{extra}', item.extra ? item.extra : ''); .replace('{extra}', item.extra ? item.extra : '');
markup = '<a id="autocomplete-item-' + item.id + '">' + markup + "</a>"; markup = '<a id="autocomplete-item-' + item.id + '">' + markup + "</a>";
var li = $("<li></li>"); let li = $("<li></li>");
if (item.id) { if (item.id) {
const t = item.id.split("||"); const t = item.id.split("||");
if (t[0] == 'app') { if (t[0] == 'app') {
...@@ -360,7 +357,7 @@ $canCreerLocal = $canAjouter; ...@@ -360,7 +357,7 @@ $canCreerLocal = $canAjouter;
}; };
$('form').on('submit', function () { $('form').on('submit', function () {
var btn = $(this).find('button[type="submit"]:first'); let btn = $(this).find('button[type="submit"]:first');
btn.attr("disabled", "disabled") btn.attr("disabled", "disabled")
.find('i').attr('class', 'fas fa-pulse fa-spinner'); .find('i').attr('class', 'fas fa-pulse fa-spinner');
}); });
...@@ -432,7 +429,5 @@ $canCreerLocal = $canAjouter; ...@@ -432,7 +429,5 @@ $canCreerLocal = $canAjouter;
cursor: pointer; cursor: pointer;
} }
.text-highlight {
color: #919191;
}
</style> </style>
\ No newline at end of file
...@@ -4,6 +4,7 @@ use UnicaenUtilisateur\Entity\Db\UserInterface; ...@@ -4,6 +4,7 @@ use UnicaenUtilisateur\Entity\Db\UserInterface;
/** /**
* @var UserInterface[] $users * @var UserInterface[] $users
* @var string $title
*/ */
?> ?>
...@@ -94,14 +95,14 @@ use UnicaenUtilisateur\Entity\Db\UserInterface; ...@@ -94,14 +95,14 @@ use UnicaenUtilisateur\Entity\Db\UserInterface;
"next": "<i class=\"fas fa-chevron-right\"></i>" "next": "<i class=\"fas fa-chevron-right\"></i>"
} }
}, },
"createdRow": function (row, data, index) { "createdRow": function (row) {
$('.pop-ajax', row).popAjax(); $('.pop-ajax', row).popAjax();
}, },
}); });
} }
$('#utilisateur-liste tbody').on('click', 'tr', function () { $('#utilisateur-liste tbody').on('click', 'tr', function () {
var href = $(this).find("a").attr("href"); let href = $(this).find("a").attr("href");
if (href) { if (href) {
window.location.href = href; window.location.href = href;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment