Add StaffController for staff supervisor workers
This commit is contained in:
		
							
								
								
									
										47
									
								
								src/Controller/StaffController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/Controller/StaffController.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,47 @@ | ||||
| <?php | ||||
|  | ||||
| namespace App\Controller; | ||||
|  | ||||
| use App\Entity\User; | ||||
| use Doctrine\ORM\EntityManagerInterface; | ||||
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | ||||
| use Symfony\Component\HttpFoundation\Response; | ||||
| use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface; | ||||
| use Symfony\Component\Routing\Annotation\Route; | ||||
| use Symfony\Component\Security\Http\Attribute\CurrentUser; | ||||
|  | ||||
| class StaffController extends AbstractController | ||||
| { | ||||
|     public function __construct( | ||||
|         private readonly EntityManagerInterface $entityManager, | ||||
|         private readonly UserPasswordHasherInterface $userPasswordHasher, | ||||
|         private array $navLinks = [] | ||||
|     ) { | ||||
|         $this->navLinks = [ | ||||
|             'admin_dashboard' => 'nav-link text-dark', | ||||
|             'user_dashboard' => 'nav-link text-dark', | ||||
|             'profile' => 'nav-link text-dark', | ||||
|             'user_list' => 'nav-link text-dark', | ||||
|             'staff_dashboard' => 'nav-link text-dark', | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|     #[Route('/staff-dashboard', name: 'staff')] | ||||
|     public function staffDashboard(#[CurrentUser()] User $user): Response | ||||
|     { | ||||
|         $this->navLinks['staff_dashboard'] = 'nav-link text-white active bg-gradient-dark'; | ||||
|  | ||||
|         return $this->render( | ||||
|             'internal/staff/staff-dashboard.html.twig', | ||||
|             array_merge( | ||||
|                 $this->navLinks, | ||||
|                 [ | ||||
|                     'breadcrumbs' => [ | ||||
|                         'Staff Dashboard' | ||||
|                     ], | ||||
|                     'notifications' => $user->retrieveUnreadNotifications(), | ||||
|                 ] | ||||
|             ) | ||||
|         ); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user