@openmrs/esm-stock-management-app 1.0.1-pre.548 → 1.0.1-pre.559
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/271.js +1 -1
- package/dist/281.js +1 -1
- package/dist/281.js.map +1 -1
- package/dist/319.js +1 -1
- package/dist/460.js +1 -1
- package/dist/574.js +1 -1
- package/dist/757.js +1 -1
- package/dist/788.js +1 -1
- package/dist/807.js +1 -1
- package/dist/833.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/openmrs-esm-stock-management-app.js.buildmanifest.json +30 -30
- package/dist/routes.json +1 -1
- package/package.json +5 -5
- package/src/core/api/types/stockOperation/StockOperationDTO.ts +0 -1
- package/src/stock-operations/add-stock-operation/add-stock-operation.component.tsx +13 -9
- package/src/stock-operations/add-stock-operation/add-stock-operation.utils.tsx +1 -4
- package/src/stock-operations/add-stock-operation/stock-operation-submission.component.tsx +17 -17
- package/src/stock-operations/stock-operations-dialog/stock-operations-complete-button.component.tsx +3 -2
- package/src/stock-operations/stock-operations-dialog/stock-operations-completed-dispatch-button.component.tsx +3 -2
- package/src/stock-operations/stock-operations-table.component.tsx +19 -65
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.component.tsx +4 -3
- package/src/stock-sources/stock-sources-delete/stock-sources-delete.test.tsx +190 -0
- package/translations/am.json +1 -0
- package/translations/ar.json +1 -0
- package/translations/en.json +2 -1
- package/translations/es.json +1 -0
- package/translations/fr.json +1 -0
- package/translations/he.json +1 -0
- package/translations/km.json +1 -0
- package/translations/zh.json +1 -0
@@ -85,10 +85,10 @@
|
|
85
85
|
"initial": true,
|
86
86
|
"entry": true,
|
87
87
|
"recorded": false,
|
88
|
-
"size":
|
88
|
+
"size": 5444407,
|
89
89
|
"sizes": {
|
90
90
|
"consume-shared": 252,
|
91
|
-
"javascript":
|
91
|
+
"javascript": 5422457,
|
92
92
|
"share-init": 252,
|
93
93
|
"runtime": 21446
|
94
94
|
},
|
@@ -105,7 +105,7 @@
|
|
105
105
|
"auxiliaryFiles": [
|
106
106
|
"main.js.map"
|
107
107
|
],
|
108
|
-
"hash": "
|
108
|
+
"hash": "0885d110df6c3477",
|
109
109
|
"childrenByOrder": {}
|
110
110
|
},
|
111
111
|
{
|
@@ -113,9 +113,9 @@
|
|
113
113
|
"initial": false,
|
114
114
|
"entry": false,
|
115
115
|
"recorded": false,
|
116
|
-
"size":
|
116
|
+
"size": 8120,
|
117
117
|
"sizes": {
|
118
|
-
"javascript":
|
118
|
+
"javascript": 8120
|
119
119
|
},
|
120
120
|
"names": [],
|
121
121
|
"idHints": [],
|
@@ -127,7 +127,7 @@
|
|
127
127
|
"271.js"
|
128
128
|
],
|
129
129
|
"auxiliaryFiles": [],
|
130
|
-
"hash": "
|
130
|
+
"hash": "67571844717f3958",
|
131
131
|
"childrenByOrder": {}
|
132
132
|
},
|
133
133
|
{
|
@@ -135,9 +135,9 @@
|
|
135
135
|
"initial": false,
|
136
136
|
"entry": false,
|
137
137
|
"recorded": false,
|
138
|
-
"size":
|
138
|
+
"size": 1775980,
|
139
139
|
"sizes": {
|
140
|
-
"javascript":
|
140
|
+
"javascript": 1775770,
|
141
141
|
"consume-shared": 210
|
142
142
|
},
|
143
143
|
"names": [],
|
@@ -151,7 +151,7 @@
|
|
151
151
|
"auxiliaryFiles": [
|
152
152
|
"281.js.map"
|
153
153
|
],
|
154
|
-
"hash": "
|
154
|
+
"hash": "140cb36d45968ade",
|
155
155
|
"childrenByOrder": {}
|
156
156
|
},
|
157
157
|
{
|
@@ -183,9 +183,9 @@
|
|
183
183
|
"initial": false,
|
184
184
|
"entry": false,
|
185
185
|
"recorded": false,
|
186
|
-
"size":
|
186
|
+
"size": 13352,
|
187
187
|
"sizes": {
|
188
|
-
"javascript":
|
188
|
+
"javascript": 13352
|
189
189
|
},
|
190
190
|
"names": [],
|
191
191
|
"idHints": [],
|
@@ -197,7 +197,7 @@
|
|
197
197
|
"319.js"
|
198
198
|
],
|
199
199
|
"auxiliaryFiles": [],
|
200
|
-
"hash": "
|
200
|
+
"hash": "212523370ebec16d",
|
201
201
|
"childrenByOrder": {}
|
202
202
|
},
|
203
203
|
{
|
@@ -205,9 +205,9 @@
|
|
205
205
|
"initial": false,
|
206
206
|
"entry": false,
|
207
207
|
"recorded": false,
|
208
|
-
"size":
|
208
|
+
"size": 11121,
|
209
209
|
"sizes": {
|
210
|
-
"javascript":
|
210
|
+
"javascript": 11121
|
211
211
|
},
|
212
212
|
"names": [],
|
213
213
|
"idHints": [],
|
@@ -219,7 +219,7 @@
|
|
219
219
|
"460.js"
|
220
220
|
],
|
221
221
|
"auxiliaryFiles": [],
|
222
|
-
"hash": "
|
222
|
+
"hash": "121c4ef0e9fc4b30",
|
223
223
|
"childrenByOrder": {}
|
224
224
|
},
|
225
225
|
{
|
@@ -251,9 +251,9 @@
|
|
251
251
|
"initial": false,
|
252
252
|
"entry": false,
|
253
253
|
"recorded": false,
|
254
|
-
"size":
|
254
|
+
"size": 11502,
|
255
255
|
"sizes": {
|
256
|
-
"javascript":
|
256
|
+
"javascript": 11502
|
257
257
|
},
|
258
258
|
"names": [],
|
259
259
|
"idHints": [],
|
@@ -265,7 +265,7 @@
|
|
265
265
|
"574.js"
|
266
266
|
],
|
267
267
|
"auxiliaryFiles": [],
|
268
|
-
"hash": "
|
268
|
+
"hash": "1dabb0391057300e",
|
269
269
|
"childrenByOrder": {}
|
270
270
|
},
|
271
271
|
{
|
@@ -342,9 +342,9 @@
|
|
342
342
|
"initial": false,
|
343
343
|
"entry": false,
|
344
344
|
"recorded": false,
|
345
|
-
"size":
|
345
|
+
"size": 13486,
|
346
346
|
"sizes": {
|
347
|
-
"javascript":
|
347
|
+
"javascript": 13486
|
348
348
|
},
|
349
349
|
"names": [],
|
350
350
|
"idHints": [],
|
@@ -356,7 +356,7 @@
|
|
356
356
|
"757.js"
|
357
357
|
],
|
358
358
|
"auxiliaryFiles": [],
|
359
|
-
"hash": "
|
359
|
+
"hash": "fd6b9f5b0f1c7de5",
|
360
360
|
"childrenByOrder": {}
|
361
361
|
},
|
362
362
|
{
|
@@ -391,9 +391,9 @@
|
|
391
391
|
"initial": false,
|
392
392
|
"entry": false,
|
393
393
|
"recorded": false,
|
394
|
-
"size":
|
394
|
+
"size": 10071,
|
395
395
|
"sizes": {
|
396
|
-
"javascript":
|
396
|
+
"javascript": 10071
|
397
397
|
},
|
398
398
|
"names": [],
|
399
399
|
"idHints": [],
|
@@ -405,7 +405,7 @@
|
|
405
405
|
"788.js"
|
406
406
|
],
|
407
407
|
"auxiliaryFiles": [],
|
408
|
-
"hash": "
|
408
|
+
"hash": "3f32b894414c9964",
|
409
409
|
"childrenByOrder": {}
|
410
410
|
},
|
411
411
|
{
|
@@ -440,9 +440,9 @@
|
|
440
440
|
"initial": false,
|
441
441
|
"entry": false,
|
442
442
|
"recorded": false,
|
443
|
-
"size":
|
443
|
+
"size": 11866,
|
444
444
|
"sizes": {
|
445
|
-
"javascript":
|
445
|
+
"javascript": 11866
|
446
446
|
},
|
447
447
|
"names": [],
|
448
448
|
"idHints": [],
|
@@ -454,7 +454,7 @@
|
|
454
454
|
"807.js"
|
455
455
|
],
|
456
456
|
"auxiliaryFiles": [],
|
457
|
-
"hash": "
|
457
|
+
"hash": "280b0ae7fdf58f36",
|
458
458
|
"childrenByOrder": {}
|
459
459
|
},
|
460
460
|
{
|
@@ -462,9 +462,9 @@
|
|
462
462
|
"initial": false,
|
463
463
|
"entry": false,
|
464
464
|
"recorded": false,
|
465
|
-
"size":
|
465
|
+
"size": 10503,
|
466
466
|
"sizes": {
|
467
|
-
"javascript":
|
467
|
+
"javascript": 10503
|
468
468
|
},
|
469
469
|
"names": [],
|
470
470
|
"idHints": [],
|
@@ -476,7 +476,7 @@
|
|
476
476
|
"833.js"
|
477
477
|
],
|
478
478
|
"auxiliaryFiles": [],
|
479
|
-
"hash": "
|
479
|
+
"hash": "27c91533423752b2",
|
480
480
|
"childrenByOrder": {}
|
481
481
|
},
|
482
482
|
{
|
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.
|
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.559"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@openmrs/esm-stock-management-app",
|
3
|
-
"version": "1.0.1-pre.
|
3
|
+
"version": "1.0.1-pre.559",
|
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",
|
@@ -69,14 +69,14 @@
|
|
69
69
|
"@swc/cli": "^0.1.62",
|
70
70
|
"@swc/core": "^1.3.68",
|
71
71
|
"@swc/jest": "^0.2.26",
|
72
|
-
"@testing-library/dom": "^
|
72
|
+
"@testing-library/dom": "^10.4.0",
|
73
73
|
"@testing-library/jest-dom": "^5.16.5",
|
74
|
-
"@testing-library/react": "^
|
74
|
+
"@testing-library/react": "^16.0.0",
|
75
75
|
"@testing-library/user-event": "^14.4.3",
|
76
76
|
"@types/file-saver": "^2.0.5",
|
77
77
|
"@types/jest": "^28.1.8",
|
78
|
-
"@types/react": "^18.
|
79
|
-
"@types/react-dom": "^18.
|
78
|
+
"@types/react": "^18.3.3",
|
79
|
+
"@types/react-dom": "^18.3.0",
|
80
80
|
"@types/react-router": "^5.1.20",
|
81
81
|
"@types/react-router-dom": "^5.3.3",
|
82
82
|
"@types/webpack-env": "^1.18.1",
|
@@ -3,7 +3,6 @@ import { StockOperationItemDTO } from "./StockOperationItemDTO";
|
|
3
3
|
import { StockOperationStatus } from "./StockOperationStatus";
|
4
4
|
|
5
5
|
export interface StockOperationDTO {
|
6
|
-
receivedItems: any;
|
7
6
|
uuid: string | null | undefined;
|
8
7
|
cancelReason: string | null | undefined;
|
9
8
|
cancelledBy: number;
|
@@ -82,10 +82,12 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
82
82
|
}, [currentStockOperationType, requisition, props.model?.uuid]);
|
83
83
|
|
84
84
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
85
|
-
const [
|
85
|
+
const [canDisplayReceivedItems, setCanDisplayReceivedItems] = useState(false);
|
86
86
|
|
87
87
|
useEffect(() => {
|
88
|
-
|
88
|
+
setCanDisplayReceivedItems(
|
89
|
+
props?.model?.permission?.canDisplayReceivedItems ?? false
|
90
|
+
);
|
89
91
|
}, [props?.model?.permission]);
|
90
92
|
|
91
93
|
if (isLoading) return <AccordionSkeleton />;
|
@@ -182,6 +184,9 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
182
184
|
: result.requiresDispatchAcknowledgement
|
183
185
|
}
|
184
186
|
actions={{
|
187
|
+
onGoBack: () => {
|
188
|
+
setSelectedIndex(1);
|
189
|
+
},
|
185
190
|
onSave: async (model) => {
|
186
191
|
// TODO: Update
|
187
192
|
await addOrEditStockOperation(
|
@@ -193,17 +198,15 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
193
198
|
props.canPrint
|
194
199
|
);
|
195
200
|
},
|
196
|
-
|
197
|
-
setSelectedIndex(1);
|
198
|
-
},
|
201
|
+
|
199
202
|
onComplete: async () => {
|
200
|
-
await showActionDialogButton("Complete",
|
203
|
+
await showActionDialogButton("Complete", false, props?.model);
|
201
204
|
},
|
202
205
|
onSubmit: async () => {
|
203
|
-
await showActionDialogButton("Submit",
|
206
|
+
await showActionDialogButton("Submit", false, props?.model);
|
204
207
|
},
|
205
208
|
onDispatch: async () => {
|
206
|
-
await showActionDialogButton("Dispatch",
|
209
|
+
await showActionDialogButton("Dispatch", false, props?.model);
|
207
210
|
},
|
208
211
|
}}
|
209
212
|
/>
|
@@ -213,7 +216,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
213
216
|
].concat(
|
214
217
|
StockOperationTypeIsStockIssue(
|
215
218
|
props?.model?.operationType as OperationType
|
216
|
-
) ||
|
219
|
+
) || canDisplayReceivedItems
|
217
220
|
? status === "DISPATCHED" || status === "COMPLETED"
|
218
221
|
? [
|
219
222
|
{
|
@@ -505,6 +508,7 @@ const AddStockOperation: React.FC<AddStockOperationProps> = (props) => {
|
|
505
508
|
<div style={{ margin: "2px" }}>
|
506
509
|
<StockOperationCompleteDispatchButton
|
507
510
|
operation={props?.model}
|
511
|
+
reason={false}
|
508
512
|
/>
|
509
513
|
</div>
|
510
514
|
<div style={{ margin: "2px" }}>
|
@@ -59,10 +59,7 @@ export async function initializeNewStockOperation(
|
|
59
59
|
let destinationPartyList: Party[] | null | undefined;
|
60
60
|
|
61
61
|
if (isNew) {
|
62
|
-
model = structuredClone(
|
63
|
-
...initialStockOperationValue(),
|
64
|
-
receivedItems: [],
|
65
|
-
});
|
62
|
+
model = structuredClone(initialStockOperationValue());
|
66
63
|
model = Object.assign(model, {
|
67
64
|
operationDate: today(),
|
68
65
|
operationTypeName: currentStockOperationType?.name,
|
@@ -46,11 +46,12 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
|
|
46
46
|
model,
|
47
47
|
requiresDispatchAcknowledgement,
|
48
48
|
actions,
|
49
|
+
isEditing,
|
49
50
|
}) => {
|
50
51
|
const { t } = useTranslation();
|
51
52
|
const [isSaving, setIsSaving] = useState(false);
|
52
53
|
const [approvalRequired, setApprovalRequired] = useState<boolean | null>(
|
53
|
-
|
54
|
+
model?.approvalRequired
|
54
55
|
);
|
55
56
|
|
56
57
|
const handleRadioButtonChange = (selectedItem: boolean) => {
|
@@ -68,7 +69,9 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
|
|
68
69
|
"Does the transaction require approval ?"
|
69
70
|
)}
|
70
71
|
onChange={handleRadioButtonChange}
|
71
|
-
defaultSelected={
|
72
|
+
defaultSelected={
|
73
|
+
model?.approvalRequired === null ? false : approvalRequired
|
74
|
+
}
|
72
75
|
>
|
73
76
|
<RadioButton
|
74
77
|
value={true}
|
@@ -111,15 +114,15 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
|
|
111
114
|
kind="primary"
|
112
115
|
onClick={async () => {
|
113
116
|
delete model?.dateCreated;
|
114
|
-
delete model?.status;
|
115
117
|
setIsSaving(true);
|
116
|
-
|
117
|
-
delete model
|
118
|
-
model
|
119
|
-
setIsSaving(true);
|
120
|
-
actions.onComplete(model);
|
118
|
+
if (!isEditing) {
|
119
|
+
delete model.status;
|
120
|
+
await actions.onSave(model);
|
121
121
|
setIsSaving(false);
|
122
|
-
}
|
122
|
+
}
|
123
|
+
model.status = "COMPLETED";
|
124
|
+
actions.onComplete(model);
|
125
|
+
setIsSaving(false);
|
123
126
|
}}
|
124
127
|
renderIcon={ListChecked}
|
125
128
|
>
|
@@ -137,13 +140,9 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
|
|
137
140
|
delete model?.dateCreated;
|
138
141
|
delete model?.status;
|
139
142
|
setIsSaving(true);
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
setIsSaving(true);
|
144
|
-
actions.onDispatch(model);
|
145
|
-
setIsSaving(false);
|
146
|
-
});
|
143
|
+
model.status = "DISPATCHED";
|
144
|
+
await actions.onDispatch(model);
|
145
|
+
setIsSaving(false);
|
147
146
|
}}
|
148
147
|
renderIcon={Departure}
|
149
148
|
>
|
@@ -160,7 +159,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
|
|
160
159
|
onClick={actions.onSubmit}
|
161
160
|
renderIcon={SendFilled}
|
162
161
|
>
|
163
|
-
{t("
|
162
|
+
{t("submitForReview", "Submit For Review")}
|
164
163
|
</Button>
|
165
164
|
)}
|
166
165
|
</>
|
@@ -175,6 +174,7 @@ const StockOperationSubmission: React.FC<StockOperationSubmissionProps> = ({
|
|
175
174
|
delete model?.dateCreated;
|
176
175
|
delete model?.status;
|
177
176
|
setIsSaving(true);
|
177
|
+
model.approvalRequired = approvalRequired ? true : false;
|
178
178
|
await actions.onSave(model);
|
179
179
|
setIsSaving(false);
|
180
180
|
}}
|
package/src/stock-operations/stock-operations-dialog/stock-operations-complete-button.component.tsx
CHANGED
@@ -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:
|
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:
|
22
|
+
requireReason: reason,
|
22
23
|
closeModal: () => dispose(),
|
23
24
|
});
|
24
25
|
}, [operation]);
|
@@ -24,15 +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
|
InlineLoading,
|
34
33
|
} from "@carbon/react";
|
35
|
-
import { ArrowRight } from "@carbon/react/icons";
|
34
|
+
import { ArrowRight, Edit } from "@carbon/react/icons";
|
36
35
|
import { formatDisplayDate } from "../core/utils/datetimeUtils";
|
37
36
|
import {
|
38
37
|
StockOperationStatusCancelled,
|
@@ -131,18 +130,8 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
131
130
|
selectedStatus.length ||
|
132
131
|
selectedOperations.length;
|
133
132
|
|
134
|
-
const config = useConfig();
|
135
|
-
|
136
133
|
let operations: StockOperationType[] | null | undefined;
|
137
134
|
|
138
|
-
const handleOnComplete = () => {
|
139
|
-
const dispose = showModal("stock-operation-dialog", {
|
140
|
-
title: "complete",
|
141
|
-
closeModal: () => dispose(),
|
142
|
-
});
|
143
|
-
handleMutate(`${restBaseUrl}/stockmanagement/stockoperation`);
|
144
|
-
};
|
145
|
-
|
146
135
|
const handleOnFilterChange = useCallback((selectedItems, filterType) => {
|
147
136
|
if (filterType === StockFilters.SOURCES) {
|
148
137
|
setSelectedSources(selectedItems);
|
@@ -308,22 +297,22 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
308
297
|
</div>
|
309
298
|
),
|
310
299
|
actions: (
|
311
|
-
<
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
/>
|
326
|
-
|
300
|
+
<Button
|
301
|
+
kind="ghost"
|
302
|
+
size="md"
|
303
|
+
onClick={() => {
|
304
|
+
launchAddOrEditDialog(
|
305
|
+
t,
|
306
|
+
items[index],
|
307
|
+
true,
|
308
|
+
operation,
|
309
|
+
operations,
|
310
|
+
false
|
311
|
+
);
|
312
|
+
}}
|
313
|
+
iconDescription={t("editStockItem", "Edit Stock Item")}
|
314
|
+
renderIcon={(props) => <Edit size={16} {...props} />}
|
315
|
+
></Button>
|
327
316
|
),
|
328
317
|
}));
|
329
318
|
}, [items, operation, operations, t]);
|
@@ -396,19 +385,16 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
396
385
|
</DatePicker>
|
397
386
|
|
398
387
|
<StockOperationsFilters
|
399
|
-
conceptUuid={config.stockSourceTypeUUID}
|
400
388
|
filterName={StockFilters.SOURCES}
|
401
389
|
onFilterChange={handleOnFilterChange}
|
402
390
|
/>
|
403
391
|
|
404
392
|
<StockOperationsFilters
|
405
|
-
conceptUuid={config.stockSourceTypeUUID}
|
406
393
|
filterName={StockFilters.STATUS}
|
407
394
|
onFilterChange={handleOnFilterChange}
|
408
395
|
/>
|
409
396
|
|
410
397
|
<StockOperationsFilters
|
411
|
-
conceptUuid={config.stockSourceTypeUUID}
|
412
398
|
filterName={StockFilters.OPERATION}
|
413
399
|
onFilterChange={handleOnFilterChange}
|
414
400
|
/>
|
@@ -423,7 +409,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
423
409
|
onOperationTypeSelected={(operation) => {
|
424
410
|
launchAddOrEditDialog(
|
425
411
|
t,
|
426
|
-
|
412
|
+
initialStockOperationValue(),
|
427
413
|
false,
|
428
414
|
operation,
|
429
415
|
operations,
|
@@ -489,10 +475,6 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
489
475
|
<StructuredListCell head>
|
490
476
|
{t("dateCompleted", "Date Completed")}
|
491
477
|
</StructuredListCell>
|
492
|
-
<StructuredListCell head>
|
493
|
-
{t("batchNumber", "Batch Number")}
|
494
|
-
</StructuredListCell>
|
495
|
-
<StructuredListCell head>Qty</StructuredListCell>
|
496
478
|
</StructuredListRow>
|
497
479
|
</StructuredListHead>
|
498
480
|
<StructuredListBody>
|
@@ -521,20 +503,6 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
521
503
|
? items[index]?.creatorFamilyName
|
522
504
|
: ""}
|
523
505
|
</StructuredListCell>
|
524
|
-
<StructuredListCell>
|
525
|
-
{items[index]?.stockOperationItems
|
526
|
-
? items[index].stockOperationItems?.map(
|
527
|
-
(item) => item.batchNo
|
528
|
-
)[0]
|
529
|
-
: ""}
|
530
|
-
</StructuredListCell>
|
531
|
-
<StructuredListCell>
|
532
|
-
{items[index]?.stockOperationItems
|
533
|
-
? items[index].stockOperationItems?.map(
|
534
|
-
(item) => item.quantity
|
535
|
-
)[0]
|
536
|
-
: ""}
|
537
|
-
</StructuredListCell>
|
538
506
|
</StructuredListRow>
|
539
507
|
<StructuredListRow>
|
540
508
|
<StructuredListCell noWrap>
|
@@ -577,20 +545,6 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
577
545
|
? items[index]?.creatorFamilyName
|
578
546
|
: ""}
|
579
547
|
</StructuredListCell>
|
580
|
-
<StructuredListCell>
|
581
|
-
{items[index]?.stockOperationItems
|
582
|
-
? items[index].stockOperationItems?.map(
|
583
|
-
(item) => item.batchNo
|
584
|
-
)[1]
|
585
|
-
: ""}
|
586
|
-
</StructuredListCell>
|
587
|
-
<StructuredListCell>
|
588
|
-
{items[index]?.stockOperationItems
|
589
|
-
? items[index].stockOperationItems?.map(
|
590
|
-
(item) => item.quantity
|
591
|
-
)[1]
|
592
|
-
: ""}
|
593
|
-
</StructuredListCell>
|
594
548
|
</StructuredListRow>
|
595
549
|
</StructuredListBody>
|
596
550
|
</>
|
@@ -61,9 +61,10 @@ const StockSourcesDeleteActionMenu: React.FC<
|
|
61
61
|
kind="ghost"
|
62
62
|
size="md"
|
63
63
|
onClick={handleDeleteStockSource}
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
aria-label={t("deleteSource", "Delete Source")}
|
65
|
+
>
|
66
|
+
<TrashCan size={16} />
|
67
|
+
</Button>
|
67
68
|
);
|
68
69
|
|
69
70
|
return deletingSource ? <InlineLoading /> : deleteButton;
|