{
0.85
+ (facility.patient_count || 0) /
+ (facility.bed_count || 0) >
+ 0.85
? "button-danger-border bg-red-500"
: "button-primary-border bg-primary-100"
}`}
@@ -185,14 +191,18 @@ export const FacilityCard = (props: { facility: any; userType: any }) => {
icon="l-bed"
className={classNames(
"mr-2",
- facility.patient_count / facility.bed_count > 0.85
+ (facility.patient_count || 0) /
+ (facility.bed_count || 0) >
+ 0.85
? "text-white"
: "text-primary-600",
)}
/>{" "}
0.85
+ (facility.patient_count || 0) /
+ (facility.bed_count || 0) >
+ 0.85
? "text-white"
: "text-secondary-700"
}`}
diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx
index 6f73fee4a54..a50b1e09390 100644
--- a/src/Components/Facility/FacilityHome.tsx
+++ b/src/Components/Facility/FacilityHome.tsx
@@ -75,6 +75,20 @@ export const FacilityHome = ({ facilityId }: Props) => {
},
});
+ const spokesQuery = useQuery(routes.getFacilitySpokes, {
+ pathParams: {
+ id: facilityId,
+ },
+ silent: true,
+ });
+
+ const hubsQuery = useQuery(routes.getFacilityHubs, {
+ pathParams: {
+ id: facilityId,
+ },
+ silent: true,
+ });
+
const handleDeleteClose = () => {
setOpenDeleteDialog(false);
};
@@ -93,13 +107,6 @@ export const FacilityHome = ({ facilityId }: Props) => {
});
};
- const spokesQuery = useQuery(routes.getFacilitySpokes, {
- pathParams: {
- id: facilityId,
- },
- silent: true,
- });
-
if (isLoading) {
return ;
}
@@ -274,7 +281,7 @@ export const FacilityHome = ({ facilityId }: Props) => {
/>