Skip to content

Commit

Permalink
fixed issue 8304
Browse files Browse the repository at this point in the history
  • Loading branch information
JOSHIK27 committed Aug 19, 2024
1 parent 9a5e833 commit 37ac873
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -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;
Expand All @@ -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]);
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 37ac873

Please sign in to comment.