From b39b28f3026feced05535bee2e9f1caa337591f9 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Wed, 22 May 2024 14:13:19 +0530 Subject: [PATCH] Fixes procedures not working in Edit Consultation form (#7879) fixes #7878 --- src/Components/Facility/ConsultationForm.tsx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index ba248b8db6f..7e6fe345f7c 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -125,7 +125,6 @@ type FormDetails = { death_datetime: string; death_confirmed_doctor: string; InvestigationAdvice: InvestigationType[]; - procedures: ProcedureType[]; consent_records: ConsentRecord[]; }; @@ -176,7 +175,6 @@ const initForm: FormDetails = { death_datetime: "", death_confirmed_doctor: "", InvestigationAdvice: [], - procedures: [], consent_records: [], }; @@ -375,7 +373,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { (Array.isArray(data.investigation) && data.investigation) || [], }); handleFormFieldChange({ - name: "procedures", + name: "procedure", value: (Array.isArray(data.procedure) && data.procedure) || [], }); if (data.suggestion === "R") { @@ -593,7 +591,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { } return; case "procedure": { - for (const p of state.form.procedures) { + for (const p of state.form.procedure) { if (!p.procedure?.replace(/\s/g, "").length) { errors[field] = "Procedure field can not be empty"; invalidForm = true; @@ -725,7 +723,7 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { create_diagnoses: isUpdate ? undefined : state.form.create_diagnoses, treating_physician: state.form.treating_physician, investigation: state.form.InvestigationAdvice, - procedure: state.form.procedures, + procedure: state.form.procedure, patient: patientId, facility: facilityId, referred_to: @@ -1433,11 +1431,11 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => { > Procedures { + procedures={state.form.procedure} + setProcedures={(procedure) => { handleFormFieldChange({ - name: "procedures", - value: procedures, + name: "procedure", + value: procedure, }); }} />