flowcore-fn 9.3.7 → 9.3.9

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.
@@ -1608,6 +1608,9 @@
1608
1608
  .fc\:py-8 {
1609
1609
  padding-block: calc(var(--fc-spacing) * 8);
1610
1610
  }
1611
+ .fc\:py-10 {
1612
+ padding-block: calc(var(--fc-spacing) * 10);
1613
+ }
1611
1614
  .fc\:pt-1 {
1612
1615
  padding-top: var(--fc-spacing);
1613
1616
  }
package/dist/pkg-index.js CHANGED
@@ -2110,6 +2110,7 @@ function WorkflowTypeMains() {
2110
2110
 
2111
2111
  // src/components/WorkflowStep/main.js
2112
2112
  var import_react18 = __toESM(require("react"));
2113
+ var import_sweetalert27 = __toESM(require("sweetalert2"));
2113
2114
 
2114
2115
  // src/components/Common/footer.js
2115
2116
  var import_react16 = __toESM(require("react"));
@@ -2128,13 +2129,11 @@ function Footer() {
2128
2129
  ] });
2129
2130
  }
2130
2131
 
2131
- // src/components/WorkflowStep/main.js
2132
- var import_link2 = __toESM(require("next/link"));
2133
-
2134
2132
  // src/components/WorkflowStep/AddWorkflowStepModal.js
2135
2133
  var import_react17 = __toESM(require("react"));
2134
+ var import_sweetalert26 = __toESM(require("sweetalert2"));
2136
2135
  var import_jsx_runtime17 = require("react/jsx-runtime");
2137
- function AddWorkflowStepModal({ onClose }) {
2136
+ function AddWorkflowStepModal({ onClose, onSave }) {
2138
2137
  const [formData, setFormData] = (0, import_react17.useState)({
2139
2138
  workflow: "",
2140
2139
  stepCode: "",
@@ -2149,6 +2148,7 @@ function AddWorkflowStepModal({ onClose }) {
2149
2148
  status: "active"
2150
2149
  });
2151
2150
  const [errors, setErrors] = (0, import_react17.useState)({});
2151
+ const [isSubmitting, setIsSubmitting] = (0, import_react17.useState)(false);
2152
2152
  const handleChange = (field, value) => {
2153
2153
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [field]: value }));
2154
2154
  if (errors[field]) {
@@ -2477,15 +2477,41 @@ function AddWorkflowStepModal({ onClose }) {
2477
2477
  "button",
2478
2478
  {
2479
2479
  type: "button",
2480
- onClick: () => {
2481
- if (validateForm()) {
2482
- console.log("Form Submitted", formData);
2480
+ disabled: isSubmitting,
2481
+ onClick: async () => {
2482
+ var _a, _b, _c, _d, _e;
2483
+ if (!validateForm()) return;
2484
+ try {
2485
+ setIsSubmitting(true);
2486
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
2487
+ if (!endpoint) throw new Error("Workflow step create endpoint is not configured.");
2488
+ const payload = {
2489
+ workflowId: Number(formData.workflow) || 0,
2490
+ stepCode: formData.stepCode.trim().toUpperCase(),
2491
+ stepName: formData.stepName.trim(),
2492
+ sequenceNo: Number(formData.sequenceNo) || 0,
2493
+ slaType: formData.slaType,
2494
+ slaValue: Number(formData.slaValue) || 0,
2495
+ reminderBefore: Number(formData.reminderBefore) || 0,
2496
+ escalationAfter: Number(formData.escalationAfter) || 0,
2497
+ workingHoursOnly: Boolean(formData.workingHoursOnly),
2498
+ excludeHolidays: Boolean(formData.excludeHolidays),
2499
+ createdBy: "System"
2500
+ };
2501
+ await getApiService().post(endpoint, payload);
2502
+ onClose();
2503
+ await (onSave == null ? void 0 : onSave());
2504
+ } catch (error) {
2505
+ const msg = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create workflow step.";
2506
+ await import_sweetalert26.default.fire("Error", msg, "error");
2507
+ } finally {
2508
+ setIsSubmitting(false);
2483
2509
  }
2484
2510
  },
2485
- className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 fc:hover:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/20 fc:transition-all fc:flex fc:items-center fc:gap-2",
2511
+ className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 fc:hover:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/20 fc:transition-all fc:flex fc:items-center fc:gap-2 disabled:fc:opacity-60 disabled:fc:cursor-not-allowed",
2486
2512
  children: [
2487
2513
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { className: "fc:w-4 fc:h-4", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" }) }),
2488
- "Save Workflow Step"
2514
+ isSubmitting ? "Saving..." : "Save Workflow Step"
2489
2515
  ]
2490
2516
  }
2491
2517
  )
@@ -2496,150 +2522,35 @@ function AddWorkflowStepModal({ onClose }) {
2496
2522
 
2497
2523
  // src/components/WorkflowStep/main.js
2498
2524
  var import_jsx_runtime18 = require("react/jsx-runtime");
2499
- var workflowSteps = [{
2500
- workflowStepId: 1,
2501
- workflowId: 1,
2502
- stepCode: "SCR",
2503
- stepName: "Scrutiny",
2504
- sequenceNo: 1,
2505
- slaType: "Hours",
2506
- slaValue: 48,
2507
- reminderBefore: 4,
2508
- escalationAfter: 48,
2509
- workingHoursOnly: 1,
2510
- excludeHolidays: 1
2511
- }, {
2512
- workflowStepId: 1,
2513
- workflowId: 1,
2514
- stepCode: "SCR",
2515
- stepName: "Scrutiny",
2516
- sequenceNo: 1,
2517
- slaType: "Hours",
2518
- slaValue: 48,
2519
- reminderBefore: 4,
2520
- escalationAfter: 48,
2521
- workingHoursOnly: 1,
2522
- excludeHolidays: 1
2523
- }, {
2524
- workflowStepId: 1,
2525
- workflowId: 1,
2526
- stepCode: "SCR",
2527
- stepName: "Scrutiny",
2528
- sequenceNo: 1,
2529
- slaType: "Hours",
2530
- slaValue: 48,
2531
- reminderBefore: 4,
2532
- escalationAfter: 48,
2533
- workingHoursOnly: 1,
2534
- excludeHolidays: 1
2535
- }, {
2536
- workflowStepId: 1,
2537
- workflowId: 1,
2538
- stepCode: "SCR",
2539
- stepName: "Scrutiny",
2540
- sequenceNo: 1,
2541
- slaType: "Hours",
2542
- slaValue: 48,
2543
- reminderBefore: 4,
2544
- escalationAfter: 48,
2545
- workingHoursOnly: 1,
2546
- excludeHolidays: 1
2547
- }, {
2548
- workflowStepId: 1,
2549
- workflowId: 1,
2550
- stepCode: "SCR",
2551
- stepName: "Scrutiny",
2552
- sequenceNo: 1,
2553
- slaType: "Hours",
2554
- slaValue: 48,
2555
- reminderBefore: 4,
2556
- escalationAfter: 48,
2557
- workingHoursOnly: 1,
2558
- excludeHolidays: 1
2559
- }, {
2560
- workflowStepId: 1,
2561
- workflowId: 1,
2562
- stepCode: "SCR",
2563
- stepName: "Scrutiny",
2564
- sequenceNo: 1,
2565
- slaType: "Hours",
2566
- slaValue: 48,
2567
- reminderBefore: 4,
2568
- escalationAfter: 48,
2569
- workingHoursOnly: 1,
2570
- excludeHolidays: 1
2571
- }, {
2572
- workflowStepId: 2,
2573
- workflowId: 1,
2574
- stepCode: "APR",
2575
- stepName: "Approval",
2576
- sequenceNo: 2,
2577
- slaType: "Days",
2578
- slaValue: 2,
2579
- reminderBefore: 1,
2580
- escalationAfter: 2,
2581
- workingHoursOnly: 1,
2582
- excludeHolidays: 1
2583
- }, {
2584
- workflowStepId: 3,
2585
- workflowId: 1,
2586
- stepCode: "APR",
2587
- stepName: "Approval",
2588
- sequenceNo: 3,
2589
- slaType: "Days",
2590
- slaValue: 2,
2591
- reminderBefore: 1,
2592
- escalationAfter: 2,
2593
- workingHoursOnly: 1,
2594
- excludeHolidays: 1
2595
- }, {
2596
- workflowStepId: 4,
2597
- workflowId: 1,
2598
- stepCode: "APR",
2599
- stepName: "Approval",
2600
- sequenceNo: 4,
2601
- slaType: "Days",
2602
- slaValue: 2,
2603
- reminderBefore: 1,
2604
- escalationAfter: 2,
2605
- workingHoursOnly: 1,
2606
- excludeHolidays: 1
2607
- }, {
2608
- workflowStepId: 5,
2609
- workflowId: 1,
2610
- stepCode: "APR",
2611
- stepName: "Approval",
2612
- sequenceNo: 5,
2613
- slaType: "Days",
2614
- slaValue: 2,
2615
- reminderBefore: 1,
2616
- escalationAfter: 2,
2617
- workingHoursOnly: 1,
2618
- excludeHolidays: 1
2619
- }];
2620
2525
  function WorkflowStep() {
2621
- const handleRefresh = () => {
2622
- console.log("Refresh clicked");
2623
- };
2624
- const handleDownload = () => {
2625
- console.log("Download clicked");
2626
- };
2627
2526
  const tableRef = (0, import_react18.useRef)(null);
2628
2527
  const [showModal, setShowModal] = (0, import_react18.useState)(false);
2629
2528
  const [pageSize, setPageSize] = (0, import_react18.useState)(5);
2630
- const [sortConfig, setSortConfig] = (0, import_react18.useState)({
2631
- key: "",
2632
- direction: "asc"
2633
- });
2529
+ const [currentPage, setCurrentPage] = (0, import_react18.useState)(1);
2530
+ const [searchQuery, setSearchQuery] = (0, import_react18.useState)("");
2531
+ const [refreshKey, setRefreshKey] = (0, import_react18.useState)(0);
2532
+ const [apiData, setApiData] = (0, import_react18.useState)([]);
2533
+ const [sortConfig, setSortConfig] = (0, import_react18.useState)({ key: "", direction: "asc" });
2534
+ (0, import_react18.useEffect)(() => {
2535
+ (async () => {
2536
+ var _a, _b, _c, _d, _e, _f, _g;
2537
+ try {
2538
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
2539
+ if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
2540
+ const result = await getApiService().get(endpoint);
2541
+ const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
2542
+ setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
2543
+ } catch (error) {
2544
+ await import_sweetalert27.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load workflow steps.", "error");
2545
+ }
2546
+ })();
2547
+ }, [refreshKey]);
2548
+ const handleRefresh = () => setRefreshKey((prev) => prev + 1);
2634
2549
  const handleSort = (key) => {
2635
2550
  let direction = "asc";
2636
- if (sortConfig.key === key && sortConfig.direction === "asc") {
2637
- direction = "desc";
2638
- }
2639
- setSortConfig({
2640
- key,
2641
- direction
2642
- });
2551
+ if (sortConfig.key === key && sortConfig.direction === "asc") direction = "desc";
2552
+ setSortConfig({ key, direction });
2553
+ setCurrentPage(1);
2643
2554
  };
2644
2555
  return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2645
2556
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
@@ -2657,7 +2568,10 @@ function WorkflowStep() {
2657
2568
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
2658
2569
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "fc:relative fc:max-w-xs fc:w-full", children: [
2659
2570
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fc:absolute fc:inset-y-0 fc:left-0 fc:flex fc:items-center fc:pl-3.5 fc:pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { className: "fc:w-4 fc:h-5 fc:text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
2660
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "text", placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:shadow-md fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
2571
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("input", { type: "text", value: searchQuery, onChange: (e) => {
2572
+ setSearchQuery(e.target.value);
2573
+ setCurrentPage(1);
2574
+ }, placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:shadow-md fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
2661
2575
  ] }),
2662
2576
  /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold", children: [
2663
2577
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Refresh_default, { onRefresh: handleRefresh }),
@@ -2707,30 +2621,63 @@ function WorkflowStep() {
2707
2621
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fc:truncate", children: column.label }),
2708
2622
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fc:text-slate-300 fc:text-[10px]", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
2709
2623
  ] }) }, column.key)) }) }),
