@openmrs/esm-stock-management-app 1.0.1-pre.476 → 1.0.1-pre.479

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. package/dist/271.js +1 -0
  2. package/dist/319.js +1 -0
  3. package/dist/460.js +1 -0
  4. package/dist/474.js +1 -1
  5. package/dist/474.js.map +1 -1
  6. package/dist/574.js +1 -1
  7. package/dist/757.js +1 -0
  8. package/dist/788.js +1 -0
  9. package/dist/807.js +1 -0
  10. package/dist/833.js +1 -0
  11. package/dist/main.js +1 -1
  12. package/dist/main.js.map +1 -1
  13. package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +163 -9
  14. package/dist/routes.json +1 -1
  15. package/i18next-parser.config.js +1 -1
  16. package/package.json +2 -2
  17. package/src/core/components/card/metrics-card-component.tsx +3 -3
  18. package/src/core/components/privilages-component/privilages.component.tsx +7 -1
  19. package/src/core/components/table/table.component.tsx +1 -1
  20. package/src/stock-items/add-bulk-stock-item/stock-items-bulk-import.component.tsx +3 -2
  21. package/src/stock-items/add-stock-item/add-stock-action-button.component.tsx +2 -2
  22. package/src/stock-items/add-stock-item/packaging-units/packaging-units-delete-modal.component.tsx +4 -4
  23. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rule-button.component.tsx +1 -1
  24. package/src/stock-items/add-stock-item/stock-item-rules/add-stock-rules.component.tsx +2 -2
  25. package/src/stock-items/add-stock-item/stock-item-rules/stock-rules-delete.component.tsx +2 -2
  26. package/src/stock-items/edit-stock-item/edit-stock-item-action-menu.component.tsx +1 -1
  27. package/src/stock-items/stock-item.utils.tsx +22 -9
  28. package/src/stock-items/stock-items-table.component.tsx +1 -1
  29. package/src/stock-locations/add-locations-form.component.tsx +8 -2
  30. package/src/stock-locations/location-admin-form.component.tsx +8 -5
  31. package/src/stock-locations/stock-locations-table.component.tsx +4 -14
  32. package/src/stock-locations/stock-locations-table.resource.tsx +9 -21
  33. package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +1 -0
  34. package/src/stock-operations/add-stock-operation/add-stock-operation.resource.tsx +1 -7
  35. package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +0 -1
  36. package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +10 -8
  37. package/src/stock-operations/add-stock-operation/stock-items-addition-row.component.tsx +2 -1
  38. package/src/stock-operations/add-stock-operation/stock-items-addition.component.tsx +2 -2
  39. package/src/stock-operations/edit-stock-operation/edit-stock-operation-action-menu.component.tsx +3 -0
  40. package/src/stock-operations/stock-operation.utils.tsx +28 -12
  41. package/src/stock-operations/stock-operations-dialog/stock-operations-issue-stock-button.component.tsx +1 -1
  42. package/src/stock-operations/stock-operations-table.component.tsx +9 -2
  43. package/src/stock-reports/generate-report/create-stock-report.component.tsx +33 -18
  44. package/src/stock-sources/add-stock-source-button.component.tsx +1 -1
  45. package/src/stock-sources/add-stock-sources/add-stock-sources.component.tsx +2 -2
  46. package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +2 -2
  47. package/src/stock-user-role-scopes/add-stock-user-role-scope-button.component.tsx +5 -2
  48. package/src/stock-user-role-scopes/add-stock-user-scope/add-stock-user-role-scope.component.tsx +10 -8
  49. package/src/stock-user-role-scopes/delete-stock-user-scope/delete-stock-user-scope.component.tsx +3 -2
  50. package/src/stock-user-role-scopes/delete-stock-user-scope-modal.component.tsx +1 -3
  51. package/src/stock-user-role-scopes/stock-user-role-scopes-items-table.component.tsx +1 -1
  52. package/src/utils.ts +0 -10
  53. package/translations/am.json +292 -0
  54. package/translations/ar.json +292 -0
  55. package/translations/en.json +75 -57
  56. package/translations/es.json +292 -0
  57. package/translations/fr.json +292 -0
  58. package/translations/he.json +292 -0
  59. package/translations/km.json +292 -0
  60. package/translations/zh.json +292 -0
