Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch assets only when bed is assigned #5769

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/Components/Facility/ConsultationDetails.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AssetBedModel, AssetClass } from "../Assets/AssetTypes";
import {
CONSULTATION_TABS,
DISCHARGE_REASONS,
Expand All @@ -18,41 +19,40 @@ import {
} from "../../Redux/actions";
import { statusType, useAbortableEffect } from "../../Common/utils";
import { useCallback, useEffect, useState } from "react";
import { useDispatch } from "react-redux";

import { ABGPlots } from "./Consultations/ABGPlots";
import ButtonV2 from "../Common/components/ButtonV2";
import CareIcon from "../../CAREUI/icons/CareIcon";
import Chip from "../../CAREUI/display/Chip";
import { DailyRoundsList } from "./Consultations/DailyRoundsList";
import { DialysisPlots } from "./Consultations/DialysisPlots";
import DischargeModal from "./DischargeModal";
import DischargeSummaryModal from "./DischargeSummaryModal";
import DoctorVideoSlideover from "./DoctorVideoSlideover";
import { Feed } from "./Consultations/Feed";
import { FileUpload } from "../Patient/FileUpload";
import HL7PatientVitalsMonitor from "../VitalsMonitor/HL7PatientVitalsMonitor";
import InvestigationTab from "./Investigations/investigationsTab";
import { make as Link } from "../Common/components/Link.gen";
import MedicineAdministrationsTable from "../Medicine/MedicineAdministrationsTable";
import { NeurologicalTable } from "./Consultations/NeurologicalTables";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import { NursingPlot } from "./Consultations/NursingPlot";
import { NutritionPlots } from "./Consultations/NutritionPlots";
import PatientInfoCard from "../Patient/PatientInfoCard";
import { PatientModel } from "../Patient/models";
import PrescriptionsTable from "../Medicine/PrescriptionsTable";
import { PressureSoreDiagrams } from "./Consultations/PressureSoreDiagrams";
import { PrimaryParametersPlot } from "./Consultations/PrimaryParametersPlot";
import ReadMore from "../Common/components/Readmore";
import VentilatorPatientVitalsMonitor from "../VitalsMonitor/VentilatorPatientVitalsMonitor";
import { VentilatorPlot } from "./Consultations/VentilatorPlot";
import { formatDate } from "../../Utils/utils";
import loadable from "@loadable/component";
import moment from "moment";
import { navigate } from "raviger";
import { useDispatch } from "react-redux";
import { useTranslation } from "react-i18next";
import { NonReadOnlyUsers } from "../../Utils/AuthorizeFor";
import PrescriptionsTable from "../Medicine/PrescriptionsTable";
import MedicineAdministrationsTable from "../Medicine/MedicineAdministrationsTable";
import DischargeSummaryModal from "./DischargeSummaryModal";
import VentilatorPatientVitalsMonitor from "../VitalsMonitor/VentilatorPatientVitalsMonitor";

import { AssetBedModel, AssetClass } from "../Assets/AssetTypes";
import HL7PatientVitalsMonitor from "../VitalsMonitor/HL7PatientVitalsMonitor";

const Loading = loadable(() => import("../Common/Loading"));
const PageTitle = loadable(() => import("../Common/PageTitle"));
Expand Down Expand Up @@ -1150,12 +1150,13 @@ export const ConsultationDetails = (props: any) => {

const VitalsCard = ({ consultation }: { consultation: ConsultationModel }) => {
const dispatch = useDispatch<any>();
const [loading, setLoading] = useState(true);
const [loading, setLoading] = useState(false);
const [hl7SocketUrl, setHL7SocketUrl] = useState<string>();
const [ventilatorSocketUrl, setVentilatorSocketUrl] = useState<string>();

useEffect(() => {
if (!consultation.facility) return;
if (!consultation.facility || !consultation.current_bed?.bed_object.id)
return;

const fetchData = async () => {
setLoading(true);
Expand Down