@openmrs/esm-stock-management-app 3.0.1-pre.855 → 3.0.1-pre.864

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 (109) hide show
  1. package/.husky/pre-commit +4 -1
  2. package/.husky/pre-push +2 -0
  3. package/__mocks__/react-i18next.js +8 -9
  4. package/dist/10.js +1 -1
  5. package/dist/10.js.map +1 -1
  6. package/dist/119.js +1 -1
  7. package/dist/119.js.map +1 -1
  8. package/dist/14.js +1 -1
  9. package/dist/14.js.map +1 -1
  10. package/dist/172.js +1 -1
  11. package/dist/172.js.map +1 -1
  12. package/dist/20.js +1 -1
  13. package/dist/20.js.map +1 -1
  14. package/dist/290.js +1 -1
  15. package/dist/290.js.map +1 -1
  16. package/dist/33.js +1 -0
  17. package/dist/33.js.map +1 -0
  18. package/dist/467.js +1 -1
  19. package/dist/467.js.map +1 -1
  20. package/dist/574.js +1 -1
  21. package/dist/606.js +1 -1
  22. package/dist/606.js.map +1 -1
  23. package/dist/642.js +1 -1
  24. package/dist/642.js.map +1 -1
  25. package/dist/675.js +1 -1
  26. package/dist/675.js.map +1 -1
  27. package/dist/727.js +1 -1
  28. package/dist/727.js.map +1 -1
  29. package/dist/842.js +1 -1
  30. package/dist/842.js.map +1 -1
  31. package/dist/93.js +1 -1
  32. package/dist/93.js.map +1 -1
  33. package/dist/main.js +1 -1
  34. package/dist/main.js.map +1 -1
  35. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +70 -70
  36. package/dist/routes.json +1 -1
  37. package/jest.config.js +6 -3
  38. package/package.json +1 -1
  39. package/src/core/components/table/table.component.tsx +2 -2
  40. package/src/index.ts +5 -5
  41. package/src/stock-items/add-bulk-stock-item/add-stock-items-bulk-import-action-button.component.tsx +3 -3
  42. package/src/stock-items/add-bulk-stock-item/{stock-items-bulk-import.component.tsx → stock-items-bulk-import.modal.tsx} +20 -19
  43. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.resource.ts +1 -1
  44. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.test.tsx +59 -59
  45. package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +6 -6
  46. package/src/stock-items/add-stock-item/add-stock-item.component.tsx +6 -4
  47. package/src/stock-items/add-stock-item/add-stock-item.scss +5 -0
  48. package/src/stock-items/add-stock-item/add-stock-item.test.tsx +28 -43
  49. package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +3 -4
  50. package/src/stock-items/add-stock-item/packaging-units/packaging-units.component.tsx +9 -10
  51. package/src/stock-items/add-stock-item/packaging-units/packaging-units.scss +4 -4
  52. package/src/stock-items/add-stock-item/stock-item-details/stock-item-details.component.tsx +27 -19
  53. package/src/stock-items/add-stock-item/stock-item-references/stock-item-references.scss +4 -4
  54. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +15 -9
  55. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.scss +1 -0
  56. package/src/stock-items/add-stock-item/stock-item-rules/delete-stock-rule-modal.component.tsx +2 -1
  57. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.component.tsx +14 -16
  58. package/src/stock-items/add-stock-item/stock-item-rules/stock-item-rules.scss +7 -3
  59. package/src/stock-items/add-stock-item/transactions/printout/transactions-print-bincard-preview.modal.tsx +14 -6
  60. package/src/stock-items/add-stock-item/transactions/printout/transactions-print-stockcard-preview.modal.tsx +14 -8
  61. package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +2 -2
  62. package/src/stock-items/stock-item.utils.tsx +3 -5
  63. package/src/stock-items/stock-items-table.component.tsx +47 -45
  64. package/src/stock-items/stock-items-table.resource.ts +2 -2
  65. package/src/stock-items/stock-items-table.scss +5 -1
  66. package/src/stock-items/stock-items-table.test.tsx +106 -65
  67. package/src/stock-locations/location-admin-form.component.tsx +5 -4
  68. package/src/stock-locations/stock-locations-table.component.tsx +10 -8
  69. package/src/stock-lookups/stock-lookups.resource.ts +18 -17
  70. package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +2 -2
  71. package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.component.tsx +11 -11
  72. package/src/stock-operations/stock-operations-forms/input-components/batch-no-selector.test.tsx +115 -25
  73. package/src/stock-operations/stock-operations-forms/input-components/qty-uim-selector.test.tsx +107 -65
  74. package/src/stock-operations/stock-operations-forms/input-components/quantity-uom-selector.component.tsx +9 -9
  75. package/src/stock-operations/stock-operations-forms/input-components/stock-operation-reason-selector.test.tsx +35 -153
  76. package/src/stock-operations/stock-operations-forms/input-components/user-selector.test.tsx +82 -29
  77. package/src/stock-operations/stock-operations-forms/step1.test.tsx +204 -69
  78. package/src/stock-operations/stock-operations-forms/step2.test.tsx +140 -63
  79. package/src/stock-operations/stock-operations-forms/step3.test.tsx +79 -60
  80. package/src/stock-operations/stock-operations-forms/steps/stock-operation-items-form-step.component.tsx +6 -5
  81. package/src/stock-operations/stock-operations-forms/steps/stock-operation-submission-form-step.component.tsx +12 -11
  82. package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.scss +1 -0
  83. package/src/stock-operations/stock-operations-forms/stock-item-form/stock-item-form.workspace.tsx +20 -12
  84. package/src/stock-operations/stock-operations-forms/stock-operation-form.scss +1 -0
  85. package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stepper.scss +1 -3
  86. package/src/stock-operations/stock-operations-forms/stock-operation-stepper/stock-operation-stepper.component.tsx +2 -1
  87. package/src/stock-reports/generate-report/create-stock-report.scss +3 -2
  88. package/src/stock-reports/generate-report/create-stock-report.workspace.tsx +32 -25
  89. package/src/stock-reports/report-list/stock-report-parameters.component.tsx +1 -1
  90. package/src/stock-reports/report-list/stock-report-status.component.tsx +1 -1
  91. package/src/stock-reports/report-list/stock-reports.component.tsx +24 -25
  92. package/src/stock-reports/report-list/stock-reports.scss +10 -2
  93. package/src/stock-sources/add-stock-sources/add-stock-sources.scss +11 -4
  94. package/src/stock-sources/add-stock-sources/add-stock-sources.test.tsx +38 -36
  95. package/src/stock-sources/add-stock-sources/add-stock-sources.workspace.tsx +35 -30
  96. package/src/stock-sources/delete-stock-modal.component.tsx +2 -1
  97. package/src/stock-sources/stock-sources-delete/stock-sources-delete.test.tsx +27 -36
  98. package/src/stock-sources/stock-sources-filter/stock-sources-filter.component.tsx +36 -21
  99. package/src/stock-sources/stock-sources-items-table.component.tsx +16 -17
  100. package/src/stock-sources/stock-sources-items-table.resource.ts +8 -6
  101. package/src/stock-sources/stock-sources-items-table.test.tsx +79 -36
  102. package/src/stock-sources/stock-sources.scss +6 -2
  103. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.scss +5 -13
  104. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.workspace.tsx +2 -2
  105. package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +2 -1
  106. package/translations/en.json +8 -6
  107. package/tsconfig.json +4 -0
  108. package/dist/627.js +0 -1
  109. package/dist/627.js.map +0 -1