@@ -86,10 +86,10 @@
86
86
  "initial": true,
87
87
  "entry": true,
88
88
  "recorded": false,
89
- "size": 4767357,
89
+ "size": 4766982,
90
90
  "sizes": {
91
91
  "consume-shared": 252,
92
- "javascript": 4745408,
92
+ "javascript": 4745033,
93
93
  "share-init": 252,
94
94
  "runtime": 21445
95
95
  },
@@ -106,7 +106,29 @@
106
106
  "auxiliaryFiles": [
107
107
  "main.js.map"
108
108
  ],
109
- "hash": "d5edd22c2f2285f1",
109
+ "hash": "b3395d02da05f6f7",
110
+ "childrenByOrder": {}
111
+ },
112
+ {
113
+ "rendered": true,
114
+ "initial": false,
115
+ "entry": false,
116
+ "recorded": false,
117
+ "size": 7685,
118
+ "sizes": {
119
+ "javascript": 7685
120
+ },
121
+ "names": [],
122
+ "idHints": [],
123
+ "runtime": [
124
+ "@openmrs/esm-stock-management-app",
125
+ "main"
126
+ ],
127
+ "files": [
128
+ "271.js"
129
+ ],
130
+ "auxiliaryFiles": [],
131
+ "hash": "62e4eff8b6ee6a39",
110
132
  "childrenByOrder": {}
111
133
  },
112
134
  {
@@ -138,9 +160,53 @@
138
160
  "initial": false,
139
161
  "entry": false,
140
162
  "recorded": false,
141
- "size": 1095645,
163
+ "size": 12768,
142
164
  "sizes": {
143
- "javascript": 1095435,
165
+ "javascript": 12768
166
+ },
167
+ "names": [],
168
+ "idHints": [],
169
+ "runtime": [
170
+ "@openmrs/esm-stock-management-app",
171
+ "main"
172
+ ],
173
+ "files": [
174
+ "319.js"
175
+ ],
176
+ "auxiliaryFiles": [],
177
+ "hash": "9577cb4bde364dd6",
178
+ "childrenByOrder": {}
179
+ },
180
+ {
181
+ "rendered": true,
182
+ "initial": false,
183
+ "entry": false,
184
+ "recorded": false,
185
+ "size": 10602,
186
+ "sizes": {
187
+ "javascript": 10602
188
+ },
189
+ "names": [],
190
+ "idHints": [],
191
+ "runtime": [
192
+ "@openmrs/esm-stock-management-app",
193
+ "main"
194
+ ],
195
+ "files": [
196
+ "460.js"
197
+ ],
198
+ "auxiliaryFiles": [],
199
+ "hash": "0239cab658afad3e",
200
+ "childrenByOrder": {}
201
+ },
202
+ {
203
+ "rendered": true,
204
+ "initial": false,
205
+ "entry": false,
206
+ "recorded": false,
207
+ "size": 1095270,
208
+ "sizes": {
209
+ "javascript": 1095060,
144
210
  "consume-shared": 210
145
211
  },
146
212
  "names": [],
@@ -154,7 +220,7 @@
154
220
  "auxiliaryFiles": [
155
221
  "474.js.map"
156
222
  ],
157
- "hash": "1fec4b5e622772a4",
223
+ "hash": "0310bd4a2bb367b0",
158
224
  "childrenByOrder": {}
159
225
  },
160
226
  {
@@ -186,9 +252,9 @@
186
252
  "initial": false,
187
253
  "entry": false,
188
254
  "recorded": false,
189
- "size": 9382,
255
+ "size": 10899,
190
256
  "sizes": {
191
- "javascript": 9382
257
+ "javascript": 10899
192
258
  },
193
259
  "names": [],
194
260
  "idHints": [],
@@ -200,7 +266,7 @@
200
266
  "574.js"
201
267
  ],
202
268
  "auxiliaryFiles": [],
203
- "hash": "998b340f1db57f85",
269
+ "hash": "3ec9fe24b95ef377",
204
270
  "childrenByOrder": {}
205
271
  },
