From 1fe6eb33177f1bf6cac576276a36ee3be462eb99 Mon Sep 17 00:00:00 2001 From: Ankur Prabhu <85862184+AnkurPrabhu@users.noreply.github.com> Date: Wed, 22 May 2024 10:06:35 +0530 Subject: [PATCH] Disable the Bed List of Already occupied Beds (front-end change) (#7699) * front-end change * adding suggested changes --- src/Components/Assets/configure/MonitorConfigure.tsx | 3 ++- src/Components/Common/BedSelect.tsx | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Components/Assets/configure/MonitorConfigure.tsx b/src/Components/Assets/configure/MonitorConfigure.tsx index 5053b5b7d02..785b82873de 100644 --- a/src/Components/Assets/configure/MonitorConfigure.tsx +++ b/src/Components/Assets/configure/MonitorConfigure.tsx @@ -1,7 +1,7 @@ import { useState } from "react"; import { BedSelect } from "../../Common/BedSelect"; import { BedModel } from "../../Facility/models"; -import { AssetData } from "../AssetTypes"; +import { AssetClass, AssetData } from "../AssetTypes"; import * as Notification from "../../../Utils/Notifications.js"; import { Submit } from "../../Common/components/ButtonV2"; import { FieldLabel } from "../../Form/FormFields/FormField"; @@ -73,6 +73,7 @@ export default function MonitorConfigure({ asset }: { asset: AssetData }) { multiple={false} location={asset?.location_object?.id} facility={asset?.location_object?.facility?.id} + not_occupied_by_asset_type={AssetClass.HL7MONITOR} className="w-full" /> diff --git a/src/Components/Common/BedSelect.tsx b/src/Components/Common/BedSelect.tsx index 2e7bf09072e..5c31055a3a4 100644 --- a/src/Components/Common/BedSelect.tsx +++ b/src/Components/Common/BedSelect.tsx @@ -4,6 +4,7 @@ import AutoCompleteAsync from "../Form/AutoCompleteAsync"; import { useTranslation } from "react-i18next"; import request from "../../Utils/request/request"; import routes from "../../Redux/api"; +import { AssetClass } from "../Assets/AssetTypes"; interface BedSelectProps { name: string; @@ -17,6 +18,7 @@ interface BedSelectProps { showAll?: boolean; showNOptions?: number; selected: BedModel | BedModel[] | null; + not_occupied_by_asset_type?: AssetClass; setSelected: (selected: BedModel | BedModel[] | null) => void; } @@ -33,6 +35,7 @@ export const BedSelect = (props: BedSelectProps) => { facility, location, showNOptions = 20, + not_occupied_by_asset_type, } = props; const { t } = useTranslation(); @@ -45,8 +48,8 @@ export const BedSelect = (props: BedSelectProps) => { all: searchAll, facility, location, + not_occupied_by_asset_type, }; - const { data } = await request(routes.listFacilityBeds, { query }); if (unoccupiedOnly) {