generated from openmrs/openmrs-esm-template-app
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) O3-4219: Add ability to print patient prescriptions (#125)
* Added preview model with printing capability * Print preview and printing and printing done * Added ability to select prescriptions to print * wraped free text under translation.Extracted patient display processing logic into utility function * Added all addtional instructions and indicating not refillable for prescription that are not refillable * Updated display for none refillable prescriptions to no refills * Captitalize patient name from styles, refactored patient name extractor from display * Fixed class name spelling * fixed variable names casing and naming, stylings and extracting of handlers funtions and wrapping them in useCallback for persisting avoiding reconstructions * Misc tweaks --------- Co-authored-by: Dennis Kigen <[email protected]>
- Loading branch information
1 parent
b2a39f6
commit dd031d5
Showing
21 changed files
with
947 additions
and
517 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import { Layer } from '@carbon/react'; | ||
import PrescriptionPrintAction from '../print-prescription/prescription-print-action.component'; | ||
import styles from './prescription-actions.scss'; | ||
|
||
type PrescriptionsActionsFooterProps = { | ||
encounterUuid: string; | ||
patientUuid: string; | ||
}; | ||
|
||
const PrescriptionsActionsFooter: React.FC<PrescriptionsActionsFooterProps> = ({ encounterUuid, patientUuid }) => { | ||
return ( | ||
<Layer className={styles.actionsContainer}> | ||
<div className={styles.actionCluster}> | ||
{/* Left buttons */} | ||
<PrescriptionPrintAction encounterUuid={encounterUuid} patientUuid={patientUuid} /> | ||
</div> | ||
|
||
<div className={styles.actionCluster}>{/* Right buttons */}</div> | ||
</Layer> | ||
); | ||
}; | ||
|
||
export default PrescriptionsActionsFooter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@use '@carbon/colors'; | ||
@use '@carbon/layout'; | ||
@use '@carbon/type'; | ||
|
||
.actionsContainer { | ||
flex-direction: row; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.actionCluster { | ||
gap: layout.$spacing-03; | ||
display: flex; | ||
flex-direction: row; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/print-prescription/prescription-print-action.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React, { useCallback } from 'react'; | ||
import { Button } from '@carbon/react'; | ||
import { Printer } from '@carbon/react/icons'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { showModal } from '@openmrs/esm-framework'; | ||
|
||
type PrescriptionPrintActionProps = { | ||
encounterUuid: string; | ||
patientUuid: string; | ||
}; | ||
|
||
const PrescriptionPrintAction: React.FC<PrescriptionPrintActionProps> = ({ encounterUuid, patientUuid }) => { | ||
const { t } = useTranslation(); | ||
|
||
const handleClick = useCallback(() => { | ||
const dispose = showModal('prescription-print-preview-modal', { | ||
onClose: () => dispose(), | ||
encounterUuid, | ||
patientUuid, | ||
}); | ||
}, [encounterUuid, patientUuid]); | ||
|
||
return ( | ||
<Button renderIcon={Printer} iconDescription={t('print', 'Print')} onClick={handleClick} kind="ghost"> | ||
{t('printPrescriptions', 'Print prescriptions')} | ||
</Button> | ||
); | ||
}; | ||
|
||
export default PrescriptionPrintAction; |
Oops, something went wrong.