Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consultation Form: skip validation for verified_by if suggestion is Declare Death and fix discharge not working on create consultation #6248

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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