diff --git a/src/Controller/ReferralSourceController.php b/src/Controller/ReferralSourceController.php index 755c66b..96e0fe0 100644 --- a/src/Controller/ReferralSourceController.php +++ b/src/Controller/ReferralSourceController.php @@ -5,6 +5,7 @@ namespace App\Controller; use App\Entity\ReferralSource; use App\Entity\User; use App\Form\ReferralSourceFormType; +use App\Libs\Breadcrumb; use App\Libs\NavList; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -38,7 +39,7 @@ class ReferralSourceController extends AbstractController 'sources' => $sources, 'notifications' => $user->retrieveUnreadNotifications(), 'breadcrumbs' => [ - 'Referral Sources' + new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources') ] ] ) @@ -62,6 +63,8 @@ class ReferralSourceController extends AbstractController $this->entityManager->persist($rs); $this->entityManager->flush(); + $this->addFlash('success', 'Referral Source added'); + return $this->redirectToRoute('app_referral_source'); } @@ -73,8 +76,8 @@ class ReferralSourceController extends AbstractController 'form' => $form, 'notifications' => $user->retrieveUnreadNotifications(), 'breadcrumbs' => [ - 'Referral Sources', - 'Add Source' + new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources'), + new Breadcrumb($this->generateUrl('app_add_source'), 'Add Source') ] ] ) @@ -96,9 +99,10 @@ class ReferralSourceController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $rs = $form->getData(); - $this->entityManager->persist($rs); $this->entityManager->flush(); + $this->addFlash('success', 'Referral Source Updated'); + return $this->redirectToRoute('app_referral_source'); } @@ -108,10 +112,11 @@ class ReferralSourceController extends AbstractController $this->navList, [ 'form' => $form, + 'rs' => $rs, 'notifications' => $user->retrieveUnreadNotifications(), 'breadcrumbs' => [ - 'Referral Sources', - 'Edit Source' + new Breadcrumb($this->generateUrl('app_referral_source'), 'Referral Sources'), + new Breadcrumb($this->generateUrl('app_edit_source', ['id' => $id]), 'Edit Source') ] ] ) diff --git a/src/Controller/StaffController.php b/src/Controller/StaffController.php index d9b1e4e..1439628 100644 --- a/src/Controller/StaffController.php +++ b/src/Controller/StaffController.php @@ -3,6 +3,7 @@ namespace App\Controller; use App\Entity\User; +use App\Libs\Breadcrumb; use App\Libs\NavList; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; @@ -21,7 +22,7 @@ class StaffController extends AbstractController $this->navLinks = NavList::LIST; } - #[Route('/staff-dashboard', name: 'staff')] + #[Route('/staff-dashboard', name: 'app_staff_dashboard')] public function staffDashboard(#[CurrentUser()] User $user): Response { $this->navLinks['staff_dashboard'] = 'nav-link text-white active bg-gradient-dark'; @@ -32,7 +33,7 @@ class StaffController extends AbstractController $this->navLinks, [ 'breadcrumbs' => [ - 'Staff Dashboard' + new Breadcrumb('', 'Staff Dashboard') ], 'notifications' => $user->retrieveUnreadNotifications(), ]