Skip to content

Commit

Permalink
fix: hide Monitors without a patient checkbox filter is not toggling …
Browse files Browse the repository at this point in the history
…state
  • Loading branch information
GokulramGHV committed Jan 7, 2024
1 parent 7f6cc0c commit d5fae13
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/Components/Facility/CentralNursingStation.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -39,6 +39,11 @@ export default function CentralNursingStation({ facilityId }: Props) {
const { qParams, updateQuery, removeFilter, updatePage } = useFilters({
limit: PER_PAGE_LIMIT,
});
const [isBedOccupied, setIsBedOccupied] = useState<boolean>(
qParams.bed_is_occupied === undefined
? true
: qParams.bed_is_occupied === "true"
);
const query = useQuery(routes.listPatientAssetBeds, {
pathParams: { facility_external_id: facilityId },
query: {
Expand Down Expand Up @@ -151,16 +156,10 @@ export default function CentralNursingStation({ facilityId }: Props) {
<CheckBoxFormField
name="bed_is_occupied"
label="Hide Monitors without Patient"
value={
qParams.bed_is_occupied === "true" ||
qParams.bed_is_occupied === undefined
}
value={isBedOccupied}
onChange={({ name, value }) => {
if (value) {
updateQuery({ [name]: value });
} else {
removeFilter(name);
}
updateQuery({ [name]: value });
setIsBedOccupied(value);
}}
labelClassName="text-sm"
errorClassName="hidden"
Expand Down

0 comments on commit d5fae13

Please sign in to comment.