From 37ac8730970cc53c523c158fded436c888594485 Mon Sep 17 00:00:00 2001 From: JOSHIK Date: Mon, 19 Aug 2024 20:56:45 +0100 Subject: [PATCH 1/5] 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/5] 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[]; From 9c8b59639a6db5711020046ce3b643019f4eb206 Mon Sep 17 00:00:00 2001 From: JOSHIK ROSHAN <96165631+JOSHIK27@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:53:05 +0100 Subject: [PATCH 3/5] Update src/Components/Facility/ConsultationForm.tsx Co-authored-by: Rithvik Nishad --- src/Components/Facility/ConsultationForm.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index b30bb2a2c0a..1345cf2fef5 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -1448,9 +1448,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { name={"treating_physician"} label={t("treating_doctor")} placeholder="Attending Doctors Name and Designation" - required={ - state.form.suggestion === "DC" ? false : true - } + required={state.form.suggestion !== "DC"} value={ state.form.treating_physician_object ?? undefined } From 81f91679bfb4fe46e01077989866e5061da05978 Mon Sep 17 00:00:00 2001 From: JOSHIK Date: Tue, 20 Aug 2024 14:33:40 +0100 Subject: [PATCH 4/5] fixes#8365 --- src/Components/Facility/ConsultationForm.tsx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 1345cf2fef5..0cd87d4e2bf 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -539,15 +539,6 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { invalidForm = true; } return; - case "consultation_notes": - if (!state.form[field]) { - errors[field] = t("field_required"); - invalidForm = true; - } else if (!state.form[field].replace(/\s/g, "").length) { - errors[field] = "Consultation notes can not be empty"; - invalidForm = true; - } - return; case "is_telemedicine": if ( state.form.admitted_to === "Home Isolation" && @@ -1415,7 +1406,6 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { > From ee3c2c614b873db3dda26c93c1606db46e06d21b Mon Sep 17 00:00:00 2001 From: JOSHIK Date: Wed, 21 Aug 2024 09:21:39 +0100 Subject: [PATCH 5/5] fixed word spacing issue --- .../Events/GenericEvent.tsx | 2 +- src/Components/Facility/ConsultationForm.tsx | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx b/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx index 04ab5657149..2c4349177a5 100644 --- a/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx +++ b/src/Components/Facility/ConsultationDetails/Events/GenericEvent.tsx @@ -93,7 +93,7 @@ export default function GenericEvent(props: IProps) { {t(key).replaceAll(/_/g, " ")} - + {formatValue(value, key)} diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 0cd87d4e2bf..355d4ce745e 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -539,6 +539,15 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { invalidForm = true; } return; + case "consultation_notes": + if (!state.form[field]) { + errors[field] = t("field_required"); + invalidForm = true; + } else if (!state.form[field].replace(/\s/g, "").length) { + errors[field] = "Consultation notes can not be empty"; + invalidForm = true; + } + return; case "is_telemedicine": if ( state.form.admitted_to === "Home Isolation" && @@ -599,9 +608,6 @@ 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; @@ -626,7 +632,6 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { return; } }); - if (invalidForm) { dispatch({ type: "set_errors", errors }); const firstError = Object.keys(errors).find((key) => errors[key]); @@ -735,12 +740,6 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { patient_no: state.form.patient_no || null, }; - request(id ? routes.updateConsultation : routes.createConsultation, { - pathParams: id ? { id } : undefined, - body: data, - controllerRef: submitController, - }); - const { data: obj } = await request( id ? routes.updateConsultation : routes.createConsultation, { @@ -1406,6 +1405,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { > @@ -1438,7 +1438,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { name={"treating_physician"} label={t("treating_doctor")} placeholder="Attending Doctors Name and Designation" - required={state.form.suggestion !== "DC"} + required value={ state.form.treating_physician_object ?? undefined }