diff --git a/src/Controller/CaseController.php b/src/Controller/CaseController.php index 9dd4b60..b48b171 100644 --- a/src/Controller/CaseController.php +++ b/src/Controller/CaseController.php @@ -96,6 +96,37 @@ class CaseController extends AbstractController ); } + #[Route('/case/{caseId}', name: 'app_view_case')] + public function showCase(Request $request, string $caseId): Response + { + if (!$this->isGranted('IS_AUTHENTICATED_FULLY')) { + return $this->redirectToRoute('app_login'); + } + + $case = $this->entityManager->getRepository(MemberCase::class)->find($caseId); + $sources = $this->entityManager->getRepository(ReferralSource::class)->findAll(); + + $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($this->getUser()); + $this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($this->getUser()); + + return $this->render( + 'internal/cases/view-case.html.twig', + array_merge( + $this->navLinks, + [ + 'case' => $case, + 'sources' => $sources, + 'breadcrumbs' => [ + new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), + new Breadcrumb($this->generateUrl('app_view_case', ['caseId' => $case->getId()]), 'View Case') + ], + 'notifications' => $this->msgs, + 'notificationCount' => $this->notificationCount, + ] + ) + ); + } + #[Route('/add-case', name: 'app_add_case')] public function addCase(Request $request, #[CurrentUser()] User $admin): Response { diff --git a/templates/internal/cases/my-cases.html.twig b/templates/internal/cases/my-cases.html.twig index 2302b8f..a7db9cc 100644 --- a/templates/internal/cases/my-cases.html.twig +++ b/templates/internal/cases/my-cases.html.twig @@ -60,13 +60,16 @@
{{ c.referrals|length }}