-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/registration-form-touched-fields
- Loading branch information
Showing
10 changed files
with
127 additions
and
92 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
packages/esm-ward-app/src/config-schema-pending-items-extension.ts
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,29 @@ | ||
import { Type } from '@openmrs/esm-framework'; | ||
|
||
export const pendingItemsExtensionConfigSchema = { | ||
orders: { | ||
orderTypes: { | ||
_type: Type.Array, | ||
_description: 'Defines order types displayed on the ward patient card pending items section.', | ||
_default: [{ label: 'Labs', uuid: '52a447d3-a64a-11e3-9aeb-50e549534c5e' }], | ||
_elements: { | ||
uuid: { | ||
_type: Type.UUID, | ||
_description: 'Identifies the order type.', | ||
}, | ||
label: { | ||
_type: Type.String, | ||
_description: | ||
"The label or i18n key to the translated label to display. If not provided, defaults to 'Orders'", | ||
_default: null, | ||
}, | ||
}, | ||
}, | ||
}, | ||
showPendingItems: { | ||
_type: Type.Boolean, | ||
_description: | ||
'Optional. If true, pending items (e.g., number of pending orders) will be displayed on the patient card.', | ||
_default: true, | ||
}, | ||
}; |
25 changes: 0 additions & 25 deletions
25
packages/esm-ward-app/src/config-schema-pending-orders-extension.ts
This file was deleted.
Oops, something went wrong.
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
50 changes: 50 additions & 0 deletions
50
packages/esm-ward-app/src/ward-patient-card/card-rows/pending-items-car-row.extension.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,50 @@ | ||
import React, { useCallback, useEffect } from 'react'; | ||
import { type WardPatientCard } from '../../types'; | ||
import { Hourglass } from '@carbon/react/icons'; | ||
|
||
import { useConfig } from '@openmrs/esm-framework'; | ||
import type { PendingItemsDefinition } from '../../config-schema'; | ||
import { WardPatientPendingOrder } from '../row-elements/ward-patient-pending-order.component'; | ||
import styles from '../ward-patient-card.scss'; | ||
import WardPatientPendingTransfer from '../row-elements/ward-patient-pending-transfer'; | ||
|
||
const PendingItemsCarRowExtension: WardPatientCard = (wardPatient) => { | ||
const { orders, showPendingItems } = useConfig<PendingItemsDefinition>(); | ||
const [hasPendingOrders, setHasPendingOrders] = React.useState(false); | ||
|
||
const hasPendingItems = !!wardPatient?.inpatientRequest || hasPendingOrders; | ||
|
||
const handlePendingOrderCount = useCallback((count: number) => { | ||
if (count > 0) { | ||
setHasPendingOrders(true); | ||
} | ||
}, []); | ||
|
||
useEffect(() => { | ||
if (!orders?.orderTypes?.length) { | ||
setHasPendingOrders(false); | ||
} | ||
}, [orders]); | ||
|
||
return ( | ||
<div className={styles.wardPatientCardPendingItemsRow}> | ||
{showPendingItems && hasPendingItems ? ( | ||
<> | ||
<Hourglass className={styles.hourGlassIcon} size="16" />: | ||
</> | ||
) : null} | ||
{orders?.orderTypes.map(({ uuid, label }) => ( | ||
<WardPatientPendingOrder | ||
key={`pending-order-type-${uuid}`} | ||
wardPatient={wardPatient} | ||
orderUuid={uuid} | ||
label={label} | ||
onOrderCount={handlePendingOrderCount} | ||
/> | ||
))} | ||
{wardPatient?.inpatientRequest ? <WardPatientPendingTransfer wardPatient={wardPatient} /> : null} | ||
</div> | ||
); | ||
}; | ||
|
||
export default PendingItemsCarRowExtension; |
28 changes: 0 additions & 28 deletions
28
packages/esm-ward-app/src/ward-patient-card/card-rows/pending-orders.extension.tsx
This file was deleted.
Oops, something went wrong.
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