From 37ac8730970cc53c523c158fded436c888594485 Mon Sep 17 00:00:00 2001 From: JOSHIK Date: Mon, 19 Aug 2024 20:56:45 +0100 Subject: [PATCH 1/2] fixed issue 8304 --- src/Components/Facility/ConsultationForm.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 5cda9d5ab01..5a2fe84a370 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -89,8 +89,8 @@ type FormDetails = { referred_from_facility_external?: string; referred_by_external?: string; transferred_from_location?: string; - treating_physician: string; - treating_physician_object: UserBareMinimum | null; + treating_physician?: string; + treating_physician_object?: UserBareMinimum | null; create_diagnoses: CreateDiagnosis[]; diagnoses: ConsultationDiagnosis[]; symptoms: EncounterSymptom[]; @@ -608,6 +608,9 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { } case "treating_physician": { + if (state.form.suggestion === "DC") { + break; + } if (state.form.suggestion !== "DD" && !state.form[field]) { errors[field] = t("field_required"); invalidForm = true; @@ -632,6 +635,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { return; } }); + if (invalidForm) { dispatch({ type: "set_errors", errors }); const firstError = Object.keys(errors).find((key) => errors[key]); @@ -1444,7 +1448,9 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { name={"treating_physician"} label={t("treating_doctor")} placeholder="Attending Doctors Name and Designation" - required + required={ + state.form.suggestion === "DC" ? false : true + } value={ state.form.treating_physician_object ?? undefined } From 30bf7a20640522bea55fe678bbae4812a4c76f84 Mon Sep 17 00:00:00 2001 From: JOSHIK Date: Mon, 19 Aug 2024 21:00:51 +0100 Subject: [PATCH 2/2] fixes 8304 --- src/Components/Facility/ConsultationForm.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 5a2fe84a370..b30bb2a2c0a 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -89,8 +89,8 @@ type FormDetails = { referred_from_facility_external?: string; referred_by_external?: string; transferred_from_location?: string; - treating_physician?: string; - treating_physician_object?: UserBareMinimum | null; + treating_physician: string; + treating_physician_object: UserBareMinimum | null; create_diagnoses: CreateDiagnosis[]; diagnoses: ConsultationDiagnosis[]; symptoms: EncounterSymptom[];