2710
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: workflowSteps.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
2711
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowStepId }),
2712
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
2713
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-2 fc:py-4 fc:text-center fc:text-[14px]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fc:inline-flex fc:items-center fc:px-2 fc:py-0.5 fc:rounded-md fc:bg-slate-100 fc:text-slate-600 fc:text-xs fc:font-bold fc:border fc:border-slate-200 fc:truncate", children: item.stepCode }) }),
2714
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.stepName }),
2715
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.sequenceNo }),
2716
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.slaType }),
2717
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.slaValue }),
2718
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.reminderBefore }),
2719
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.escalationAfter }),
2720
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workingHoursOnly }),
2721
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.excludeHolidays })
2722
- ] }, item.workflowStepId)) })
2624
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tbody", { children: (() => {
2625
+ const q = searchQuery.toLowerCase();
2626
+ const filtered = apiData.filter(
2627
+ (item) => {
2628
+ var _a, _b, _c;
2629
+ return !q || String((_a = item.stepCode) != null ? _a : "").toLowerCase().includes(q) || String((_b = item.stepName) != null ? _b : "").toLowerCase().includes(q) || String((_c = item.workflowId) != null ? _c : "").toLowerCase().includes(q);
2630
+ }
2631
+ );
2632
+ const sorted = [...filtered].sort((a, b) => {
2633
+ var _a, _b;
2634
+ if (!sortConfig.key) return 0;
2635
+ const aVal = (_a = a[sortConfig.key]) != null ? _a : "";
2636
+ const bVal = (_b = b[sortConfig.key]) != null ? _b : "";
2637
+ return sortConfig.direction === "asc" ? String(aVal).localeCompare(String(bVal), void 0, { numeric: true }) : String(bVal).localeCompare(String(aVal), void 0, { numeric: true });
2638
+ });
2639
+ const start = (currentPage - 1) * pageSize;
2640
+ const paginated = sorted.slice(start, start + pageSize);
2641
+ if (paginated.length === 0) {
2642
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { colSpan: 11, className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm", children: "No records found." }) });
2643
+ }
2644
+ return paginated.map((item, idx) => {
2645
+ var _a;
2646
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
2647
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowStepId }),
2648
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
2649
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-2 fc:py-4 fc:text-center fc:text-[14px]", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "fc:inline-flex fc:items-center fc:px-2 fc:py-0.5 fc:rounded-md fc:bg-slate-100 fc:text-slate-600 fc:text-xs fc:font-bold fc:border fc:border-slate-200 fc:truncate", children: item.stepCode }) }),
2650
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.stepName }),
2651
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.sequenceNo }),
2652
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.slaType }),
2653
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.slaValue }),
2654
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.reminderBefore }),
2655
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.escalationAfter }),
2656
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workingHoursOnly }),
2657
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.excludeHolidays })
2658
+ ] }, (_a = item.workflowStepId) != null ? _a : idx);
2659
+ });
2660
+ })() })
2723
2661
  ] }) }) }),
2724
2662
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Footer, {}) })
2725
2663
  ] })
2726
2664
  ] }),