206
272
  {
@@ -272,6 +338,50 @@
272
338
  "hash": "e9b7d1108fb062e0",
273
339
  "childrenByOrder": {}
274
340
  },
341
+ {
342
+ "rendered": true,
343
+ "initial": false,
344
+ "entry": false,
345
+ "recorded": false,
346
+ "size": 12877,
347
+ "sizes": {
348
+ "javascript": 12877
349
+ },
350
+ "names": [],
351
+ "idHints": [],
352
+ "runtime": [
353
+ "@openmrs/esm-stock-management-app",
354
+ "main"
355
+ ],
356
+ "files": [
357
+ "757.js"
358
+ ],
359
+ "auxiliaryFiles": [],
360
+ "hash": "1673f3931afe5889",
361
+ "childrenByOrder": {}
362
+ },
363
+ {
364
+ "rendered": true,
365
+ "initial": false,
366
+ "entry": false,
367
+ "recorded": false,
368
+ "size": 9609,
369
+ "sizes": {
370
+ "javascript": 9609
371
+ },
372
+ "names": [],
373
+ "idHints": [],
374
+ "runtime": [
375
+ "@openmrs/esm-stock-management-app",
376
+ "main"
377
+ ],
378
+ "files": [
379
+ "788.js"
380
+ ],
381
+ "auxiliaryFiles": [],
382
+ "hash": "ea169669bdd9d02e",
383
+ "childrenByOrder": {}
384
+ },
275
385
  {
276
386
  "rendered": true,
277
387
  "initial": false,
@@ -299,6 +409,50 @@
299
409
  "hash": "63121f39673cb859",
300
410
  "childrenByOrder": {}
301
411
  },
