diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index c3bc337..3ac6989 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -63,7 +63,7 @@ class UserController extends AbstractController * GET /user/{id} - Show specific user (show/member) */ #[Route('/{id}', name: 'show', requirements: ['id' => '\d+'], methods: ['GET'])] - public function show(int $id, EntityManagerInterface $entityManager): Response + public function show(int $id, EntityManagerInterface $entityManager, Request $request): Response { if (!$this->isGranted('ROLE_SUPER_ADMIN')) { throw $this->createAccessDeniedException(self::ACCESS_DENIED); @@ -73,8 +73,11 @@ class UserController extends AbstractController if (!$user) { throw $this->createNotFoundException(self::NOT_FOUND); } - - $userOrganizations = $this->userOrganizationService->getUserOrganizations($user); + if($request->query->has('organizationId')) { + $userOrganizations = $this->userOrganizationService->getUserOrganizations($user, $request->query->get('organizationId')); + }else{ + $userOrganizations = $this->userOrganizationService->getUserOrganizations($user); + } return $this->render('user/show.html.twig', [ 'user' => $user, @@ -310,7 +313,7 @@ class UserController extends AbstractController // Fetch all roles and apps $roles = $entityManager->getRepository(Roles::class)->findAll(); - $apps = $entityManager->getRepository(Apps::class)->findAll(); + $apps = $organization->getApps() ?? throw $this->createNotFoundException(self::NOT_FOUND); if (!$roles) { throw $this->createNotFoundException(self::NOT_FOUND); } diff --git a/templates/organization/show.html.twig b/templates/organization/show.html.twig index 1945cb0..ff4c5ad 100644 --- a/templates/organization/show.html.twig +++ b/templates/organization/show.html.twig @@ -16,7 +16,7 @@ {% include 'user/userListSmall.html.twig' with { title: 'Nouveaux utilisateurs', users: newUsers, - empty_message: 'Aucun nouvel utilisateur trouvé.', + empty_message: 'Aucun nouveaux utilisateurs trouvé.', organizationId: organization.id } %} @@ -24,13 +24,15 @@ {% include 'user/userListSmall.html.twig' with { title: 'Administrateurs', users: adminUsers, - empty_message: 'Aucun administrateur trouvé.' + empty_message: 'Aucun administrateur trouvé.', + organizationId: organization.id } %}
{% include 'user/userList.html.twig' with { title: 'Mes utilisateurs', + organizationId: organization.id } %}
{# APPLICATION ROW #} diff --git a/templates/user/userList.html.twig b/templates/user/userList.html.twig index c91924a..fc625c8 100644 --- a/templates/user/userList.html.twig +++ b/templates/user/userList.html.twig @@ -47,10 +47,17 @@ {% endif %} - - + {% if organizationId is defined %} + {{ ux_icon('fa6-regular:eye', {height: '30px', width: '30px'}) }} - + + {% else %} + + {{ ux_icon('fa6-regular:eye', {height: '30px', width: '30px'}) }} + + {% endif %} {% endfor %} diff --git a/templates/user/userListSmall.html.twig b/templates/user/userListSmall.html.twig index 7a30d9f..684146b 100644 --- a/templates/user/userListSmall.html.twig +++ b/templates/user/userListSmall.html.twig @@ -32,10 +32,18 @@ {{ user.email }} - {{ ux_icon('fa6-regular:eye', {height: '30px', width: '30px'}) }} + {% else %} + + {{ ux_icon('fa6-regular:eye', {height: '30px', width: '30px'}) }} + + {% endif %} + {% endfor %}