{t('error', 'Error')}
} + {error &&{t('error', 'Error')}
} {medicationRequestBundles && medicationRequestBundles .flatMap((medicationDispenseBundle) => medicationDispenseBundle.dispenses) diff --git a/src/index.ts b/src/index.ts index 3b527f5..5089caf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,7 @@ import DispensingDashboardComponent from './dashboard/dispensing-dashboard.compo import DispensingLinkComponent from './dispensing-link.component'; import DispensingLinkHomepageComponent from './dashboard/dispensing-dashboard-link.component'; import PauseActionButton from './components/prescription-actions/pause-action-button.component'; +import PrescriptionPrintPreviewModal from './print-prescription/prescription-print-preview.modal'; export const importTranslation = require.context('../translations', false, /.json$/, 'lazy'); @@ -17,16 +18,16 @@ const options = { moduleName, }; +export function startupApp() { + defineConfigSchema(moduleName, configSchema); +} + export const dispensing = getSyncLifecycle(DispensingComponent, options); export const dispensingLink = getSyncLifecycle(DispensingLinkComponent, options); export const dispensingDashboard = getSyncLifecycle(DispensingDashboardComponent, options); -export function startupApp() { - defineConfigSchema(moduleName, configSchema); -} - export const dispensingDashboardLink = getSyncLifecycle(DispensingLinkHomepageComponent, options); // Prescription action buttons @@ -37,7 +38,9 @@ export const pauseActionButton = getSyncLifecycle(PauseActionButton, options); // Dispensing workspace // t('closePrescription', 'Close prescription') export const closeDispenseWorkspace = getAsyncLifecycle(() => import('./forms/close-dispense-form.workspace'), options); -// t('dispensDPrescription', 'Dispense prescription') +// t('dispensePrescription', 'Dispense prescription') export const dispenseWorkspace = getAsyncLifecycle(() => import('./forms/dispense-form.workspace'), options); // t('pausePrescription', 'Pause prescription') export const pauseDispenseWorkspace = getAsyncLifecycle(() => import('./forms/pause-dispense-form.workspace'), options); + +export const printPrescriptionPreviewModal = getSyncLifecycle(PrescriptionPrintPreviewModal, options); diff --git a/src/location/location.resource.tsx b/src/location/location.resource.tsx index 60bfbb0..3f29d1a 100644 --- a/src/location/location.resource.tsx +++ b/src/location/location.resource.tsx @@ -19,7 +19,7 @@ export function useLocationForFiltering(config: PharmacyConfig) { return { filterLocations, - isError: error, + error, isLoading: !filterLocations && !error, }; } diff --git a/src/medication-dispense/medication-dispense.resource.tsx b/src/medication-dispense/medication-dispense.resource.tsx index f193d15..5cb34f7 100644 --- a/src/medication-dispense/medication-dispense.resource.tsx +++ b/src/medication-dispense/medication-dispense.resource.tsx @@ -1,6 +1,6 @@ -import { fhirBaseUrl, restBaseUrl, openmrsFetch, type Session } from '@openmrs/esm-framework'; import dayjs from 'dayjs'; import useSWR from 'swr'; +import { fhirBaseUrl, restBaseUrl, openmrsFetch, type Session } from '@openmrs/esm-framework'; import { type MedicationDispense, type MedicationDispenseStatus, @@ -51,8 +51,8 @@ export function useOrderConfig() { ); return { orderConfigObject: data ? data.data : null, + error, isLoading: !data && !error, - isError: error, isValidating, }; } diff --git a/src/medication-request/medication-request.resource.tsx b/src/medication-request/medication-request.resource.tsx index b7939cc..8d77d21 100644 --- a/src/medication-request/medication-request.resource.tsx +++ b/src/medication-request/medication-request.resource.tsx @@ -170,7 +170,7 @@ export function usePrescriptionDetails(encounterUuid: string, refreshInterval = return { medicationRequestBundles, prescriptionDate, - isError: error, + error, isLoading, }; } @@ -193,7 +193,7 @@ export function usePatientAllergies(patientUuid: string, refreshInterval) { return { allergies, totalAllergies: data?.data.total, - isError: error, + error, }; } diff --git a/src/prescriptions/prescription-actions.component.tsx b/src/prescriptions/prescription-actions.component.tsx new file mode 100644 index 0000000..420c8ee --- /dev/null +++ b/src/prescriptions/prescription-actions.component.tsx @@ -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{t('error', 'Error')}
} + {error &&{t('error', 'Error')}
} {medicationRequestBundles && medicationRequestBundles.map((bundle) => { return ( @@ -113,6 +109,7 @@ const PrescriptionDetails: React.FC<{ ); })} +{t('prescriptionInstructions', 'Prescription instructions')}
+ {patient && ( ++ {extractPatientName(patient.display)} +
+ )} ++ + {getMedicationDisplay(getMedicationReferenceOrCodeableConcept(medicationEvent))} + +
++ {t('dose', 'Dose')} + {': '} + + {dosageInstruction?.doseAndRate?.map((doseAndRate, index) => { + return ( + + {doseAndRate?.doseQuantity?.value} {doseAndRate?.doseQuantity?.unit} + + ); + })} + {' '} + — {dosageInstruction?.route?.text} — {dosageInstruction?.timing?.code?.text} + {dosageInstruction?.timing?.repeat?.duration + ? ` ${t('for', 'for')} ` + + dosageInstruction?.timing?.repeat?.duration + + ' ' + + dosageInstruction?.timing?.repeat?.durationUnit + : ' '} + {quantity && ( +
+ {t('quantity', 'Quantity')} + {': '} + + {quantity.value} {quantity.unit} + +
+ )} + ++ {t('datePrescribed', 'Date prescribed')} + {': '} {formatDate(parseDate(request.request.authoredOn))} +
++ {t('refills', 'Refills')} + {': '}{' '} + + {numberOfRefillsAllowed || numberOfRefillsAllowed === 0 + ? numberOfRefillsAllowed + : t('noRefills', 'No refills')} + +
+ + {dosageInstruction?.text &&{dosageInstruction.text}
} + {dosageInstruction?.additionalInstruction?.length > 0 && ( ++ {dosageInstruction?.additionalInstruction.map((instruction) => instruction.text).join(', ')} +
+ )} +{facilityName}
++ {t('selectPrescriptions', 'Check prescriptions to print')} +
+ {medicationRequests?.map((request) => { + const medicationEvent = request.request; + const dosageInstruction: DosageInstruction = getDosageInstruction(medicationEvent.dosageInstruction); + + return ( +