<?php
namespace App\Controller;
use App\Entity\{ WardBed, WardMedicineSchedule };
use App\Repository\{ CaseMedicineRepository, CaseRepository, WardBedRepository, WardMedicineScheduleRepository };
use App\Service\Pagination;
use Doctrine\ORM\EntityManagerInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{ Request, Response };
use Symfony\Component\Routing\Annotation\Route;
use Nzo\UrlEncryptorBundle\Annotations\ParamDecryptor;
#[Route(path: '/general-ward'), IsGranted(data: 'ROLE_WARD')]
class GeneralWardController extends AbstractController
{
use WardTrait;
private string $templatePath = 'general_ward';
#[Route(path: '/', name: 'general_ward_index', methods: ['GET'])]
public function index(Request $request, Pagination $pagination, WardBedRepository $wardBedRepo) : Response
{
return $this->indexMethod($request, $pagination, $wardBedRepo);
}
#[Route(path: '/total-patients', name: 'general_ward_all', methods: ['GET'])]
public function allBeds(Request $request, Pagination $pagination, WardBedRepository $wardBedRepo) : Response
{
return $this->allBedsMethod($request, $pagination, $wardBedRepo);
}
#[Route(path: '/prescription/{id}/{mode}', name: 'general_ward_prescription', methods: ['GET', 'POST'])]
#[ParamDecryptor(["id"])]
public function prescription(WardBed $wardBed, string $mode, CaseRepository $caseRepo) : Response
{
return $this->prescriptionMethod($wardBed, $mode, $caseRepo);
}
#[Route(path: '/create-schedule/{id}', name: 'general_ward_create_schedule', methods: ['GET', 'POST'])]
#[ParamDecryptor(["id"])]
public function createSchedule(Request $request, WardBed $wardBed, EntityManagerInterface $entityManager, CaseMedicineRepository $caseMedicineRepo, WardMedicineScheduleRepository $wardMedicineScheduleRepo) : Response
{
return $this->createScheduleMethod($request, $wardBed, 'general_ward_create_schedule', $entityManager, $caseMedicineRepo, $wardMedicineScheduleRepo);
}
#[Route(path: '/print-schedule/{id}', name: 'general_ward_print_schedule', methods: ['GET', 'POST'])]
#[ParamDecryptor(["id"])]
public function printSchedule(WardMedicineSchedule $schedule, WardMedicineScheduleRepository $wardMedicineScheduleRepo) : Response
{
return $this->printScheduleMethod($schedule, $wardMedicineScheduleRepo);
}
#[Route(path: '/remove-schedule', name: 'general_ward_remove_schedule', methods: ['GET'])]
public function removeSchedule(Request $request, WardMedicineScheduleRepository $wardMedicineScheduleRepo) : Response
{
return $this->removeScheduleMethod($request, 'general_ward_create_schedule', $wardMedicineScheduleRepo);
}
#[Route(path: '/current-schedule', name: 'general_ward_current_schedule', methods: ['GET', 'POST'])]
public function currentSchedule(Request $request, WardMedicineScheduleRepository $wardMedicineScheduleRepo) : Response
{
return $this->currentScheduleMethod($request, 'general_ward_current_schedule', $wardMedicineScheduleRepo);
}
#[Route(path: '/emergency-medicine/{id}', name: 'general_ward_emergency_medicine', methods: ['GET', 'POST'])]
#[ParamDecryptor(["id"])]
public function emergencyMedicine(Request $request, WardBed $wardBed, CaseRepository $caseRepo, EntityManagerInterface $entityManager) : Response
{
return $this->emergencyMedicineMethod($request, $wardBed, $caseRepo, 'general_ward_index', 'general_ward_emergency_medicine', $entityManager);
}
}