Skip to content

Commit

Permalink
hide device if not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad committed Jun 24, 2023
1 parent ca5b767 commit f91a276
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 35 deletions.
49 changes: 15 additions & 34 deletions src/Components/Facility/ConsultationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -443,15 +443,15 @@ export const ConsultationDetails = (props: any) => {
</div>
{tab === "UPDATES" && (
<div className="flex flex-col gap-2">
{!consultationData.discharge_date && (
<section className="bg-white shadow-sm rounded-md flex items-stretch w-full flex-col lg:flex-row overflow-hidden">
<VitalsCard consultation={consultationData} />
</section>
)}
<div className="flex xl:flex-row flex-col">
<div className="xl:w-2/3 w-full">
<PageTitle title="Info" hideBack={true} breadcrumbs={false} />
<div className="grid lg:grid-cols-2 gap-4 mt-4">
{!consultationData.discharge_date && (
<section className="lg:col-span-2 bg-white shadow-sm rounded-md flex items-stretch w-full flex-col lg:flex-row overflow-hidden">
<VitalsCard consultation={consultationData} />
</section>
)}
{consultationData.discharge_date && (
<div
className={`bg-white overflow-hidden shadow rounded-lg gap-4 ${
Expand Down Expand Up @@ -1202,11 +1202,7 @@ const VitalsCard = ({ consultation }: { consultation: ConsultationModel }) => {
}, [consultation]);

if (loading) {
return (
<div className="bg-black flex w-full h-full max-h-[400px] justify-center items-center text-center gap-4 rounded">
<Loading />
</div>
);
return <div></div>;
}

if (!hl7SocketUrl && !ventilatorSocketUrl) {
Expand All @@ -1218,32 +1214,17 @@ const VitalsCard = ({ consultation }: { consultation: ConsultationModel }) => {
}

return (
<div className="flex flex-col lg:flex-row w-full bg-slate-800 gap-1 justify-between min-h-[400px] rounded">
<div className="flex-1">
{hl7SocketUrl ? (
<div className="w-full flex flex-col bg-slate-800 gap-1 justify-between rounded mx-auto">
{hl7SocketUrl && (
<div className="flex-1 min-h-[400px]">
<HL7PatientVitalsMonitor socketUrl={hl7SocketUrl} />
) : (
<VitalsDeviceNotConfigured device="HL7 Monitor" />
)}
</div>
<div className="flex-1">
{ventilatorSocketUrl ? (
</div>
)}
{ventilatorSocketUrl && (
<div className="flex-1 min-h-[400px]">
<VentilatorPatientVitalsMonitor socketUrl={ventilatorSocketUrl} />
) : (
<VitalsDeviceNotConfigured device="Ventilator" />
)}
</div>
</div>
);
};

const VitalsDeviceNotConfigured = ({ device }: { device: string }) => {
return (
<div className="hidden lg:flex flex-col gap-4 bg-black w-full h-full items-center justify-center text-center text-gray-700">
<CareIcon className="care-l-sync-exclamation text-4xl text-gray-600" />
<span className="font-medium text-xl text-gray-700">
No {device} configured for this bed
</span>
</div>
)}
</div>
);
};
2 changes: 1 addition & 1 deletion src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { MaterialUiPickersDate } from "@material-ui/pickers/typings/date";
import InsuranceDetailsBuilder from "../HCX/InsuranceDetailsBuilder";
import { HCXPolicyModel } from "../HCX/models";
import HCXPolicyValidator from "../HCX/validators";
import { FieldError } from "../Form/Fi1eldValidators";
import { FieldError } from "../Form/FieldValidators";
import useAppHistory from "../../Common/hooks/useAppHistory";
import DialogModal from "../Common/Dialog";
import { DraftSection, useAutoSaveReducer } from "../../Utils/AutoSave";
Expand Down

0 comments on commit f91a276

Please sign in to comment.