@openmrs/esm-stock-management-app 1.0.1-pre.509 → 1.0.1-pre.514

Sign up to get free protection for your applications and to get access to all the features.
@@ -85,9 +85,9 @@
85
85
  "initial": false,
86
86
  "entry": false,
87
87
  "recorded": false,
88
- "size": 1733497,
88
+ "size": 1733858,
89
89
  "sizes": {
90
- "javascript": 1733287,
90
+ "javascript": 1733648,
91
91
  "consume-shared": 210
92
92
  },
93
93
  "names": [],
@@ -101,7 +101,7 @@
101
101
  "auxiliaryFiles": [
102
102
  "157.js.map"
103
103
  ],
104
- "hash": "13b0960f00e48981",
104
+ "hash": "04f4bbc9ccf6cac6",
105
105
  "childrenByOrder": {}
106
106
  },
107
107
  {
@@ -109,10 +109,10 @@
109
109
  "initial": true,
110
110
  "entry": true,
111
111
  "recorded": false,
112
- "size": 5401924,
112
+ "size": 5402285,
113
113
  "sizes": {
114
114
  "consume-shared": 252,
115
- "javascript": 5379974,
115
+ "javascript": 5380335,
116
116
  "share-init": 252,
117
117
  "runtime": 21446
118
118
  },
@@ -129,7 +129,7 @@
129
129
  "auxiliaryFiles": [
130
130
  "main.js.map"
131
131
  ],
132
- "hash": "868181b0c33268be",
132
+ "hash": "100861ca78612a07",
133
133
  "childrenByOrder": {}
134
134
  },
135
135
  {
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.509"}
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.514"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.509",
3
+ "version": "1.0.1-pre.514",
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",
@@ -33,7 +33,7 @@ import { InitializeResult } from "./types";
33
33
  import { ResourceRepresentation } from "../../core/api/api";
34
34
  import { useStockOperationPages } from "../stock-operations-table.resource";
35
35
  import { createBaseOperationPayload } from "./add-stock-utils";
36
- import { showSnackbar } from "@openmrs/esm-framework";
36
+ import { showSnackbar, useSession } from "@openmrs/esm-framework";
37
37
 
38
38
  import rootStyles from "../../root.scss";
39
39
 
@@ -67,6 +67,8 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
67
67
  });
68
68
  const operationType = operationFromString(operation?.operationType);
69
69
  const issueStockOperation = mapIssueStockLocations(model);
70
+ const { user } = useSession();
71
+ const defaultLoggedUserUuid = user.uuid;
70
72
 
71
73
  const {
72
74
  handleSubmit,
@@ -243,6 +245,7 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
243
245
  title={t("responsiblePerson:", "Responsible Person")}
244
246
  placeholder={t("filter", "Filter ...")}
245
247
  invalid={!!errors.responsiblePersonUuid}
248
+ userUuid={defaultLoggedUserUuid}
246
249
  invalidText={
247
250
  errors.responsiblePersonUuid &&
248
251
  errors?.responsiblePersonUuid?.message
@@ -57,14 +57,7 @@ const EditStockOperationActionMenu: React.FC<
57
57
  iconDescription={"View"}
58
58
  kind="ghost"
59
59
  onClick={() => {
60
- launchAddOrEditDialog(
61
- t,
62
- model ?? operation,
63
- true,
64
- type,
65
- operations,
66
- false
67
- );
60
+ launchAddOrEditDialog(t, model ?? operation, true, type, operations);
68
61
  }}
69
62
  >
70
63
  {operationNumber ? operationNumber : `${model?.operationNumber}`}
@@ -27,7 +27,8 @@ export const addOrEditStockOperation = async (
27
27
  isEditing: boolean,
28
28
  operation?: StockOperationType,
29
29
  operations?: StockOperationType[],
30
- canPrint?: boolean
30
+ canPrint?: boolean,
31
+ printEnabled?: boolean
31
32
  ) => {
32
33
  const payload = stockOperation;
33
34
  try {
@@ -83,6 +84,9 @@ export const launchAddOrEditDialog = (
83
84
  operations?: StockOperationType[],
84
85
  canPrint?: boolean
85
86
  ) => {
87
+ const printEnabled =
88
+ canPrint !== undefined ? canPrint : stockOperation?.status === "COMPLETED";
89
+
86
90
  launchOverlay(
87
91
  isEditing
88
92
  ? t("editOperationTitle", "Edit {{operationType}}", {
@@ -100,7 +104,8 @@ export const launchAddOrEditDialog = (
100
104
  isEditing,
101
105
  operation,
102
106
  operations,
103
- canPrint
107
+ canPrint,
108
+ printEnabled
104
109
  )
105
110
  }
106
111
  isEditing={isEditing}
@@ -108,6 +113,7 @@ export const launchAddOrEditDialog = (
108
113
  canEdit={
109
114
  isEditing ? (stockOperation?.status === "NEW" ? true : false) : true
110
115
  }
116
+ canPrint={printEnabled}
111
117
  />
112
118
  );
113
119
  };