@@ -1,18 +1,14 @@
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';
5
+ import { type Concept } from '../core/api/types/concept/Concept';
6
+ import { useConcept } from '../stock-lookups/stock-lookups.resource';
6
7
  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
- }));
8
+ import StockSourcesItems from './stock-sources-items-table.component';
12
9
 
13
- const mockTranslation = {
14
- t: (key) => key,
15
- };
10
+ const mockUseStockSourcesPage = jest.mocked(useStockSourcesPage);
11
+ const mockUseConcept = jest.mocked(useConcept);
16
12
 
17
13
  jest.mock('./stock-sources-items-table.resource', () => ({
18
14
  __esModule: true,
@@ -20,16 +16,46 @@ jest.mock('./stock-sources-items-table.resource', () => ({
20
16
  useStockSourcesPage: jest.fn(),
21
17
  }));
22
18
 
19
+ jest.mock('../stock-lookups/stock-lookups.resource', () => ({
20
+ useConcept: jest.fn(),
21
+ }));
22
+
23
23
  describe('StockSourcesItems', () => {
24
24
  const mockFilter = {};
25
25
  const mockItems = {
26
- results: [{ name: 'Community', acronym: 'Community', sourceType: { display: 'Donation' } }],
26
+ results: [
27
+ {
28
+ uuid: '1',
29
+ name: 'Community',
30
+ acronym: 'Community',
31
+ sourceType: { display: 'Donation' },
32
+ creator: null,
33
+ dateCreated: null,
34
+ changedBy: null,
35
+ dateChanged: null,
36
+ retired: false,
37
+ dateRetired: null,
38
+ retiredBy: null,
39
+ retireReason: null,
40
+ },
41
+ ] as unknown as StockSource[],
27
42
  totalCount: 1,
28
43
  };
29
44
 
30
45
  beforeEach(() => {
31
- (useTranslation as jest.Mock).mockReturnValue(mockTranslation);
32
- (useStockSourcesPage as jest.Mock).mockClear();
46
+ mockUseConcept.mockReturnValue({
47
+ items: {
48
+ uuid: '1',
49
+ display: 'Source Types',
50
+ answers: [
51
+ { uuid: '1', display: 'All' },
52
+ { uuid: '2', display: 'Internal' },
53
+ { uuid: '3', display: 'External' },
54
+ ] as Concept[],
55
+ } as Concept,
56
+ isLoading: false,
57
+ error: null,
58
+ });
33
59
  });
34
60
 
35
61
  it('should return initial values', () => {
@@ -39,8 +65,8 @@ describe('StockSourcesItems', () => {
39
65
  totalCount: 1,
40
66
  };
41
67
 
42
- (useStockSourcesPage as jest.Mock).mockReturnValue({
43
- items: mockItems.results,
68
+ mockUseStockSourcesPage.mockReturnValue({
69
+ items: mockItems.results as unknown as StockSource[],
44
70
  isLoading: false,
45
71
  totalItems: mockItems.totalCount,
46
72
  currentPage: 1,
@@ -49,6 +75,8 @@ describe('StockSourcesItems', () => {
49
75
  currentPageSize: 10,
50
76
  setPageSize: jest.fn(),
51
77
  error: null,
78
+ paginatedItems: mockItems.results as unknown as StockSource[],
79
+ tableHeaders: [],
52
80
  });
53
81
 
54
82
  const { result } = renderHook(() => useStockSourcesPage(mockFilter));
@@ -63,7 +91,7 @@ describe('StockSourcesItems', () => {
63
91
  it('should update current page size', () => {
64
92
  let currentPageSize = 10; // Track page size with a local variable
65
93
 
66
- (useStockSourcesPage as jest.Mock).mockReturnValue({
94
+ mockUseStockSourcesPage.mockReturnValue({
67
95
  items: mockItems.results,
68
96
  isLoading: false,
69
97
  totalItems: mockItems.totalCount,
@@ -71,10 +99,12 @@ describe('StockSourcesItems', () => {
71
99
  pageSizes: [10, 20, 50],
72
100
  goTo: jest.fn(),
73
101
  currentPageSize,
74
- setPageSize: jest.fn((size) => {
75
- currentPageSize = size; // Update local variable
102
+ setPageSize: jest.fn((size: number) => {
103
+ currentPageSize = size;
76
104
  }),
77
105
  error: null,
106
+ paginatedItems: mockItems.results,
107
+ tableHeaders: [],
78
108
  });
79
109
 
80
110
  const { result } = renderHook(() => useStockSourcesPage(mockFilter));
@@ -87,8 +117,8 @@ describe('StockSourcesItems', () => {
87
117
  });
88
118
 
89
119
  it('should handle loading and error states', () => {
90
- (useStockSourcesPage as jest.Mock).mockReturnValue({
91
- items: { results: [], totalCount: 0 },
120
+ mockUseStockSourcesPage.mockReturnValue({
121
+ items: [] as unknown as StockSource[],
92
122
  isLoading: true,
93
123
  error: null,
94
124
  totalItems: 0,
@@ -97,6 +127,8 @@ describe('StockSourcesItems', () => {
97
127
  pageSizes: [10, 20, 50],
98
128
  goTo: jest.fn(),
99
129
  setPageSize: jest.fn(),
130
+ paginatedItems: [] as unknown as StockSource[],
131
+ tableHeaders: [],
100
132
  });
101
133
 
102
134
  const { result } = renderHook(() => useStockSourcesPage(mockFilter));
@@ -107,7 +139,7 @@ describe('StockSourcesItems', () => {
107
139
  });
108
140
 
109
141
  test('renders loading state when data is being fetched', () => {
110
- (useStockSourcesPage as jest.Mock).mockReturnValue({
142
+ mockUseStockSourcesPage.mockReturnValue({
111
143
  items: [],
112
144
  isLoading: true,
113
145
  totalItems: 0,
@@ -117,9 +149,12 @@ describe('StockSourcesItems', () => {
117
149
  goTo: jest.fn(),
118
150
  currentPageSize: 10,
119
151
  setPageSize: jest.fn(),
152
+ paginatedItems: [],
153
+ error: null,
120
154
  });
121
155
 
122
156
  render(<StockSourcesItems />);
157
+
123
158
  expect(screen.getByRole('progressbar')).toBeInTheDocument();
124
159
  });
125
160
 
@@ -133,25 +168,27 @@ describe('StockSourcesItems', () => {
133
168
  },
134
169
  ];
135
170
 
136
- (useStockSourcesPage as jest.Mock).mockReturnValue({
137
- items: mockItems,
171
+ mockUseStockSourcesPage.mockReturnValue({
172
+ items: mockItems as unknown as StockSource[],
138
173
  isLoading: false,
139
174
  totalItems: 1,
140
175
  tableHeaders: [
141
- { key: 'name', header: 'Name' },
142
- { key: 'sourceType', header: 'Source Type' },
176
+ { id: 0, key: 'name', header: 'Name' },
177
+ { id: 1, key: 'sourceType', header: 'Source Type' },
143
178
  ],
144
179
  currentPage: 1,
145
180
  pageSizes: [10, 20, 50],
146
181
  goTo: jest.fn(),
147
182
  currentPageSize: 10,
148
183
  setPageSize: jest.fn(),
184
+ paginatedItems: mockItems as unknown as StockSource[],
185
+ error: null,
149
186
  });
150
187
 
151
188
  render(<StockSourcesItems />);
152
189
 
153
- expect(screen.getByText('Source A')).toBeInTheDocument();
154
- expect(screen.getByText('Internal')).toBeInTheDocument();
190
+ expect(screen.getByText(/source a/i)).toBeInTheDocument();
191
+ expect(screen.getByText(/internal/i)).toBeInTheDocument();
155
192
  });
156
193
 
157
194
  test('filters data based on source type', async () => {
@@ -172,16 +209,18 @@ describe('StockSourcesItems', () => {
172
209
  },
173
210
  ];
174
211
 
175
- (useStockSourcesPage as jest.Mock).mockReturnValue({
176
- items: mockItems,
212
+ mockUseStockSourcesPage.mockReturnValue({
213
+ items: mockItems as unknown as StockSource[],
177
214
  isLoading: false,
178
215
  totalItems: 2,
179
- tableHeaders: [{ key: 'name', header: 'Name' }],
216
+ tableHeaders: [{ id: 0, key: 'name', header: 'Name' }],
180
217
  currentPage: 1,
181
218
  pageSizes: [10, 20, 50],
182
219
  goTo: jest.fn(),
183
220
  currentPageSize: 10,
184
221
  setPageSize: jest.fn(),
222
+ paginatedItems: mockItems as unknown as StockSource[],
223
+ error: null,
185
224
  });
186
225
 
187
226
  render(<StockSourcesItems />);
@@ -202,7 +241,7 @@ describe('StockSourcesItems', () => {
202
241
  });
203
242
 
204
243
  test('renders a message when no stock sources are available', () => {
205
- (useStockSourcesPage as jest.Mock).mockReturnValue({
244
+ mockUseStockSourcesPage.mockReturnValue({
206
245
  items: [],
207
246
  isLoading: false,
208
247
  totalItems: 0,
@@ -212,12 +251,14 @@ describe('StockSourcesItems', () => {
212
251
  goTo: jest.fn(),
213
252
  currentPageSize: 10,
214
253
  setPageSize: jest.fn(),
254
+ paginatedItems: [],
255
+ error: null,
215
256
  });
216
257
 
217
258
  render(<StockSourcesItems />);
218
259
 
219
- expect(screen.getByText('noSourcesToDisplay')).toBeInTheDocument();
220
- expect(screen.getByText('checkFilters')).toBeInTheDocument();
260
+ expect(screen.getByText(/no stock sources to display/i)).toBeInTheDocument();
261
+ expect(screen.getByText(/check the filters above/i)).toBeInTheDocument();
221
262
  });
222
263
 
223
264
  test('pagination works as expected', async () => {
@@ -226,7 +267,7 @@ describe('StockSourcesItems', () => {
226
267
  const mockGoTo = jest.fn();
227
268
  const mockSetPageSize = jest.fn();
228
269
 
229
- (useStockSourcesPage as jest.Mock).mockReturnValue({
270
+ mockUseStockSourcesPage.mockReturnValue({
230
271
  items: [],
231
272
  isLoading: false,
232
273
  totalItems: 20,
@@ -236,11 +277,13 @@ describe('StockSourcesItems', () => {
236
277
  goTo: mockGoTo,
237
278
  currentPageSize: 10,
238
279
  setPageSize: mockSetPageSize,
280
+ paginatedItems: [],
281
+ error: null,
239
282
  });
240
283
 
241
284
  render(<StockSourcesItems />);
242
285
 
243
- const nextPageButton = screen.getByLabelText('Next page');
286
+ const nextPageButton = screen.getByLabelText(/next page/i);
244
287
  await user.click(nextPageButton);
245
288
 
246
289
  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",
@@ -114,6 +112,7 @@
114
112
  "errorDeletingSource": "Error deleting a source",
115
113
  "errorDeletingUserScope": "Error deleting a user scope",
116
114
  "errorEditingStockItem": "Error editing a stock Item",
115
+ "errorFetchingStockSourceTypes": "Error fetching stock source types",
117
116
  "errorLoadingStockOperation": "Error loading stock operation",
118
117
  "errorLoadingStockOperationTypes": "Error loading stock operation types",
119
118
  "errorPrintingStockOperation": "Error printing stock operation",
@@ -190,7 +189,6 @@
190
189
  "noInventoryAlerts": "No inventory alerts to display",
191
190
  "noIssuedStock": "No issued stock to display",
192
191
  "noIssuedStockDataAvailable": "No issued stock data available.",
193
- "noItemsToDisplay": "No Stock Items to display",
194
192
  "noneFulfillment": "Non Fulfillment",
195
193
  "noOperationsToDisplay": "No Stock Operations to display",
196
194
  "noPrivilagesTitle": "",
@@ -205,6 +203,7 @@
205
203
  "notSet": "Not Set",
206
204
  "noViewPrivilegesDescription": "Description: {{description}}",
207
205
  "number": "Number",
206
+ "onlyCsvFilesAt2mbOrLess": "Only .csv files at 2MB or less",
208
207
  "operationDate": "Operation Date",
209
208
  "operationModalTitle": "{{title}} Operation",
210
209
  "operationNumber": "Operation Number",
@@ -253,7 +252,6 @@
253
252
  "refresh": "Refresh",
254
253
  "reject": "Reject ",
255
254
  "rejected": "Rejected",
256
- "rejectOrder": "Uploaded Order",
257
255
  "relatedStockRequisitionRequired": "Related stock requisition Required",
258
256
  "remarks": "Remarks",
259
257
  "removePackagingUnit": "Remove Packaging Unit",
@@ -280,8 +278,12 @@
280
278
  "saveStockItemReferenceErrorTitle": "StockItem Reference",
281
279
  "saveStockItemReferenceMessage": "Stock Item Reference saved successfully",
282
280
  "search": "Search",
281
+ "searchStockItems": "Search stock items",
282
+ "searchStockOperations": "Search stock operations",
283
283
  "searchThisList": "Search this list",
284
+ "selectFile": "Select file",
284
285
  "SelectOption": "Select an option",
286
+ "selectSourceType": "Select Source Type",
285
287
  "selectTags": "Select tag(s)",
286
288
  "source": "Source",
287
289
  "sourceType": "Source Type",
@@ -297,6 +299,7 @@
297
299
  "stockItemEdited": "Stock Item Edited Successfully",
298
300
  "stockItemError": "Error loading stock item",
299
301
  "stockItems": "Stock Items",
302
+ "stockItemsUploadedSuccessfully": "Stock items uploaded successfully",
300
303
  "stockManagement": "Stock Management",
301
304
  "stockOperation": "Stock Operations",
302
305
  "stockOperationAdded": "Stock operation added successfully",
@@ -326,7 +329,6 @@
326
329
  "submittingForReview": "Submitting for review",
327
330
  "success": "Success",
328
331
  "successfullysaved": "You have successfully saved user role scope",
329
- "SuccessfullyUploadedStockItem": "You have successfully uploaded stock items",
330
332
  "tabletOverlay": "Tablet overlay",
331
333
  "tags": "Tags",
332
334
  "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":""}