@openmrs/esm-stock-management-app 1.0.1-pre.484 → 1.0.1-pre.485

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": 4766853,
89
+ "size": 4763915,
90
90
  "sizes": {
91
91
  "consume-shared": 252,
92
- "javascript": 4744904,
92
+ "javascript": 4741966,
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": "e52cb3631184607a",
109
+ "hash": "26765f1fdc368317",
110
110
  "childrenByOrder": {}
111
111
  },
112
112
  {
@@ -204,9 +204,9 @@
204
204
  "initial": false,
205
205
  "entry": false,
206
206
  "recorded": false,
207
- "size": 1095141,
207
+ "size": 1092203,
208
208
  "sizes": {
209
- "javascript": 1094931,
209
+ "javascript": 1091993,
210
210
  "consume-shared": 210
211
211
  },
212
212
  "names": [],
@@ -220,7 +220,7 @@
220
220
  "auxiliaryFiles": [
221
221
  "474.js.map"
222
222
  ],
223
- "hash": "229d6a418e7c76e6",
223
+ "hash": "75f18ad427b85c95",
224
224
  "childrenByOrder": {}
225
225
  },
226
226
  {
@@ -252,9 +252,9 @@
252
252
  "initial": false,
253
253
  "entry": false,
254
254
  "recorded": false,
255
- "size": 10901,
255
+ "size": 10907,
256
256
  "sizes": {
257
- "javascript": 10901
257
+ "javascript": 10907
258
258
  },
259
259
  "names": [],
260
260
  "idHints": [],
@@ -266,7 +266,7 @@
266
266
  "574.js"
267
267
  ],
268
268
  "auxiliaryFiles": [],
269
- "hash": "73adef869115d16f",
269
+ "hash": "532db745e309f76a",
270
270
  "childrenByOrder": {}
271
271
  },
272
272
  {
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.484"}
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.485"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.484",
3
+ "version": "1.0.1-pre.485",
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",
@@ -132,6 +132,9 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
132
132
  : result.requiresDispatchAcknowledgement
133
133
  }
134
134
  actions={{
135
+ onGoBack: () => {
136
+ setSelectedIndex(1);
137
+ },
135
138
  onSave: async (model) => {
136
139
  // TODO: Update
137
140
  await addOrEditStockOperation(
@@ -143,17 +146,15 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
143
146
  props.canPrint
144
147
  );
145
148
  },
146
- onGoBack: () => {
147
- setSelectedIndex(1);
148
- },
149
+
149
150
  onComplete: async () => {
150
- await showActionDialogButton("Complete", true, props?.model);
151
+ await showActionDialogButton("Complete", false, props?.model);
151
152
  },
152
153
  onSubmit: async () => {
153
- await showActionDialogButton("Submit", true, props?.model);
154
+ await showActionDialogButton("Submit", false, props?.model);
154
155
  },
155
156
  onDispatch: async () => {
156
- await showActionDialogButton("Dispatch", true, props?.model);
157
+ await showActionDialogButton("Dispatch", false, props?.model);
157
158
  },
158
159
  }}
159
160
  />
@@ -442,6 +443,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
442
443
  <div style={{ margin: "2px" }}>
443
444
  <StockOperationCompleteDispatchButton
444
445
  operation={props?.model}
446
+ reason={false}
445
447
  />
446
448
  </div>
447
449
  <div style={{ margin: "2px" }}>
@@ -50,7 +50,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
50
50
  const { t } = useTranslation();
51
51
  const [isSaving, setIsSaving] = useState(false);
52
52
  const [approvalRequired, setApprovalRequired] = useState<boolean | null>(
53
- null
53
+ model?.approvalRequired
54
54
  );
55
55
 
56
56
  const handleRadioButtonChange = (selectedItem: boolean) => {
@@ -68,7 +68,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
68
68
  "Does the transaction require approval ?"
69
69
  )}
70
70
  onChange={handleRadioButtonChange}
71
- defaultSelected={approvalRequired}
71
+ defaultSelected={model?.approvalRequired}
72
72
  >
73
73
  <RadioButton
74
74
  value={true}