2727
- showModal && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AddWorkflowStepModal, { onClose: () => setShowModal(false) })
2665
+ showModal && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2666
+ AddWorkflowStepModal,
2667
+ {
2668
+ onClose: () => setShowModal(false),
2669
+ onSave: async () => {
2670
+ await import_sweetalert27.default.fire("Success", "Workflow step created successfully.", "success");
2671
+ handleRefresh();
2672
+ }
2673
+ }
2674
+ )
2728
2675
  ] });
2729
2676
  }
2730
2677
 
2731
2678
  // src/components/WorkFlowTransition/Transitiontable.js
2732
2679
  var import_react20 = __toESM(require("react"));
2733
- var import_link3 = __toESM(require("next/link"));
2680
+ var import_link2 = __toESM(require("next/link"));
2734
2681
 
2735
2682
  // src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
2736
2683
  var import_react19 = __toESM(require("react"));
@@ -3271,7 +3218,7 @@ function WorkFlowTransition() {
3271
3218
 
3272
3219
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3273
3220
  var import_react26 = __toESM(require("react"));
3274
- var import_sweetalert26 = __toESM(require("sweetalert2"));
3221
+ var import_sweetalert28 = __toESM(require("sweetalert2"));
3275
3222
 
3276
3223
  // src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
3277
3224
  var import_react21 = __toESM(require("react"));
@@ -3841,7 +3788,7 @@ function User_hierarchy_mapping_main() {
3841
3788
  const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
3842
3789
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
3843
3790
  } catch (error) {
3844
- await import_sweetalert26.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load user hierarchy node mappings.", "error");
3791
+ await import_sweetalert28.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load user hierarchy node mappings.", "error");
3845
3792
  }
3846
3793
  })();
3847
3794
  }, [refreshkey]);
