Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kajambiya committed Apr 25, 2024
1 parent 49ebef7 commit b482677
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
23 changes: 22 additions & 1 deletion src/components/encounter/encounter-form.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ export const EncounterForm: React.FC<EncounterFormProps> = ({
};
}

let formPatientIdentifiers = '';
const patientIdentifierFields = fields.filter((field) => field.type === 'patientIdentifier');
const patientIdentifierPromises = patientIdentifierFields.map((field) => {
const identfier: PatientIdentifier = {
Expand All @@ -572,8 +573,28 @@ export const EncounterForm: React.FC<EncounterFormProps> = ({
});

return Promise.all(patientIdentifierPromises)
.then(() => saveEncounterWithAttachments(encounterForSubmission))
.then(() => {
for (let i = 0; i < patientIdentifierFields.length; i++) {
formPatientIdentifiers += patientIdentifierFields[i].value;
if (i < patientIdentifierFields.length - 1) {
formPatientIdentifiers += ', ';
}
}
if (patientIdentifierFields.length) {
showSnackbar({
title: t('identifierCreated', 'Identifier Created'),
subtitle: t(
'identifierCreatedDescription',
`Patient Identifier(s) ${formPatientIdentifiers} successfully created!`,
),
kind: 'success',
isLowContrast: true,
});
}
saveEncounterWithAttachments(encounterForSubmission);
})
.catch((error) => {
setIsSubmitting(false);
showSnackbar({
title: t('errorDescriptionTitle', 'Error on saving form'),
subtitle: t('errorDescription', error.message),
Expand Down
2 changes: 1 addition & 1 deletion src/utils/patient-identifier-helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PatientIdentifier } from "../api/types";
import { savePatientIdentifier} from "../api/api";
import { PatientIdentifier } from "../types";

export const saveIdentifier = (patient: fhir.Patient, patientIdentifier:PatientIdentifier) =>{
const identifier = getPatientLatestIdentifier(patient, patientIdentifier.identifierType);
Expand Down

0 comments on commit b482677

Please sign in to comment.