Skip to content

Commit

Permalink
Consultation Form: skip validation for verified_by if suggestion
Browse files Browse the repository at this point in the history
…is Declare Death and fix discharge not working on create consultation (#6248)

* fix verified by validation

* fix decalre dead
  • Loading branch information
rithviknishad authored Sep 8, 2023
1 parent 9b45c5e commit fb4e7be
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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 }
)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fb4e7be

Please sign in to comment.