@openmrs/esm-stock-management-app 1.0.1-pre.508 → 1.0.1-pre.510
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/157.js +1 -1
- package/dist/157.js.map +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 +6 -6
- package/dist/routes.json +1 -1
- package/package.json +1 -1
- package/src/stock-operations/add-stock-operation/base-operation-details.component.tsx +51 -27
@@ -85,9 +85,9 @@
|
|
85
85
|
"initial": false,
|
86
86
|
"entry": false,
|
87
87
|
"recorded": false,
|
88
|
-
"size":
|
88
|
+
"size": 1733627,
|
89
89
|
"sizes": {
|
90
|
-
"javascript":
|
90
|
+
"javascript": 1733417,
|
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": "
|
104
|
+
"hash": "2bdfef68656abb81",
|
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":
|
112
|
+
"size": 5402054,
|
113
113
|
"sizes": {
|
114
114
|
"consume-shared": 252,
|
115
|
-
"javascript":
|
115
|
+
"javascript": 5380104,
|
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": "
|
132
|
+
"hash": "ce8d6a466f812c73",
|
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.
|
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.510"}
|
package/package.json
CHANGED
@@ -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,
|
@@ -98,7 +100,7 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
|
|
98
100
|
await onSave(payload);
|
99
101
|
} catch (e) {
|
100
102
|
showSnackbar({
|
101
|
-
title: t("errorSavingBaseOperation", "
|
103
|
+
title: t("errorSavingBaseOperation", "Error saving base operation"),
|
102
104
|
isLowContrast: true,
|
103
105
|
kind: "error",
|
104
106
|
});
|
@@ -181,17 +183,22 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
|
|
181
183
|
)}
|
182
184
|
|
183
185
|
{(!canEdit || isEditing || lockSource) && (
|
184
|
-
<
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
186
|
+
<PartySelector
|
187
|
+
controllerName="sourceUuid"
|
188
|
+
name="sourceUuid"
|
189
|
+
control={control}
|
190
|
+
title={operation?.hasDestination ? "From" : "Location"}
|
191
|
+
placeholder={
|
192
|
+
operation.hasDestination
|
193
|
+
? t("chooseASource", "Choose a source")
|
194
|
+
: t("chooseALocation", "Choose a location")
|
190
195
|
}
|
191
|
-
|
192
|
-
|
196
|
+
invalid={!!errors.sourceUuid}
|
197
|
+
invalidText={errors.sourceUuid && errors?.sourceUuid?.message}
|
198
|
+
parties={sourcePartyList || []}
|
193
199
|
/>
|
194
200
|
)}
|
201
|
+
|
195
202
|
{canEdit && !lockDestination && operation?.hasDestination && (
|
196
203
|
<PartySelector
|
197
204
|
controllerName="destinationUuid"
|
@@ -212,15 +219,21 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
|
|
212
219
|
)}
|
213
220
|
|
214
221
|
{(!canEdit || isEditing || lockDestination) && (
|
215
|
-
<
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
222
|
+
<PartySelector
|
223
|
+
controllerName="destinationUuid"
|
224
|
+
name="destinationUuid"
|
225
|
+
control={control}
|
226
|
+
title={operation?.hasSource ? "To" : "Location"}
|
227
|
+
placeholder={
|
228
|
+
operation?.hasSource
|
229
|
+
? t("chooseADestination", "Choose a destination")
|
230
|
+
: "Location"
|
221
231
|
}
|
222
|
-
|
223
|
-
|
232
|
+
invalid={!!errors.destinationUuid}
|
233
|
+
invalidText={
|
234
|
+
errors.destinationUuid && errors?.destinationUuid?.message
|
235
|
+
}
|
236
|
+
parties={destinationPartyList || []}
|
224
237
|
/>
|
225
238
|
)}
|
226
239
|
|
@@ -232,6 +245,7 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
|
|
232
245
|
title={t("responsiblePerson:", "Responsible Person")}
|
233
246
|
placeholder={t("filter", "Filter ...")}
|
234
247
|
invalid={!!errors.responsiblePersonUuid}
|
248
|
+
userUuid={defaultLoggedUserUuid}
|
235
249
|
invalidText={
|
236
250
|
errors.responsiblePersonUuid &&
|
237
251
|
errors?.responsiblePersonUuid?.message
|
@@ -239,6 +253,8 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
|
|
239
253
|
onUserChanged={(user) => {
|
240
254
|
if (user?.uuid === otherUser.uuid) {
|
241
255
|
setIsOtherUser(true);
|
256
|
+
} else {
|
257
|
+
setIsOtherUser(false);
|
242
258
|
}
|
243
259
|
}}
|
244
260
|
/>
|
@@ -264,16 +280,24 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({
|
|
264
280
|
)}
|
265
281
|
|
266
282
|
{!canEdit && (
|
267
|
-
<
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
283
|
+
<UsersSelector
|
284
|
+
controllerName="responsiblePersonUuid"
|
285
|
+
name="responsiblePersonUuid"
|
286
|
+
control={control}
|
287
|
+
title={t("responsiblePerson:", "Responsible Person")}
|
288
|
+
placeholder={t("filter", "Filter ...")}
|
289
|
+
invalid={!!errors.responsiblePersonUuid}
|
290
|
+
invalidText={
|
291
|
+
errors.responsiblePersonUuid &&
|
292
|
+
errors?.responsiblePersonUuid?.message
|
274
293
|
}
|
275
|
-
|
276
|
-
|
294
|
+
onUserChanged={(user) => {
|
295
|
+
if (user?.uuid === otherUser.uuid) {
|
296
|
+
setIsOtherUser(true);
|
297
|
+
} else {
|
298
|
+
setIsOtherUser(false);
|
299
|
+
}
|
300
|
+
}}
|
277
301
|
/>
|
278
302
|
)}
|
279
303
|
|