fix getting correct breadcrumb link and highling correct nav link

This commit is contained in:
Ryan Prather 2024-12-25 17:16:04 +00:00
parent 6a9c35842f
commit 1e3a6dd612

View File

@ -34,11 +34,15 @@ class ReferralController extends AbstractController
private array $navLinks = []
) {
$this->navLinks = NavList::LIST;
$this->navLinks['case_list'] = NavList::PRESENT_LINK;
if (strpos($_SERVER['HTTP_REFERER'], 'my-cases') !== false) {
$this->navLinks['my_cases'] = NavList::PRESENT_LINK;
} else {
$this->navLinks['case_list'] = NavList::PRESENT_LINK;
}
}
#[Route('/list-referrals/{id}', name: 'app_list_referrals')]
public function listReferrals(#[CurrentUser()] User $user, string $id): Response
public function listReferrals(#[CurrentUser()] User $user, string $id, Request $request): Response
{
$this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user);
$this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user);
@ -53,7 +57,11 @@ class ReferralController extends AbstractController
$this->navLinks,
[
'breadcrumbs' => [
new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'),
(
strpos($request->server->get('HTTP_REFERER'), 'my-cases') !== false
? new Breadcrumb($this->generateUrl('app_my_cases'), 'My Cases')
: new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases')
),
new Breadcrumb($this->generateUrl('app_list_referrals', ['id' => $case->getId()]), 'Referrals'),
],
'notifications' => $this->msgs,