@@ -111,15 +111,10 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
111
111
  kind="primary"
112
112
  onClick={async () => {
113
113
  delete model?.dateCreated;
114
- delete model?.status;
114
+ model.status = "COMPLETED";
115
115
  setIsSaving(true);
116
- await actions.onSave(model).then(() => {
117
- delete model?.dateCreated;
118
- model.status = "COMPLETED";
119
- setIsSaving(true);
120
- actions.onComplete(model);
121
- setIsSaving(false);
122
- });
116
+ await actions.onComplete(model);
117
+ setIsSaving(false);
123
118
  }}
124
119
  renderIcon={ListChecked}
125
120
  >
@@ -137,13 +132,9 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
137
132
  delete model?.dateCreated;
138
133
  delete model?.status;
139
134
  setIsSaving(true);
140
- await actions.onSave(model).then(() => {
141
- delete model?.dateCreated;
142
- model.status = "COMPLETED";
143
- setIsSaving(true);
144
- actions.onDispatch(model);
145
- setIsSaving(false);
146
- });
135
+ model.status = "DISPATCHED";
136
+ await actions.onDispatch(model);
137
+ setIsSaving(false);
147
138
  }}
148
139
  renderIcon={Departure}
149
140
  >
@@ -160,7 +151,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
160
151
  onClick={actions.onSubmit}
161
152
  renderIcon={SendFilled}
162
153
  >
163
- {t("submit", "Submit For Review")}
154
+ {t("submitForReview", "Submit For Review")}
164
155
  </Button>
165
156
  )}
166
157
  </>
@@ -175,6 +166,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
175
166
  delete model?.dateCreated;
176
167
  delete model?.status;
177
168
  setIsSaving(true);
169
+ model.approvalRequired = approvalRequired ? true : false;
178
170
  await actions.onSave(model);
179
171
  setIsSaving(false);
180
172
  }}
@@ -8,17 +8,18 @@ import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOper
8
8
 
9
9
  interface StockOperationCompleteButtonProps {
10
10
  operation: StockOperationDTO;
11
+ reason: boolean;
11
12
  }
12
13
 
13
14
  const StockOperationCompleteButton: React.FC<
14
15
  StockOperationCompleteButtonProps
15
- > = ({ operation }) => {
16
+ > = ({ operation, reason }) => {
16
17
  const { t } = useTranslation();
17
18
  const launchCompleteModal = useCallback(() => {
18
19
  const dispose = showModal("stock-operation-dialog", {
19
20
  title: "Complete",
20
21
  operation: operation,
21
- requireReason: true,
22
+ requireReason: reason,
22
23
  closeModal: () => dispose(),
23
24
  });
24
25
  }, [operation]);
@@ -8,17 +8,18 @@ import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOper
8
8
 
9
9
  interface StockOperationCompleteDispatchButtonProps {
10
10
  operation: StockOperationDTO;
11
+ reason: boolean;
11
12
  }
12
13
 
13
14
  const StockOperationCompleteDispatchButton: React.FC<
14
15
  StockOperationCompleteDispatchButtonProps
15
- > = ({ operation }) => {
16
+ > = ({ operation, reason }) => {
16
17
  const { t } = useTranslation();
17
18
  const launchcompletedDispatchModal = useCallback(() => {
18
19
  const dispose = showModal("stock-operation-dialog", {
19
20
  title: "Complete Dispatch",
20
21
  operation: operation,
21
- requireReason: false,
22
+ requireReason: reason,
22
23
  closeModal: () => dispose(),
23
24
  });
24
25
  }, [operation]);
@@ -24,14 +24,14 @@ import {
24
24
  StructuredListRow,
25
25
  StructuredListCell,
26
26
  StructuredListBody,
27
- OverflowMenu,
28
- OverflowMenuItem,
29
27
  DatePickerInput,
30
28
  DatePicker,
31
29
  TableToolbarMenu,
32
30
  TableToolbarAction,
31
+ Button,
33
32
  } from "@carbon/react";
34
- import { ArrowRight } from "@carbon/react/icons";
33
+ import { ArrowRight, Edit } from "@carbon/react/icons";
34
+
35
35
  import { formatDisplayDate } from "../core/utils/datetimeUtils";
36
36
  import styles from "../stock-items/stock-items-table.scss";
37
37
  import {
@@ -341,22 +341,22 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
341
341
  </div>
342
342
  ),
343
343
  actions: (
344
- <OverflowMenu flipped={"true"} aria-label="overflow-menu">
345
- <OverflowMenuItem itemText="Complete" onClick={handleOnComplete} />
346
- <OverflowMenuItem
347
- itemText="Edit"
348
- onClick={() => {
349
- launchAddOrEditDialog(
350
- t,
351
- filteredItems[index],
352
- true,
353
- operation,
354
- operations,
355
- false
356
- );
357
- }}
358
- />
359
- </OverflowMenu>
344
+ <Button
345
+ kind="ghost"
346
+ size="md"
347
+ onClick={() => {
348
+ launchAddOrEditDialog(
349
+ t,
350
+ filteredItems[index],
351
+ true,
352
+ operation,
353
+ operations,
354
+ false
355
+ );
356
+ }}
357
+ iconDescription={t("editStockItem", "Edit Stock Item")}
358
+ renderIcon={(props) => <Edit size={16} {...props} />}
359
+ ></Button>
360
360
  ),
361
361
  }));
362
362
  }, [handleOnComplete, filteredItems, operation, operations, t]);
