From 539beecc51200417059258faf1c7c5b8e2efb213 Mon Sep 17 00:00:00 2001 From: Suprabath <34211797+suprabathk@users.noreply.github.com> Date: Wed, 6 Sep 2023 08:38:58 +0530 Subject: [PATCH] Added nav link for bed status in consultation form (#6170) --- src/Components/Facility/ConsultationForm.tsx | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index ed7fd7b57b6..c71c70b162c 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -198,7 +198,8 @@ const consultationFormReducer = (state = initialState, action: FormAction) => { type ConsultationFormSection = | "Consultation Details" | "Diagnosis" - | "Treatment Plan"; + | "Treatment Plan" + | "Bed Status"; export const ConsultationForm = (props: any) => { const { goBack } = useAppHistory(); @@ -223,6 +224,7 @@ export const ConsultationForm = (props: any) => { const [consultationDetailsVisible, consultationDetailsRef] = useVisibility(); const [diagnosisVisible, diagnosisRef] = useVisibility(-300); const [treatmentPlanVisible, treatmentPlanRef] = useVisibility(-300); + const [bedStatusVisible, bedStatusRef] = useVisibility(-300); const [disabledFields, setDisabledFields] = useState([]); const sections = { @@ -241,6 +243,11 @@ export const ConsultationForm = (props: any) => { visible: treatmentPlanVisible, ref: treatmentPlanRef, }, + "Bed Status": { + iconClass: "care-l-bed", + visible: bedStatusVisible, + ref: bedStatusRef, + }, }; useEffect(() => { @@ -248,9 +255,15 @@ export const ConsultationForm = (props: any) => { if (consultationDetailsVisible) return "Consultation Details"; if (diagnosisVisible) return "Diagnosis"; if (treatmentPlanVisible) return "Treatment Plan"; + if (bedStatusVisible) return "Bed Status"; return prev; }); - }, [consultationDetailsVisible, diagnosisVisible, treatmentPlanVisible]); + }, [ + consultationDetailsVisible, + diagnosisVisible, + treatmentPlanVisible, + bedStatusVisible, + ]); useEffect(() => { async function fetchPatientName() { @@ -817,6 +830,9 @@ export const ConsultationForm = (props: any) => { if (state.form.consultation_status === 1) { return null; } + if (!isUpdate && sectionTitle === "Bed Status") { + return null; + } const isCurrent = currentSection === sectionTitle; const section = sections[sectionTitle as ConsultationFormSection]; return ( @@ -1306,7 +1322,7 @@ export const ConsultationForm = (props: any) => { {isUpdate && ( <>
-

Update Bed

+ {sectionTitle("Bed Status")}