src/Controller/DashboardController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Service\Sms;
  4. use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\Response;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. #[IsGranted(data'IS_AUTHENTICATED_REMEMBERED')]
  9. class DashboardController extends AbstractController
  10. {
  11.     #[Route(path'/dashboard'name'dashboard')]
  12.     public function index(): Response
  13.     {
  14.         $template = match (true) {
  15.             $this->isGranted('ROLE_ADMIN') => 'admin',
  16.             $this->isGranted('ROLE_RECEP') => 'receptionist',
  17.             $this->isGranted('ROLE_DOC') => 'doctor',
  18.             $this->isGranted('ROLE_LAB_TECH') => 'lab_tech',
  19.             $this->isGranted('ROLE_PHARMA') => 'pharmacist',
  20.             $this->isGranted('ROLE_WARD') => 'general_ward',
  21.             $this->isGranted('ROLE_RAD') => 'radiology',
  22.             $this->isGranted('ROLE_HR') => 'hr',
  23.             $this->isGranted('ROLE_CHILD_WARD') => 'child_care_ward',
  24.             $this->isGranted('ROLE_ICU_WARD') => 'icu_ward',
  25.             $this->isGranted('ROLE_WOMAN_WARD') => 'woman_care_ward',
  26.             $this->isGranted('ROLE_SPW_WARD') => 'specialized_ward',
  27.             $this->isGranted('ROLE_OT_WARD') => 'ot_ward',
  28.             $this->isGranted('ROLE_SURG_WARD') => 'surgery_ward',
  29.             $this->isGranted('ROLE_HOSP_ADMIN') => 'hospital_admin',
  30.             $this->isGranted('ROLE_STOCK') => 'stock_manager',
  31.             $this->isGranted('ROLE_CHO') => 'cho',
  32.             $this->isGranted('ROLE_AYUSH') => 'ayush',
  33.             $this->isGranted('ROLE_MPHW') => 'mphw',
  34.             $this->isGranted('ROLE_DENT') => 'dentist',
  35.             $this->isGranted('ROLE_DENT_WARD') => 'dental_ward',
  36.             $this->isGranted('ROLE_DEAN') => 'dean',
  37.             $this->isGranted('ROLE_DEAN_MEDICAL') => 'dean',
  38.             $this->isGranted('ROLE_DEAN_DISTRICT') => 'dean',
  39.             $this->isGranted('ROLE_DEAN_SUB_DISTRICT') => 'dean',
  40.             $this->isGranted('ROLE_DEAN_CHC') => 'dean',
  41.             $this->isGranted('ROLE_DEAN_PHC') => 'dean',
  42.             $this->isGranted('ROLE_DEAN_CHO') => 'dean',
  43.             $this->isGranted('ROLE_RMO') => 'rmo',
  44.             $this->isGranted('ROLE_HOD') => 'hod',
  45.             $this->isGranted('ROLE_HOD_Medicine') => 'hod',
  46.             $this->isGranted('ROLE_HOD_Female') => 'hod',
  47.             $this->isGranted('ROLE_HOD_Child') => 'hod',
  48.             $this->isGranted('ROLE_HOD_Surgery') => 'hod',
  49.             $this->isGranted('ROLE_HOD_Orth') => 'hod',
  50.             $this->isGranted('ROLE_HOD_Lab') => 'hod',
  51.             default => 'receptionist'
  52.         };
  53.         if ($template == 'rmo' or $template == 'hod') {
  54.         } else {
  55.             //$dashboard = 'kheda_dashboard';
  56.             //$template = 'hod';
  57.         }
  58.         $dashboard 'dashboard';
  59.         return $this->render($dashboard '/' $template '.html.twig');
  60.     }
  61.     #[Route(path'/text'name'sms_msg')]
  62.     public function sendText(Sms $sms)
  63.     {
  64.         //dd($sms->sendSms('+919825726321', 'Test'));
  65.     }
  66. }