@openmrs/esm-patient-orders-app 11.3.1-pre.9294 → 11.3.1-pre.9296
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.
- package/.turbo/turbo-build.log +3 -3
- package/dist/4300.js +1 -1
- package/dist/7202.js +1 -1
- package/dist/7202.js.map +1 -1
- package/dist/8625.js +1 -1
- package/dist/8625.js.map +1 -1
- package/dist/8803.js +1 -1
- package/dist/8803.js.map +1 -1
- package/dist/8960.js +1 -1
- package/dist/8960.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-patient-orders-app.js +1 -1
- package/dist/openmrs-esm-patient-orders-app.js.buildmanifest.json +19 -19
- package/dist/routes.json +1 -1
- package/package.json +2 -2
- package/src/api/api.ts +16 -9
- package/src/components/order-details-table.component.tsx +16 -6
- package/src/lab-results/lab-results-form.test.tsx +2 -0
- package/src/order-basket/general-order-type/general-order-form/general-order-form.component.tsx +2 -1
- package/src/order-basket/general-order-type/general-order-type.component.tsx +3 -2
- package/src/order-basket/general-order-type/orderable-concept-search/orderable-concept-search.workspace.tsx +19 -5
- package/src/order-basket/general-order-type/orderable-concept-search/search-results.component.tsx +6 -1
- package/src/order-basket/order-basket.workspace.tsx +37 -16
- package/src/order-basket-action-button/order-basket-action-button.extension.tsx +11 -3
- package/src/order-basket-action-button/order-basket-action-button.test.tsx +6 -30
- package/translations/en.json +0 -1
|
@@ -3,10 +3,18 @@ import { useTranslation } from 'react-i18next';
|
|
|
3
3
|
import { ActionMenuButton, ShoppingCartIcon } from '@openmrs/esm-framework';
|
|
4
4
|
import { useLaunchWorkspaceRequiringVisit, useOrderBasket } from '@openmrs/esm-patient-common-lib';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface OrderBasketActionButtonProps {
|
|
7
|
+
patientUuid: string;
|
|
8
|
+
patient: fhir.Patient;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This extension uses the patient chart store and MUST only be mounted within the patient chart
|
|
13
|
+
*/
|
|
14
|
+
const OrderBasketActionButton: React.FC<OrderBasketActionButtonProps> = ({ patientUuid, patient }) => {
|
|
7
15
|
const { t } = useTranslation();
|
|
8
|
-
const { orders } = useOrderBasket();
|
|
9
|
-
const launchOrderBasket = useLaunchWorkspaceRequiringVisit('order-basket');
|
|
16
|
+
const { orders } = useOrderBasket(patient);
|
|
17
|
+
const launchOrderBasket = useLaunchWorkspaceRequiringVisit(patientUuid, 'order-basket');
|
|
10
18
|
|
|
11
19
|
return (
|
|
12
20
|
<ActionMenuButton
|
|
@@ -36,15 +36,6 @@ mockUseWorkspaces.mockReturnValue({
|
|
|
36
36
|
// I think it is related to this: https://github.com/swc-project/jest/issues/14#issuecomment-1238621942
|
|
37
37
|
|
|
38
38
|
const mockLaunchStartVisitPrompt = jest.fn();
|
|
39
|
-
const mockUseVisitOrOfflineVisit = jest.fn(() => ({
|
|
40
|
-
activeVisit: {
|
|
41
|
-
uuid: '8ef90c91-14be-42dd-a1c0-e67fbf904470',
|
|
42
|
-
},
|
|
43
|
-
currentVisit: {
|
|
44
|
-
uuid: '8ef90c91-14be-42dd-a1c0-e67fbf904470',
|
|
45
|
-
},
|
|
46
|
-
}));
|
|
47
|
-
const mockGetPatientUuidFromUrl = jest.fn(() => mockPatient.id);
|
|
48
39
|
const mockUseSystemVisitSetting = jest.fn();
|
|
49
40
|
|
|
50
41
|
jest.mock('@openmrs/esm-patient-common-lib/src/useSystemVisitSetting', () => {
|
|
@@ -57,17 +48,6 @@ jest.mock('@openmrs/esm-patient-common-lib/src/launchStartVisitPrompt', () => {
|
|
|
57
48
|
return { launchStartVisitPrompt: () => mockLaunchStartVisitPrompt() };
|
|
58
49
|
});
|
|
59
50
|
|
|
60
|
-
jest.mock('@openmrs/esm-patient-common-lib/src/store/patient-chart-store', () => {
|
|
61
|
-
return {
|
|
62
|
-
getPatientUuidFromStore: () => mockGetPatientUuidFromUrl(),
|
|
63
|
-
usePatientChartStore: () => ({ patientUuid: mockPatient.id }),
|
|
64
|
-
};
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
jest.mock('@openmrs/esm-patient-common-lib/src/offline/visit', () => {
|
|
68
|
-
return { useVisitOrOfflineVisit: () => mockUseVisitOrOfflineVisit() };
|
|
69
|
-
});
|
|
70
|
-
|
|
71
51
|
mockUseSystemVisitSetting.mockReturnValue({ systemVisitEnabled: false });
|
|
72
52
|
|
|
73
53
|
const mockedUseFeatureFlag = jest.mocked(useFeatureFlag);
|
|
@@ -86,7 +66,7 @@ describe('<OrderBasketActionButton/>', () => {
|
|
|
86
66
|
it('should display tablet view action button', async () => {
|
|
87
67
|
const user = userEvent.setup();
|
|
88
68
|
mockUseLayoutType.mockReturnValue('tablet');
|
|
89
|
-
render(<OrderBasketActionButton />);
|
|
69
|
+
render(<OrderBasketActionButton patient={mockPatient} patientUuid={mockPatient.id} />);
|
|
90
70
|
|
|
91
71
|
const orderBasketButton = screen.getByRole('button', { name: /Order Basket/i });
|
|
92
72
|
expect(orderBasketButton).toBeInTheDocument();
|
|
@@ -97,7 +77,7 @@ describe('<OrderBasketActionButton/>', () => {
|
|
|
97
77
|
it('should display desktop view action button', async () => {
|
|
98
78
|
const user = userEvent.setup();
|
|
99
79
|
mockUseLayoutType.mockReturnValue('small-desktop');
|
|
100
|
-
render(<OrderBasketActionButton />);
|
|
80
|
+
render(<OrderBasketActionButton patient={mockPatient} patientUuid={mockPatient.id} />);
|
|
101
81
|
|
|
102
82
|
const orderBasketButton = screen.getByRole('button', { name: /order basket/i });
|
|
103
83
|
expect(orderBasketButton).toBeInTheDocument();
|
|
@@ -110,12 +90,8 @@ describe('<OrderBasketActionButton/>', () => {
|
|
|
110
90
|
const user = userEvent.setup();
|
|
111
91
|
mockUseLayoutType.mockReturnValue('small-desktop');
|
|
112
92
|
mockUseSystemVisitSetting.mockReturnValue({ systemVisitEnabled: true });
|
|
113
|
-
mockUseVisitOrOfflineVisit.mockImplementation(() => ({
|
|
114
|
-
activeVisit: null,
|
|
115
|
-
currentVisit: null,
|
|
116
|
-
}));
|
|
117
93
|
|
|
118
|
-
render(<OrderBasketActionButton />);
|
|
94
|
+
render(<OrderBasketActionButton patient={mockPatient} patientUuid={mockPatient.id} />);
|
|
119
95
|
|
|
120
96
|
const orderBasketButton = screen.getByRole('button', { name: /order basket/i });
|
|
121
97
|
expect(orderBasketButton).toBeInTheDocument();
|
|
@@ -126,9 +102,9 @@ describe('<OrderBasketActionButton/>', () => {
|
|
|
126
102
|
|
|
127
103
|
it('should display a count tag when orders are present on the desktop view', () => {
|
|
128
104
|
mockUseLayoutType.mockReturnValue('small-desktop');
|
|
129
|
-
const { result } = renderHook(useOrderBasket);
|
|
105
|
+
const { result } = renderHook(() => useOrderBasket(mockPatient));
|
|
130
106
|
expect(result.current.orders).toHaveLength(1); // sanity check
|
|
131
|
-
render(<OrderBasketActionButton />);
|
|
107
|
+
render(<OrderBasketActionButton patient={mockPatient} patientUuid={mockPatient.id} />);
|
|
132
108
|
|
|
133
109
|
expect(screen.getByText(/order basket/i)).toBeInTheDocument();
|
|
134
110
|
expect(screen.getByText(/1/i)).toBeInTheDocument();
|
|
@@ -136,7 +112,7 @@ describe('<OrderBasketActionButton/>', () => {
|
|
|
136
112
|
|
|
137
113
|
it('should display the count tag when orders are present on the tablet view', () => {
|
|
138
114
|
mockUseLayoutType.mockReturnValue('tablet');
|
|
139
|
-
render(<OrderBasketActionButton />);
|
|
115
|
+
render(<OrderBasketActionButton patient={mockPatient} patientUuid={mockPatient.id} />);
|
|
140
116
|
|
|
141
117
|
expect(screen.getByRole('button', { name: /1 order basket/i })).toBeInTheDocument();
|
|
142
118
|
});
|
package/translations/en.json
CHANGED
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
"orderBasketWorkspaceTitle": "Order basket",
|
|
66
66
|
"orderCancellation": "Order cancellation",
|
|
67
67
|
"orderCancelled": "Order cancelled",
|
|
68
|
-
"orderCompleted": "Placed orders",
|
|
69
68
|
"orderDetails": "Order details",
|
|
70
69
|
"ordered": "Placed order for",
|
|
71
70
|
"orderedBy": "Ordered by",
|