@@ -520,10 +520,6 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
520
520
  <StructuredListCell head>
521
521
  {t("dateCompleted", "Date Completed")}
522
522
  </StructuredListCell>
523
- <StructuredListCell head>
524
- {t("batchNumber", "Batch Number")}
525
- </StructuredListCell>
526
- <StructuredListCell head>Qty</StructuredListCell>
527
523
  </StructuredListRow>
528
524
  </StructuredListHead>
529
525
  <StructuredListBody>
@@ -556,24 +552,6 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
556
552
  ? filteredItems[index]?.creatorFamilyName
557
553
  : ""}
558
554
  </StructuredListCell>
559
- <StructuredListCell>
560
- {filteredItems[index]?.stockOperationItems
561
- ? filteredItems[
562
- index
563
- ].stockOperationItems?.map(
564
- (item) => item.batchNo
565
- )[0]
566
- : ""}
567
- </StructuredListCell>
568
- <StructuredListCell>
569
- {filteredItems[index]?.stockOperationItems
570
- ? filteredItems[
571
- index
572
- ].stockOperationItems?.map(
573
- (item) => item.quantity
574
- )[0]
575
- : ""}
576
- </StructuredListCell>
577
555
  </StructuredListRow>
578
556
  <StructuredListRow>
579
557
  <StructuredListCell noWrap>
@@ -618,24 +596,6 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
618
596
  ? items[index]?.creatorFamilyName
619
597
  : ""}
620
598
  </StructuredListCell>
621
- <StructuredListCell>
622
- {filteredItems[index]?.stockOperationItems
623
- ? filteredItems[
624
- index
625
- ].stockOperationItems?.map(
626
- (item) => item.batchNo
627
- )[1]
628
- : ""}
629
- </StructuredListCell>
630
- <StructuredListCell>
631
- {filteredItems[index]?.stockOperationItems
632
- ? filteredItems[
633
- index
634
- ].stockOperationItems?.map(
635
- (item) => item.quantity
636
- )[1]
637
- : ""}
638
- </StructuredListCell>
639
599
  </StructuredListRow>
640
600
  </StructuredListBody>
641
601
  </>
@@ -52,8 +52,8 @@
52
52
  "code": "Code",
53
53
  "comingSoonUnderDev": "Exciting updates are on the way! In the meantime, use the link below to access Admin UI settings.",
54
54
  "commonName": "Common Name",
55
- "complete": "Complete Dispatch ",
56
- "completed": "Completed",
55
+ "completedispatch": "Complete Dispatch ",
56
+ "complete": "Complete",
57
57
  "continue": "Continue",
58
58
  "created": "Created",
59
59
  "createLocation": "Create Location",