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.js CHANGED
@@ -701,6 +701,7 @@ function SendBackDialog({
701
701
  },
702
702
  serviceURL: "api"
703
703
  });
704
+ console.log("\u{1F680} ~ onSubmit ~ res:", res);
704
705
  if ((res == null ? void 0 : res.status) === 200) {
705
706
  setSnackbar({
706
707
  open: true,
@@ -908,11 +909,18 @@ function ApproveDialog({
908
909
  created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
909
910
  },
910
911
  serviceURL: "api"
911
- });
912
- setSnackbar({
913
- open: true,
914
- message: "Approved successfully!",
915
- severity: "success"
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
+ });
916
924
  });
917
925
  } catch (e) {
918
926
  setSnackbar({
@@ -1108,11 +1116,18 @@ function RejectDialog({
1108
1116
  created_by: (_a = userInfo == null ? void 0 : userInfo.userInfo) == null ? void 0 : _a.id
1109
1117
  },
1110
1118
  serviceURL: "api"
1111
- });
1112
- setSnackbar({
1113
- open: true,
1114
- message: "Rejected successfully!",
1115
- severity: "success"
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
+ });
1116
1131
  });
1117
1132
  } catch (e) {
1118
1133
  const message = ((_c = (_b = e == null ? void 0 : e.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || "Something went wrong!";
@@ -1752,6 +1767,7 @@ function ApprovalWorkflow({
1752
1767
  const [selectedOption, setSelectedOption] = React7.useState(
1753
1768
  selectedWorkflowsList.length ? "selected" : "Assign To Me"
1754
1769
  );
1770
+ console.log("\u{1F680} ~ ApprovalWorkflow ~ selectedOption:", selectedOption);
1755
1771
  const [expandedId, setExpandedId] = React7.useState(null);
1756
1772
  const [sendDialog, setSendDialog] = React7__default.default.useState(null);
1757
1773
  const [approveTarget, setApproveTarget] = React7__default.default.useState(null);
@@ -2106,6 +2122,27 @@ function ApprovalWorkflow({
2106
2122
  const m = totalMinutes % 60;
2107
2123
  return `${d}d: ${h}h: ${m}m`;
2108
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
+ };
2109
2146
  if (((_e = tabs[selectedOption]) == null ? void 0 : _e.loading) && ((_f = tabs[selectedOption]) == null ? void 0 : _f.page) === 1 && loadingComponent)
2110
2147
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: loadingComponent });
2111
2148
  console.info("LIBRARY RUNNING...");
@@ -2276,15 +2313,7 @@ function ApprovalWorkflow({
2276
2313
  closeModal: () => setSendDialog(null),
2277
2314
  header: "Send Back",
2278
2315
  workflowLogId: sendDialog || "",
2279
- onSuccess: () => {
2280
- var _a2, _b2;
2281
- return fetchData(
2282
- selectedOption,
2283
- 1,
2284
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2285
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2286
- );
2287
- }
2316
+ onSuccess: () => callAllApi()
2288
2317
  }
2289
2318
  ),
2290
2319
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2295,15 +2324,7 @@ function ApprovalWorkflow({
2295
2324
  header: "Approve",
2296
2325
  workflowLogId: (_m = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _m[0],
2297
2326
  statusId: (_n = approveTarget == null ? void 0 : approveTarget.split("|")) == null ? void 0 : _n[1],
2298
- onSuccess: () => {
2299
- var _a2, _b2;
2300
- return fetchData(
2301
- selectedOption,
2302
- 1,
2303
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2304
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2305
- );
2306
- }
2327
+ onSuccess: () => callAllApi()
2307
2328
  }
2308
2329
  ),
2309
2330
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2315,15 +2336,7 @@ function ApprovalWorkflow({
2315
2336
  workflowLogId: (_o = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _o[0],
2316
2337
  statusId: (_p = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _p[1],
2317
2338
  rejection_reason_master: (_q = rejectTarget == null ? void 0 : rejectTarget.split("|")) == null ? void 0 : _q[2],
2318
- onSuccess: () => {
2319
- var _a2, _b2;
2320
- return fetchData(
2321
- selectedOption,
2322
- 1,
2323
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2324
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2325
- );
2326
- }
2339
+ onSuccess: () => callAllApi()
2327
2340
  }
2328
2341
  ),
2329
2342
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2334,15 +2347,7 @@ function ApprovalWorkflow({
2334
2347
  header: "On Hold",
2335
2348
  workflowLogId: (_r = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _r[0],
2336
2349
  statusId: (_s = onHoldTarget == null ? void 0 : onHoldTarget.split("|")) == null ? void 0 : _s[1],
2337
- onSuccess: () => {
2338
- var _a2, _b2;
2339
- return fetchData(
2340
- selectedOption,
2341
- 1,
2342
- (_a2 = tabs[selectedOption]) == null ? void 0 : _a2.search,
2343
- (_b2 = tabs[selectedOption]) == null ? void 0 : _b2.filters
2344
- );
2345
- }
2350
+ onSuccess: () => callAllApi()
2346
2351
  }
2347
2352
  ),
2348
2353
  /* @__PURE__ */ jsxRuntime.jsxs(