@@ -3864,11 +3811,11 @@ function User_hierarchy_mapping_main() {
3864
3811
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.userHierarchyNodeMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
3865
3812
  if (!endpoint) throw new Error(`User hierarchy node mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
3866
3813
  await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
3867
- await import_sweetalert26.default.fire("Success", `User hierarchy node mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
3814
+ await import_sweetalert28.default.fire("Success", `User hierarchy node mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
3868
3815
  handleRefresh();
3869
3816
  return true;
3870
3817
  } catch (error) {
3871
- await import_sweetalert26.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} user hierarchy node mapping.`, "error");
3818
+ await import_sweetalert28.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} user hierarchy node mapping.`, "error");
3872
3819
  return false;
3873
3820
  }
3874
3821
  };
@@ -8940,7 +8887,7 @@ function Comment_main() {
8940
8887
 
8941
8888
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
8942
8889
  var import_react68 = __toESM(require("react"));
8943
- var import_sweetalert27 = __toESM(require("sweetalert2"));
8890
+ var import_sweetalert29 = __toESM(require("sweetalert2"));
8944
8891
 
8945
8892
  // src/components/hierarchy-node/SearchBar.jsx
8946
8893
  var import_react63 = __toESM(require("react"));
@@ -9015,7 +8962,7 @@ function AddEditModal({
9015
8962
  const handleSave = async () => {
9016
8963
  const success = await (onSave == null ? void 0 : onSave({
9017
8964
  hierarchyNodeId: Number(formData.hierarchyNodeId),
9018
- parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0),
8965
+ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId) || null,
9019
8966
  hierarchyLevel: Number(formData.hierarchyLevel || 0),
9020
8967
  nodeType: formData.nodeType,
9021
8968
  nodeName: formData.nodeName,
@@ -9416,7 +9363,15 @@ function AddHierarchyNodeModal({
9416
9363
  const handleSave = async () => {
9417
9364
  if (!onSave) return;
9418
9365
  setIsSubmitting(true);
9419
- const success = await onSave({ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0), hierarchyLevel: Number(formData.hierarchyLevel || 0), nodeType: formData.nodeType, nodeName: formData.nodeName, externalEntityType: formData.externalEntityType, externalEntityId: Number(formData.externalEntityId || 0), createdBy: "System" });
9366
+ const success = await onSave({
9367
+ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId) || null,
9368
+ hierarchyLevel: Number(formData.hierarchyLevel || 0),
9369
+ nodeType: formData.nodeType,
9370
+ nodeName: formData.nodeName,
9371
+ externalEntityType: formData.externalEntityType,
9372
+ externalEntityId: Number(formData.externalEntityId || 0),
9373
+ createdBy: "System"
9374
+ });
9420
9375
  setIsSubmitting(false);
9421
9376
  if (success) onClose();
9422
9377
  };
@@ -9536,7 +9491,7 @@ function HierarchyNodeMain() {
9536
9491
  const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
9537
9492
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
9538
9493
  } catch (error) {
9539
- await import_sweetalert27.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9494
+ await import_sweetalert29.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9540
9495
  }
9541
9496
  })();
9542
9497
  }, [refreshKey]);
@@ -9549,11 +9504,11 @@ function HierarchyNodeMain() {
9549
9504
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
9550
9505
  if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
9551
9506
  await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
9552
- await import_sweetalert27.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
9507
+ await import_sweetalert29.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
9553
9508
  handleRefresh();
9554
9509
  return true;
9555
9510
  } catch (error) {
9556
- await import_sweetalert27.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
9511
+ await import_sweetalert29.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
9557
9512
  return false;
9558
9513
  }
9559
9514
  };
@@ -10263,7 +10218,7 @@ function UploadedDocumentMain() {
10263
10218
 
10264
10219
  // src/components/BuisnessEntity/BusinessEntitymain.js
10265
10220
  var import_react78 = __toESM(require("react"));
10266
- var import_link4 = __toESM(require("next/link"));
10221
+ var import_link3 = __toESM(require("next/link"));
10267
10222
 
10268
10223
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
10269
10224
  var import_react77 = __toESM(require("react"));
@@ -10735,7 +10690,7 @@ function BusinessEntity() {
10735
10690
 
10736
10691
  // src/components/FileInstance/FileInstancemain.js
10737
10692
  var import_react80 = __toESM(require("react"));
10738
- var import_link5 = __toESM(require("next/link"));
10693
+ var import_link4 = __toESM(require("next/link"));
10739
10694
 
10740
10695
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
10741
10696
  var import_react79 = __toESM(require("react"));
@@ -11849,7 +11804,7 @@ function Sidebar({
11849
11804
  const Icon = item.icon;
11850
11805
  const handleClick = () => {
11851
11806
  if (item.component) {
11852
- router.push("/flowCore", void 0, {
11807
+ router.push("/", void 0, {
11853
11808
  shallow: true
11854
11809
  });
11855
11810
  setActiveComponent(item.component);
@@ -2073,7 +2073,8 @@ function WorkflowTypeMains() {
2073
2073
  }
2074
2074
 
2075
2075
  // src/components/WorkflowStep/main.js
2076
- import React18, { useState as useState12, useRef as useRef4 } from "react";
2076
+ import React18, { useState as useState12, useRef as useRef4, useEffect as useEffect9 } from "react";
2077
+ import Swal7 from "sweetalert2";
2077
2078
 
2078
2079
  // src/components/Common/footer.js
2079
2080
  import React16 from "react";
@@ -2092,13 +2093,11 @@ function Footer() {
2092
2093
  ] });
2093
2094
  }
2094
2095
 
2095
- // src/components/WorkflowStep/main.js
2096
- import Link2 from "next/link";
2097
-
2098
2096
  // src/components/WorkflowStep/AddWorkflowStepModal.js
2099
2097
  import React17, { useState as useState11 } from "react";
2098
+ import Swal6 from "sweetalert2";
2100
2099
  import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
2101
- function AddWorkflowStepModal({ onClose }) {
2100
+ function AddWorkflowStepModal({ onClose, onSave }) {
2102
2101
  const [formData, setFormData] = useState11({
2103
2102
  workflow: "",
2104
2103
  stepCode: "",
@@ -2113,6 +2112,7 @@ function AddWorkflowStepModal({ onClose }) {
2113
2112
  status: "active"
2114
2113
  });
2115
2114
  const [errors, setErrors] = useState11({});
2115
+ const [isSubmitting, setIsSubmitting] = useState11(false);
2116
2116
  const handleChange = (field, value) => {
2117
2117
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [field]: value }));
2118
2118
  if (errors[field]) {
@@ -2441,15 +2441,41 @@ function AddWorkflowStepModal({ onClose }) {
2441
2441
  "button",
2442
2442
  {
2443
2443
  type: "button",
2444
- onClick: () => {
2445
- if (validateForm()) {
2446
- console.log("Form Submitted", formData);
2444
+ disabled: isSubmitting,
2445
+ onClick: async () => {
2446
+ var _a, _b, _c, _d, _e;
2447
+ if (!validateForm()) return;
2448
+ try {
2449
+ setIsSubmitting(true);
2450
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
2451
+ if (!endpoint) throw new Error("Workflow step create endpoint is not configured.");
2452
+ const payload = {
2453
+ workflowId: Number(formData.workflow) || 0,
2454
+ stepCode: formData.stepCode.trim().toUpperCase(),
2455
+ stepName: formData.stepName.trim(),
2456
+ sequenceNo: Number(formData.sequenceNo) || 0,
2457
+ slaType: formData.slaType,
2458
+ slaValue: Number(formData.slaValue) || 0,
2459
+ reminderBefore: Number(formData.reminderBefore) || 0,
2460
+ escalationAfter: Number(formData.escalationAfter) || 0,
2461
+ workingHoursOnly: Boolean(formData.workingHoursOnly),
2462
+ excludeHolidays: Boolean(formData.excludeHolidays),
2463
+ createdBy: "System"
2464
+ };
2465
+ await getApiService().post(endpoint, payload);
2466
+ onClose();
2467
+ await (onSave == null ? void 0 : onSave());
2468
+ } catch (error) {
2469
+ const msg = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create workflow step.";
2470
+ await Swal6.fire("Error", msg, "error");
2471
+ } finally {
2472
+ setIsSubmitting(false);
2447
2473
  }
2448
2474
  },
2449
- className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 fc:hover:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/20 fc:transition-all fc:flex fc:items-center fc:gap-2",
2475
+ className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 fc:hover:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/20 fc:transition-all fc:flex fc:items-center fc:gap-2 disabled:fc:opacity-60 disabled:fc:cursor-not-allowed",
2450
2476
  children: [
2451
2477
  /* @__PURE__ */ jsx17("svg", { className: "fc:w-4 fc:h-4", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx17("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" }) }),
2452
- "Save Workflow Step"
2478
+ isSubmitting ? "Saving..." : "Save Workflow Step"
2453
2479
  ]
2454
2480
  }
2455
2481
  )
@@ -2460,150 +2486,35 @@ function AddWorkflowStepModal({ onClose }) {
2460
2486
 
2461
2487
  // src/components/WorkflowStep/main.js
2462
2488
  import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2463
- var workflowSteps = [{
2464
- workflowStepId: 1,
2465
- workflowId: 1,
2466
- stepCode: "SCR",
2467
- stepName: "Scrutiny",
2468
- sequenceNo: 1,
2469
- slaType: "Hours",
2470
- slaValue: 48,
2471
- reminderBefore: 4,
2472
- escalationAfter: 48,
2473
- workingHoursOnly: 1,
2474
- excludeHolidays: 1
2475
- }, {
2476
- workflowStepId: 1,
2477
- workflowId: 1,
2478
- stepCode: "SCR",
2479
- stepName: "Scrutiny",
2480
- sequenceNo: 1,
2481
- slaType: "Hours",
2482
- slaValue: 48,
2483
- reminderBefore: 4,
2484
- escalationAfter: 48,
2485
- workingHoursOnly: 1,
2486
- excludeHolidays: 1
2487
- }, {
2488
- workflowStepId: 1,
2489
- workflowId: 1,
2490
- stepCode: "SCR",
2491
- stepName: "Scrutiny",
2492
- sequenceNo: 1,
2493
- slaType: "Hours",
2494
- slaValue: 48,
2495
- reminderBefore: 4,
2496
- escalationAfter: 48,
2497
- workingHoursOnly: 1,
2498
- excludeHolidays: 1
2499
- }, {
2500
- workflowStepId: 1,
2501
- workflowId: 1,
2502
- stepCode: "SCR",
2503
- stepName: "Scrutiny",
2504
- sequenceNo: 1,
2505
- slaType: "Hours",
2506
- slaValue: 48,
2507
- reminderBefore: 4,
2508
- escalationAfter: 48,
2509
- workingHoursOnly: 1,
2510
- excludeHolidays: 1
2511
- }, {
2512
- workflowStepId: 1,
2513
- workflowId: 1,
2514
- stepCode: "SCR",
2515
- stepName: "Scrutiny",
2516
- sequenceNo: 1,
2517
- slaType: "Hours",
2518
- slaValue: 48,
2519
- reminderBefore: 4,
2520
- escalationAfter: 48,
2521
- workingHoursOnly: 1,
2522
- excludeHolidays: 1
2523
- }, {
2524
- workflowStepId: 1,
2525
- workflowId: 1,
2526
- stepCode: "SCR",
2527
- stepName: "Scrutiny",
2528
- sequenceNo: 1,
2529
- slaType: "Hours",
2530
- slaValue: 48,
2531
- reminderBefore: 4,
2532
- escalationAfter: 48,
2533
- workingHoursOnly: 1,
2534
- excludeHolidays: 1
2535
- }, {
2536
- workflowStepId: 2,
2537
- workflowId: 1,
2538
- stepCode: "APR",
2539
- stepName: "Approval",
2540
- sequenceNo: 2,
2541
- slaType: "Days",
2542
- slaValue: 2,
2543
- reminderBefore: 1,
2544
- escalationAfter: 2,
2545
- workingHoursOnly: 1,
2546
- excludeHolidays: 1
2547
- }, {
2548
- workflowStepId: 3,
2549
- workflowId: 1,
2550
- stepCode: "APR",
2551
- stepName: "Approval",
2552
- sequenceNo: 3,
2553
- slaType: "Days",
2554
- slaValue: 2,
2555
- reminderBefore: 1,
2556
- escalationAfter: 2,
2557
- workingHoursOnly: 1,
2558
- excludeHolidays: 1
2559
- }, {
2560
- workflowStepId: 4,
2561
- workflowId: 1,
2562
- stepCode: "APR",
2563
- stepName: "Approval",
2564
- sequenceNo: 4,
2565
- slaType: "Days",
2566
- slaValue: 2,
2567
- reminderBefore: 1,
2568
- escalationAfter: 2,
2569
- workingHoursOnly: 1,
2570
- excludeHolidays: 1
2571
- }, {
2572
- workflowStepId: 5,
2573
- workflowId: 1,
2574
- stepCode: "APR",
2575
- stepName: "Approval",
2576
- sequenceNo: 5,
2577
- slaType: "Days",
2578
- slaValue: 2,
2579
- reminderBefore: 1,
2580
- escalationAfter: 2,
2581
- workingHoursOnly: 1,
2582
- excludeHolidays: 1
2583
- }];
2584
2489
  function WorkflowStep() {
2585
- const handleRefresh = () => {
2586
- console.log("Refresh clicked");
2587
- };
2588
- const handleDownload = () => {
2589
- console.log("Download clicked");
2590
- };
2591
2490
  const tableRef = useRef4(null);
2592
2491
  const [showModal, setShowModal] = useState12(false);
2593
2492
  const [pageSize, setPageSize] = useState12(5);
2594
- const [sortConfig, setSortConfig] = useState12({
2595
- key: "",
2596
- direction: "asc"
2597
- });
2493
+ const [currentPage, setCurrentPage] = useState12(1);
2494
+ const [searchQuery, setSearchQuery] = useState12("");
2495
+ const [refreshKey, setRefreshKey] = useState12(0);
2496
+ const [apiData, setApiData] = useState12([]);
2497
+ const [sortConfig, setSortConfig] = useState12({ key: "", direction: "asc" });
2498
+ useEffect9(() => {
2499
+ (async () => {
2500
+ var _a, _b, _c, _d, _e, _f, _g;
2501
+ try {
2502
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
2503
+ if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
2504
+ const result = await getApiService().get(endpoint);
2505
+ const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
2506
+ setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
2507
+ } catch (error) {
2508
+ await Swal7.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load workflow steps.", "error");
2509
+ }
2510
+ })();
2511
+ }, [refreshKey]);
2512
+ const handleRefresh = () => setRefreshKey((prev) => prev + 1);
2598
2513
  const handleSort = (key) => {
2599
2514
  let direction = "asc";
2600
- if (sortConfig.key === key && sortConfig.direction === "asc") {
2601
- direction = "desc";
2602
- }
2603
- setSortConfig({
2604
- key,
2605
- direction
2606
- });
2515
+ if (sortConfig.key === key && sortConfig.direction === "asc") direction = "desc";
2516
+ setSortConfig({ key, direction });
2517
+ setCurrentPage(1);
2607
2518
  };
2608
2519
  return /* @__PURE__ */ jsxs17(Fragment4, { children: [
2609
2520
  /* @__PURE__ */ jsxs17("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
@@ -2621,7 +2532,10 @@ function WorkflowStep() {
2621
2532
  /* @__PURE__ */ jsxs17("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
2622
2533
  /* @__PURE__ */ jsxs17("div", { className: "fc:relative fc:max-w-xs fc:w-full", children: [
2623
2534
  /* @__PURE__ */ jsx18("span", { className: "fc:absolute fc:inset-y-0 fc:left-0 fc:flex fc:items-center fc:pl-3.5 fc:pointer-events-none", children: /* @__PURE__ */ jsx18("svg", { className: "fc:w-4 fc:h-5 fc:text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx18("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
2624
- /* @__PURE__ */ jsx18("input", { type: "text", placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:shadow-md fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
2535
+ /* @__PURE__ */ jsx18("input", { type: "text", value: searchQuery, onChange: (e) => {
2536
+ setSearchQuery(e.target.value);
2537
+ setCurrentPage(1);
2538
+ }, placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:shadow-md fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
2625
2539
  ] }),
2626
2540
  /* @__PURE__ */ jsxs17("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold", children: [
2627
2541
  /* @__PURE__ */ jsx18(Refresh_default, { onRefresh: handleRefresh }),
@@ -2671,30 +2585,63 @@ function WorkflowStep() {
2671
2585
  /* @__PURE__ */ jsx18("span", { className: "fc:truncate", children: column.label }),
2672
2586
  /* @__PURE__ */ jsx18("span", { className: "fc:text-slate-300 fc:text-[10px]", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
2673
2587
  ] }) }, column.key)) }) }),
2674
- /* @__PURE__ */ jsx18("tbody", { children: workflowSteps.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs17("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
2675
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowStepId }),
2676
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
2677
- /* @__PURE__ */ jsx18("td", { className: "fc:px-2 fc:py-4 fc:text-center fc:text-[14px]", children: /* @__PURE__ */ jsx18("span", { className: "fc:inline-flex fc:items-center fc:px-2 fc:py-0.5 fc:rounded-md fc:bg-slate-100 fc:text-slate-600 fc:text-xs fc:font-bold fc:border fc:border-slate-200 fc:truncate", children: item.stepCode }) }),
2678
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.stepName }),
2679
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.sequenceNo }),
2680
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.slaType }),
2681
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.slaValue }),
2682
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.reminderBefore }),
2683
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.escalationAfter }),
2684
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workingHoursOnly }),
2685
- /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.excludeHolidays })
2686
- ] }, item.workflowStepId)) })
2588
+ /* @__PURE__ */ jsx18("tbody", { children: (() => {
2589
+ const q = searchQuery.toLowerCase();
2590
+ const filtered = apiData.filter(
2591
+ (item) => {
2592
+ var _a, _b, _c;
2593
+ return !q || String((_a = item.stepCode) != null ? _a : "").toLowerCase().includes(q) || String((_b = item.stepName) != null ? _b : "").toLowerCase().includes(q) || String((_c = item.workflowId) != null ? _c : "").toLowerCase().includes(q);
2594
+ }
2595
+ );
2596
+ const sorted = [...filtered].sort((a, b) => {
2597
+ var _a, _b;
2598
+ if (!sortConfig.key) return 0;
2599
+ const aVal = (_a = a[sortConfig.key]) != null ? _a : "";
2600
+ const bVal = (_b = b[sortConfig.key]) != null ? _b : "";
2601
+ return sortConfig.direction === "asc" ? String(aVal).localeCompare(String(bVal), void 0, { numeric: true }) : String(bVal).localeCompare(String(aVal), void 0, { numeric: true });
2602
+ });
2603
+ const start = (currentPage - 1) * pageSize;
2604
+ const paginated = sorted.slice(start, start + pageSize);
2605
+ if (paginated.length === 0) {
2606
+ return /* @__PURE__ */ jsx18("tr", { children: /* @__PURE__ */ jsx18("td", { colSpan: 11, className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm", children: "No records found." }) });
2607
+ }
2608
+ return paginated.map((item, idx) => {
2609
+ var _a;
2610
+ return /* @__PURE__ */ jsxs17("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
2611
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowStepId }),
2612
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
2613
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-2 fc:py-4 fc:text-center fc:text-[14px]", children: /* @__PURE__ */ jsx18("span", { className: "fc:inline-flex fc:items-center fc:px-2 fc:py-0.5 fc:rounded-md fc:bg-slate-100 fc:text-slate-600 fc:text-xs fc:font-bold fc:border fc:border-slate-200 fc:truncate", children: item.stepCode }) }),
2614
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.stepName }),
2615
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.sequenceNo }),
2616
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.slaType }),
2617
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.slaValue }),
2618
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.reminderBefore }),
2619
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.escalationAfter }),
2620
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workingHoursOnly }),
2621
+ /* @__PURE__ */ jsx18("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.excludeHolidays })
2622
+ ] }, (_a = item.workflowStepId) != null ? _a : idx);
2623
+ });
2624
+ })() })
2687
2625
  ] }) }) }),
2688
2626
  /* @__PURE__ */ jsx18("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: /* @__PURE__ */ jsx18(Footer, {}) })
2689
2627
  ] })
2690
2628
  ] }),
2691
- showModal && /* @__PURE__ */ jsx18(AddWorkflowStepModal, { onClose: () => setShowModal(false) })
2629
+ showModal && /* @__PURE__ */ jsx18(
2630
+ AddWorkflowStepModal,
2631
+ {
2632
+ onClose: () => setShowModal(false),
2633
+ onSave: async () => {
2634
+ await Swal7.fire("Success", "Workflow step created successfully.", "success");
2635
+ handleRefresh();
2636
+ }
2637
+ }
2638
+ )
2692
2639
  ] });
2693
2640
  }
2694
2641
 
2695
2642
  // src/components/WorkFlowTransition/Transitiontable.js
2696
2643
  import React20, { useState as useState14, useRef as useRef5 } from "react";
2697
- import Link3 from "next/link";
2644
+ import Link2 from "next/link";
2698
2645
 
2699
2646
  // src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
2700
2647
  import React19, { useState as useState13 } from "react";
@@ -3234,8 +3181,8 @@ function WorkFlowTransition() {
3234
3181
  }
3235
3182
 
3236
3183
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3237
- import React26, { useState as useState18, useRef as useRef6, useEffect as useEffect11 } from "react";
3238
- import Swal6 from "sweetalert2";
3184
+ import React26, { useState as useState18, useRef as useRef6, useEffect as useEffect12 } from "react";
3185
+ import Swal8 from "sweetalert2";
3239
3186
 
3240
3187
  // src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
3241
3188
  import React21, { useState as useState15 } from "react";
@@ -3379,10 +3326,10 @@ function MappingSearchBar({
3379
3326
  }
3380
3327
 
3381
3328
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
3382
- import React25, { useState as useState17, useEffect as useEffect10 } from "react";
3329
+ import React25, { useState as useState17, useEffect as useEffect11 } from "react";
3383
3330
 
3384
3331
  // src/components/user-hierarchy-node-mapping/edit-mapping.jsx
3385
- import React23, { useEffect as useEffect9, useState as useState16 } from "react";
3332
+ import React23, { useEffect as useEffect10, useState as useState16 } from "react";
3386
3333
  import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
3387
3334
  function EditUserHierarchyNodeMappingModal({
3388
3335
  isOpen,
@@ -3397,7 +3344,7 @@ function EditUserHierarchyNodeMappingModal({
3397
3344
  effectiveFrom: "",
3398
3345
  effectiveTo: ""
3399
3346
  });
3400
- useEffect9(() => {
3347
+ useEffect10(() => {
3401
3348
  if (selectedMapping) {
3402
3349
  setFormData({
3403
3350
  hierarchyNodeId: selectedMapping.hierarchyNodeId || "",
@@ -3645,7 +3592,7 @@ function UserHierarchyNodeMappingTable({
3645
3592
  onDelete
3646
3593
  }) {
3647
3594
  const [data, setData] = useState17(apiData || []);
3648
- useEffect10(() => {
3595
+ useEffect11(() => {
3649
3596
  setData(apiData || []);
3650
3597
  }, [apiData]);
3651
3598
  const [sortOrder, setSortOrder] = useState17("asc");
@@ -3665,7 +3612,7 @@ function UserHierarchyNodeMappingTable({
3665
3612
  const query = (searchQuery || "").toLowerCase();
3666
3613
  return String(item.mappingId).toLowerCase().includes(query) || String(item.externalUserId).toLowerCase().includes(query) || String(item.hierarchyNodeId).toLowerCase().includes(query) || item.roleCode.toLowerCase().includes(query);
3667
3614
  });
3668
- useEffect10(() => {
3615
+ useEffect11(() => {
3669
3616
  if (setTotalEntries) setTotalEntries(filteredData.length);
3670
3617
  }, [filteredData.length, setTotalEntries]);
3671
3618
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -3795,7 +3742,7 @@ import { jsx as jsx26, jsxs as jsxs25 } from "react/jsx-runtime";
3795
3742
  function User_hierarchy_mapping_main() {
3796
3743
  const [refreshkey, setRefreshKey] = useState18(0);
3797
3744
  const [apiData, setApiData] = useState18([]);
3798
- useEffect11(() => {
3745
+ useEffect12(() => {
3799
3746
  (async () => {
3800
3747
  var _a, _b, _c, _d, _e, _f, _g;
3801
3748
  try {
@@ -3805,7 +3752,7 @@ function User_hierarchy_mapping_main() {
3805
3752
  const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
3806
3753
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
3807
3754
  } catch (error) {
3808
- await Swal6.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load user hierarchy node mappings.", "error");
3755
+ await Swal8.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load user hierarchy node mappings.", "error");
3809
3756
  }
3810
3757
  })();
3811
3758
  }, [refreshkey]);
@@ -3828,11 +3775,11 @@ function User_hierarchy_mapping_main() {
3828
3775
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.userHierarchyNodeMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
3829
3776
  if (!endpoint) throw new Error(`User hierarchy node mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
3830
3777
  await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
3831
- await Swal6.fire("Success", `User hierarchy node mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
3778
+ await Swal8.fire("Success", `User hierarchy node mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
3832
3779
  handleRefresh();
3833
3780
  return true;
3834
3781
  } catch (error) {
3835
- await Swal6.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} user hierarchy node mapping.`, "error");
3782
+ await Swal8.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} user hierarchy node mapping.`, "error");
3836
3783
  return false;
