src/Controller/FacilityDashboardController.php line 69

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Hardy\Finder\BedCapacity;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\{ RequestResponse };
  6. use Symfony\Component\Routing\Annotation\Route;
  7. #[Route(path'/facililties')]
  8. class FacilityDashboardController extends AbstractController
  9. {
  10.     #[Route(path'/bed-capacity'name'facilities_index')]
  11.     public function index(Request $request) : Response
  12.     {
  13.         $bedCapacity = new BedCapacity();
  14.         $type $request->get('type');
  15.         $level $request->get('level');
  16.         $departmentId $request->get('department_id');
  17.         return $this->render('facility_dashboard/index.html.twig', [
  18.             'beds' => $bedCapacity->getAllSummary($type$level$departmentId),
  19.             'ward_types' => $bedCapacity->getWardTypes(),
  20.             'url' => $this->generateUrl('facilities_index')
  21.         ]);
  22.     }
  23.     #[Route(path'/bed-capacity-by-district/{id}'name'facilities_district')]
  24.     public function district(Request $requestint $id) : Response
  25.     {
  26.         $bedCapacity = new BedCapacity();
  27.         $type $request->get('type');
  28.         $level $request->get('level');
  29.         $department $request->get('department');
  30.         $beds $bedCapacity->getDetailsByDistrictId($id$type$level$department);
  31.         if (!$beds) {
  32.             return $this->redirectToRoute('homepage');
  33.         }
  34.         return $this->render('facility_dashboard/district.html.twig', [
  35.             'beds' => $beds,
  36.             'ward_types' => $bedCapacity->getWardTypes(),
  37.             'url' => $this->generateUrl('facilities_district', ['id' => $id])
  38.         ]);
  39.     }
  40.     #[Route(path'/bed-capacity-in-hospital/{id}'name'facilities_hospital')]
  41.     public function hospital(Request $requestint $id) : Response
  42.     {
  43.         $bedCapacity = new BedCapacity();
  44.         $type $request->get('type');
  45.         $level $request->get('level');
  46.         $department $request->get('department');
  47.         $beds $bedCapacity->getDetailsByHospitalId($id$type$level$department);
  48.         if (!$beds) {
  49.             return $this->redirectToRoute('homepage');
  50.         }
  51.         return $this->render('facility_dashboard/hospital.html.twig', [
  52.             'beds' => $beds,
  53.             'ward_types' => $bedCapacity->getWardTypes(),
  54.             'url' => $this->generateUrl('facilities_hospital', ['id' => $id])
  55.         ]);
  56.     }
  57.     #[Route(path'/bed-types-in-department/{id}'name'facilities_department')]
  58.     public function department(int $id) : Response
  59.     {
  60.         $bedCapacity = new BedCapacity();
  61.         $beds $bedCapacity->getDetailsByDepartmentId($id);
  62.         if (!$beds) {
  63.             return $this->redirectToRoute('homepage');
  64.         }
  65.         return $this->render('facility_dashboard/department.html.twig', [
  66.             'beds' => $beds
  67.         ]);
  68.     }
  69. }