Skip to content

Commit

Permalink
Hide Camera Feed button for patient with no bed assigned. (#6868)
Browse files Browse the repository at this point in the history
* Hide camera feed for no bed

* updated type of asset
  • Loading branch information
shyamprakash123 authored Dec 27, 2023
1 parent a5a61ca commit ce066ce
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { ConsultationNeurologicalMonitoringTab } from "./ConsultationNeurologica
import { ConsultationNutritionTab } from "./ConsultationNutritionTab";
import PatientNotesSlideover from "../PatientNotesSlideover";
import LegacyDiagnosesList from "../../Diagnosis/LegacyDiagnosesList";
import { AssetBedModel } from "../../Assets/AssetTypes";

const Loading = lazy(() => import("../../Common/Loading"));
const PageTitle = lazy(() => import("../../Common/PageTitle"));
Expand Down Expand Up @@ -120,16 +121,19 @@ export const ConsultationDetails = (props: any) => {
data.symptoms_text = symptoms.join(", ");
}
setConsultationData(data);
const assetRes = await dispatch(
listAssetBeds({
bed: data?.current_bed?.bed_object?.id,
})
);
const isCameraAttachedRes = assetRes.data.results.some(
(asset: { asset_object: { asset_class: string } }) => {
return asset?.asset_object?.asset_class === "ONVIF";
}
);
const assetRes = data?.current_bed?.bed_object?.id
? await dispatch(
listAssetBeds({
bed: data?.current_bed?.bed_object?.id,
})
)
: null;
const isCameraAttachedRes =
assetRes != null
? assetRes.data.results.some((asset: AssetBedModel) => {
return asset?.asset_object?.asset_class === "ONVIF";
})
: false;
setIsCameraAttached(isCameraAttachedRes);
const id = res.data.patient;
const patientRes = await dispatch(getPatient({ id }));
Expand Down

0 comments on commit ce066ce

Please sign in to comment.