@openmrs/esm-patient-orders-app 11.3.1-patch.9310 → 11.3.1-patch.9508

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.turbo/turbo-build.log +15 -18
  2. package/dist/1119.js +1 -1
  3. package/dist/1197.js +1 -1
  4. package/dist/1571.js +1 -0
  5. package/dist/1571.js.map +1 -0
  6. package/dist/2146.js +1 -1
  7. package/dist/2690.js +1 -1
  8. package/dist/2717.js +1 -0
  9. package/dist/2717.js.map +1 -0
  10. package/dist/3099.js +1 -1
  11. package/dist/3584.js +1 -1
  12. package/dist/4055.js +1 -1
  13. package/dist/4132.js +1 -1
  14. package/dist/4300.js +1 -1
  15. package/dist/4335.js +1 -1
  16. package/dist/439.js +1 -0
  17. package/dist/4618.js +1 -1
  18. package/dist/4652.js +1 -1
  19. package/dist/4937.js +1 -1
  20. package/dist/4937.js.map +1 -1
  21. package/dist/4944.js +1 -1
  22. package/dist/5134.js +2 -0
  23. package/dist/5134.js.map +1 -0
  24. package/dist/5173.js +1 -1
  25. package/dist/5241.js +1 -1
  26. package/dist/5442.js +1 -1
  27. package/dist/5661.js +1 -1
  28. package/dist/5670.js +1 -1
  29. package/dist/5670.js.map +1 -1
  30. package/dist/6022.js +1 -1
  31. package/dist/6468.js +1 -1
  32. package/dist/6589.js +1 -0
  33. package/dist/6679.js +1 -1
  34. package/dist/6840.js +1 -1
  35. package/dist/6859.js +1 -1
  36. package/dist/7097.js +1 -1
  37. package/dist/7159.js +1 -1
  38. package/dist/723.js +1 -1
  39. package/dist/7617.js +1 -1
  40. package/dist/795.js +1 -1
  41. package/dist/8163.js +1 -1
  42. package/dist/8349.js +1 -1
  43. package/dist/8371.js +1 -0
  44. package/dist/8618.js +1 -1
  45. package/dist/8625.js +1 -0
  46. package/dist/8625.js.map +1 -0
  47. package/dist/8803.js +1 -0
  48. package/dist/8803.js.map +1 -0
  49. package/dist/890.js +1 -1
  50. package/dist/8960.js +1 -0
  51. package/dist/8960.js.map +1 -0
  52. package/dist/9214.js +1 -1
  53. package/dist/9538.js +1 -1
  54. package/dist/9569.js +1 -1
  55. package/dist/986.js +1 -1
  56. package/dist/9879.js +1 -1
  57. package/dist/9895.js +1 -1
  58. package/dist/9900.js +1 -1
  59. package/dist/9913.js +1 -1
  60. package/dist/main.js +1 -1
  61. package/dist/main.js.map +1 -1
  62. package/dist/openmrs-esm-patient-orders-app.js +1 -1
  63. package/dist/openmrs-esm-patient-orders-app.js.buildmanifest.json +276 -259
  64. package/dist/openmrs-esm-patient-orders-app.js.map +1 -1
  65. package/dist/routes.json +1 -1
  66. package/package.json +2 -2
  67. package/src/api/api.ts +25 -0
  68. package/src/components/order-details-table.component.tsx +40 -53
  69. package/src/components/test-order.component.tsx +53 -49
  70. package/src/index.ts +9 -12
  71. package/src/lab-results/lab-results-form.component.tsx +343 -0
  72. package/src/lab-results/lab-results-form.test.tsx +455 -306
  73. package/src/lab-results/lab-results-schema.resource.tsx +13 -4
  74. package/src/lab-results/lab-results.resource.ts +113 -0
  75. package/src/order-basket/general-order-type/general-order-form/general-order-form.component.tsx +25 -71
  76. package/src/order-basket/general-order-type/{general-order-panel.component.tsx → general-order-type.component.tsx} +41 -23
  77. package/src/order-basket/general-order-type/{add-general-order/add-general-order.component.tsx → orderable-concept-search/orderable-concept-search.workspace.tsx} +83 -78
  78. package/src/order-basket/general-order-type/{add-general-order → orderable-concept-search}/search-results.component.tsx +14 -15
  79. package/src/order-basket/general-order-type/resources.ts +2 -3
  80. package/src/order-basket/order-basket.workspace.tsx +251 -35
  81. package/src/order-basket-action-button/order-basket-action-button.extension.tsx +31 -0
  82. package/src/order-basket-action-button/order-basket-action-button.test.tsx +36 -27
  83. package/src/order-cancellation-form/cancel-order-form.component.tsx +85 -82
  84. package/src/routes.json +25 -17
  85. package/src/utils/index.ts +3 -15
  86. package/translations/am.json +6 -20
  87. package/translations/ar.json +6 -20
  88. package/translations/ar_SY.json +6 -20
  89. package/translations/bn.json +6 -20
  90. package/translations/cs.json +114 -0
  91. package/translations/de.json +6 -20
  92. package/translations/en.json +12 -4
  93. package/translations/en_US.json +6 -20
  94. package/translations/es.json +6 -20
  95. package/translations/es_MX.json +6 -20
  96. package/translations/fr.json +7 -21
  97. package/translations/he.json +6 -20
  98. package/translations/hi.json +6 -20
  99. package/translations/hi_IN.json +6 -20
  100. package/translations/id.json +6 -20
  101. package/translations/it.json +6 -20
  102. package/translations/ka.json +6 -20
  103. package/translations/km.json +6 -20
  104. package/translations/ku.json +6 -20
  105. package/translations/ky.json +6 -20
  106. package/translations/lg.json +6 -20
  107. package/translations/ne.json +6 -20
  108. package/translations/pl.json +6 -20
  109. package/translations/pt.json +6 -20
  110. package/translations/pt_BR.json +6 -20
  111. package/translations/qu.json +6 -20
  112. package/translations/ro_RO.json +6 -20
  113. package/translations/ru_RU.json +6 -20
  114. package/translations/si.json +6 -20
  115. package/translations/sq.json +114 -0
  116. package/translations/sw.json +6 -20
  117. package/translations/sw_KE.json +6 -20
  118. package/translations/tr.json +6 -20
  119. package/translations/tr_TR.json +6 -20
  120. package/translations/uk.json +6 -20
  121. package/translations/uz.json +6 -20
  122. package/translations/uz@Latn.json +6 -20
  123. package/translations/uz_UZ.json +6 -20
  124. package/translations/vi.json +6 -20
  125. package/translations/zh.json +6 -20
  126. package/translations/zh_CN.json +6 -20
  127. package/translations/zh_TW.json +114 -0
  128. package/dist/1253.js +0 -1
  129. package/dist/1253.js.map +0 -1
  130. package/dist/1268.js +0 -2
  131. package/dist/1268.js.map +0 -1
  132. package/dist/375.js +0 -1
  133. package/dist/375.js.map +0 -1
  134. package/dist/4341.js +0 -1
  135. package/dist/4341.js.map +0 -1
  136. package/dist/4687.js +0 -1
  137. package/dist/4687.js.map +0 -1
  138. package/dist/6364.js +0 -1
  139. package/dist/6364.js.map +0 -1
  140. package/dist/6473.js +0 -1
  141. package/dist/6473.js.map +0 -1
  142. package/dist/8416.js +0 -1
  143. package/dist/8416.js.map +0 -1
  144. package/src/lab-results/exported-lab-results-form.workspace.tsx +0 -264
  145. package/src/lab-results/lab-results-form.workspace.tsx +0 -25
  146. package/src/order-basket/exported-order-basket.workspace.tsx +0 -54
  147. package/src/order-basket/general-order-type/add-general-order/add-general-order.workspace.tsx +0 -35
  148. package/src/order-basket/general-order-type/add-general-order/exported-add-general-order.workspace.tsx +0 -32
  149. package/src/order-basket/order-basket.component.tsx +0 -213
  150. package/src/order-basket-action-button/order-basket-action-button.component.tsx +0 -35
  151. /package/dist/{1268.js.LICENSE.txt → 5134.js.LICENSE.txt} +0 -0
  152. /package/src/order-basket/general-order-type/{add-general-order → orderable-concept-search}/orderable-concept-search.scss +0 -0
  153. /package/src/order-basket/general-order-type/{add-general-order → orderable-concept-search}/search-results.scss +0 -0
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { type Order, type PatientWorkspace2DefinitionProps } from '@openmrs/esm-patient-common-lib';
3
- import ExportedLabResultsForm from './exported-lab-results-form.workspace';
4
-
5
- export interface LabResultsFormProps {
6
- order: Order;
7
- /** Callback to refresh lab orders in the Laboratory app after results are saved.
8
- * This ensures the orders list stays in sync across the different tabs in the Laboratory app.
9
- * @see https://github.com/openmrs/openmrs-esm-laboratory-app/pull/117 */
10
- invalidateLabOrders?: () => void;
11
- }
12
-
13
- /**
14
- * This workspace displays the form to input lab results for orders.
15
- * This workspace should only be used within the patient chart. Use ExportedLabResultsForm
16
- * for use cases outside the patient chart.
17
- */
18
- const LabResultsForm: React.FC<PatientWorkspace2DefinitionProps<LabResultsFormProps, {}>> = ({
19
- workspaceProps: { order, invalidateLabOrders },
20
- ...rest
21
- }) => {
22
- return <ExportedLabResultsForm workspaceProps={{ order, invalidateLabOrders }} {...rest} />;
23
- };
24
-
25
- export default LabResultsForm;
@@ -1,54 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { type Workspace2DefinitionProps } from '@openmrs/esm-framework';
3
- import {
4
- type OrderBasketExtensionProps,
5
- type OrderBasketItem,
6
- type ExportedOrderBasketWindowProps,
7
- } from '@openmrs/esm-patient-common-lib';
8
- import OrderBasket from './order-basket.component';
9
-
10
- const ExportedOrderBasketWorkspace: React.FC<Workspace2DefinitionProps<{}, ExportedOrderBasketWindowProps, {}>> = ({
11
- windowProps: {
12
- patientUuid,
13
- patient,
14
- visitContext,
15
- mutateVisitContext,
16
- drugOrderWorkspaceName,
17
- labOrderWorkspaceName,
18
- generalOrderWorkspaceName,
19
- },
20
- closeWorkspace,
21
- launchChildWorkspace,
22
- }) => {
23
- const orderBasketExtensionProps = useMemo(() => {
24
- const launchDrugOrderForm = (order: OrderBasketItem) => {
25
- launchChildWorkspace(drugOrderWorkspaceName, { order });
26
- };
27
- const launchLabOrderForm = (orderTypeUuid: string, order: OrderBasketItem) => {
28
- launchChildWorkspace(labOrderWorkspaceName, { orderTypeUuid, order });
29
- };
30
- const launchGeneralOrderForm = (orderTypeUuid: string, order: OrderBasketItem) => {
31
- launchChildWorkspace(generalOrderWorkspaceName, { orderTypeUuid, order });
32
- };
33
-
34
- return {
35
- patient,
36
- launchDrugOrderForm,
37
- launchLabOrderForm,
38
- launchGeneralOrderForm,
39
- } satisfies OrderBasketExtensionProps;
40
- }, [launchChildWorkspace, drugOrderWorkspaceName, labOrderWorkspaceName, generalOrderWorkspaceName, patient]);
41
-
42
- return (
43
- <OrderBasket
44
- patientUuid={patientUuid}
45
- patient={patient}
46
- visitContext={visitContext}
47
- mutateVisitContext={mutateVisitContext}
48
- closeWorkspace={closeWorkspace}
49
- orderBasketExtensionProps={orderBasketExtensionProps}
50
- />
51
- );
52
- };
53
-
54
- export default ExportedOrderBasketWorkspace;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import {
3
- type OrderBasketItem,
4
- type OrderBasketWindowProps,
5
- type PatientWorkspace2DefinitionProps,
6
- } from '@openmrs/esm-patient-common-lib';
7
- import AddGeneralOrder from './add-general-order.component';
8
-
9
- interface OrderableConceptSearchWorkspaceProps {
10
- order: OrderBasketItem;
11
- orderTypeUuid: string;
12
- }
13
-
14
- /**
15
- * This workspace displays the drug order form for adding or editing a general order.
16
- */
17
- const AddGeneralOrderWorkspace: React.FC<
18
- PatientWorkspace2DefinitionProps<OrderableConceptSearchWorkspaceProps, OrderBasketWindowProps>
19
- > = ({
20
- workspaceProps: { order: initialOrder, orderTypeUuid },
21
- groupProps: { patient, visitContext, mutateVisitContext },
22
- closeWorkspace,
23
- }) => {
24
- return (
25
- <AddGeneralOrder
26
- initialOrder={initialOrder}
27
- orderTypeUuid={orderTypeUuid}
28
- patient={patient}
29
- visitContext={visitContext}
30
- closeWorkspace={closeWorkspace}
31
- />
32
- );
33
- };
34
-
35
- export default AddGeneralOrderWorkspace;
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { type Workspace2DefinitionProps } from '@openmrs/esm-framework';
3
- import { type ExportedOrderBasketWindowProps, type OrderBasketItem } from '@openmrs/esm-patient-common-lib';
4
- import AddGeneralOrder from './add-general-order.component';
5
-
6
- interface OrderableConceptSearchWorkspaceProps {
7
- order: OrderBasketItem;
8
- orderTypeUuid: string;
9
- }
10
-
11
- /**
12
- * This workspace displays the drug order form for adding or editing a general order.
13
- */
14
- const ExportedAddGeneralOrderWorkspace: React.FC<
15
- Workspace2DefinitionProps<OrderableConceptSearchWorkspaceProps, ExportedOrderBasketWindowProps, {}>
16
- > = ({
17
- workspaceProps: { order: initialOrder, orderTypeUuid },
18
- windowProps: { patient, visitContext },
19
- closeWorkspace,
20
- }) => {
21
- return (
22
- <AddGeneralOrder
23
- initialOrder={initialOrder}
24
- orderTypeUuid={orderTypeUuid}
25
- patient={patient}
26
- visitContext={visitContext}
27
- closeWorkspace={closeWorkspace}
28
- />
29
- );
30
- };
31
-
32
- export default ExportedAddGeneralOrderWorkspace;
@@ -1,213 +0,0 @@
1
- import React, { useCallback, useMemo, useState } from 'react';
2
- import classNames from 'classnames';
3
- import { useTranslation } from 'react-i18next';
4
- import { Button, ButtonSet, InlineLoading, InlineNotification } from '@carbon/react';
5
- import {
6
- ExtensionSlot,
7
- useConfig,
8
- useLayoutType,
9
- useSession,
10
- type Visit,
11
- Workspace2,
12
- type Workspace2DefinitionProps,
13
- } from '@openmrs/esm-framework';
14
- import {
15
- invalidateVisitAndEncounterData,
16
- type OrderBasketExtensionProps,
17
- type OrderBasketItem,
18
- postOrders,
19
- postOrdersOnNewEncounter,
20
- showOrderSuccessToast,
21
- useMutatePatientOrders,
22
- useOrderBasket,
23
- } from '@openmrs/esm-patient-common-lib';
24
- import { useSWRConfig } from 'swr';
25
- import { type ConfigObject } from '../config-schema';
26
- import { useOrderEncounter } from '../api/api';
27
- import GeneralOrderPanel from './general-order-type/general-order-panel.component';
28
- import styles from './order-basket.scss';
29
-
30
- interface OrderBasketProps {
31
- patientUuid: string;
32
- patient: fhir.Patient;
33
- visitContext: Visit;
34
- mutateVisitContext: () => void;
35
- closeWorkspace: Workspace2DefinitionProps['closeWorkspace'];
36
- orderBasketExtensionProps: OrderBasketExtensionProps;
37
- }
38
-
39
- const OrderBasket: React.FC<OrderBasketProps> = ({
40
- patientUuid,
41
- patient,
42
- visitContext,
43
- mutateVisitContext,
44
- closeWorkspace,
45
- orderBasketExtensionProps,
46
- }) => {
47
- const { t } = useTranslation();
48
- const isTablet = useLayoutType() === 'tablet';
49
- const config = useConfig<ConfigObject>();
50
- const session = useSession();
51
- const { orders, clearOrders } = useOrderBasket(patient);
52
- const [ordersWithErrors, setOrdersWithErrors] = useState<OrderBasketItem[]>([]);
53
- const {
54
- visitRequired,
55
- isLoading: isLoadingEncounterUuid,
56
- encounterUuid,
57
- error: errorFetchingEncounterUuid,
58
- mutate: mutateEncounterUuid,
59
- } = useOrderEncounter(patientUuid, visitContext, mutateVisitContext, config.orderEncounterType);
60
- const [isSavingOrders, setIsSavingOrders] = useState(false);
61
- const [creatingEncounterError, setCreatingEncounterError] = useState('');
62
- const { mutate: mutateOrders } = useMutatePatientOrders(patientUuid);
63
- const { mutate } = useSWRConfig();
64
-
65
- const handleSave = useCallback(async () => {
66
- const abortController = new AbortController();
67
- setCreatingEncounterError('');
68
- let orderEncounterUuid = encounterUuid;
69
- setIsSavingOrders(true);
70
- // If there's no encounter present, create an encounter along with the orders.
71
- if (!orderEncounterUuid) {
72
- try {
73
- await postOrdersOnNewEncounter(
74
- patientUuid,
75
- config?.orderEncounterType,
76
- visitRequired ? visitContext : null,
77
- session?.sessionLocation?.uuid,
78
- abortController,
79
- );
80
- await closeWorkspace({ discardUnsavedChanges: true });
81
- mutateEncounterUuid();
82
- // Only revalidate current visit since orders create new encounters
83
- mutateVisitContext?.();
84
- invalidateVisitAndEncounterData(mutate, patientUuid);
85
- clearOrders();
86
- await mutateOrders();
87
- showOrderSuccessToast(t, orders);
88
- } catch (e) {
89
- console.error(e);
90
- setCreatingEncounterError(
91
- e.responseBody?.error?.message ||
92
- t('tryReopeningTheWorkspaceAgain', 'Please try launching the workspace again'),
93
- );
94
- }
95
- } else {
96
- const erroredItems = await postOrders(patientUuid, orderEncounterUuid, abortController);
97
- clearOrders({ exceptThoseMatching: (item) => erroredItems.map((e) => e.display).includes(item.display) });
98
- // Only revalidate current visit since orders create new encounters
99
- mutateVisitContext?.();
100
- await mutateOrders();
101
- invalidateVisitAndEncounterData(mutate, patientUuid);
102
-
103
- if (erroredItems.length == 0) {
104
- await closeWorkspace({ discardUnsavedChanges: true });
105
- showOrderSuccessToast(t, orders);
106
- } else {
107
- setOrdersWithErrors(erroredItems);
108
- }
109
- clearOrders({ exceptThoseMatching: (item) => erroredItems.map((e) => e.display).includes(item.display) });
110
- // Only revalidate current visit since orders create new encounters
111
- mutateVisitContext?.();
112
- await mutateOrders();
113
- invalidateVisitAndEncounterData(mutate, patientUuid);
114
- }
115
- setIsSavingOrders(false);
116
- return () => abortController.abort();
117
- }, [
118
- visitContext,
119
- visitRequired,
120
- clearOrders,
121
- closeWorkspace,
122
- config,
123
- encounterUuid,
124
- mutateEncounterUuid,
125
- mutateOrders,
126
- mutateVisitContext,
127
- orders,
128
- patientUuid,
129
- session,
130
- t,
131
- mutate,
132
- ]);
133
-
134
- const handleCancel = useCallback(() => {
135
- closeWorkspace().then((didClose) => {
136
- if (didClose) {
137
- clearOrders();
138
- }
139
- });
140
- }, [clearOrders, closeWorkspace]);
141
-
142
- return (
143
- <Workspace2 title={t('orderBasketWorkspaceTitle', 'Order Basket')} hasUnsavedChanges={!!orders.length}>
144
- <div id="order-basket" className={styles.container}>
145
- <ExtensionSlot name="visit-context-header-slot" state={{ patientUuid }} />
146
- <div className={styles.orderBasketContainer}>
147
- <ExtensionSlot
148
- className={classNames(styles.orderBasketSlot, {
149
- [styles.orderBasketSlotTablet]: isTablet,
150
- })}
151
- name="order-basket-slot"
152
- state={orderBasketExtensionProps as any}
153
- />
154
- {config?.orderTypes?.length > 0 &&
155
- config.orderTypes.map((orderType) => (
156
- <div className={styles.orderPanel} key={orderType.orderTypeUuid}>
157
- <GeneralOrderPanel
158
- {...orderType}
159
- launchGeneralOrderForm={orderBasketExtensionProps.launchGeneralOrderForm}
160
- patient={patient}
161
- />
162
- </div>
163
- ))}
164
- </div>
165
- <div>
166
- {(creatingEncounterError || errorFetchingEncounterUuid) && (
167
- <InlineNotification
168
- kind="error"
169
- title={t('tryReopeningTheWorkspaceAgain', 'Please try launching the workspace again')}
170
- subtitle={creatingEncounterError}
171
- lowContrast={true}
172
- className={styles.inlineNotification}
173
- />
174
- )}
175
- {ordersWithErrors.map((order) => (
176
- <InlineNotification
177
- lowContrast
178
- kind="error"
179
- title={t('saveDrugOrderFailed', 'Error ordering {{orderName}}', { orderName: order.display })}
180
- subtitle={order.extractedOrderError?.fieldErrors?.join(', ')}
181
- className={styles.inlineNotification}
182
- />
183
- ))}
184
- <ButtonSet className={styles.buttonSet}>
185
- <Button className={styles.actionButton} kind="secondary" onClick={handleCancel}>
186
- {t('cancel', 'Cancel')}
187
- </Button>
188
- <Button
189
- className={styles.actionButton}
190
- kind="primary"
191
- onClick={handleSave}
192
- disabled={
193
- isSavingOrders ||
194
- !orders?.length ||
195
- isLoadingEncounterUuid ||
196
- (visitRequired && !visitContext) ||
197
- orders?.some(({ isOrderIncomplete }) => isOrderIncomplete)
198
- }
199
- >
200
- {isSavingOrders ? (
201
- <InlineLoading description={t('saving', 'Saving') + '...'} />
202
- ) : (
203
- <span>{t('signAndClose', 'Sign and close')}</span>
204
- )}
205
- </Button>
206
- </ButtonSet>
207
- </div>
208
- </div>
209
- </Workspace2>
210
- );
211
- };
212
-
213
- export default OrderBasket;
@@ -1,35 +0,0 @@
1
- import React, { type ComponentProps } from 'react';
2
- import { useTranslation } from 'react-i18next';
3
- import { ActionMenuButton2, ShoppingCartIcon } from '@openmrs/esm-framework';
4
- import {
5
- useStartVisitIfNeeded,
6
- useOrderBasket,
7
- type PatientChartWorkspaceActionButtonProps,
8
- } from '@openmrs/esm-patient-common-lib';
9
-
10
- /**
11
- * This extension uses the patient chart store and MUST only be mounted within the patient chart
12
- */
13
- const OrderBasketActionButton: React.FC<PatientChartWorkspaceActionButtonProps> = (props) => {
14
- const {
15
- groupProps: { patientUuid, patient },
16
- } = props;
17
- const { t } = useTranslation();
18
- const { orders } = useOrderBasket(patient);
19
- const startVisitIfNeeded = useStartVisitIfNeeded(patientUuid);
20
-
21
- return (
22
- <ActionMenuButton2
23
- icon={(props: ComponentProps<typeof ShoppingCartIcon>) => <ShoppingCartIcon {...props} />}
24
- label={t('orderBasket', 'Order basket')}
25
- tagContent={orders?.length > 0 ? orders?.length : null}
26
- workspaceToLaunch={{
27
- workspaceName: 'order-basket',
28
- windowProps: { encounterUuid: '' },
29
- }}
30
- onBeforeWorkspaceLaunch={startVisitIfNeeded}
31
- />
32
- );
33
- };
34
-
35
- export default OrderBasketActionButton;