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

Fixes procedures not working in Edit Consultation form due to spelling mistake #7879

Merged
merged 2 commits into from
May 22, 2024
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
16 changes: 7 additions & 9 deletions src/Components/Facility/ConsultationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ type FormDetails = {
death_datetime: string;
death_confirmed_doctor: string;
InvestigationAdvice: InvestigationType[];
procedures: ProcedureType[];
consent_records: ConsentRecord[];
};

Expand Down Expand Up @@ -176,7 +175,6 @@ const initForm: FormDetails = {
death_datetime: "",
death_confirmed_doctor: "",
InvestigationAdvice: [],
procedures: [],
consent_records: [],
};

Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1433,11 +1431,11 @@ export const ConsultationForm = ({ facilityId, patientId, id }: Props) => {
>
<FieldLabel>Procedures</FieldLabel>
<ProcedureBuilder
procedures={state.form.procedures}
setProcedures={(procedures) => {
procedures={state.form.procedure}
setProcedures={(procedure) => {
handleFormFieldChange({
name: "procedures",
value: procedures,
name: "procedure",
value: procedure,
});
}}
/>
Expand Down
Loading