From 5593dc2b9ac52a4da98dfb3fceca30deac178f7c Mon Sep 17 00:00:00 2001 From: Kunal Dubey <21157775+xakep8@users.noreply.github.com> Date: Tue, 21 Nov 2023 06:10:41 +0000 Subject: [PATCH 1/2] fixed the delete facility button to be hidden and not diabled --- src/Components/Facility/FacilityHome.tsx | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index 405ba236f05..73018e36b20 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -594,16 +594,21 @@ export const FacilityHome = (props: any) => { > View Users - setOpenDeleteDialog(true)} - className="flex items-center gap-3" - icon={} - authorizeFor={AuthorizeFor(["DistrictAdmin", "StateAdmin"])} - > - Delete Facility - + {authUser.user_type == "DistrictAdmin" || + authUser.user_type == "StateAdmin" ? ( + setOpenDeleteDialog(true)} + className="flex items-center gap-3" + icon={} + authorizeFor={AuthorizeFor(["DistrictAdmin", "StateAdmin"])} + > + Delete Facility + + ) : ( + <> + )}
From b2c525724b6c65699b79b391d7be80b5e1f1a3e0 Mon Sep 17 00:00:00 2001 From: Kunal Dubey Date: Tue, 21 Nov 2023 17:58:28 +0530 Subject: [PATCH 2/2] removed the "authorizeFor" prop from the delete-facility DropdownItem --- src/Components/Facility/FacilityHome.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index 73018e36b20..4825c6e1706 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -1,6 +1,6 @@ import * as Notification from "../../Utils/Notifications.js"; -import AuthorizeFor, { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; +import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor"; import { CapacityModal, DoctorModal, @@ -602,7 +602,6 @@ export const FacilityHome = (props: any) => { onClick={() => setOpenDeleteDialog(true)} className="flex items-center gap-3" icon={} - authorizeFor={AuthorizeFor(["DistrictAdmin", "StateAdmin"])} > Delete Facility