Add flash messages and convert to use Breadcrumb class
This commit is contained in:
parent
bcbd0575b6
commit
94a7a324a1
@ -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')
|
||||
]
|
||||
]
|
||||
)
|
||||
|
@ -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(),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user