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.js
CHANGED
|
@@ -618,7 +618,8 @@ function SendBackDialog({
|
|
|
618
618
|
openModal,
|
|
619
619
|
closeModal,
|
|
620
620
|
header,
|
|
621
|
-
workflowLogId
|
|
621
|
+
workflowLogId,
|
|
622
|
+
onSuccess
|
|
622
623
|
}) {
|
|
623
624
|
const { userInfo, api } = useWorkflowContext();
|
|
624
625
|
const [comment, setComment] = React7.useState("");
|
|
@@ -700,6 +701,7 @@ function SendBackDialog({
|
|
|
700
701
|
},
|
|
701
702
|
serviceURL: "api"
|
|
702
703
|
});
|
|
704
|
+
console.log("\u{1F680} ~ onSubmit ~ res:", res);
|
|
703
705
|
if ((res == null ? void 0 : res.status) === 200) {
|
|
704
706
|
setSnackbar({
|
|
705
707
|
open: true,
|
|
@@ -725,6 +727,7 @@ function SendBackDialog({
|
|
|
725
727
|
setFileName("");
|
|
726
728
|
setLoading(false);
|
|
727
729
|
closeModal && closeModal();
|
|
730
|
+
onSuccess && onSuccess();
|
|
728
731
|
}
|
|
729
732
|
};
|
|
730
733
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -869,7 +872,8 @@ function ApproveDialog({
|
|
|
869
872
|
closeModal,
|
|
870
873
|
header,
|
|
871
874
|
workflowLogId,
|
|
872
|
-
statusId
|
|
875
|
+
statusId,
|
|
876
|
+
onSuccess
|
|
873
877
|
}) {
|
|
874
878
|
const { userInfo, api } = useWorkflowContext();
|
|
875
879
|
const theme = styles.useTheme();
|
|
@@ -905,11 +909,18 @@ function ApproveDialog({
|
|
|
905
909
|
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
906
910
|
},
|
|
907
911
|
serviceURL: "api"
|
|
908
|
-
})
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
912
|
+
}).then((res) => {
|
|
913
|
+
var _a2, _b2;
|
|
914
|
+
console.log("\u{1F680} ~ onSubmit ~ res:", res);
|
|
915
|
+
((_a2 = res == null ? void 0 : res.error) == null ? void 0 : _a2.status) == 500 ? setSnackbar({
|
|
916
|
+
open: true,
|
|
917
|
+
message: ((_b2 = res == null ? void 0 : res.error) == null ? void 0 : _b2.message) || "Something unexpected occurred!",
|
|
918
|
+
severity: "error"
|
|
919
|
+
}) : setSnackbar({
|
|
920
|
+
open: true,
|
|
921
|
+
message: "Approved successfully!",
|
|
922
|
+
severity: "success"
|
|
923
|
+
});
|
|
913
924
|
});
|
|
914
925
|
} catch (e) {
|
|
915
926
|
setSnackbar({
|
|
@@ -921,6 +932,7 @@ function ApproveDialog({
|
|
|
921
932
|
setComment("");
|
|
922
933
|
setLoading(false);
|
|
923
934
|
closeModal && closeModal();
|
|
935
|
+
onSuccess && onSuccess();
|
|
924
936
|
}
|
|
925
937
|
};
|
|
926
938
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1030,7 +1042,8 @@ function RejectDialog({
|
|
|
1030
1042
|
header,
|
|
1031
1043
|
workflowLogId,
|
|
1032
1044
|
statusId,
|
|
1033
|
-
rejection_reason_master
|
|
1045
|
+
rejection_reason_master,
|
|
1046
|
+
onSuccess
|
|
1034
1047
|
}) {
|
|
1035
1048
|
const { userInfo, api } = useWorkflowContext();
|
|
1036
1049
|
const theme = styles.useTheme();
|
|
@@ -1103,11 +1116,18 @@ function RejectDialog({
|
|
|
1103
1116
|
created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
|
|
1104
1117
|
},
|
|
1105
1118
|
serviceURL: "api"
|
|
1106
|
-
})
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1119
|
+
}).then((res) => {
|
|
1120
|
+
var _a2;
|
|
1121
|
+
console.log("\u{1F680} ~ onSubmit ~ res:", res);
|
|
1122
|
+
(res == null ? void 0 : res.status) == 200 ? setSnackbar({
|
|
1123
|
+
open: true,
|
|
1124
|
+
message: "Rejected successfully!",
|
|
1125
|
+
severity: "success"
|
|
1126
|
+
}) : setSnackbar({
|
|
1127
|
+
open: true,
|
|
1128
|
+
message: ((_a2 = res == null ? void 0 : res.error) == null ? void 0 : _a2.message) || "Something unexpected occurred!",
|
|
1129
|
+
severity: "error"
|
|
1130
|
+
});
|
|
1111
1131
|
});
|
|
1112
1132
|
} catch (e) {
|
|
1113
1133
|
const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
|
|
@@ -1122,6 +1142,7 @@ function RejectDialog({
|
|
|
1122
1142
|
setRejectReasons("");
|
|
1123
1143
|
setLoading(false);
|
|
1124
1144
|
closeModal && closeModal();
|
|
1145
|
+
onSuccess && onSuccess();
|
|
1125
1146
|
}
|
|
1126
1147
|
};
|
|
1127
1148
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1248,7 +1269,8 @@ function OnHoldDialog({
|
|
|
1248
1269
|
closeModal,
|
|
1249
1270
|
header,
|
|
1250
1271
|
workflowLogId,
|
|
1251
|
-
statusId
|
|
1272
|
+
statusId,
|
|
1273
|
+
onSuccess
|
|
1252
1274
|
}) {
|
|
1253
1275
|
const { userInfo, api } = useWorkflowContext();
|
|
1254
1276
|
const theme = styles.useTheme();
|
|
@@ -1300,6 +1322,7 @@ function OnHoldDialog({
|
|
|
1300
1322
|
setComment("");
|
|
1301
1323
|
closeModal && closeModal();
|
|
1302
1324
|
setLoading(false);
|
|
1325
|
+
onSuccess && onSuccess();
|
|
1303
1326
|
}
|
|
1304
1327
|
};
|
|
1305
1328
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -1744,6 +1767,7 @@ function ApprovalWorkflow({
|
|
|
1744
1767
|
const [selectedOption, setSelectedOption] = React7.useState(
|
|
1745
1768
|
selectedWorkflowsList.length ? "selected" : "Assign To Me"
|
|
1746
1769
|
);
|
|
1770
|
+
console.log("\u{1F680} ~ ApprovalWorkflow ~ selectedOption:", selectedOption);
|
|
1747
1771
|
const [expandedId, setExpandedId] = React7.useState(null);
|
|
1748
1772
|
const [sendDialog, setSendDialog] = React7__default.default.useState(null);
|
|
1749
1773
|
const [approveTarget, setApproveTarget] = React7__default.default.useState(null);
|
|
@@ -2098,6 +2122,27 @@ function ApprovalWorkflow({
|
|
|
2098
2122
|
const m = totalMinutes % 60;
|
|
2099
2123
|
return `${d}d: ${h}h: ${m}m`;
|
|
2100
2124
|
}
|
|
2125
|
+
const callAllApi = () => {
|
|
2126
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
2127
|
+
fetchData(
|
|
2128
|
+
"Assign To Me",
|
|
2129
|
+
1,
|
|
2130
|
+
(_a2 = tabs["Assign To Me"]) == null ? void 0 : _a2.search,
|
|
2131
|
+
(_b2 = tabs["Assign To Me"]) == null ? void 0 : _b2.filters
|
|
2132
|
+
);
|
|
2133
|
+
fetchData(
|
|
2134
|
+
"All Requests",
|
|
2135
|
+
1,
|
|
2136
|
+
(_c2 = tabs["All Requests"]) == null ? void 0 : _c2.search,
|
|
2137
|
+
(_d2 = tabs["All Requests"]) == null ? void 0 : _d2.filters
|
|
2138
|
+
);
|
|
2139
|
+
fetchData(
|
|
2140
|
+
"Completed",
|
|
2141
|
+
1,
|
|
2142
|
+
(_e2 = tabs["Completed"]) == null ? void 0 : _e2.search,
|
|
2143
|
+
(_f2 = tabs["Completed"]) == null ? void 0 : _f2.filters
|
|
2144
|
+
);
|
|
2145
|
+
};
|
|
2101
2146
|
if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
|
|
2102
2147
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
|
|
2103
2148
|
console.info("LIBRARY RUNNING...");
|
|
@@ -2267,7 +2312,8 @@ function ApprovalWorkflow({
|
|
|
2267
2312
|
openModal: !!sendDialog,
|
|
2268
2313
|
closeModal: () => setSendDialog(null),
|
|
2269
2314
|
header: "Send Back",
|
|
2270
|
-
workflowLogId: sendDialog || ""
|
|
2315
|
+
workflowLogId: sendDialog || "",
|
|
2316
|
+
onSuccess: () => callAllApi()
|
|
2271
2317
|
}
|
|
2272
2318
|
),
|
|
2273
2319
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2277,7 +2323,8 @@ function ApprovalWorkflow({
|
|
|
2277
2323
|
closeModal: () => setApproveTarget(null),
|
|
2278
2324
|
header: "Approve",
|
|
2279
2325
|
workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
|
|
2280
|
-
statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1]
|
|
2326
|
+
statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1],
|
|
2327
|
+
onSuccess: () => callAllApi()
|
|
2281
2328
|
}
|
|
2282
2329
|
),
|
|
2283
2330
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2288,7 +2335,8 @@ function ApprovalWorkflow({
|
|
|
2288
2335
|
header: "Reject",
|
|
2289
2336
|
workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
|
|
2290
2337
|
statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
|
|
2291
|
-
rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2]
|
|
2338
|
+
rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2],
|
|
2339
|
+
onSuccess: () => callAllApi()
|
|
2292
2340
|
}
|
|
2293
2341
|
),
|
|
2294
2342
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2298,7 +2346,8 @@ function ApprovalWorkflow({
|
|
|
2298
2346
|
closeModal: () => setOnHoldTarget(null),
|
|
2299
2347
|
header: "On Hold",
|
|
2300
2348
|
workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
|
|
2301
|
-
statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1]
|
|
2349
|
+
statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1],
|
|
2350
|
+
onSuccess: () => callAllApi()
|
|
2302
2351
|
}
|
|
2303
2352
|
),
|
|
2304
2353
|
/* @__PURE__ */ jsxRuntime.jsxs(
|