amp-workflow-ui 0.1.18 → 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.mjs CHANGED
@@ -687,6 +687,7 @@ function SendBackDialog({
687
687
  },
688
688
  serviceURL: "api"
689
689
  });
690
+ console.log("\u{1F680} ~ onSubmit ~ res:", res);
690
691
  if ((res == null ? void 0 : res.status) === 200) {
691
692
  setSnackbar({
692
693
  open: true,
@@ -894,11 +895,18 @@ function ApproveDialog({
894
895
  created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
895
896
  },
896
897
  serviceURL: "api"
897
- });
898
- setSnackbar({
899
- open: true,
900
- message: "Approved successfully!",
901
- severity: "success"
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
+ });
902
910
  });
903
911
  } catch (e) {
904
912
  setSnackbar({
@@ -1094,11 +1102,18 @@ function RejectDialog({
1094
1102
  created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
1095
1103
  },
1096
1104
  serviceURL: "api"
1097
- });
1098
- setSnackbar({
1099
- open: true,
1100
- message: "Rejected successfully!",
1101
- severity: "success"
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
+ });
1102
1117
  });
1103
1118
  } catch (e) {
1104
1119
  const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
@@ -1738,6 +1753,7 @@ function ApprovalWorkflow({
1738
1753
  const [selectedOption, setSelectedOption] = useState(
1739
1754
  selectedWorkflowsList.length ? "selected" : "Assign To Me"
1740
1755
  );
1756
+ console.log("\u{1F680} ~ ApprovalWorkflow ~ selectedOption:", selectedOption);
1741
1757
  const [expandedId, setExpandedId] = useState(null);
1742
1758
  const [sendDialog, setSendDialog] = React7.useState(null);
1743
1759
  const [approveTarget, setApproveTarget] = React7.useState(null);
@@ -2092,6 +2108,27 @@ function ApprovalWorkflow({
2092
2108
  const m = totalMinutes % 60;
2093
2109
  return `${d}d: ${h}h: ${m}m`;
2094
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
+ };
2095
2132
  if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
2096
2133
  return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
2097
2134
  console.info("LIBRARY RUNNING...");
@@ -2262,15 +2299,7 @@ function ApprovalWorkflow({
2262
2299
  closeModal: () => setSendDialog(null),
2263
2300
  header: "Send Back",
2264
2301
  workflowLogId: sendDialog || "",
2265
- onSuccess: () => {
2266
- var _a2, _b2;
2267
- return fetchData(
2268
- selectedOption,
2269
- 1,
2270
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2271
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2272
- );
2273
- }
2302
+ onSuccess: () => callAllApi()
2274
2303
  }
2275
2304
  ),
2276
2305
  /* @__PURE__ */ jsx(
@@ -2281,15 +2310,7 @@ function ApprovalWorkflow({
2281
2310
  header: "Approve",
2282
2311
  workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2283
2312
  statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1],
2284
- onSuccess: () => {
2285
- var _a2, _b2;
2286
- return fetchData(
2287
- selectedOption,
2288
- 1,
2289
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2290
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2291
- );
2292
- }
2313
+ onSuccess: () => callAllApi()
2293
2314
  }
2294
2315
  ),
2295
2316
  /* @__PURE__ */ jsx(
@@ -2301,15 +2322,7 @@ function ApprovalWorkflow({
2301
2322
  workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2302
2323
  statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2303
2324
  rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2],
2304
- onSuccess: () => {
2305
- var _a2, _b2;
2306
- return fetchData(
2307
- selectedOption,
2308
- 1,
2309
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2310
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2311
- );
2312
- }
2325
+ onSuccess: () => callAllApi()
2313
2326
  }
2314
2327
  ),
2315
2328
  /* @__PURE__ */ jsx(
@@ -2320,15 +2333,7 @@ function ApprovalWorkflow({
2320
2333
  header: "On Hold",
2321
2334
  workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2322
2335
  statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1],
2323
- onSuccess: () => {
2324
- var _a2, _b2;
2325
- return fetchData(
2326
- selectedOption,
2327
- 1,
2328
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2329
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2330
- );
2331
- }
2336
+ onSuccess: () => callAllApi()
2332
2337
  }
2333
2338
  ),
2334
2339
  /* @__PURE__ */ jsxs(