@openmrs/esm-stock-management-app 3.0.1-pre.848 → 3.0.1-pre.853

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 (108) hide show
  1. package/.husky/pre-commit +4 -1
  2. package/__mocks__/react-i18next.js +8 -9
  3. package/dist/10.js +1 -1
  4. package/dist/10.js.map +1 -1
  5. package/dist/119.js +1 -1
  6. package/dist/119.js.map +1 -1
  7. package/dist/14.js +1 -1
  8. package/dist/14.js.map +1 -1
  9. package/dist/172.js +1 -1
  10. package/dist/172.js.map +1 -1
  11. package/dist/20.js +1 -1
  12. package/dist/20.js.map +1 -1
  13. package/dist/290.js +1 -1
  14. package/dist/290.js.map +1 -1
  15. package/dist/33.js +1 -0
  16. package/dist/33.js.map +1 -0
  17. package/dist/467.js +1 -1
  18. package/dist/467.js.map +1 -1
  19. package/dist/574.js +1 -1
  20. package/dist/606.js +1 -1
  21. package/dist/606.js.map +1 -1
  22. package/dist/642.js +1 -1
  23. package/dist/642.js.map +1 -1
  24. package/dist/675.js +1 -1
  25. package/dist/675.js.map +1 -1
  26. package/dist/727.js +1 -1
  27. package/dist/727.js.map +1 -1
  28. package/dist/842.js +1 -1
  29. package/dist/842.js.map +1 -1
  30. package/dist/93.js +1 -1
  31. package/dist/93.js.map +1 -1
  32. package/dist/main.js +1 -1
  33. package/dist/main.js.map +1 -1
  34. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +70 -70
  35. package/dist/routes.json +1 -1
  36. package/jest.config.js +6 -3
  37. package/package.json +1 -1
  38. package/src/core/components/table/table.component.tsx +2 -2
  39. package/src/index.ts +5 -5
  40. package/src/stock-items/add-bulk-stock-item/add-stock-items-bulk-import-action-button.component.tsx +3 -3
  41. package/src/stock-items/add-bulk-stock-item/{stock-items-bulk-import.component.tsx → stock-items-bulk-import.modal.tsx} +20 -19
  42. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts +1 -1
  43. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.test.tsx +59 -59
  44. package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +6 -6
  45. package/src/stock-items/add-stock-item/add-stock-item.component.tsx +6 -4
  46. package/src/stock-items/add-stock-item/add-stock-item.scss +5 -0
  47. package/src/stock-items/add-stock-item/add-stock-item.test.tsx +28 -43
  48. package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +3 -4
  49. package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +9 -10
  50. package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +4 -4
  51. package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +27 -19
  52. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss +4 -4
  53. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +15 -9
  54. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +1 -0
  55. package/src/stock-items/add-stock-item/stock-item-rules/delete-stock-rule-modal.component.tsx +2 -1
  56. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +14 -16
  57. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +7 -3
  58. package/src/stock-items/add-stock-item/transactions/printout/transactions-print-bincard-preview.modal.tsx +14 -6
  59. package/src/stock-items/add-stock-item/transactions/printout/transactions-print-stockcard-preview.modal.tsx +14 -8
  60. package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +2 -2
  61. package/src/stock-items/stock-item.utils.tsx +3 -5
  62. package/src/stock-items/stock-items-table.component.tsx +47 -45
  63. package/src/stock-items/stock-items-table.resource.ts +2 -2
  64. package/src/stock-items/stock-items-table.scss +5 -1
  65. package/src/stock-items/stock-items-table.test.tsx +106 -65
  66. package/src/stock-locations/location-admin-form.component.tsx +5 -4
  67. package/src/stock-locations/stock-locations-table.component.tsx +10 -8
  68. package/src/stock-lookups/stock-lookups.resource.ts +3 -2
  69. package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +2 -2
  70. package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.component.tsx +11 -11
  71. package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.test.tsx +115 -25
  72. package/src/stock-operations/stock-operations-forms/input-components/qty-uim-selector.test.tsx +107 -65
  73. package/src/stock-operations/stock-operations-forms/input-components/quantity-uom-selector.component.tsx +9 -9
  74. package/src/stock-operations/stock-operations-forms/input-components/stock-operation-reason-selector.test.tsx +35 -153
  75. package/src/stock-operations/stock-operations-forms/input-components/user-selector.test.tsx +82 -29
  76. package/src/stock-operations/stock-operations-forms/step1.test.tsx +204 -69
  77. package/src/stock-operations/stock-operations-forms/step2.test.tsx +140 -63
  78. package/src/stock-operations/stock-operations-forms/step3.test.tsx +79 -60
  79. package/src/stock-operations/stock-operations-forms/steps/stock-operation-items-form-step.component.tsx +6 -5
  80. package/src/stock-operations/stock-operations-forms/steps/stock-operation-submission-form-step.component.tsx +12 -11
  81. package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.scss +1 -0
  82. package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx +20 -12
  83. package/src/stock-operations/stock-operations-forms/stock-operation-form.scss +1 -0
  84. package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stepper.scss +1 -3
  85. package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stock-operation-stepper.component.tsx +2 -1
  86. package/src/stock-reports/generate-report/create-stock-report.scss +3 -2
  87. package/src/stock-reports/generate-report/create-stock-report.workspace.tsx +32 -25
  88. package/src/stock-reports/report-list/stock-report-parameters.component.tsx +1 -1
  89. package/src/stock-reports/report-list/stock-report-status.component.tsx +1 -1
  90. package/src/stock-reports/report-list/stock-reports.component.tsx +24 -25
  91. package/src/stock-reports/report-list/stock-reports.scss +10 -2
  92. package/src/stock-sources/add-stock-sources/add-stock-sources.scss +11 -4
  93. package/src/stock-sources/add-stock-sources/add-stock-sources.test.tsx +38 -36
  94. package/src/stock-sources/add-stock-sources/add-stock-sources.workspace.tsx +35 -30
  95. package/src/stock-sources/delete-stock-modal.component.tsx +2 -1
  96. package/src/stock-sources/stock-sources-delete/stock-sources-delete.test.tsx +27 -36
  97. package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +33 -21
  98. package/src/stock-sources/stock-sources-items-table.component.tsx +16 -17
  99. package/src/stock-sources/stock-sources-items-table.resource.ts +8 -6
  100. package/src/stock-sources/stock-sources-items-table.test.tsx +60 -37
  101. package/src/stock-sources/stock-sources.scss +6 -2
  102. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +5 -13
  103. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.workspace.tsx +2 -2
  104. package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +2 -1
  105. package/translations/en.json +5 -6
  106. package/tsconfig.json +4 -0
  107. package/dist/627.js +0 -1
  108. package/dist/627.js.map +0 -1