3837
3784
  }
3838
3785
  };
@@ -3893,10 +3840,10 @@ function SearchBar3({
3893
3840
  }
3894
3841
 
3895
3842
  // src/components/document-configuration/DocumentConfigurationTable.jsx
3896
- import React30, { useState as useState20, useEffect as useEffect13 } from "react";
3843
+ import React30, { useState as useState20, useEffect as useEffect14 } from "react";
3897
3844
 
3898
3845
  // src/components/document-configuration/Edit.jsx
3899
- import React28, { useState as useState19, useEffect as useEffect12 } from "react";
3846
+ import React28, { useState as useState19, useEffect as useEffect13 } from "react";
3900
3847
  import { jsx as jsx28, jsxs as jsxs27 } from "react/jsx-runtime";
3901
3848
  function EditDocumentConfiguration({
3902
3849
  isOpen,
@@ -3914,7 +3861,7 @@ function EditDocumentConfiguration({
3914
3861
  status: "Active"
3915
3862
  });
3916
3863
  const [errors, setErrors] = useState19({});
3917
- useEffect12(() => {
3864
+ useEffect13(() => {
3918
3865
  if (initialData) {
3919
3866
  const sizeParts = (initialData.maxSize || "10 MB").split(" ");
3920
3867
  setFormData({
@@ -4344,7 +4291,7 @@ function DocumentConfigTable({
4344
4291
  const query = (searchQuery || "").toLowerCase();
4345
4292
  return item.docName.toLowerCase().includes(query) || item.extensions.toLowerCase().includes(query) || item.stepId.toLowerCase().includes(query);
4346
4293
  });
4347
- useEffect13(() => {
4294
+ useEffect14(() => {
4348
4295
  if (setTotalEntries) setTotalEntries(filteredData.length);
4349
4296
  }, [filteredData.length, setTotalEntries]);
4350
4297
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -4765,7 +4712,7 @@ function SearchBar4({
4765
4712
  }
4766
4713
 
4767
4714
  // src/components/audit-log/AuditLogTable.jsx
4768
- import React34, { useState as useState23, useEffect as useEffect14 } from "react";
4715
+ import React34, { useState as useState23, useEffect as useEffect15 } from "react";
4769
4716
  import { jsx as jsx34, jsxs as jsxs33 } from "react/jsx-runtime";
4770
4717
  function AuditLogTable({
4771
4718
  pageSize,
@@ -4993,7 +4940,7 @@ function AuditLogTable({
4993
4940
  const query = (searchQuery || "").toLowerCase();
4994
4941
  return item.logId.toLowerCase().includes(query) || item.user.toLowerCase().includes(query) || item.section.toLowerCase().includes(query) || item.action.toLowerCase().includes(query);
4995
4942
  });
4996
- useEffect14(() => {
4943
+ useEffect15(() => {
4997
4944
  if (setTotalEntries) setTotalEntries(filteredData.length);
4998
4945
  }, [filteredData.length, setTotalEntries]);
4999
4946
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5281,7 +5228,7 @@ function SearchBar5({
5281
5228
  }
5282
5229
 
5283
5230
  // src/components/movement-history/MovementHistoryTable.jsx
5284
- import React38, { useState as useState26, useEffect as useEffect15 } from "react";
5231
+ import React38, { useState as useState26, useEffect as useEffect16 } from "react";
5285
5232
  import { jsx as jsx38, jsxs as jsxs37 } from "react/jsx-runtime";
5286
5233
  function MovementHistoryTable({
5287
5234
  pageSize,
@@ -5509,7 +5456,7 @@ function MovementHistoryTable({
5509
5456
  const query = (searchQuery || "").toLowerCase();
5510
5457
  return item.movementHistoryId.toLowerCase().includes(query) || item.name.toLowerCase().includes(query) || item.toStepId.toLowerCase().includes(query);
5511
5458
  });
5512
- useEffect15(() => {
5459
+ useEffect16(() => {
5513
5460
  if (setTotalEntries) setTotalEntries(filteredData.length);
5514
5461
  }, [filteredData.length, setTotalEntries]);
5515
5462
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5791,7 +5738,7 @@ function SearchBar6({
5791
5738
  }
5792
5739
 
5793
5740
  // src/components/task-permission/Table.js
5794
- import React42, { useState as useState29, useEffect as useEffect16 } from "react";
5741
+ import React42, { useState as useState29, useEffect as useEffect17 } from "react";
5795
5742
  import { jsx as jsx42, jsxs as jsxs41 } from "react/jsx-runtime";
5796
5743
  function Table({
5797
5744
  pageSize,
@@ -6038,7 +5985,7 @@ function Table({
6038
5985
  }
6039
5986
  return item.taskId && item.taskId.toString().toLowerCase().includes(query) || item.role && item.role.toLowerCase().includes(query) || item.taskName && item.taskName.toLowerCase().includes(query) || item.permissionType && item.permissionType.toLowerCase().includes(query);
6040
5987
  });
6041
- useEffect16(() => {
5988
+ useEffect17(() => {
6042
5989
  if (setTotalEntries) setTotalEntries(filteredData.length);
6043
5990
  }, [filteredData.length, setTotalEntries]);
6044
5991
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6375,7 +6322,7 @@ function SearchBar7({
6375
6322
  }
6376
6323
 
6377
6324
  // src/components/Workflow-Setting/Table.js
6378
- import React46, { useState as useState32, useEffect as useEffect17 } from "react";
6325
+ import React46, { useState as useState32, useEffect as useEffect18 } from "react";
6379
6326
  import { jsx as jsx46, jsxs as jsxs45 } from "react/jsx-runtime";
6380
6327
  function Table2({
6381
6328
  pageSize,
@@ -6622,7 +6569,7 @@ function Table2({
6622
6569
  }
6623
6570
  return item.settingId && item.settingId.toString().toLowerCase().includes(query) || item.moduleName && item.moduleName.toLowerCase().includes(query) || item.executionOrder && item.executionOrder.toString().toLowerCase().includes(query) || item.SLA && item.SLA.toLowerCase().includes(query);
6624
6571
  });
6625
- useEffect17(() => {
6572
+ useEffect18(() => {
6626
6573
  if (setTotalEntries) setTotalEntries(filteredData.length);
6627
6574
  }, [filteredData.length, setTotalEntries]);
6628
6575
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6898,7 +6845,7 @@ function SearchBar8({
6898
6845
  }
6899
6846
 
6900
6847
  // src/components/notification/Table.js
6901
- import React50, { useState as useState35, useEffect as useEffect18 } from "react";
6848
+ import React50, { useState as useState35, useEffect as useEffect19 } from "react";
6902
6849
  import { jsx as jsx50, jsxs as jsxs49 } from "react/jsx-runtime";
6903
6850
  function Table3({
6904
6851
  pageSize,
@@ -7145,7 +7092,7 @@ function Table3({
7145
7092
  }
7146
7093
  return item.notificationId && item.notificationId.toString().toLowerCase().includes(query) || item.eventTrigger && item.eventTrigger.toLowerCase().includes(query) || item.channelType && item.channelType.toLowerCase().includes(query) || item.recipientGroup && item.recipientGroup.toLowerCase().includes(query);
7147
7094
  });
7148
- useEffect18(() => {
7095
+ useEffect19(() => {
7149
7096
  if (setTotalEntries) setTotalEntries(filteredData.length);
7150
7097
  }, [filteredData.length, setTotalEntries]);
7151
7098
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -7431,10 +7378,10 @@ function TaskInstanceSearchBar({
7431
7378
  }
7432
7379
 
7433
7380
  // src/components/task-instance/taskinstancetable.jsx
7434
- import React56, { useState as useState39, useEffect as useEffect20 } from "react";
7381
+ import React56, { useState as useState39, useEffect as useEffect21 } from "react";
7435
7382
 
7436
7383
  // src/components/task-instance/edit-instance.jsx
7437
- import React54, { useEffect as useEffect19, useState as useState38 } from "react";
7384
+ import React54, { useEffect as useEffect20, useState as useState38 } from "react";
7438
7385
  import { jsx as jsx54, jsxs as jsxs53 } from "react/jsx-runtime";
7439
7386
  function EditTaskInstanceModal({
7440
7387
  isOpen,
@@ -7450,7 +7397,7 @@ function EditTaskInstanceModal({
7450
7397
  escalatedOn: "",
7451
7398
  slaStatus: ""
7452
7399
  });
7453
- useEffect19(() => {
7400
+ useEffect20(() => {
7454
7401
  if (selectedTask) {
7455
7402
  setFormData({
7456
7403
  assignedUserId: selectedTask.assignedUserId || selectedTask.assigned_user_id || "",
@@ -7971,7 +7918,7 @@ function TaskInstanceTable({
7971
7918
  const query = (searchQuery || "").toLowerCase();
7972
7919
  return String(item.taskInstanceId).includes(query) || String(item.fileInstanceId).includes(query) || String(item.workflowStepId).includes(query) || String(item.assignedUserId).includes(query) || item.status.toLowerCase().includes(query);
7973
7920
  });
7974
- useEffect20(() => {
7921
+ useEffect21(() => {
7975
7922
  if (setTotalEntries) setTotalEntries(filteredData.length);
7976
7923
  }, [filteredData.length, setTotalEntries]);
7977
7924
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -8340,7 +8287,7 @@ function CommentSearchBar({
8340
8287
  }
8341
8288
 
8342
8289
  // src/components/comment/commenttable.jsx
8343
- import React60, { useState as useState41, useEffect as useEffect21 } from "react";
8290
+ import React60, { useState as useState41, useEffect as useEffect22 } from "react";
8344
8291
  import { jsx as jsx60, jsxs as jsxs59 } from "react/jsx-runtime";
8345
8292
  function CommentTable({
8346
8293
  pageSize,
@@ -8568,7 +8515,7 @@ function CommentTable({
8568
8515
  const query = (searchQuery || "").toLowerCase();
8569
8516
  return String(item.commentId).toLowerCase().includes(query) || String(item.taskInstanceId).toLowerCase().includes(query) || item.comment.toLowerCase().includes(query) || String(item.commentedBy).toLowerCase().includes(query);
8570
8517
  });
8571
- useEffect21(() => {
8518
+ useEffect22(() => {
8572
8519
  if (setTotalEntries) setTotalEntries(filteredData.length);
8573
8520
  }, [filteredData.length, setTotalEntries]);
8574
8521
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -8903,8 +8850,8 @@ function Comment_main() {
8903
8850
  }
8904
8851
 
8905
8852
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
8906
- import React68, { useState as useState47, useRef as useRef15, useEffect as useEffect24 } from "react";
8907
- import Swal7 from "sweetalert2";
8853
+ import React68, { useState as useState47, useRef as useRef15, useEffect as useEffect25 } from "react";
8854
+ import Swal9 from "sweetalert2";
8908
8855
 
8909
8856
  // src/components/hierarchy-node/SearchBar.jsx
8910
8857
  import React63 from "react";
@@ -8943,10 +8890,10 @@ function SearchBar9({ searchQuery, setSearchQuery }) {
8943
8890
  }
8944
8891
 
8945
8892
  // src/components/hierarchy-node/HierarchyTable.jsx
8946
- import React66, { useState as useState45, useEffect as useEffect23 } from "react";
8893
+ import React66, { useState as useState45, useEffect as useEffect24 } from "react";
8947
8894
 
8948
8895
  // src/components/hierarchy-node/AddEditModal.jsx
8949
- import React64, { useEffect as useEffect22, useState as useState44 } from "react";
8896
+ import React64, { useEffect as useEffect23, useState as useState44 } from "react";
8950
8897
  import { jsx as jsx64, jsxs as jsxs63 } from "react/jsx-runtime";
8951
8898
  function AddEditModal({
8952
8899
  isOpen,
@@ -8964,7 +8911,7 @@ function AddEditModal({
8964
8911
  externalEntityId: "",
8965
8912
  isActive: true
8966
8913
  });
8967
- useEffect22(() => {
8914
+ useEffect23(() => {
8968
8915
  if (editData) {
8969
8916
  setFormData(editData);
8970
8917
  }
@@ -8979,7 +8926,7 @@ function AddEditModal({
8979
8926
  const handleSave = async () => {
8980
8927
  const success = await (onSave == null ? void 0 : onSave({
8981
8928
  hierarchyNodeId: Number(formData.hierarchyNodeId),
8982
- parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0),
8929
+ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId) || null,
8983
8930
  hierarchyLevel: Number(formData.hierarchyLevel || 0),
8984
8931
  nodeType: formData.nodeType,
8985
8932
  nodeName: formData.nodeName,
@@ -9187,7 +9134,7 @@ function HierarchyTable({
9187
9134
  const [currentPage, setCurrentPage] = useState45(1);
9188
9135
  ;
9189
9136
  const [data, setData] = useState45(apiData || []);
9190
- useEffect23(() => {
9137
+ useEffect24(() => {
9191
9138
  setData(apiData || []);
9192
9139
  }, [apiData]);
9193
9140
  const filteredData = data.filter(
@@ -9204,7 +9151,7 @@ function HierarchyTable({
9204
9151
  const [editOpen, setEditOpen] = useState45(false);
9205
9152
  const [deleteOpen, setDeleteOpen] = useState45(false);
9206
9153
  const [selectedNode, setSelectedNode] = useState45(null);
9207
- useEffect23(() => {
9154
+ useEffect24(() => {
9208
9155
  setCurrentPage(1);
9209
9156
  }, [searchQuery, pageSize]);
9210
9157
  const handleSort = (column) => {
@@ -9380,7 +9327,15 @@ function AddHierarchyNodeModal({
9380
9327
  const handleSave = async () => {
9381
9328
  if (!onSave) return;
9382
9329
  setIsSubmitting(true);
9383
- const success = await onSave({ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0), hierarchyLevel: Number(formData.hierarchyLevel || 0), nodeType: formData.nodeType, nodeName: formData.nodeName, externalEntityType: formData.externalEntityType, externalEntityId: Number(formData.externalEntityId || 0), createdBy: "System" });
9330
+ const success = await onSave({
9331
+ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId) || null,
9332
+ hierarchyLevel: Number(formData.hierarchyLevel || 0),
9333
+ nodeType: formData.nodeType,
9334
+ nodeName: formData.nodeName,
9335
+ externalEntityType: formData.externalEntityType,
9336
+ externalEntityId: Number(formData.externalEntityId || 0),
9337
+ createdBy: "System"
9338
+ });
9384
9339
  setIsSubmitting(false);
9385
9340
  if (success) onClose();
9386
9341
  };
@@ -9490,7 +9445,7 @@ function HierarchyNodeMain() {
9490
9445
  const [searchQuery, setSearchQuery] = useState47("");
9491
9446
  const [apiData, setApiData] = useState47([]);
9492
9447
  const [refreshKey, setRefreshKey] = useState47(0);
9493
- useEffect24(() => {
9448
+ useEffect25(() => {
9494
9449
  (async () => {
9495
9450
  var _a, _b, _c, _d, _e, _f, _g;
9496
9451
  try {
@@ -9500,7 +9455,7 @@ function HierarchyNodeMain() {
9500
9455
  const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
9501
9456
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
9502
9457
  } catch (error) {
9503
- await Swal7.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9458
+ await Swal9.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9504
9459
  }
9505
9460
  })();
9506
9461
  }, [refreshKey]);
@@ -9513,11 +9468,11 @@ function HierarchyNodeMain() {
9513
9468
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
9514
9469
  if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
9515
9470
  await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
9516
- await Swal7.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
9471
+ await Swal9.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
9517
9472
  handleRefresh();
9518
9473
  return true;
9519
9474
  } catch (error) {
9520
- await Swal7.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
9475
+ await Swal9.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
9521
9476
  return false;
9522
9477
  }
9523
9478
  };
@@ -10227,7 +10182,7 @@ function UploadedDocumentMain() {
10227
10182
 
10228
10183
  // src/components/BuisnessEntity/BusinessEntitymain.js
10229
10184
  import React78, { useState as useState53, useRef as useRef18 } from "react";
10230
- import Link4 from "next/link";
10185
+ import Link3 from "next/link";
10231
10186
 
10232
10187
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
10233
10188
  import React77, { useState as useState52 } from "react";
@@ -10699,7 +10654,7 @@ function BusinessEntity() {
10699
10654
 
10700
10655
  // src/components/FileInstance/FileInstancemain.js
10701
10656
  import React80, { useState as useState55, useRef as useRef19 } from "react";
10702
- import Link5 from "next/link";
10657
+ import Link4 from "next/link";
10703
10658
 
10704
10659
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
10705
10660
  import React79, { useState as useState54 } from "react";
@@ -11260,7 +11215,7 @@ function SearchBar12({
11260
11215
  }
11261
11216
 
11262
11217
  // src/components/assignment-rule/Table.js
11263
- import React82, { useState as useState56, useEffect as useEffect25 } from "react";
11218
+ import React82, { useState as useState56, useEffect as useEffect26 } from "react";
11264
11219
  import { jsx as jsx82, jsxs as jsxs81 } from "react/jsx-runtime";
11265
11220
  function Table4({
11266
11221
  pageSize,
@@ -11426,7 +11381,7 @@ function Table4({
11426
11381
  const query = searchQuery.toLowerCase().trim();
11427
11382
  return item.workflowStepId && item.workflowStepId.toString().toLowerCase().includes(query) || item.assignmentType && item.assignmentType.toLowerCase().includes(query) || item.hierarchyNodeType && item.hierarchyNodeType.toLowerCase().includes(query) || item.dynamicFunctionId && item.dynamicFunctionId.toString().toLowerCase().includes(query);
11428
11383
  });
11429
- useEffect25(() => {
11384
+ useEffect26(() => {
11430
11385
  if (setTotalEntries) setTotalEntries(filteredData.length);
11431
11386
  }, [filteredData.length, setTotalEntries]);
11432
11387
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -11813,7 +11768,7 @@ function Sidebar({
11813
11768
  const Icon = item.icon;
11814
11769
  const handleClick = () => {
11815
11770
  if (item.component) {
11816
- router.push("/flowCore", void 0, {
11771
+ router.push("/", void 0, {
11817
11772
  shallow: true
11818
11773
  });
11819
11774
  setActiveComponent(item.component);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "9.3.7",
3
+ "version": "9.3.9",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [