<?php
namespace App\Controller;
use App\Service\Sms;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
#[IsGranted(data: 'IS_AUTHENTICATED_REMEMBERED')]
class DashboardController extends AbstractController
{
#[Route(path: '/dashboard', name: 'dashboard')]
public function index(): Response
{
$template = match (true) {
$this->isGranted('ROLE_ADMIN') => 'admin',
$this->isGranted('ROLE_RECEP') => 'receptionist',
$this->isGranted('ROLE_DOC') => 'doctor',
$this->isGranted('ROLE_LAB_TECH') => 'lab_tech',
$this->isGranted('ROLE_PHARMA') => 'pharmacist',
$this->isGranted('ROLE_WARD') => 'general_ward',
$this->isGranted('ROLE_RAD') => 'radiology',
$this->isGranted('ROLE_HR') => 'hr',
$this->isGranted('ROLE_CHILD_WARD') => 'child_care_ward',
$this->isGranted('ROLE_ICU_WARD') => 'icu_ward',
$this->isGranted('ROLE_WOMAN_WARD') => 'woman_care_ward',
$this->isGranted('ROLE_SPW_WARD') => 'specialized_ward',
$this->isGranted('ROLE_OT_WARD') => 'ot_ward',
$this->isGranted('ROLE_SURG_WARD') => 'surgery_ward',
$this->isGranted('ROLE_HOSP_ADMIN') => 'hospital_admin',
$this->isGranted('ROLE_STOCK') => 'stock_manager',
$this->isGranted('ROLE_CHO') => 'cho',
$this->isGranted('ROLE_AYUSH') => 'ayush',
$this->isGranted('ROLE_MPHW') => 'mphw',
$this->isGranted('ROLE_DENT') => 'dentist',
$this->isGranted('ROLE_DENT_WARD') => 'dental_ward',
$this->isGranted('ROLE_DEAN') => 'dean',
$this->isGranted('ROLE_DEAN_MEDICAL') => 'dean',
$this->isGranted('ROLE_DEAN_DISTRICT') => 'dean',
$this->isGranted('ROLE_DEAN_SUB_DISTRICT') => 'dean',
$this->isGranted('ROLE_DEAN_CHC') => 'dean',
$this->isGranted('ROLE_DEAN_PHC') => 'dean',
$this->isGranted('ROLE_DEAN_CHO') => 'dean',
$this->isGranted('ROLE_RMO') => 'rmo',
$this->isGranted('ROLE_HOD') => 'hod',
$this->isGranted('ROLE_HOD_Medicine') => 'hod',
$this->isGranted('ROLE_HOD_Female') => 'hod',
$this->isGranted('ROLE_HOD_Child') => 'hod',
$this->isGranted('ROLE_HOD_Surgery') => 'hod',
$this->isGranted('ROLE_HOD_Orth') => 'hod',
$this->isGranted('ROLE_HOD_Lab') => 'hod',
default => 'receptionist'
};
if ($template == 'rmo' or $template == 'hod') {
} else {
//$dashboard = 'kheda_dashboard';
//$template = 'hod';
}
$dashboard = 'dashboard';
return $this->render($dashboard . '/' . $template . '.html.twig');
}
#[Route(path: '/text', name: 'sms_msg')]
public function sendText(Sms $sms)
{
//dd($sms->sendSms('+919825726321', 'Test'));
}
}