Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the delete facility button to be hidden and not diabled #6677

Closed
wants to merge 13 commits into from
Closed
26 changes: 15 additions & 11 deletions src/Components/Facility/FacilityHome.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Notification from "../../Utils/Notifications.js";

import AuthorizeFor, { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import { FacilityModel } from "./models";
import { FACILITY_FEATURE_TYPES, USER_TYPES } from "../../Common/constants";
import DropdownMenu, { DropdownItem } from "../Common/components/Menu";
Expand Down Expand Up @@ -367,16 +367,20 @@ export const FacilityHome = (props: any) => {
>
View Users
</DropdownItem>
<DropdownItem
id="delete-facility"
variant="danger"
onClick={() => setOpenDeleteDialog(true)}
className="flex items-center gap-3"
icon={<CareIcon className="care-l-trash-alt text-lg" />}
authorizeFor={AuthorizeFor(["DistrictAdmin", "StateAdmin"])}
>
Delete Facility
</DropdownItem>
{authUser.user_type == "DistrictAdmin" ||
authUser.user_type == "StateAdmin" ? (
<DropdownItem
id="delete-facility"
variant="danger"
onClick={() => setOpenDeleteDialog(true)}
className="flex items-center gap-3"
icon={<CareIcon className="care-l-trash-alt text-lg" />}
>
Delete Facility
</DropdownItem>
) : (
<></>
)}
</DropdownMenu>
</div>
<div className="flex flex-col justify-end">
Expand Down
Loading