From d5fae131fab5a47f4cfe43994db12a6e4d77a583 Mon Sep 17 00:00:00 2001 From: Gokulram A Date: Sun, 7 Jan 2024 17:13:34 +0530 Subject: [PATCH] fix: hide Monitors without a patient checkbox filter is not toggling state --- .../Facility/CentralNursingStation.tsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Components/Facility/CentralNursingStation.tsx b/src/Components/Facility/CentralNursingStation.tsx index 75214b5506c..db9e826a61e 100644 --- a/src/Components/Facility/CentralNursingStation.tsx +++ b/src/Components/Facility/CentralNursingStation.tsx @@ -1,5 +1,5 @@ import useFullscreen from "../../Common/hooks/useFullscreen"; -import { Fragment } from "react"; +import { Fragment, useState } from "react"; import HL7PatientVitalsMonitor from "../VitalsMonitor/HL7PatientVitalsMonitor"; import useFilters from "../../Common/hooks/useFilters"; import Loading from "../Common/Loading"; @@ -39,6 +39,11 @@ export default function CentralNursingStation({ facilityId }: Props) { const { qParams, updateQuery, removeFilter, updatePage } = useFilters({ limit: PER_PAGE_LIMIT, }); + const [isBedOccupied, setIsBedOccupied] = useState( + qParams.bed_is_occupied === undefined + ? true + : qParams.bed_is_occupied === "true" + ); const query = useQuery(routes.listPatientAssetBeds, { pathParams: { facility_external_id: facilityId }, query: { @@ -151,16 +156,10 @@ export default function CentralNursingStation({ facilityId }: Props) { { - if (value) { - updateQuery({ [name]: value }); - } else { - removeFilter(name); - } + updateQuery({ [name]: value }); + setIsBedOccupied(value); }} labelClassName="text-sm" errorClassName="hidden"