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

fix/O3-3515: Add user & timestamp to the Printed patient identifier sticker #2060

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import Barcode from 'react-barcode';
import { useTranslation } from 'react-i18next';
import { useReactToPrint } from 'react-to-print';
import { Button, InlineLoading, ModalBody, ModalFooter, ModalHeader } from '@carbon/react';
import { getPatientName, showSnackbar, useConfig, getCoreTranslation } from '@openmrs/esm-framework';
import {
getPatientName,
showSnackbar,
useConfig,
getCoreTranslation,
formatDate,
useSession,
} from '@openmrs/esm-framework';
import { type ConfigObject } from '../config-schema';
import { defaultBarcodeParams, getPatientField } from './print-identifier-sticker.resource';
import styles from './print-identifier-sticker.scss';
Expand All @@ -25,6 +32,7 @@ const PrintIdentifierSticker: React.FC<PrintIdentifierStickerProps> = ({ closeMo
const onBeforeGetContentResolve = useRef<() => void | null>(null);
const [isPrinting, setIsPrinting] = useState(false);
const headerTitle = t('patientIdentifierSticker', 'Patient identifier sticker');
const session = useSession();

useEffect(() => {
if (isPrinting && onBeforeGetContentResolve.current) {
Expand Down Expand Up @@ -88,6 +96,12 @@ const PrintIdentifierSticker: React.FC<PrintIdentifierStickerProps> = ({ closeMo
}
`}
</style>
<div className={styles.printedBy}>
<span>
{t('printedBy', 'Printed by')} {session?.user?.display || t('unknownUser', 'Unknown user')}{' '}
{t('onDate', 'on')} {formatDate(new Date(), { noToday: true })}
</span>
</div>
<PrintComponent patient={patient} />
</div>
</ModalBody>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use '@carbon/colors';
@use '@carbon/layout';
@use '@carbon/type';
@use '@openmrs/esm-styleguide/src/_vars' as *;
Expand All @@ -6,6 +7,12 @@
padding: layout.$spacing-03 layout.$spacing-05;
}

.printedBy {
display: none;
background-color: colors.$white;
padding: 15px;
}

.documentHeader {
display: flex;
justify-content: space-between;
Expand Down Expand Up @@ -80,4 +87,10 @@
padding: 0 !important;
overflow: hidden;
}

.printedBy {
@include type.type-style('body-compact-01');
display: flex;
gap: 10px;
}
}
5 changes: 4 additions & 1 deletion packages/esm-patient-banner-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
"countyDistrict": "District",
"district": "District",
"implementationLogo": "Implementation logo",
"onDate": "On date",
"patientAge": "Age:",
"patientDateOfBirthWithSeparator": "Date of birth:",
"patientGenderWithSeparator": "Gender:",
"patientIdentifierSticker": "Patient identifier sticker",
"patientNameWithSeparator": "Patient name:",
"postalCode": "Postal code",
"printedBy": "Printed by",
"printIdentifierSticker": "Print identifier sticker",
"state": "State",
"stateProvince": "State",
"telephoneNumberWithSeparator": "Telephone number:"
"telephoneNumberWithSeparator": "Telephone number:",
"unknownUser": "Unknown user"
}