From fb4e7bed464b858e5a127b9701c5caa1660a8447 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Fri, 8 Sep 2023 15:28:47 +0000 Subject: [PATCH] Consultation Form: skip validation for `verified_by` if `suggestion` is Declare Death and fix discharge not working on create consultation (#6248) * fix verified by validation * fix decalre dead --- src/Components/Facility/ConsultationForm.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/ConsultationForm.tsx b/src/Components/Facility/ConsultationForm.tsx index 97f35f292f8..49028a62953 100644 --- a/src/Components/Facility/ConsultationForm.tsx +++ b/src/Components/Facility/ConsultationForm.tsx @@ -538,7 +538,7 @@ export const ConsultationForm = (props: any) => { } case "verified_by": { - if (!state.form[field]) { + if (state.form.suggestion !== "DD" && !state.form[field]) { errors[field] = "Please fill verified by"; invalidForm = true; break; @@ -618,6 +618,7 @@ export const ConsultationForm = (props: any) => { }; const declareThePatientDead = async ( + id: string, cause_of_death: string, death_datetime: string, death_confirmed_doctor: string @@ -629,6 +630,7 @@ export const ConsultationForm = (props: any) => { discharge_notes: cause_of_death, death_datetime: death_datetime, death_confirmed_doctor: death_confirmed_doctor, + discharge_date: dayjs().toISOString(), }, { id } ) @@ -714,6 +716,7 @@ export const ConsultationForm = (props: any) => { if (data.suggestion === "DD") { await declareThePatientDead( + res.data.id, state.form.cause_of_death, state.form.death_datetime, state.form.death_confirmed_doctor