412
+ {
413
+ "rendered": true,
414
+ "initial": false,
415
+ "entry": false,
416
+ "recorded": false,
417
+ "size": 11292,
418
+ "sizes": {
419
+ "javascript": 11292
420
+ },
421
+ "names": [],
422
+ "idHints": [],
423
+ "runtime": [
424
+ "@openmrs/esm-stock-management-app",
425
+ "main"
426
+ ],
427
+ "files": [
428
+ "807.js"
429
+ ],
430
+ "auxiliaryFiles": [],
431
+ "hash": "19a2bffdfb06fcf0",
432
+ "childrenByOrder": {}
433
+ },
434
+ {
435
+ "rendered": true,
436
+ "initial": false,
437
+ "entry": false,
438
+ "recorded": false,
439
+ "size": 10017,
440
+ "sizes": {
441
+ "javascript": 10017
442
+ },
443
+ "names": [],
444
+ "idHints": [],
445
+ "runtime": [
446
+ "@openmrs/esm-stock-management-app",
447
+ "main"
448
+ ],
449
+ "files": [
450
+ "833.js"
451
+ ],
452
+ "auxiliaryFiles": [],
453
+ "hash": "dc7f9b3f51a934e7",
454
+ "childrenByOrder": {}
455
+ },
302
456
  {
303
457
  "rendered": true,
304
458
  "initial": false,
package/dist/routes.json CHANGED
@@ -1 +1 @@
1
- {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"root","route":"stock-management"}],"version":"1.0.1-pre.476"}
1
+ {"$schema":"https://json.openmrs.org/routes.schema.json","backendDependencies":{"fhir2":">=1.2","webservices.rest":"^2.24.0"},"extensions":[{"name":"stock-nav-menu","slot":"stock-sidebar-slot","component":"stockNavMenu","online":true,"offline":true},{"name":"overview-db-link","slot":"stock-page-dashboard-slot","component":"stockOverviewLink","meta":{"name":"overview","slot":"overview-dashboard-slot","title":"overview"},"order":0,"online":true,"offline":true},{"name":"stock-overview-db","slot":"overview-dashboard-slot","component":"stockOverview"},{"name":"operations-db-link","slot":"stock-page-dashboard-slot","component":"stockOperationsLink","meta":{"name":"operations","slot":"operations-dashboard-slot","title":"operations"},"order":2,"online":true,"offline":true},{"name":"stock-operations-db","slot":"operations-dashboard-slot","component":"stockOperations"},{"name":"items-db-link","slot":"stock-page-dashboard-slot","component":"stockItemsLink","meta":{"name":"items","slot":"items-dashboard-slot","title":"items"},"order":1,"online":true,"offline":true},{"name":"stock-items-db","slot":"items-dashboard-slot","component":"stockItems"},{"name":"user-scopes-db-link","slot":"stock-page-dashboard-slot","component":"stockUserScopesLink","meta":{"name":"user-scopes","slot":"user-scopes-dashboard-slot","title":"user-scopes"},"order":3,"online":true,"offline":true},{"name":"stock-user-scopes-db","slot":"user-scopes-dashboard-slot","component":"stockUserScopes"},{"name":"sources-db-link","slot":"stock-page-dashboard-slot","component":"stockSourcesLink","meta":{"name":"sources","slot":"sources-dashboard-slot","title":"Sources"},"order":2,"online":true,"offline":true},{"name":"stock-sources-db","slot":"sources-dashboard-slot","component":"stockSources"},{"name":"locations-db-link","slot":"stock-page-dashboard-slot","component":"stockLocationsLink","meta":{"name":"locations","slot":"locations-dashboard-slot","title":"Locations"},"order":4,"online":true,"offline":true},{"name":"stock-locations-db","slot":"locations-dashboard-slot","component":"stockLocations"},{"name":"reports-db-link","slot":"stock-page-dashboard-slot","component":"stockReportsLink","meta":{"name":"reports","slot":"reports-dashboard-slot","title":"Reports"},"order":5,"online":true,"offline":true},{"name":"stock-reports-db","slot":"reports-dashboard-slot","component":"stockReports"},{"name":"settings-db-link","slot":"stock-page-dashboard-slot","component":"stockSettingsLink","meta":{"name":"settings","slot":"settings-dashboard-slot","title":"Settings"},"order":6,"online":true,"offline":true},{"name":"stock-settings-db","slot":"settings-dashboard-slot","component":"stockSettings"},{"name":"stock-management-admin-card-link","slot":"system-admin-page-card-link-slot","component":"stockManagementAdminCardLink"},{"name":"stock-operation-dialog","component":"stockOperationDialog"},{"name":"import-bulk-stock-items","component":"importBulkStockItemsDialog"},{"name":"delete-stock-modal","component":"deleteStockModal"},{"name":"delete-stock-user-scope-modal","component":"deleteUserScopeModal"},{"name":"stock-management-app-menu-item","component":"stockManagementAppMenuItem","slot":"app-menu-item-slot","meta":{"name":" Stock Management"}},{"name":"delete-stock-rule-modal","component":"deleteStockRuleModal"},{"name":"delete-packaging-unit-modal","component":"deletePackagingUnitModal"},{"name":"delete-packaging-unit-button","component":"deletePackagingUnitButton"}],"pages":[{"component":"root","route":"stock-management"}],"version":"1.0.1-pre.479"}
@@ -42,7 +42,7 @@ module.exports = {
42
42
  lineEnding: "auto",
43
43
  // Control the line ending. See options at https://github.com/ryanve/eol
44
44
 
45
- locales: ["en"],
45
+ locales: ["en", "am", "ar", "he", "es", "fr", "km", "zh"],
46
46
  // An array of the locales in your applications
47
47
 
48
48
  namespaceSeparator: ":",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.476",
3
+ "version": "1.0.1-pre.479",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Stock management microfrontend for OpenMRS 3.x",
6
6
  "browser": "dist/openmrs-esm-stock-management-app.js",
@@ -18,7 +18,7 @@
18
18
  "verify": "turbo lint typescript coverage",
19
19
  "coverage": "yarn test --coverage",
20
20
  "prepare": "husky install",
21
- "extract-translations": "i18next 'src/**/*.component.tsx' --config ./i18next-parser.config.js"
21
+ "extract-translations": "i18next 'src/**/*.component.tsx' 'src/**/*.tsx' --config ./i18next-parser.config.js"
22
22
  },
