diff --git a/packages/esm-patient-banner-app/src/config-schema.ts b/packages/esm-patient-banner-app/src/config-schema.ts index 88de883e5..c2c282451 100644 --- a/packages/esm-patient-banner-app/src/config-schema.ts +++ b/packages/esm-patient-banner-app/src/config-schema.ts @@ -1,5 +1,4 @@ import { Type } from '@openmrs/esm-framework'; -import _default from 'react-hook-form/dist/logic/appendErrors'; export const configSchema = { contactAttributeTypes: { @@ -21,7 +20,8 @@ export const configSchema = { }, header: { _type: Type.Object, - _description: 'The header to display on the patient sticker', + _description: + 'Configuration properties for the patient sticker headerConfiguration properties for the patient sticker header', showBarcode: { _type: Type.Boolean, _description: 'Whether to display a barcode on the patient sticker', diff --git a/packages/esm-patient-banner-app/src/print-identifier-sticker/patient-detail.component.tsx b/packages/esm-patient-banner-app/src/print-identifier-sticker/patient-detail.component.tsx index 8e5adf337..48193d112 100644 --- a/packages/esm-patient-banner-app/src/print-identifier-sticker/patient-detail.component.tsx +++ b/packages/esm-patient-banner-app/src/print-identifier-sticker/patient-detail.component.tsx @@ -95,7 +95,7 @@ export const PatientIdentifier: React.FC = ({ patient }) => export const PatientContact: React.FC = ({ patient }) => { const { t } = useTranslation(); - if (patient.telecom.length == 0) { + if (!patient?.telecom?.length) { return null; } @@ -104,7 +104,7 @@ export const PatientContact: React.FC = ({ patient }) => { {t('telephoneNumberWithSeparator', 'Telephone number:')} - {patient.telecom[0]?.value} + {patient.telecom?.[0]?.value} ); }; diff --git a/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker-modal.test.tsx b/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker-modal.test.tsx index 45f99631c..527e3c3ce 100644 --- a/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker-modal.test.tsx +++ b/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker-modal.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import PrintIdentifierSticker from './print-identifier-sticker.modal'; import { mockFhirPatient } from '../../../../__mocks__/patient.mock'; -import { getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework'; +import { age, getDefaultsFromConfigSchema, useConfig } from '@openmrs/esm-framework'; import { type ConfigObject, configSchema } from '../config-schema'; import { useReactToPrint } from 'react-to-print'; import userEvent from '@testing-library/user-event'; @@ -109,7 +109,7 @@ describe('Testing PrintIdentifierStickerModal', () => { expect(getByTextWithMarkup(/Joshua Johnson/i)).toBeInTheDocument(); expect(getByTextWithMarkup(/\+255777053243/i)).toBeInTheDocument(); expect(getByTextWithMarkup(/100008E/i)).toBeInTheDocument(); - expect(getByTextWithMarkup(/4 yrs, 11 mths/i)).toBeInTheDocument(); + expect(getByTextWithMarkup(age(mockFhirPatient.birthDate))).toBeInTheDocument(); }); }); diff --git a/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.modal.tsx b/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.modal.tsx index ee0e9bcdb..317b167cc 100644 --- a/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.modal.tsx +++ b/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.modal.tsx @@ -42,8 +42,8 @@ const PrintIdentifierSticker: React.FC = ({ closeMo const handleAfterPrint = useCallback(() => { onBeforeGetContentResolve.current = null; setIsPrinting(false); - // closeModal(); - }, []); + closeModal(); + }, [closeModal]); const handlePrintError = useCallback((errorLocation, error) => { onBeforeGetContentResolve.current = null; diff --git a/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.resource.ts b/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.resource.ts index 721742265..ef32c1272 100644 --- a/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.resource.ts +++ b/packages/esm-patient-banner-app/src/print-identifier-sticker/print-identifier-sticker.resource.ts @@ -13,6 +13,7 @@ import { export const defaultBarcodeParams: Options = { width: 2, + format: 'CODE39', background: '#f4f4f4', displayValue: true, renderer: 'img',