Skip to content

Commit

Permalink
fix codes
Browse files Browse the repository at this point in the history
  • Loading branch information
AshrafMd-1 committed May 1, 2024
1 parent c4decb4 commit 2e81525
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Components/ExternalResult/FacilitiesSelectDialogue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ const FacilitiesSelectDialog = (props: Props) => {
district={
authUser?.user_type === "DistrictAdmin"
? authUser?.district?.toString()
: ""
: undefined
}
state={
authUser?.user_type === "StateAdmin"
? authUser?.state?.toString()
: ""
: undefined
}
/>
<div className="mt-4 flex flex-col gap-2 sm:flex-row sm:justify-end">
Expand Down
16 changes: 9 additions & 7 deletions src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1063,25 +1063,27 @@ export const PatientRegister = (props: PatientRegisterProps) => {
}

const PatientRegisterAuth = () => {
let check = false;
const showAllFacilityUsers = ["DistrictAdmin", "StateAdmin"];
if (
!showAllFacilityUsers.includes(authUser.user_type) &&
authUser.home_facility_object?.id === facilityId
) {
check = true;
} else if (
return true;
}
if (
authUser.user_type === "DistrictAdmin" &&
authUser.district === facilityObject?.district
) {
check = true;
} else if (
return true;
}
if (
authUser.user_type === "StateAdmin" &&
authUser.state === facilityObject?.state
) {
check = true;
return true;
}
return check;

return false;
};

if (!isLoading && facilityId && facilityObject && !PatientRegisterAuth()) {
Expand Down

0 comments on commit 2e81525

Please sign in to comment.