From ac442e65b69365d68d53620df836a4ef9e2176c6 Mon Sep 17 00:00:00 2001 From: Ryan Prather Date: Mon, 2 Dec 2024 23:57:55 -0500 Subject: [PATCH] Added class with listCases initial method --- src/Controller/CaseController.php | 69 +++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/Controller/CaseController.php diff --git a/src/Controller/CaseController.php b/src/Controller/CaseController.php new file mode 100644 index 0000000..6b3d783 --- /dev/null +++ b/src/Controller/CaseController.php @@ -0,0 +1,69 @@ +navLinks = NavList::LIST; + } + + #[Route('/list-cases', name: 'app_list_cases')] + public function listCases(#[CurrentUser()] User $user): Response + { + $this->denyAccessUnlessGranted('ROLE_ADMIN'); + + $this->navLinks['case_list'] = 'nav-link text-white active bg-gradient-dark'; + + return $this->render( + 'internal/cases/case-list.html.twig', + array_merge( + $this->navLinks, + [ + 'breadcrumbs' => [ + 'List Cases' + ], + 'notifications' => $user->retrieveUnreadNotifications(), + ] + ) + ); + } + + #[Route('/add-case', name: 'app_case')] + public function addCase(#[CurrentUser()] User $admin): Response + { + $this->denyAccessUnlessGranted('ROLE_ADMIN'); + + $this->navLinks['case_list'] = 'nav-link text-white active bg-gradient-dark'; + + $case = new MemberCase(); + $form = $this->createForm(MemberCaseFormType::class, $case); + + return $this->render( + 'internal/admin/cases/add-case.html.twig', + array_merge( + $this->navLinks, + [ + 'title' => 'Add Case', + 'breadcrumbs' => [ + 'Case', + 'Add Case' + ], + 'notifications' => $admin->retrieveUnreadNotifications(), + 'form' => $form, + ] + ) + ); + } +}