amp-workflow-ui 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +67 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -604,7 +604,8 @@ function SendBackDialog({
|
|
|
604
604
|
openModal,
|
|
605
605
|
closeModal,
|
|
606
606
|
header,
|
|
607
|
-
workflowLogId
|
|
607
|
+
workflowLogId,
|
|
608
|
+
onSuccess
|
|
608
609
|
}) {
|
|
609
610
|
const { userInfo, api } = useWorkflowContext();
|
|
610
611
|
const [comment, setComment] = useState("");
|
|
@@ -686,6 +687,7 @@ function SendBackDialog({
|
|
|
686
687
|
},
|
|
687
688
|
serviceURL: "api"
|
|
688
689
|
});
|
|
690
|
+
console.log("\u{1F680} ~ onSubmit ~ res:", res);
|
|
689
691
|
if ((res == null ? void 0 : res.status) === 200) {
|
|
690
692
|
setSnackbar({
|
|
691
693
|
open: true,
|
|
@@ -711,6 +713,7 @@ function SendBackDialog({
|
|
|
711
713
|
setFileName("");
|
|
712
714
|
setLoading(false);
|
|
713
715
|
closeModal && closeModal();
|
|
716
|
+
onSuccess && onSuccess();
|
|
714
717
|
}
|
|
715
718
|
};
|
|
716
719
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -855,7 +858,8 @@ function ApproveDialog({
|
|
|
855
858
|
closeModal,
|
|
856
859
|
header,
|
|
857
860
|
workflowLogId,
|
|
858
|
-
statusId
|
|
861
|
+
statusId,
|
|
862
|
+
onSuccess
|
|
859
863
|
}) {
|
|
860
864
|
const { userInfo, api } = useWorkflowContext();
|
|
861
865
|
const theme = useTheme();
|
|
@@ -891,11 +895,18 @@ function ApproveDialog({
|
|
|
891
895
|
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
892
896
|
},
|
|
893
897
|
serviceURL: "api"
|
|
894
|
-
})
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
898
|
+
}).then((res) => {
|
|
899
|
+
var _a2, _b2;
|
|
900
|
+
console.log("\u{1F680} ~ onSubmit ~ res:", res);
|
|
901
|
+
((_a2 = res == null ? void 0 : res.error) == null ? void 0 : _a2.status) == 500 ? setSnackbar({
|
|
902
|
+
open: true,
|
|
903
|
+
message: ((_b2 = res == null ? void 0 : res.error) == null ? void 0 : _b2.message) || "Something unexpected occurred!",
|
|
904
|
+
severity: "error"
|
|
905
|
+
}) : setSnackbar({
|
|
906
|
+
open: true,
|
|
907
|
+
message: "Approved successfully!",
|
|
908
|
+
severity: "success"
|
|
909
|
+
});
|
|
899
910
|
});
|
|
900
911
|
} catch (e) {
|
|
901
912
|
setSnackbar({
|
|
@@ -907,6 +918,7 @@ function ApproveDialog({
|
|
|
907
918
|
setComment("");
|
|
908
919
|
setLoading(false);
|
|
909
920
|
closeModal && closeModal();
|
|
921
|
+
onSuccess && onSuccess();
|
|
910
922
|
}
|
|
911
923
|
};
|
|
912
924
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1016,7 +1028,8 @@ function RejectDialog({
|
|
|
1016
1028
|
header,
|
|
1017
1029
|
workflowLogId,
|
|
1018
1030
|
statusId,
|
|
1019
|
-
rejection_reason_master
|
|
1031
|
+
rejection_reason_master,
|
|
1032
|
+
onSuccess
|
|
1020
1033
|
}) {
|
|
1021
1034
|
const { userInfo, api } = useWorkflowContext();
|
|
1022
1035
|
const theme = useTheme();
|
|
@@ -1089,11 +1102,18 @@ function RejectDialog({
|
|
|
1089
1102
|
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
1090
1103
|
},
|
|
1091
1104
|
serviceURL: "api"
|
|
1092
|
-
})
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1105
|
+
}).then((res) => {
|
|
1106
|
+
var _a2;
|
|
1107
|
+
console.log("\u{1F680} ~ onSubmit ~ res:", res);
|
|
1108
|
+
(res == null ? void 0 : res.status) == 200 ? setSnackbar({
|
|
1109
|
+
open: true,
|
|
1110
|
+
message: "Rejected successfully!",
|
|
1111
|
+
severity: "success"
|
|
1112
|
+
}) : setSnackbar({
|
|
1113
|
+
open: true,
|
|
1114
|
+
message: ((_a2 = res == null ? void 0 : res.error) == null ? void 0 : _a2.message) || "Something unexpected occurred!",
|
|
1115
|
+
severity: "error"
|
|
1116
|
+
});
|
|
1097
1117
|
});
|
|
1098
1118
|
} catch (e) {
|
|
1099
1119
|
const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
|
|
@@ -1108,6 +1128,7 @@ function RejectDialog({
|
|
|
1108
1128
|
setRejectReasons("");
|
|
1109
1129
|
setLoading(false);
|
|
1110
1130
|
closeModal && closeModal();
|
|
1131
|
+
onSuccess && onSuccess();
|
|
1111
1132
|
}
|
|
1112
1133
|
};
|
|
1113
1134
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1234,7 +1255,8 @@ function OnHoldDialog({
|
|
|
1234
1255
|
closeModal,
|
|
1235
1256
|
header,
|
|
1236
1257
|
workflowLogId,
|
|
1237
|
-
statusId
|
|
1258
|
+
statusId,
|
|
1259
|
+
onSuccess
|
|
1238
1260
|
}) {
|
|
1239
1261
|
const { userInfo, api } = useWorkflowContext();
|
|
1240
1262
|
const theme = useTheme();
|
|
@@ -1286,6 +1308,7 @@ function OnHoldDialog({
|
|
|
1286
1308
|
setComment("");
|
|
1287
1309
|
closeModal && closeModal();
|
|
1288
1310
|
setLoading(false);
|
|
1311
|
+
onSuccess && onSuccess();
|
|
1289
1312
|
}
|
|
1290
1313
|
};
|
|
1291
1314
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1730,6 +1753,7 @@ function ApprovalWorkflow({
|
|
|
1730
1753
|
const [selectedOption, setSelectedOption] = useState(
|
|
1731
1754
|
selectedWorkflowsList.length ? "selected" : "Assign To Me"
|
|
1732
1755
|
);
|
|
1756
|
+
console.log("\u{1F680} ~ ApprovalWorkflow ~ selectedOption:", selectedOption);
|
|
1733
1757
|
const [expandedId, setExpandedId] = useState(null);
|
|
1734
1758
|
const [sendDialog, setSendDialog] = React7.useState(null);
|
|
1735
1759
|
const [approveTarget, setApproveTarget] = React7.useState(null);
|
|
@@ -2084,6 +2108,27 @@ function ApprovalWorkflow({
|
|
|
2084
2108
|
const m = totalMinutes % 60;
|
|
2085
2109
|
return `${d}d: ${h}h: ${m}m`;
|
|
2086
2110
|
}
|
|
2111
|
+
const callAllApi = () => {
|
|
2112
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
2113
|
+
fetchData(
|
|
2114
|
+
"Assign To Me",
|
|
2115
|
+
1,
|
|
2116
|
+
(_a2 = tabs["Assign To Me"]) == null ? void 0 : _a2.search,
|
|
2117
|
+
(_b2 = tabs["Assign To Me"]) == null ? void 0 : _b2.filters
|
|
2118
|
+
);
|
|
2119
|
+
fetchData(
|
|
2120
|
+
"All Requests",
|
|
2121
|
+
1,
|
|
2122
|
+
(_c2 = tabs["All Requests"]) == null ? void 0 : _c2.search,
|
|
2123
|
+
(_d2 = tabs["All Requests"]) == null ? void 0 : _d2.filters
|
|
2124
|
+
);
|
|
2125
|
+
fetchData(
|
|
2126
|
+
"Completed",
|
|
2127
|
+
1,
|
|
2128
|
+
(_e2 = tabs["Completed"]) == null ? void 0 : _e2.search,
|
|
2129
|
+
(_f2 = tabs["Completed"]) == null ? void 0 : _f2.filters
|
|
2130
|
+
);
|
|
2131
|
+
};
|
|
2087
2132
|
if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
|
|
2088
2133
|
return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
|
|
2089
2134
|
console.info("LIBRARY RUNNING...");
|
|
@@ -2253,7 +2298,8 @@ function ApprovalWorkflow({
|
|
|
2253
2298
|
openModal: !!sendDialog,
|
|
2254
2299
|
closeModal: () => setSendDialog(null),
|
|
2255
2300
|
header: "Send Back",
|
|
2256
|
-
workflowLogId: sendDialog || ""
|
|
2301
|
+
workflowLogId: sendDialog || "",
|
|
2302
|
+
onSuccess: () => callAllApi()
|
|
2257
2303
|
}
|
|
2258
2304
|
),
|
|
2259
2305
|
/* @__PURE__ */ jsx(
|
|
@@ -2263,7 +2309,8 @@ function ApprovalWorkflow({
|
|
|
2263
2309
|
closeModal: () => setApproveTarget(null),
|
|
2264
2310
|
header: "Approve",
|
|
2265
2311
|
workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
|
|
2266
|
-
statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
|
|
2312
|
+
statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1],
|
|
2313
|
+
onSuccess: () => callAllApi()
|
|
2267
2314
|
}
|
|
2268
2315
|
),
|
|
2269
2316
|
/* @__PURE__ */ jsx(
|
|
@@ -2274,7 +2321,8 @@ function ApprovalWorkflow({
|
|
|
2274
2321
|
header: "Reject",
|
|
2275
2322
|
workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
|
|
2276
2323
|
statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
|
|
2277
|
-
rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
|
|
2324
|
+
rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2],
|
|
2325
|
+
onSuccess: () => callAllApi()
|
|
2278
2326
|
}
|
|
2279
2327
|
),
|
|
2280
2328
|
/* @__PURE__ */ jsx(
|
|
@@ -2284,7 +2332,8 @@ function ApprovalWorkflow({
|
|
|
2284
2332
|
closeModal: () => setOnHoldTarget(null),
|
|
2285
2333
|
header: "On Hold",
|
|
2286
2334
|
workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
|
|
2287
|
-
statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
|
|
2335
|
+
statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1],
|
|
2336
|
+
onSuccess: () => callAllApi()
|
|
2288
2337
|
}
|
|
2289
2338
|
),
|
|
2290
2339
|
/* @__PURE__ */ jsxs(
|