@@ -1,18 +1,10 @@
1
1
  import React from 'react';
2
- import { renderHook, act, render, screen, waitFor } from '@testing-library/react';
3
2
  import userEvent from '@testing-library/user-event';
4
- import '@testing-library/jest-dom/extend-expect';
5
- import StockSourcesItems from './stock-sources-items-table.component';
3
+ import { renderHook, act, render, screen, waitFor } from '@testing-library/react';
4
+ import { type StockSource } from '../core/api/types/stockOperation/StockSource';
6
5
  import useStockSourcesPage from './stock-sources-items-table.resource';
7
- import { useTranslation } from 'react-i18next';
8
-
9
- jest.mock('react-i18next', () => ({
10
- useTranslation: jest.fn(),
11
- }));
12
-
13
- const mockTranslation = {
14
- t: (key) => key,
15
- };
6
+ import StockSourcesItems from './stock-sources-items-table.component';
7
+ const mockUseStockSourcesPage = jest.mocked(useStockSourcesPage);
16
8
 
17
9
  jest.mock('./stock-sources-items-table.resource', () => ({
18
10
  __esModule: true,
@@ -23,13 +15,27 @@ jest.mock('./stock-sources-items-table.resource', () => ({
23
15
  describe('StockSourcesItems', () => {
24
16
  const mockFilter = {};
25
17
  const mockItems = {
26
- results: [{ name: 'Community', acronym: 'Community', sourceType: { display: 'Donation' } }],
18
+ results: [
19
+ {
20
+ uuid: '1',
21
+ name: 'Community',
22
+ acronym: 'Community',
23
+ sourceType: { display: 'Donation' },
24
+ creator: null,
25
+ dateCreated: null,
26
+ changedBy: null,
27
+ dateChanged: null,
28
+ retired: false,
29
+ dateRetired: null,
30
+ retiredBy: null,
31
+ retireReason: null,
32
+ },
33
+ ] as unknown as StockSource[],
27
34
  totalCount: 1,
28
35
  };
29
36
 
30
37
  beforeEach(() => {
31
- (useTranslation as jest.Mock).mockReturnValue(mockTranslation);
32
- (useStockSourcesPage as jest.Mock).mockClear();
38
+ mockUseStockSourcesPage.mockClear();
33
39
  });
34
40
 
35
41
  it('should return initial values', () => {
@@ -39,8 +45,8 @@ describe('StockSourcesItems', () => {
39
45
  totalCount: 1,
40
46
  };
41
47
 
42
- (useStockSourcesPage as jest.Mock).mockReturnValue({
43
- items: mockItems.results,
48
+ mockUseStockSourcesPage.mockReturnValue({
49
+ items: mockItems.results as unknown as StockSource[],
44
50
  isLoading: false,
45
51
  totalItems: mockItems.totalCount,
46
52
  currentPage: 1,
@@ -49,6 +55,8 @@ describe('StockSourcesItems', () => {
49
55
  currentPageSize: 10,
50
56
  setPageSize: jest.fn(),
51
57
  error: null,
58
+ paginatedItems: mockItems.results as unknown as StockSource[],
59
+ tableHeaders: [],
52
60
  });
53
61
 
54
62
  const { result } = renderHook(() => useStockSourcesPage(mockFilter));
@@ -63,7 +71,7 @@ describe('StockSourcesItems', () => {
63
71
  it('should update current page size', () => {
64
72
  let currentPageSize = 10; // Track page size with a local variable
65
73
 
66
- (useStockSourcesPage as jest.Mock).mockReturnValue({
74
+ mockUseStockSourcesPage.mockReturnValue({
67
75
  items: mockItems.results,
68
76
  isLoading: false,
69
77
  totalItems: mockItems.totalCount,
@@ -71,10 +79,12 @@ describe('StockSourcesItems', () => {
71
79
  pageSizes: [10, 20, 50],
72
80
  goTo: jest.fn(),
73
81
  currentPageSize,
74
- setPageSize: jest.fn((size) => {
75
- currentPageSize = size; // Update local variable
82
+ setPageSize: jest.fn((size: number) => {
83
+ currentPageSize = size;
76
84
  }),
77
85
  error: null,
86
+ paginatedItems: mockItems.results,
87
+ tableHeaders: [],
78
88
  });
79
89
 
80
90
  const { result } = renderHook(() => useStockSourcesPage(mockFilter));
@@ -87,8 +97,8 @@ describe('StockSourcesItems', () => {
87
97
  });
88
98
 
89
99
  it('should handle loading and error states', () => {
90
- (useStockSourcesPage as jest.Mock).mockReturnValue({
91
- items: { results: [], totalCount: 0 },
100
+ mockUseStockSourcesPage.mockReturnValue({
101
+ items: [] as unknown as StockSource[],
92
102
  isLoading: true,
93
103
  error: null,
94
104
  totalItems: 0,
@@ -97,6 +107,8 @@ describe('StockSourcesItems', () => {
97
107
  pageSizes: [10, 20, 50],
98
108
  goTo: jest.fn(),
99
109
  setPageSize: jest.fn(),
110
+ paginatedItems: [] as unknown as StockSource[],
111
+ tableHeaders: [],
100
112
  });
101
113
 
102
114
  const { result } = renderHook(() => useStockSourcesPage(mockFilter));
@@ -107,7 +119,7 @@ describe('StockSourcesItems', () => {
107
119
  });
108
120
 
109
121
  test('renders loading state when data is being fetched', () => {
110
- (useStockSourcesPage as jest.Mock).mockReturnValue({
122
+ mockUseStockSourcesPage.mockReturnValue({
111
123
  items: [],
112
124
  isLoading: true,
113
125
  totalItems: 0,
@@ -117,9 +129,12 @@ describe('StockSourcesItems', () => {
117
129
  goTo: jest.fn(),
118
130
  currentPageSize: 10,
119
131
  setPageSize: jest.fn(),
132
+ paginatedItems: [],
133
+ error: null,
120
134
  });
121
135
 
122
136
  render(<StockSourcesItems />);
137
+
123
138
  expect(screen.getByRole('progressbar')).toBeInTheDocument();
124
139
  });
125
140
 
@@ -133,25 +148,27 @@ describe('StockSourcesItems', () => {
133
148
  },
134
149
  ];
135
150
 
136
- (useStockSourcesPage as jest.Mock).mockReturnValue({
137
- items: mockItems,
151
+ mockUseStockSourcesPage.mockReturnValue({
152
+ items: mockItems as unknown as StockSource[],
138
153
  isLoading: false,
139
154
  totalItems: 1,
140
155
  tableHeaders: [
141
- { key: 'name', header: 'Name' },
142
- { key: 'sourceType', header: 'Source Type' },
156
+ { id: 0, key: 'name', header: 'Name' },
157
+ { id: 1, key: 'sourceType', header: 'Source Type' },
143
158
  ],
144
159
  currentPage: 1,
145
160
  pageSizes: [10, 20, 50],
146
161
  goTo: jest.fn(),
147
162
  currentPageSize: 10,
148
163
  setPageSize: jest.fn(),
164
+ paginatedItems: mockItems as unknown as StockSource[],
165
+ error: null,
149
166
  });
150
167
 
151
168
  render(<StockSourcesItems />);
152
169
 
153
- expect(screen.getByText('Source A')).toBeInTheDocument();
154
- expect(screen.getByText('Internal')).toBeInTheDocument();
170
+ expect(screen.getByText(/source a/i)).toBeInTheDocument();
171
+ expect(screen.getByText(/internal/i)).toBeInTheDocument();
155
172
  });
156
173
 
157
174
  test('filters data based on source type', async () => {
@@ -172,16 +189,18 @@ describe('StockSourcesItems', () => {
172
189
  },
173
190
  ];
174
191
 
175
- (useStockSourcesPage as jest.Mock).mockReturnValue({
176
- items: mockItems,
192
+ mockUseStockSourcesPage.mockReturnValue({
193
+ items: mockItems as unknown as StockSource[],
177
194
  isLoading: false,
178
195
  totalItems: 2,
179
- tableHeaders: [{ key: 'name', header: 'Name' }],
196
+ tableHeaders: [{ id: 0, key: 'name', header: 'Name' }],
180
197
  currentPage: 1,
181
198
  pageSizes: [10, 20, 50],
182
199
  goTo: jest.fn(),
183
200
  currentPageSize: 10,
184
201
  setPageSize: jest.fn(),
202
+ paginatedItems: mockItems as unknown as StockSource[],
203
+ error: null,
185
204
  });
186
205
 
187
206
  render(<StockSourcesItems />);
@@ -202,7 +221,7 @@ describe('StockSourcesItems', () => {
202
221
  });
203
222
 
204
223
  test('renders a message when no stock sources are available', () => {
205
- (useStockSourcesPage as jest.Mock).mockReturnValue({
224
+ mockUseStockSourcesPage.mockReturnValue({
206
225
  items: [],
207
226
  isLoading: false,
208
227
  totalItems: 0,
@@ -212,12 +231,14 @@ describe('StockSourcesItems', () => {
212
231
  goTo: jest.fn(),
213
232
  currentPageSize: 10,
214
233
  setPageSize: jest.fn(),
234
+ paginatedItems: [],
235
+ error: null,
215
236
  });
216
237
 
217
238
  render(<StockSourcesItems />);
218
239
 
219
- expect(screen.getByText('noSourcesToDisplay')).toBeInTheDocument();
220
- expect(screen.getByText('checkFilters')).toBeInTheDocument();
240
+ expect(screen.getByText(/no stock sources to display/i)).toBeInTheDocument();
241
+ expect(screen.getByText(/check the filters above/i)).toBeInTheDocument();
221
242
  });
222
243
 
223
244
  test('pagination works as expected', async () => {
@@ -226,7 +247,7 @@ describe('StockSourcesItems', () => {
226
247
  const mockGoTo = jest.fn();
227
248
  const mockSetPageSize = jest.fn();
228
249
 
229
- (useStockSourcesPage as jest.Mock).mockReturnValue({
250
+ mockUseStockSourcesPage.mockReturnValue({
230
251
  items: [],
231
252
  isLoading: false,
232
253
  totalItems: 20,
@@ -236,11 +257,13 @@ describe('StockSourcesItems', () => {
236
257
  goTo: mockGoTo,
237
258
  currentPageSize: 10,
238
259
  setPageSize: mockSetPageSize,
260
+ paginatedItems: [],
261
+ error: null,
239
262
  });
240
263
 
241
264
  render(<StockSourcesItems />);
242
265
 
243
- const nextPageButton = screen.getByLabelText('Next page');
266
+ const nextPageButton = screen.getByLabelText(/next page/i);
244
267
  await user.click(nextPageButton);
245
268
 
246
269
  expect(mockGoTo).toHaveBeenCalledWith(2);
@@ -1,6 +1,6 @@
1
- @use '@carbon/styles/scss/colors';
1
+ @use '@carbon/colors';
2
2
  @use '@carbon/layout';
3
- @use '@carbon/styles/scss/type';
3
+ @use '@carbon/type';
4
4
  @use '@openmrs/esm-styleguide/src/vars' as *;
5
5
 
6
6
  .container {
@@ -217,3 +217,7 @@
217
217
  margin-top: 0.5rem;
218
218
  cursor: pointer;
219
219
  }
220
+
221
+ .toolbarMenuAction {
222
+ max-width: none;
223
+ }
@@ -1,25 +1,24 @@
1
- @use '@carbon/styles/scss/spacing';
2
- @use '@carbon/styles/scss/type';
3
1
  @use '@carbon/layout';
2
+ @use '@carbon/type';
4
3
  @use '@openmrs/esm-styleguide/src/vars' as *;
5
4
 
6
5
  .section {
7
- margin: spacing.$spacing-03;
6
+ margin: layout.$spacing-03;
8
7
  }
9
8
 
10
9
  .sectionTitle {
11
10
  @include type.type-style('heading-compact-02');
12
11
  color: $text-02;
13
- margin-bottom: spacing.$spacing-04;
12
+ margin-bottom: layout.$spacing-04;
14
13
  }
15
14
 
16
15
  .subTitle {
17
16
  font-size: 14px;
18
- margin-bottom: spacing.$spacing-04;
17
+ margin-bottom: layout.$spacing-04;
19
18
  }
20
19
 
21
20
  .modalBody {
22
- padding-bottom: spacing.$spacing-05;
21
+ padding-bottom: layout.$spacing-05;
23
22
  }
24
23
 
25
24
  .checkboxGrid {
@@ -52,13 +51,6 @@
52
51
  margin: layout.$spacing-05;
53
52
  }
54
53
 
55
- .button {
56
- display: flex;
57
- align-content: flex-start;
58
- align-items: baseline;
59
- min-width: 50%;
60
- }
61
-
62
54
  .buttonSet {
63
55
  display: flex;
64
56
  justify-content: space-between;
@@ -403,10 +403,10 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({ model, ed
403
403
  })}
404
404
  >
405
405
  <Button kind="secondary" onClick={closeWorkspace} className={styles.button}>
406
- {getCoreTranslation('cancel', 'Cancel')}
406
+ {getCoreTranslation('cancel')}
407
407
  </Button>
408
408
  <Button type="submit" className={styles.button} onClick={addStockUserRole} renderIcon={Save}>
409
- {getCoreTranslation('save', 'Save')}
409
+ {getCoreTranslation('save')}
410
410
  </Button>
411
411
  </ButtonSet>
412
412
  </Form>
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useTranslation } from 'react-i18next';
3
3
  import { Button, ModalHeader, ModalBody, ModalFooter } from '@carbon/react';
4
+ import { getCoreTranslation } from '@openmrs/esm-framework';
4
5
  import styles from './delete-stock-user-scope-modal.scss';
5
6
 
6
7
  interface DeleteConfirmationProps {
@@ -26,7 +27,7 @@ const DeleteConfirmation: React.FC<DeleteConfirmationProps> = ({ close, onConfir
26
27
  </ModalBody>
27
28
  <ModalFooter>
28
29
  <Button size="lg" kind="secondary" onClick={handleCancel}>
29
- {t('cancel', 'Cancel')}
30
+ {getCoreTranslation('cancel')}
30
31
  </Button>
31
32
  <Button autoFocus kind="danger" onClick={handleDelete} size="lg">
32
33
  {t('delete', 'Delete')}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "abbreviation": "Abbreviation",
3
- "acronym": "Acronym/Code",
3
+ "acronymOrCode": "Acronym/Code",
4
4
  "action": "Actions",
5
5
  "actionFrequency": "Notification Frequency (Minutes)",
6
6
  "actions": "Actions",
@@ -11,7 +11,6 @@
11
11
  "addedSource": "Add Source",
12
12
  "addItem": "Add stock item",
13
13
  "addLocation": "Create new Location",
14
- "addNewStock": "Add New",
15
14
  "addNewStockRule": "Add New Rule",
16
15
  "addNewStockSource": "Add new source",
17
16
  "addNewUserRoleScope": "Add new user role scope",
@@ -94,7 +93,6 @@
94
93
  "disposedStock": "Disposed stock",
95
94
  "doesThisTransactionRequireApproval": "Does the transaction require approval ?",
96
95
  "drug": "Drug",
97
- "editItem": "Edit {{name}}",
98
96
  "editOperationTitle": "Edit {{operationType}}",
99
97
  "editStockItem": "Edit Stock Item",
100
98
  "editStockOperation": "Edit stock operation",
@@ -190,7 +188,6 @@
190
188
  "noInventoryAlerts": "No inventory alerts to display",
191
189
  "noIssuedStock": "No issued stock to display",
192
190
  "noIssuedStockDataAvailable": "No issued stock data available.",
193
- "noItemsToDisplay": "No Stock Items to display",
194
191
  "noneFulfillment": "Non Fulfillment",
195
192
  "noOperationsToDisplay": "No Stock Operations to display",
196
193
  "noPrivilagesTitle": "",
@@ -205,6 +202,7 @@
205
202
  "notSet": "Not Set",
206
203
  "noViewPrivilegesDescription": "Description: {{description}}",
207
204
  "number": "Number",
205
+ "onlyCsvFilesAt2mbOrLess": "Only .csv files at 2MB or less",
208
206
  "operationDate": "Operation Date",
209
207
  "operationModalTitle": "{{title}} Operation",
210
208
  "operationNumber": "Operation Number",
@@ -253,7 +251,6 @@
253
251
  "refresh": "Refresh",
254
252
  "reject": "Reject ",
255
253
  "rejected": "Rejected",
256
- "rejectOrder": "Uploaded Order",
257
254
  "relatedStockRequisitionRequired": "Related stock requisition Required",
258
255
  "remarks": "Remarks",
259
256
  "removePackagingUnit": "Remove Packaging Unit",
@@ -280,7 +277,9 @@
280
277
  "saveStockItemReferenceErrorTitle": "StockItem Reference",
281
278
  "saveStockItemReferenceMessage": "Stock Item Reference saved successfully",
282
279
  "search": "Search",
280
+ "searchStockOperations": "Search stock operations",
283
281
  "searchThisList": "Search this list",
282
+ "selectFile": "Select file",
284
283
  "SelectOption": "Select an option",
285
284
  "selectTags": "Select tag(s)",
286
285
  "source": "Source",
@@ -297,6 +296,7 @@
297
296
  "stockItemEdited": "Stock Item Edited Successfully",
298
297
  "stockItemError": "Error loading stock item",
299
298
  "stockItems": "Stock Items",
299
+ "stockItemsUploadedSuccessfully": "Stock items uploaded successfully",
300
300
  "stockManagement": "Stock Management",
301
301
  "stockOperation": "Stock Operations",
302
302
  "stockOperationAdded": "Stock operation added successfully",
@@ -326,7 +326,6 @@
326
326
  "submittingForReview": "Submitting for review",
327
327
  "success": "Success",
328
328
  "successfullysaved": "You have successfully saved user role scope",
329
- "SuccessfullyUploadedStockItem": "You have successfully uploaded stock items",
330
329
  "tabletOverlay": "Tablet overlay",
331
330
  "tags": "Tags",
332
331
  "timeTaken": "Time Taken",
package/tsconfig.json CHANGED
@@ -7,6 +7,10 @@
7
7
  "module": "esnext",
8
8
  "moduleResolution": "node",
9
9
  "noEmit": true,
10
+ "paths": {
11
+ "@mocks": ["./__mocks__"],
12
+ "@tools": ["./tools"]
13
+ },
10
14
  "resolveJsonModule": true,
11
15
  "skipLibCheck": true,
12
16
  "target": "esnext"
package/dist/627.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_openmrs_esm_stock_management_app=globalThis.webpackChunk_openmrs_esm_stock_management_app||[]).push([[627],{7627:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var r=n(1672),o=n.n(r),l=n(3397),a=n(5787),i=n(3775);function c(e,t,n,r,o,l,a){try{var i=e[l](a),c=i.value}catch(e){return void n(e)}i.done?t(c):Promise.resolve(c).then(r,o)}function u(){var e;return e=function(e){var t;return function(e,t){var n,r,o,l,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return l={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function i(l){return function(i){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,i])}}}(this,(function(n){return t=new AbortController,[2,(0,i.openmrsFetch)("".concat(i.restBaseUrl,"/stockmanagement/stockitemimport"),{method:"POST",signal:t.signal,body:e})]}))},u=function(){var t=this,n=arguments;return new Promise((function(r,o){var l=e.apply(t,n);function a(e){c(l,r,o,a,i,"next",e)}function i(e){c(l,r,o,a,i,"throw",e)}a(void 0)}))},u.apply(this,arguments)}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const f=function(e){var t,n,c=e.closeModal,f=(0,l.useTranslation)().t,p=(t=(0,r.useState)(),n=2,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,l=[],a=!0,i=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);a=!0);}catch(e){i=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(i)throw o}}return l}}(t,n)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=p[0],d=p[1];return o().createElement("div",null,o().createElement(a.l09,null,o().createElement(a.xBx,{closeModal:c,title:f("importStockItems","Import Stock Items")}),o().createElement(a.fef,null,o().createElement(a.bAu,{accept:[".csv"],multiple:!1,name:"file",buttonLabel:"Select file",labelDescription:"Only .csv files at 2mb or less",filenameStatus:"edit",labelTitle:"",size:"sm",onChange:function(e){var t,n,r=null==e||null===(n=e.target)||void 0===n||null===(t=n.files)||void 0===t?void 0:t[0];r?d(r):e.preventDefault()}})),o().createElement(a.mzw,null,o().createElement(a.zxk,{kind:"secondary",onClick:c},f("cancel","Cancel")),o().createElement(a.zxk,{type:"button",onClick:function(){if(m){var e=new FormData;m&&(e.append("file",m,"Import_Stock_Items.csv"),e.append("hasHeader","true")),function(e){return u.apply(this,arguments)}(e).then((function(){(0,i.showSnackbar)({isLowContrast:!0,title:f("rejectOrder","Uploaded Order"),kind:"success",subtitle:f("SuccessfullyUploadedStockItem","You have successfully uploaded stock items")}),c()}),(function(e){(0,i.showSnackbar)({title:f("errorUploadingItems","An error occurred uploading stock items"),kind:"error",isLowContrast:!0,subtitle:null==e?void 0:e.message})}))}}},f("uploadStockItems","Upload StockItems")))))}}}]);
package/dist/627.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"627.js","mappings":"sXAEsBA,I,eAAf,SAAgCC,G,IAC/BC,E,8jCAEN,OAFMA,EAAkB,IAAIC,gBAErB,C,GAAAC,EAAAA,EAAAA,cAAa,GAAe,OAAZC,EAAAA,YAAY,oCAAmC,CACpEC,OAAQ,OAIRC,OAAQL,EAAgBK,OACxBN,KAAMA,I,GAEV,EAXsBD,E,8KAAAA,EAAAA,MAAAA,KAAAA,U,2GCiFtB,QAzE4D,Y,QAAGQ,EAAAA,EAAAA,WACvD,GAAQC,EAAAA,EAAAA,kBAANC,EACgCC,G,GAAAA,EAAAA,EAAAA,Y,EAAQA,E,+zBAAzCC,EAAiCD,EAAAA,GAAnBE,EAAmBF,EAAAA,GAyCxC,OACE,kBAACG,MAAAA,KACC,kBAACC,EAAAA,IAAIA,KACH,kBAACC,EAAAA,IAAWA,CAACR,WAAYA,EAAYS,MAAOP,EAAE,mBAAoB,wBAClE,kBAACQ,EAAAA,IAASA,KACR,kBAACC,EAAAA,IAAYA,CACXC,OAAQ,CAAC,QACTC,UAAU,EACVC,KAAM,OACNC,YAAY,cACZC,iBAAiB,iCACjBC,eAAe,OACfC,WAAW,GACXC,KAAK,KACLC,SAvBY,SAACC,G,IACRA,EAAAA,EAAPC,EAAOD,SAAa,QAAbA,EAAAA,EAAOE,cAAPF,IAAAA,GAAoB,QAApBA,EAAAA,EAAeG,aAAfH,IAAAA,OAAAA,EAAAA,EAAuB,GAChCC,EACFjB,EAAgBiB,GAEhBD,EAAMI,gBAEV,KAmBM,kBAACC,EAAAA,IAAWA,KACV,kBAACC,EAAAA,IAAMA,CAACC,KAAK,YAAYC,QAAS7B,GAC/BE,EAAE,SAAU,WAEf,kBAACyB,EAAAA,IAAMA,CAACG,KAAK,SAASD,QA5DN,WACtB,GAAKzB,EAAL,CAGA,IAAM2B,EAAW,IAAIC,SACjB5B,IACF2B,EAASE,OAAO,OAAQ7B,EAAc,0BACtC2B,EAASE,OAAO,YAAa,SDnB5B,SAAgCxC,G,OAAjBD,EAAAA,MAAAA,KAAAA,U,CCqBlBA,CAAiBuC,GAAUG,MACzB,YACEC,EAAAA,EAAAA,cAAa,CACXC,eAAe,EACf3B,MAAOP,EAAE,cAAe,kBACxB0B,KAAM,UACNS,SAAUnC,EAAE,gCAAkC,gDAEhDF,GACF,IACA,SAACsC,IACCH,EAAAA,EAAAA,cAAa,CACX1B,MAAOP,EAAE,sBAAuB,2CAChC0B,KAAM,QACNQ,eAAe,EACfC,SAAUC,aAAAA,EAAAA,EAAKC,SAEnB,GAvBF,CAyBF,GAiCWrC,EAAE,mBAAoB,wBAMnC,C","sources":["webpack://@openmrs/esm-stock-management-app/./src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts","webpack://@openmrs/esm-stock-management-app/./src/stock-items/add-bulk-stock-item/stock-items-bulk-import.component.tsx"],"names":["UploadStockItems","body","abortController","AbortController","openmrsFetch","restBaseUrl","method","signal","closeModal","useTranslation","t","useState","selectedFile","setSelectedFile","div","Form","ModalHeader","title","ModalBody","FileUploader","accept","multiple","name","buttonLabel","labelDescription","filenameStatus","labelTitle","size","onChange","event","file","target","files","preventDefault","ModalFooter","Button","kind","onClick","type","formData","FormData","append","then","showSnackbar","isLowContrast","subtitle","err","message"],"sourceRoot":""}