@openmrs/esm-stock-management-app 1.0.1-pre.530 → 1.0.1-pre.543

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": 1736785,
88
+ "size": 1739943,
89
89
  "sizes": {
90
- "javascript": 1736575,
90
+ "javascript": 1739733,
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": "b8776b32894c2d4f",
104
+ "hash": "6e1e36609f817bba",
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": 5405212,
112
+ "size": 5408370,
113
113
  "sizes": {
114
114
  "consume-shared": 252,
115
- "javascript": 5383262,
115
+ "javascript": 5386420,
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": "0928e485f903a05b",
132
+ "hash": "8eb04c77d0daacf5",
133
133
  "childrenByOrder": {}
134
134
  },
135
135
  {
@@ -251,9 +251,9 @@
251
251
  "initial": false,
252
252
  "entry": false,
253
253
  "recorded": false,
254
- "size": 10907,
254
+ "size": 10901,
255
255
  "sizes": {
256
- "javascript": 10907
256
+ "javascript": 10901
257
257
  },
258
258
  "names": [],
259
259
  "idHints": [],
@@ -265,7 +265,7 @@
265
265
  "574.js"
266
266
  ],
267
267
  "auxiliaryFiles": [],
268
- "hash": "532db745e309f76a",
268
+ "hash": "73adef869115d16f",
269
269
  "childrenByOrder": {}
270
270
  },
271
271
  {
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.530"}
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.543"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-stock-management-app",
3
- "version": "1.0.1-pre.530",
3
+ "version": "1.0.1-pre.543",
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",
@@ -182,9 +182,6 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
182
182
  : result.requiresDispatchAcknowledgement
183
183
  }
184
184
  actions={{
185
- onGoBack: () => {
186
- setSelectedIndex(1);
187
- },
188
185
  onSave: async (model) => {
189
186
  // TODO: Update
190
187
  await addOrEditStockOperation(
@@ -196,15 +193,17 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
196
193
  props.canPrint
197
194
  );
198
195
  },
199
-
196
+ onGoBack: () => {
197
+ setSelectedIndex(1);
198
+ },
200
199
  onComplete: async () => {
201
- await showActionDialogButton("Complete", false, props?.model);
200
+ await showActionDialogButton("Complete", true, props?.model);
202
201
  },
203
202
  onSubmit: async () => {
204
- await showActionDialogButton("Submit", false, props?.model);
203
+ await showActionDialogButton("Submit", true, props?.model);
205
204
  },
206
205
  onDispatch: async () => {
207
- await showActionDialogButton("Dispatch", false, props?.model);
206
+ await showActionDialogButton("Dispatch", true, props?.model);
208
207
  },
209
208
  }}
210
209
  />
@@ -506,7 +505,6 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
506
505
  <div style={{ margin: "2px" }}>
507
506
  <StockOperationCompleteDispatchButton
508
507
  operation={props?.model}
509
- reason={false}
510
508
  />
511
509
  </div>
512
510
  <div style={{ margin: "2px" }}>
@@ -1,4 +1,4 @@
1
- import React, { useState } from "react";
1
+ import React, { useState, useEffect } from "react";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOperationDTO";
4
4
  import { SaveStockOperation } from "../../stock-items/types";
@@ -83,6 +83,12 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
83
83
 
84
84
  const [isOtherUser, setIsOtherUser] = useState<boolean | null>();
85
85
  const [isSaving, setIsSaving] = useState(false);
86
+ useEffect(() => {
87
+ if (defaultLoggedUserUuid) {
88
+ setValue("responsiblePersonUuid", defaultLoggedUserUuid);
89
+ }
90
+ }, [defaultLoggedUserUuid, setValue]);
91
+
86
92
  if (isLoading) {
87
93
  return (
88
94
  <InlineLoading
@@ -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
- model?.approvalRequired
53
+ null
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={model?.approvalRequired}
71
+ defaultSelected={approvalRequired}
72
72
  >
73
73
  <RadioButton
74
74
  value={true}
@@ -111,10 +111,15 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
111
111
  kind="primary"
112
112
  onClick={async () => {
113
113
  delete model?.dateCreated;
114
- model.status = "COMPLETED";
114
+ delete model?.status;
115
115
  setIsSaving(true);
116
- await actions.onComplete(model);
117
- setIsSaving(false);
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
+ });
118
123
  }}
119
124
  renderIcon={ListChecked}
120
125
  >
@@ -132,9 +137,13 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
132
137
  delete model?.dateCreated;
133
138
  delete model?.status;
134
139
  setIsSaving(true);
135
- model.status = "DISPATCHED";
136
- await actions.onDispatch(model);
137
- setIsSaving(false);
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
+ });
138
147
  }}
139
148
  renderIcon={Departure}
140
149
  >
@@ -151,7 +160,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
151
160
  onClick={actions.onSubmit}
152
161
  renderIcon={SendFilled}
153
162
  >
154
- {t("submitForReview", "Submit For Review")}
163
+ {t("submit", "Submit For Review")}
155
164
  </Button>
156
165
  )}
157
166
  </>
@@ -166,7 +175,6 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
166
175
  delete model?.dateCreated;
