From 8825f5fc369dfca5f5dd19bd2777d329943e4fa0 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Sat, 30 Nov 2024 22:12:33 -0500 Subject: [PATCH] Move files and add list-cases route method --- src/Controller/AdminController.php | 25 +++++- .../internal/admin/users/add-user.html.twig | 86 +++++++++++++++++++ .../internal/admin/users/edit-user.html.twig | 80 +++++++++++++++++ .../internal/admin/users/list-users.html.twig | 73 ++++++++++++++++ 4 files changed, 261 insertions(+), 3 deletions(-) create mode 100644 templates/internal/admin/users/add-user.html.twig create mode 100644 templates/internal/admin/users/edit-user.html.twig create mode 100644 templates/internal/admin/users/list-users.html.twig diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 471c5e8..3f41740 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -73,7 +73,7 @@ class AdminController extends AbstractController $this->navLinks['user_list'] = 'nav-link text-white active bg-gradient-dark'; return $this->render( - 'internal/admin/list-users.html.twig', + 'internal/admin/users/list-users.html.twig', array_merge( $this->navLinks, [ @@ -126,7 +126,7 @@ class AdminController extends AbstractController $this->navLinks['user_list'] = 'nav-link text-white active bg-gradient-dark'; return $this->render( - 'internal/admin/add-user.html.twig', + 'internal/admin/users/add-user.html.twig', array_merge( $this->navLinks, [ @@ -169,7 +169,7 @@ class AdminController extends AbstractController } return $this->render( - 'internal/admin/edit-user.html.twig', + 'internal/admin/users/edit-user.html.twig', array_merge( $this->navLinks, [ @@ -225,4 +225,23 @@ class AdminController extends AbstractController ) ); } + + #[Route('/list-cases', name: 'app_list_cases')] + public function listCases(#[CurrentUser()] User $user): Response + { + $this->denyAccessUnlessGranted('ROLE_ADMIN'); + + return $this->render( + 'internal/cases/case-list.html.twig', + array_merge( + $this->navLinks, + [ + 'breadcrumbs' => [ + 'List Cases' + ], + 'notifications' => $user->retrieveUnreadNotifications(), + ] + ) + ); + } } diff --git a/templates/internal/admin/users/add-user.html.twig b/templates/internal/admin/users/add-user.html.twig new file mode 100644 index 0000000..5239644 --- /dev/null +++ b/templates/internal/admin/users/add-user.html.twig @@ -0,0 +1,86 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+ +
+
+{% endblock %} diff --git a/templates/internal/admin/users/edit-user.html.twig b/templates/internal/admin/users/edit-user.html.twig new file mode 100644 index 0000000..6cd76f6 --- /dev/null +++ b/templates/internal/admin/users/edit-user.html.twig @@ -0,0 +1,80 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+ +
+
+{% endblock %} diff --git a/templates/internal/admin/users/list-users.html.twig b/templates/internal/admin/users/list-users.html.twig new file mode 100644 index 0000000..4d90513 --- /dev/null +++ b/templates/internal/admin/users/list-users.html.twig @@ -0,0 +1,73 @@ +{% extends 'base.html.twig' %} + +{% block body %} + {{ block('nav', 'internal/libs/nav.html.twig') }} + +
+ {{ block('topnav', 'internal/libs/top-nav.html.twig') }} + +
+
+
+
+
+
+
User List
+
+
+
+
+ + + + + + + + + + + + {% for user in users %} + + + + + + + + {% endfor %} + +
NameJobActive CasesSupervisor
+
+
+ {{ user.name }} +
+
+
{{ user.name }}
+

+ {{ user.email }} +

+
+
+
+

{{ user.job.value|lower|capitalize }}

+
+ {{ user.userCases|length }} + + {% if user.supervisor %} + {{ user.supervisor.name }} + {% endif %} + + Edit +    + Assign +
+
+
+
+
+
+ +
+ {% endblock %}