23
23
  "husky": {
24
24
  "hooks": {
@@ -58,7 +58,7 @@ const MetricsCard: React.FC<MetricsCardProps> = ({
58
58
  {!isEmpty(count) && (
59
59
  <div className={styles.countGrid}>
60
60
  <span style={{ color: "#DA1E28" }}>
61
- {t("in6months", "In 6 months")}
61
+ {t("in6Months", "In 6 months")}
62
62
  </span>
63
63
  <p style={{ color: "#DA1E28" }}>{count.expiry6months?.length}</p>
64
64
  </div>
@@ -66,10 +66,10 @@ const MetricsCard: React.FC<MetricsCardProps> = ({
66
66
  {!isEmpty(outofstockCount) && (
67
67
  <div className={styles.countGrid}>
68
68
  <span style={{ color: "#DA1E28" }}>
69
- {t("itemsbelowmin", "Items Below Min")}
69
+ {t("itemsBelowMin", "Items Below Min")}
70
70
  </span>
71
71
  <span style={{ color: "#319227" }}>
72
- {t("itemsabovemax", "Items Above Max")}
72
+ {t("itemsAboveMax", "Items Above Max")}
73
73
  </span>
74
74
  <p style={{ color: "#DA1E28" }}>
75
75
  {outofstockCount.itemsbelowmin?.length}
@@ -24,7 +24,13 @@ export const PrivilagedView: React.FC<PrivilageComponentProps> = ({
24
24
  <p className={styles.content}>{t("noPrivilagesTitle", `${title}`)}</p>
25
25
  {description && (
26
26
  <p className={styles.helper}>
27
- {t("noViewPrivilegesDescription", `${description}`)}
27
+ {t(
28
+ "noViewPrivilegesDescription",
29
+ "Description: {{description}}",
30
+ {
31
+ description,
32
+ }
33
+ )}
28
34
  </p>
29
35
  )}
30
36
  </div>
@@ -198,7 +198,7 @@ const DataList: React.FC<ListProps> = ({
198
198
  <Tile className={styles.tile}>
199
199
  <div className={styles.tileContent}>
200
200
  <p className={styles.content}>
201
- {t("No data", "No data to display")}
201
+ {t("noData", "No data to display")}
202
202
  </p>
203
203
  <p className={styles.helper}>
204
204
  {t("checkFilters", "Check the filters above")}
@@ -37,7 +37,7 @@ const ImportDialogPopup: React.FC<ImportDialogPopupProps> = ({
37
37
  title: t("rejectOrder", "Uploaded Order"),
38
38
  kind: "success",
39
39
  subtitle: t(
40
- "Successfully uploaded",
40
+ "SuccessfullyUploadedStockItem",
41
41
  `You have successfully uploaded stock items`
42
42
  ),
43
43
  });
@@ -46,7 +46,8 @@ const ImportDialogPopup: React.FC<ImportDialogPopupProps> = ({
46
46
  (err) => {
47
47
  showSnackbar({
48
48
  title: t(
49
- `errorUploadingItems', 'An error occurred uploading stock items`
49
+ "errorUploadingItems",
50
+ "An error occurred uploading stock items"
50
51
  ),
51
52
  kind: "error",
52
53
  isLowContrast: true,
@@ -8,12 +8,12 @@ const AddStockItemActionButton: React.FC = () => {
8
8
  const { t } = useTranslation();
9
9
 
10
10
  const handleClick = useCallback(() => {
11
- launchAddOrEditDialog(initialValues, false);
11
+ launchAddOrEditDialog(t, initialValues, false);
12
12
  }, []);
13
13
 
14
14
  return (
15
15
  <Button onClick={handleClick} size="md" kind="primary">
16
- {t("stockmanagement.addnew", "Add New")}
16
+ {t("addNewStock", "Add New")}
17
17
  </Button>
18
18
  );
19
19
  };
@@ -44,11 +44,11 @@ const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({
44
44
  closeModal();
45
45
  showSnackbar({
46
46
  isLowContrast: true,
47
- title: t("deletePackagingUnitTitle", `Delete packing item `),
47
+ title: t("deletePackagingUnitTitle", "Delete packing item"),
48
48
  kind: "success",
49
49
  subtitle: t(
50
50
  "deletePackagingUnitMesaage",
51
- `Stock Item packing unit deleted Successfully`
51
+ "Stock Item packing unit deleted Successfully"
52
52
  ),
53
53
  });
54
54
  },
@@ -56,7 +56,7 @@ const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({
56
56
  showSnackbar({
57
57
  title: t(
58
58
  "deletePackingUnitErrorTitle",
59
- `Error Deleting a stock item packing unit`
59
+ "Error Deleting a stock item packing unit"
60
60
  ),
61
61
  kind: "error",
62
62
  isLowContrast: true,
@@ -78,7 +78,7 @@ const DeletePackagingUnit: React.FC<DeletePackagingUnitProps> = ({
78
78
  <span>
79
79
  {t(
80
80
  "removePackagingUnitConfirmation",
81
- `Would you really like to remove the packaging unit ${row?.packagingUomName} from the stock item?`
81
+ "Would you really like to remove the packaging unit ${row?.packagingUomName} from the stock item?"
82
82
  )}
83
83
  </span>
84
84
  <TextArea
@@ -22,7 +22,7 @@ const AddStockRuleActionButton: React.FC<AddStockRuleActionButtonProps> = ({
22
22
 
23
23
  return (
24
24
  <Button onClick={handleClick} size="md" kind="primary">
25
- {t("stockmanagement.addnewrule", "Add New Rule")}
25
+ {t("addNewStockRule", "Add New Rule")}
26
26
  </Button>
27
27
  );
28
28
  };
@@ -165,7 +165,7 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
165
165
  title: t("addedRule", "Add Rule"),
166
166
  kind: "success",
167
167
  subtitle: t(
168
- "stockruleaddedsuccessfully",
168
+ "stockRuleAddedSuccessfully",
169
169
  "Stock Rule Added Successfully"
170
170
  ),
171
171
  });
@@ -173,7 +173,7 @@ const StockRulesAddOrUpdate: React.FC<AddStockRuleProps> = ({
173
173
  },
174
174
  (error) => {
175
175
  showSnackbar({
176
- title: t(`errorAddingRule', 'error adding a rule`),
176
+ title: t("errorAddingRule", "Error adding a rule"),
177
177
  kind: "error",
178
178
  isLowContrast: true,
179
179
  subtitle: error?.message,
@@ -30,7 +30,7 @@ const StockRulesDeleteActionMenu: React.FC<StockRulesDeleteActionMenuProps> = ({
30
30
  title: t("deletingRule", "Delete Rule"),
31
31
  kind: "success",
32
32
  subtitle: t(
33
- "stockruledeletedsuccessfully",
33
+ "stockRuleDeletedSuccessfully",
34
34
  "Stock Rule Deleted Successfully"
35
35
  ),
36
36
  });
@@ -38,7 +38,7 @@ const StockRulesDeleteActionMenu: React.FC<StockRulesDeleteActionMenuProps> = ({
38
38
  (error) => {
39
39
  setDeletingRule(false);
40
40
  showSnackbar({
41
- title: t(`errorDeletingRule', 'error deleting a rule`),
41
+ title: t("errorDeletingRule", "Error deleting a rule"),
42
42
  kind: "error",
43
43
  isLowContrast: true,
44
44
  subtitle: error?.message,
@@ -19,7 +19,7 @@ const EditStockItemActionsMenu: React.FC<EditStockItemActionsMenuProps> = ({
19
19
  size="md"
20
20
  onClick={() => {
21
21
  data.isDrug = !!data.drugUuid;
22
- launchAddOrEditDialog(data, true);
22
+ launchAddOrEditDialog(t, data, true);
23
23
  }}
24
24
  iconDescription={t("editStockItem", "Edit Stock Item")}
25
25
  >
@@ -1,11 +1,13 @@
1
+ import React from "react";
1
2
  import { closeOverlay, launchOverlay } from "../core/components/overlay/hook";
2
3
  import { StockItemDTO } from "../core/api/types/stockItem/StockItem";
3
- import React from "react";
4
+ import { type TFunction } from "react-i18next";
4
5
  import AddEditStockItem from "./add-stock-item/add-stock-item.component";
5
6
  import { FetchResponse, showSnackbar } from "@openmrs/esm-framework";
6
7
  import { createStockItem, updateStockItem } from "./stock-items.resource";
7
8
 
8
9
  export const addOrEditStockItem = async (
10
+ t: TFunction,
9
11
  stockItem: StockItemDTO,
10
12
  isEditing = false
11
13
  ) => {
@@ -17,9 +19,13 @@ export const addOrEditStockItem = async (
17
19
  if (response?.data) {
18
20
  showSnackbar({
19
21
  isLowContrast: true,
20
- title: `${isEditing ? "Edit" : "Add"} Stock Item`,
22
+ title: isEditing
23
+ ? `${t("editStockItem", "Edit Stock Item")}`
24
+ : `${t("addStockItem", "Add Stock Item")}`,
21
25
  kind: "success",
22
- subtitle: `Stock Item ${isEditing ? "Edited" : "Added"} Successfully`,
26
+ subtitle: isEditing
27
+ ? `${t("stockItemEdited", "Stock Item Edited Successfully")}`
28
+ : `${t("stockItemAdded", "Stock Item Added Successfully")}`,
23
29
  });
24
30
 
25
31
  if (!isEditing) {
@@ -28,12 +34,14 @@ export const addOrEditStockItem = async (
28
34
  // launch edit dialog
29
35
  const item = response.data;
30
36
  item.isDrug = !!item.drugUuid;
31
- launchAddOrEditDialog(item, true);
37
+ launchAddOrEditDialog(t, item, true);
32
38
  }
33
39
  }
34
40
  } catch (error) {
35
41
  showSnackbar({
36
- title: `Error ${isEditing ? "edit" : "add"}ing a stock item`,
42
+ title: isEditing
43
+ ? t("errorEditingStockItem", "Error editing a stock Item")
44
+ : t("errorAddingStockItem", "Error adding a stock Item"),
37
45
  kind: "error",
38
46
  isLowContrast: true,
39
47
  subtitle: error?.responseBody?.error?.message,
@@ -42,16 +50,21 @@ export const addOrEditStockItem = async (
42
50
  };
43
51
 
44
52
  export const launchAddOrEditDialog = (
53
+ t: TFunction,
45
54
  stockItem: StockItemDTO,
46
55
  isEditing = false
47
56
  ) => {
48
57
  launchOverlay(
49
- `${isEditing ? "Edit" : "Add"} ${
50
- stockItem?.drugName || stockItem.conceptName || ""
51
- }`,
58
+ isEditing
59
+ ? t("editItem", "Edit {{name}}", {
60
+ name: stockItem?.drugName || stockItem.conceptName || "",
61
+ })
62
+ : t("addItem", "Add {{name}}", {
63
+ name: stockItem?.drugName || stockItem.conceptName || "",
64
+ }),
52
65
  <AddEditStockItem
53
66
  model={stockItem}
54
- onSave={(stockItem) => addOrEditStockItem(stockItem, isEditing)}
67
+ onSave={(stockItem) => addOrEditStockItem(t, stockItem, isEditing)}
55
68
  isEditing={isEditing}
56
69
  />
57
70
  );
@@ -146,7 +146,7 @@ const StockItemsTableComponent: React.FC<StockItemsTableProps> = () => {
146
146
  size="md"
147
147
  onClick={() => {
148
148
  stockItem.isDrug = !!stockItem.drugUuid;
149
- launchAddOrEditDialog(stockItem, true);
149
+ launchAddOrEditDialog(t, stockItem, true);
150
150
  }}
151
151
  iconDescription={t("editStockItem", "Edit Stock Item")}
152
152
  renderIcon={(props) => <Edit size={16} {...props} />}
@@ -4,6 +4,7 @@ import { showSnackbar } from "@openmrs/esm-framework";
4
4
  import { saveLocation } from "./stock-locations-table.resource";
5
5
  import { locationData, LocationMutator } from "../stock-items/types";
6
6
  import LocationAdministrationForm from "./location-admin-form.component";
7
+ import { extractErrorMessagesFromResponse } from "../constants";
7
8
 
8
9
  interface LocationFormProps {
9
10
  showModal: boolean;
@@ -39,18 +40,23 @@ const NewLocationForm: React.FC<LocationFormProps> = ({
39
40
  title: t("formCreated", "Add Location"),
40
41
  kind: "success",
41
42
  isLowContrast: true,
42
- subtitle: t(`Location ${name} was created successfully.`),
43
+ subtitle: t(
44
+ "locationCreatedSuccessfully",
45
+ "Location {{locationName}} was created successfully.",
46
+ { locationName: name }
47
+ ),
43
48
  });
44
49
 
45
50
  mutate();
46
51
  onModalChange(false);
47
52
  })
48
53
  .catch((error) => {
54
+ const errorMessages = extractErrorMessagesFromResponse(error);
49
55
  showSnackbar({
50
56
  title: t("errorCreatingForm", "Error creating location"),
51
57
  kind: "error",
52
58
  isLowContrast: true,
53
- subtitle: error?.message,
59
+ subtitle: errorMessages.join(", "),
54
60
  });
55
61
  onModalChange(false);
56
62
  });
@@ -13,7 +13,6 @@ import {
13
13
  TextInput,
14
14
  InlineNotification,
15
15
  FilterableMultiSelect,
16
- InlineLoading,
17
16
  } from "@carbon/react";
18
17
  import { useTranslation } from "react-i18next";
19
18
  import { locationData } from "../stock-items/types";
@@ -50,7 +49,7 @@ const LocationAdministrationForm: React.FC<LocationAdministrationFormProps> = ({
50
49
  const [formStateError, setFormStateError] = useState("");
51
50
 
52
51
  // Location tag types
53
- const { locationTagList: Tags, loading: loadingRoles } = useLocationTags();
52
+ const { locationTagList: Tags } = useLocationTags();
54
53
 
55
54
  const {
56
55
  handleSubmit,
@@ -120,10 +119,10 @@ const LocationAdministrationForm: React.FC<LocationAdministrationFormProps> = ({
120
119
  <Controller
121
120
  name="tags"
122
121
  control={control}
123
- render={({ field, fieldState }) => (
122
+ render={({ field }) => (
124
123
  <FilterableMultiSelect
125
124
  id="tag"
126
- titleText="Select tag(s)"
125
+ titleText={t("selectTags", "Select tag(s)")}
127
126
  helperText="This is helper text"
128
127
  items={Tags ?? []}
129
128
  {...field}
@@ -142,7 +141,11 @@ const LocationAdministrationForm: React.FC<LocationAdministrationFormProps> = ({
142
141
  style={{ minWidth: "100%", margin: "0rem", padding: "0rem" }}
143
142
  role="alert"
144
143
  kind="error"
145
- subtitle={t("pleaseFillField", formStateError) + "."}
144
+ subtitle={
145
+ t("pleaseFillField", "{{message}}", {
146
+ message: formStateError,
147
+ }) + "."
148
+ }
146
149
  onClose={() => setShowErrorNotification(false)}
147
150
  />
148
151
  )}
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState } from "react";
1
+ import React, { useState } from "react";
2
2
  import { useStockLocationPages } from "./stock-locations-table.resource";
3
3
  import {
4
4
  Button,
@@ -35,18 +35,6 @@ const StockLocationsItems: React.FC<StockLocationsTableProps> = () => {
35
35
  handleMutate(`${restBaseUrl}/Location?_summary=data`);
36
36
  };
37
37
 
38
- const createStockLocation = () => {
39
- {
40
- showLocationModal ? (
41
- <NewLocationForm
42
- onModalChange={setAddLocationModal}
43
- showModal={showLocationModal}
44
- mutate={mutate}
45
- />
46
- ) : null;
47
- }
48
- };
49
-
50
38
  if (isLoading) {
51
39
  return <DataTableSkeleton role="progressbar" />;
52
40
  }
@@ -85,7 +73,9 @@ const StockLocationsItems: React.FC<StockLocationsTableProps> = () => {
85
73
  return (
86
74
  <div className={styles.tileContainer}>
87
75
  <Tile className={styles.tile}>
88
- <p className={styles.content}>No stock items to display</p>
76
+ <p className={styles.content}>
77
+ {t("noStockItemsToDisplay", "No stock items to display")}
78
+ </p>
89
79
  </Tile>
90
80
  </div>
91
81
  );