@openmrs/esm-stock-management-app 1.0.1-pre.368 → 1.0.1-pre.377
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/56.js +1 -1
- package/dist/56.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/stock-operation.utils.tsx +2 -1
- package/src/stock-operations/stock-operations-dialog/stock-operations-dialog.component.tsx +12 -12
- package/src/stock-operations/stock-operations-table.component.tsx +16 -15
@@ -59,9 +59,9 @@
|
|
59
59
|
"initial": false,
|
60
60
|
"entry": false,
|
61
61
|
"recorded": false,
|
62
|
-
"size":
|
62
|
+
"size": 1024662,
|
63
63
|
"sizes": {
|
64
|
-
"javascript":
|
64
|
+
"javascript": 1024452,
|
65
65
|
"consume-shared": 210
|
66
66
|
},
|
67
67
|
"names": [],
|
@@ -75,7 +75,7 @@
|
|
75
75
|
"auxiliaryFiles": [
|
76
76
|
"56.js.map"
|
77
77
|
],
|
78
|
-
"hash": "
|
78
|
+
"hash": "4ee3259f79d57dc5",
|
79
79
|
"childrenByOrder": {}
|
80
80
|
},
|
81
81
|
{
|
@@ -110,10 +110,10 @@
|
|
110
110
|
"initial": true,
|
111
111
|
"entry": true,
|
112
112
|
"recorded": false,
|
113
|
-
"size":
|
113
|
+
"size": 4773711,
|
114
114
|
"sizes": {
|
115
115
|
"consume-shared": 252,
|
116
|
-
"javascript":
|
116
|
+
"javascript": 4751763,
|
117
117
|
"share-init": 252,
|
118
118
|
"runtime": 21444
|
119
119
|
},
|
@@ -130,7 +130,7 @@
|
|
130
130
|
"auxiliaryFiles": [
|
131
131
|
"main.js.map"
|
132
132
|
],
|
133
|
-
"hash": "
|
133
|
+
"hash": "b5fe33bc3d4cadc9",
|
134
134
|
"childrenByOrder": {}
|
135
135
|
},
|
136
136
|
{
|
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-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"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"}],"pages":[{"component":"stockManagement","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-management-dashboard","slot":"stock-management-dashboard-slot","component":"stockManagementDashboard"},{"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"}],"pages":[{"component":"stockManagement","route":"stock-management"}],"version":"1.0.1-pre.377"}
|
package/package.json
CHANGED
@@ -2,6 +2,7 @@ import { closeOverlay, launchOverlay } from "../core/components/overlay/hook";
|
|
2
2
|
import React from "react";
|
3
3
|
import {
|
4
4
|
FetchResponse,
|
5
|
+
restBaseUrl,
|
5
6
|
showModal,
|
6
7
|
showNotification,
|
7
8
|
showToast,
|
@@ -47,7 +48,7 @@ export const addOrEditStockOperation = async (
|
|
47
48
|
: createStockOperation)(payload);
|
48
49
|
|
49
50
|
if (response?.data) {
|
50
|
-
handleMutate(
|
51
|
+
handleMutate(`${restBaseUrl}/stockmanagement/stockoperation`);
|
51
52
|
showToast({
|
52
53
|
critical: true,
|
53
54
|
title: `${isEditing ? "Edit" : "Add"} Stock Operation`,
|
@@ -16,9 +16,10 @@ import {
|
|
16
16
|
StopOperationActionType,
|
17
17
|
} from "../../core/api/types/stockOperation/StockOperationAction";
|
18
18
|
import { executeStockOperationAction } from "../stock-operations.resource";
|
19
|
-
import {
|
19
|
+
import { restBaseUrl, showSnackbar } from "@openmrs/esm-framework";
|
20
20
|
import { closeOverlay } from "../../core/components/overlay/hook";
|
21
21
|
import { extractErrorMessagesFromResponse } from "../../constants";
|
22
|
+
import { handleMutate } from "../swr-revalidation";
|
22
23
|
|
23
24
|
interface StockOperationDialogProps {
|
24
25
|
title: string;
|
@@ -92,28 +93,27 @@ const StockOperationDialog: React.FC<StockOperationDialogProps> = ({
|
|
92
93
|
executeStockOperationAction(payload).then(
|
93
94
|
() => {
|
94
95
|
setIsApproving(false);
|
95
|
-
|
96
|
-
critical: true,
|
96
|
+
showSnackbar({
|
97
97
|
title: t("title", `${title} Operation`),
|
98
|
-
|
99
|
-
description: t(
|
98
|
+
subtitle: t(
|
100
99
|
"successMessage",
|
101
100
|
`You have successfully ${title} operation `
|
102
101
|
),
|
103
|
-
|
104
|
-
|
102
|
+
kind: "success",
|
103
|
+
}),
|
104
|
+
closeModal();
|
105
105
|
closeOverlay();
|
106
|
+
handleMutate(`${restBaseUrl}/stockmanagement/stockoperation`);
|
106
107
|
},
|
107
108
|
(err) => {
|
108
109
|
setIsApproving(false);
|
109
110
|
const errorMessages = extractErrorMessagesFromResponse(err);
|
110
|
-
|
111
|
-
description: t("errorDescription", errorMessages.join(", ")),
|
111
|
+
showSnackbar({
|
112
112
|
title: t("errorDescriptionTitle", "Error on saving form"),
|
113
|
+
subtitle: t("errorDescription", errorMessages.join(", ")),
|
113
114
|
kind: "error",
|
114
|
-
|
115
|
-
|
116
|
-
closeModal();
|
115
|
+
}),
|
116
|
+
closeModal();
|
117
117
|
closeOverlay();
|
118
118
|
}
|
119
119
|
);
|
@@ -45,7 +45,6 @@ import { initialStockOperationValue } from "../core/utils/utils";
|
|
45
45
|
import { StockOperationType } from "../core/api/types/stockOperation/StockOperationType";
|
46
46
|
import { useTranslation } from "react-i18next";
|
47
47
|
import EditStockOperationActionMenu from "./edit-stock-operation/edit-stock-operation-action-menu.component";
|
48
|
-
import { handleMutate } from "./swr-revalidation";
|
49
48
|
import StockOperationsFilters from "./stock-operations-filters.component";
|
50
49
|
import {
|
51
50
|
DATE_PICKER_CONTROL_FORMAT,
|
@@ -107,18 +106,14 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
107
106
|
const [selectedSources, setSelectedSources] = useState<string[]>([]);
|
108
107
|
const [selectedStatus, setSelectedStatus] = useState<string[]>([]);
|
109
108
|
const [selectedOperations, setSelectedOperations] = useState<string[]>([]);
|
110
|
-
|
111
109
|
const config = useConfig();
|
112
110
|
|
113
111
|
let operations: StockOperationType[] | null | undefined;
|
114
112
|
const handleOnComplete = () => {
|
115
113
|
const dispose = showModal("stock-operation-dialog", {
|
116
114
|
title: "complete",
|
117
|
-
operation: operation,
|
118
|
-
requireReason: "",
|
119
115
|
closeModal: () => dispose(),
|
120
116
|
});
|
121
|
-
handleMutate("ws/rest/v1/stockmanagement/stockoperation");
|
122
117
|
};
|
123
118
|
|
124
119
|
useEffect(() => {
|
@@ -131,6 +126,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
131
126
|
selectedOperations,
|
132
127
|
currentPage,
|
133
128
|
currentPageSize,
|
129
|
+
items,
|
134
130
|
]);
|
135
131
|
|
136
132
|
const handleOnFilterChange = useCallback((selectedItems, filterType) => {
|
@@ -230,12 +226,12 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
230
226
|
details: (
|
231
227
|
<div className="tbl-expand-display-fields">
|
232
228
|
<div className="field-label">
|
233
|
-
<span className="field-title">Created</span>
|
229
|
+
<span className="field-title"> {t("created", "Created")}</span>
|
234
230
|
<span className="field-desc">
|
235
231
|
<span className="action-date">
|
236
232
|
{formatDisplayDate(stockOperation?.dateCreated)}
|
237
233
|
</span>{" "}
|
238
|
-
By
|
234
|
+
{t("by", "By")}
|
239
235
|
<span className="action-by">
|
240
236
|
{stockOperation.creatorFamilyName ?? ""}{" "}
|
241
237
|
{stockOperation.creatorGivenName ?? ""}
|
@@ -246,12 +242,14 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
246
242
|
stockOperation?.status !== StockOperationStatusReturned &&
|
247
243
|
stockOperation?.submittedDate && (
|
248
244
|
<div className="field-label">
|
249
|
-
<span className="field-title">
|
245
|
+
<span className="field-title">
|
246
|
+
{t("submitted", "Submitted")}
|
247
|
+
</span>
|
250
248
|
<span className="field-desc">
|
251
249
|
<span className="action-date">
|
252
250
|
{formatDisplayDate(stockOperation?.submittedDate)}
|
253
251
|
</span>{" "}
|
254
|
-
By
|
252
|
+
{t("by", "By")}
|
255
253
|
<span className="action-by">
|
256
254
|
{stockOperation.submittedByFamilyName ?? ""}{" "}
|
257
255
|
{stockOperation.submittedByGivenName ?? ""}
|
@@ -262,12 +260,12 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
262
260
|
|
263
261
|
{stockOperation?.completedDate && (
|
264
262
|
<div className="field-label">
|
265
|
-
<span className="field-title">Completed</span>
|
263
|
+
<span className="field-title">{t("completed", "Completed")}</span>
|
266
264
|
<span className="field-desc">
|
267
265
|
<span className="action-date">
|
268
266
|
{formatDisplayDate(stockOperation?.completedDate)}
|
269
267
|
</span>{" "}
|
270
|
-
By
|
268
|
+
{t("by", "By")}
|
271
269
|
<span className="action-by">
|
272
270
|
{stockOperation.completedByFamilyName ?? ""}{" "}
|
273
271
|
{stockOperation.completedByGivenName ?? ""}
|
@@ -278,12 +276,15 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
278
276
|
|
279
277
|
{stockOperation?.status === StockOperationStatusCancelled && (
|
280
278
|
<div className="field-label">
|
281
|
-
<span className="field-title">
|
279
|
+
<span className="field-title">
|
280
|
+
{" "}
|
281
|
+
{t("cancelled", "Cancelled")}
|
282
|
+
</span>
|
282
283
|
<span className="field-desc">
|
283
284
|
<span className="action-date">
|
284
285
|
{formatDisplayDate(stockOperation?.cancelledDate)}
|
285
286
|
</span>{" "}
|
286
|
-
By
|
287
|
+
{t("by", "By")}
|
287
288
|
<span className="action-by">
|
288
289
|
{stockOperation.cancelledByFamilyName ?? ""}{" "}
|
289
290
|
{stockOperation.cancelledByGivenName ?? ""}
|
@@ -300,7 +301,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
300
301
|
<span className="action-date">
|
301
302
|
{formatDisplayDate(stockOperation?.rejectedDate)}
|
302
303
|
</span>{" "}
|
303
|
-
By
|
304
|
+
{t("by", "By")}
|
304
305
|
<span className="action-by">
|
305
306
|
{stockOperation.rejectedByFamilyName ?? ""}{" "}
|
306
307
|
{stockOperation.rejectedByGivenName ?? ""}
|
@@ -346,7 +347,7 @@ const StockOperations: React.FC<StockOperationsTableProps> = () => {
|
|
346
347
|
</OverflowMenu>
|
347
348
|
),
|
348
349
|
}));
|
349
|
-
}, [handleOnComplete, filteredItems, operation, operations]);
|
350
|
+
}, [handleOnComplete, filteredItems, operation, operations, items]);
|
350
351
|
|
351
352
|
if (isLoading) {
|
352
353
|
return (
|