@openmrs/esm-stock-management-app 1.0.1-pre.464 → 1.0.1-pre.467

Sign up to get free protection for your applications and to get access to all the features.
@@ -86,10 +86,10 @@
86
86
  "initial": true,
87
87
  "entry": true,
88
88
  "recorded": false,
89
- "size": 4763084,
89
+ "size": 4763480,
90
90
  "sizes": {
91
91
  "consume-shared": 252,
92
- "javascript": 4741135,
92
+ "javascript": 4741531,
93
93
  "share-init": 252,
94
94
  "runtime": 21445
95
95
  },
@@ -106,7 +106,7 @@
106
106
  "auxiliaryFiles": [
107
107
  "main.js.map"
108
108
  ],
109
- "hash": "e9a2b88cc084f4ab",
109
+ "hash": "1b25ee6a5d6d7b6e",
110
110
  "childrenByOrder": {}
111
111
  },
112
112
  {
@@ -138,9 +138,9 @@
138
138
  "initial": false,
139
139
  "entry": false,
140
140
  "recorded": false,
141
- "size": 1091372,
141
+ "size": 1091768,
142
142
  "sizes": {
143
- "javascript": 1091162,
143
+ "javascript": 1091558,
144
144
  "consume-shared": 210
145
145
  },
146
146
  "names": [],
@@ -154,7 +154,7 @@
154
154
  "auxiliaryFiles": [
155
155
  "474.js.map"
156
156
  ],
157
- "hash": "8f2f8e9691b245f7",
157
+ "hash": "7bb203dc9788e158",
158
158
  "childrenByOrder": {}
159
159
  },
160
160
  {
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.464"}
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.467"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.464",
3
+ "version": "1.0.1-pre.467",
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",
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useMemo, useState } from "react";
2
- import { showSnackbar } from "@openmrs/esm-framework";
2
+ import { showSnackbar, restBaseUrl } from "@openmrs/esm-framework";
3
3
  import { useTranslation } from "react-i18next";
4
4
  import { useStockItemPackageUnitsHook } from "./packaging-units.resource";
5
5
  import {
@@ -26,8 +26,10 @@ import {
26
26
  updateStockItemPackagingUnit,
27
27
  } from "../../stock-items.resource";
28
28
  import DeleteModalButton from "./packaging-units-delete-modal-button.component";
29
+ import { handleMutate } from "../../../utils";
29
30
 
30
31
  import styles from "./packaging-units.scss";
32
+ import { closeOverlay } from "../../../core/components/overlay/hook";
31
33
 
32
34
  interface PackagingUnitsProps {
33
35
  isEditing?: boolean;
@@ -171,11 +173,14 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
171
173
  // Wait for all requests to complete
172
174
  Promise.all([createPromises, ...updatePromises]).then(() => {
173
175
  mutate();
176
+ handleMutate(`${restBaseUrl}/stockmanagement/stockitem`);
174
177
  reset();
175
178
  handleTabChange(0);
176
179
  });
177
180
  };
178
-
181
+ const handleCancelPackagingUnits = () => {
182
+ handleTabChange(0);
183
+ };
179
184
  const handleNewUnitFactorChange = (value: string | number) => {
180
185
  setNewUnit({
181
186
  ...newUnit,
@@ -267,6 +272,9 @@ const PackagingUnits: React.FC<PackagingUnitsProps> = ({
267
272
  )}
268
273
  />
269
274
  <div className={styles.packageUnitsBtn}>
275
+ <Button kind="secondary" onClick={handleCancelPackagingUnits}>
276
+ {t("cancel", "Cancel")}
277
+ </Button>
270
278
  <Button
271
279
  name="save"
272
280
  type="submit"
@@ -52,7 +52,9 @@ export const launchAddOrEditDialog = (
52
52
  isEditing = false
53
53
  ) => {
54
54
  launchOverlay(
55
- `${isEditing ? "Edit" : "Add"} ${stockItem?.drugName || ""}`,
55
+ `${isEditing ? "Edit" : "Add"} ${
56
+ stockItem?.drugName || stockItem.conceptName || ""
57
+ }`,
56
58
  <AddEditStockItem
57
59
  model={stockItem}
58
60
  onSave={(stockItem) => addOrEditStockItem(stockItem, isEditing)}