167
176
  delete model?.status;
168
177
  setIsSaving(true);
169
- model.approvalRequired = approvalRequired ? true : false;
170
178
  await actions.onSave(model);
171
179
  setIsSaving(false);
172
180
  }}
@@ -8,18 +8,17 @@ import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOper
8
8
 
9
9
  interface StockOperationCompleteButtonProps {
10
10
  operation: StockOperationDTO;
11
- reason: boolean;
12
11
  }
13
12
 
14
13
  const StockOperationCompleteButton: React.FC<
15
14
  StockOperationCompleteButtonProps
16
- > = ({ operation, reason }) => {
15
+ > = ({ operation }) => {
17
16
  const { t } = useTranslation();
18
17
  const launchCompleteModal = useCallback(() => {
19
18
  const dispose = showModal("stock-operation-dialog", {
20
19
  title: "Complete",
21
20
  operation: operation,
22
- requireReason: reason,
21
+ requireReason: true,
23
22
  closeModal: () => dispose(),
24
23
  });
25
24
  }, [operation]);
@@ -8,18 +8,17 @@ import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOper
8
8
 
9
9
  interface StockOperationCompleteDispatchButtonProps {
10
10
  operation: StockOperationDTO;
11
- reason: boolean;
12
11
  }
13
12
 
14
13
  const StockOperationCompleteDispatchButton: React.FC<
15
14
  StockOperationCompleteDispatchButtonProps
16
- > = ({ operation, reason }) => {
15
+ > = ({ operation }) => {
17
16
  const { t } = useTranslation();
18
17
  const launchcompletedDispatchModal = useCallback(() => {
19
18
  const dispose = showModal("stock-operation-dialog", {
20
19
  title: "Complete Dispatch",
21
20
  operation: operation,
22
- requireReason: reason,
21
+ requireReason: false,
23
22
  closeModal: () => dispose(),
24
23
  });
25
24
  }, [operation]);
@@ -24,14 +24,14 @@ import {
24
24
  StructuredListRow,
25
25
  StructuredListCell,
26
26
  StructuredListBody,
27
+ OverflowMenu,
28
+ OverflowMenuItem,
27
29
  DatePickerInput,
28
30
  DatePicker,
29
31
  TableToolbarMenu,
30
32
  TableToolbarAction,
31
- Button,
32
33
  } from "@carbon/react";
33
- import { ArrowRight, Edit } from "@carbon/react/icons";
34
-
34
+ import { ArrowRight } from "@carbon/react/icons";
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
- <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>
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>
360
360
  ),
361
361
  }));
362
362
  }, [handleOnComplete, filteredItems, operation, operations, t]);
@@ -522,6 +522,10 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
522
522
  <StructuredListCell head>
523
523
  {t("dateCompleted", "Date Completed")}
524
524
  </StructuredListCell>
525
+ <StructuredListCell head>
526
+ {t("batchNumber", "Batch Number")}
527
+ </StructuredListCell>
528
+ <StructuredListCell head>Qty</StructuredListCell>
525
529
  </StructuredListRow>
526
530
  </StructuredListHead>
527
531
  <StructuredListBody>
@@ -554,6 +558,24 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
554
558
  ? filteredItems[index]?.creatorFamilyName
555
559
  : ""}
556
560
  </StructuredListCell>
561
+ <StructuredListCell>
562
+ {filteredItems[index]?.stockOperationItems
563
+ ? filteredItems[
564
+ index
565
+ ].stockOperationItems?.map(
566
+ (item) => item.batchNo
567
+ )[0]
568
+ : ""}
569
+ </StructuredListCell>
570
+ <StructuredListCell>
571
+ {filteredItems[index]?.stockOperationItems
572
+ ? filteredItems[
573
+ index
574
+ ].stockOperationItems?.map(
575
+ (item) => item.quantity
576
+ )[0]
577
+ : ""}
578
+ </StructuredListCell>
557
579
  </StructuredListRow>
558
580
  <StructuredListRow>
559
581
  <StructuredListCell noWrap>
@@ -598,6 +620,24 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
598
620
  ? items[index]?.creatorFamilyName
599
621
  : ""}
600
622
  </StructuredListCell>
623
+ <StructuredListCell>
624
+ {filteredItems[index]?.stockOperationItems
625
+ ? filteredItems[
626
+ index
627
+ ].stockOperationItems?.map(
628
+ (item) => item.batchNo
629
+ )[1]
630
+ : ""}
631
+ </StructuredListCell>
632
+ <StructuredListCell>
633
+ {filteredItems[index]?.stockOperationItems
634
+ ? filteredItems[
635
+ index
636
+ ].stockOperationItems?.map(
637
+ (item) => item.quantity
638
+ )[1]
639
+ : ""}
640
+ </StructuredListCell>
601
641
  </StructuredListRow>
602
642
  </StructuredListBody>
603
643
  </>
@@ -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
- "completedispatch": "Complete Dispatch ",
56
- "complete": "Complete",
55
+ "complete": "Complete Dispatch ",
56
+ "completed": "Completed",
57
57
  "continue": "Continue",
58
58
  "created": "Created",
59
59
  "createLocation": "Create Location",