flowcore-fn 10.1.5 → 10.1.6

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.
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-I4E63NIC.mjs";
13
13
 
14
14
  // src/components/Sidebar.jsx
15
- import { useState as useState62 } from "react";
15
+ import { useState as useState62, useEffect as useEffect41 } from "react";
16
16
  import { RiFlowChart, RiShieldUserLine, RiFolder3Line, RiCheckboxCircleLine, RiRouteLine, RiMessage2Line, RiMenuLine, RiGitMergeLine, RiNodeTree, RiGitBranchLine, RiCornerDownRightLine, RiUserSettingsLine, RiFileShieldLine, RiUserSharedLine, RiSettings4Line, RiFileSettingsLine, RiFileList3Line, RiFileUploadLine, RiNotification4Line, RiDatabase2Line, RiChat3Line, RiCheckboxMultipleLine, RiShieldCheckLine, RiHistoryLine, RiArrowDownSLine, RiArrowRightSLine } from "@remixicon/react";
17
17
  import { useRouter } from "next/router";
18
18
 
@@ -1115,10 +1115,10 @@ function Workflow() {
1115
1115
  (async () => {
1116
1116
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1117
1117
  try {
1118
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
1118
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
1119
1119
  const typeEndpoint = (_f = (_e = (_d = getApiEndpoints()) == null ? void 0 : _d.flowCore) == null ? void 0 : _e.workflowType) == null ? void 0 : _f.getList;
1120
- if (!endpoint) throw Error("Workflow list endpoint is not configured.");
1121
- const [result, types] = await Promise.all([getApiService().get(endpoint), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
1120
+ if (!endpoint2) throw Error("Workflow list endpoint is not configured.");
1121
+ const [result, types] = await Promise.all([getApiService().get(endpoint2), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
1122
1122
  const value = ((_g = result == null ? void 0 : result.data) == null ? void 0 : _g.data) || ((_h = result == null ? void 0 : result.data) == null ? void 0 : _h.result) || (result == null ? void 0 : result.data) || result;
1123
1123
  const rows = Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || [];
1124
1124
  const typeValue = ((_i = types == null ? void 0 : types.data) == null ? void 0 : _i.data) || ((_j = types == null ? void 0 : types.data) == null ? void 0 : _j.result) || (types == null ? void 0 : types.data) || types;
@@ -1141,9 +1141,9 @@ function Workflow() {
1141
1141
  const handleCreateApi = async (workflowPayload) => {
1142
1142
  var _a, _b, _c, _d, _e;
1143
1143
  try {
1144
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
1145
- if (!endpoint) throw new Error("Workflow create endpoint is not configured.");
1146
- await getApiService().post(endpoint, workflowPayload);
1144
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
1145
+ if (!endpoint2) throw new Error("Workflow create endpoint is not configured.");
1146
+ await getApiService().post(endpoint2, workflowPayload);
1147
1147
  await Swal3.fire("Success", "Workflow created successfully.", "success");
1148
1148
  handleRefresh();
1149
1149
  return true;
@@ -1155,9 +1155,9 @@ function Workflow() {
1155
1155
  const handleUpdateApi = async (workflowPayload) => {
1156
1156
  var _a, _b, _c, _d, _e;
1157
1157
  try {
1158
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
1159
- if (!endpoint) throw new Error("Workflow update endpoint is not configured.");
1160
- await getApiService().put(endpoint, workflowPayload);
1158
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
1159
+ if (!endpoint2) throw new Error("Workflow update endpoint is not configured.");
1160
+ await getApiService().put(endpoint2, workflowPayload);
1161
1161
  await Swal3.fire("Success", "Workflow updated successfully.", "success");
1162
1162
  handleRefresh();
1163
1163
  return true;
@@ -1860,9 +1860,9 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1860
1860
  setIsSubmitting(true);
1861
1861
  setSubmitError("");
1862
1862
  const endpoints = getApiEndpoints();
1863
- const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
1864
- if (!endpoint) throw new Error("Create workflow type endpoint is not configured.");
1865
- const response = await getApiService().post(endpoint, payload);
1863
+ const endpoint2 = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
1864
+ if (!endpoint2) throw new Error("Create workflow type endpoint is not configured.");
1865
+ const response = await getApiService().post(endpoint2, payload);
1866
1866
  const resData = (_c = response == null ? void 0 : response.data) != null ? _c : response;
1867
1867
  if ((resData == null ? void 0 : resData.success) === false) {
1868
1868
  const apiErrors = Array.isArray(resData == null ? void 0 : resData.errors) && resData.errors.length > 0 ? resData.errors : null;
@@ -1944,9 +1944,9 @@ function WorkflowTypeMains() {
1944
1944
  const handleUpdateApi = async (item) => {
1945
1945
  var _a, _b, _c, _d;
1946
1946
  try {
1947
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
1948
- if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
1949
- await getApiService().put(endpoint, { workflowTypeId: item.workflowTypeId, workflowTypeCode: item.workflowTypeCode.trim().toUpperCase(), workflowTypeName: item.workflowTypeName.trim(), description: (item.description || "").trim(), isActive: Boolean(item.isActive), updatedBy: item.updatedBy || item.createdBy || "System" });
1947
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
1948
+ if (!endpoint2) throw new Error("Workflow type update endpoint is not configured.");
1949
+ await getApiService().put(endpoint2, { workflowTypeId: item.workflowTypeId, workflowTypeCode: item.workflowTypeCode.trim().toUpperCase(), workflowTypeName: item.workflowTypeName.trim(), description: (item.description || "").trim(), isActive: Boolean(item.isActive), updatedBy: item.updatedBy || item.createdBy || "System" });
1950
1950
  await Swal5.fire("Success", "Workflow type updated successfully.", "success");
1951
1951
  handleRefresh();
1952
1952
  return true;
@@ -1978,9 +1978,9 @@ function WorkflowTypeMains() {
1978
1978
  (async () => {
1979
1979
  var _a, _b, _c, _d, _e, _f, _g;
1980
1980
  try {
1981
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.getList;
1982
- if (!endpoint) throw new Error("Workflow type list endpoint is not configured.");
1983
- const result = await getApiService().get(endpoint);
1981
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.getList;
1982
+ if (!endpoint2) throw new Error("Workflow type list endpoint is not configured.");
1983
+ const result = await getApiService().get(endpoint2);
1984
1984
  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;
1985
1985
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
1986
1986
  } catch (error) {
@@ -2093,9 +2093,9 @@ function AddWorkflowStepModal({ onClose, onSave }) {
2093
2093
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2094
2094
  try {
2095
2095
  setLoadingWorkflows(true);
2096
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2097
- if (!endpoint) return;
2098
- const result = await getApiService().get(endpoint);
2096
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2097
+ if (!endpoint2) return;
2098
+ const result = await getApiService().get(endpoint2);
2099
2099
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
2100
2100
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
2101
2101
  setWorkflows(rows);
@@ -2445,8 +2445,8 @@ function AddWorkflowStepModal({ onClose, onSave }) {
2445
2445
  if (!validateForm()) return;
2446
2446
  try {
2447
2447
  setIsSubmitting(true);
2448
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
2449
- if (!endpoint) throw new Error("Workflow step create endpoint is not configured.");
2448
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
2449
+ if (!endpoint2) throw new Error("Workflow step create endpoint is not configured.");
2450
2450
  const payload = {
2451
2451
  workflowId: Number(formData.workflow) || 0,
2452
2452
  stepCode: formData.stepCode.trim().toUpperCase(),
@@ -2460,7 +2460,7 @@ function AddWorkflowStepModal({ onClose, onSave }) {
2460
2460
  excludeHolidays: Boolean(formData.excludeHolidays),
2461
2461
  createdBy: "System"
2462
2462
  };
2463
- await getApiService().post(endpoint, payload);
2463
+ await getApiService().post(endpoint2, payload);
2464
2464
  onClose();
2465
2465
  await (onSave == null ? void 0 : onSave());
2466
2466
  } catch (error) {
@@ -2511,9 +2511,9 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
2511
2511
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2512
2512
  try {
2513
2513
  setLoadingWorkflows(true);
2514
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2515
- if (!endpoint) return;
2516
- const result = await getApiService().get(endpoint);
2514
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2515
+ if (!endpoint2) return;
2516
+ const result = await getApiService().get(endpoint2);
2517
2517
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
2518
2518
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
2519
2519
  setWorkflows(rows);
@@ -2567,8 +2567,8 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
2567
2567
  if (!validate()) return;
2568
2568
  try {
2569
2569
  setIsSubmitting(true);
2570
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
2571
- if (!endpoint) throw new Error("Workflow step update endpoint is not configured.");
2570
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
2571
+ if (!endpoint2) throw new Error("Workflow step update endpoint is not configured.");
2572
2572
  const payload = {
2573
2573
  workflowStepId: (_e = (_d = selectedData == null ? void 0 : selectedData.workflowStepId) != null ? _d : selectedData == null ? void 0 : selectedData.WorkflowStepId) != null ? _e : 0,
2574
2574
  workflowId: Number(formData.workflowId) || 0,
@@ -2584,7 +2584,7 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
2584
2584
  isActive: Boolean(formData.isActive),
2585
2585
  updatedBy: String(formData.updatedBy).trim() || "System"
2586
2586
  };
2587
- await getApiService().put(endpoint, payload);
2587
+ await getApiService().put(endpoint2, payload);
2588
2588
  onClose();
2589
2589
  await (onSave == null ? void 0 : onSave());
2590
2590
  } catch (error) {
@@ -2963,9 +2963,9 @@ function WorkflowStep() {
2963
2963
  const handleUpdateApi = async (item) => {
2964
2964
  var _a, _b, _c, _d, _e, _f, _g;
2965
2965
  try {
2966
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
2967
- if (!endpoint) throw new Error("Workflow step update endpoint is not configured.");
2968
- await getApiService().put(endpoint, {
2966
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
2967
+ if (!endpoint2) throw new Error("Workflow step update endpoint is not configured.");
2968
+ await getApiService().put(endpoint2, {
2969
2969
  workflowStepId: (_e = (_d = item.workflowStepId) != null ? _d : item.WorkflowStepId) != null ? _e : 0,
2970
2970
  workflowId: Number(item.workflowId) || 0,
2971
2971
  stepCode: String(item.stepCode).trim().toUpperCase(),
@@ -3229,25 +3229,57 @@ function WorkflowStep() {
3229
3229
  }
3230
3230
 
3231
3231
  // src/components/WorkFlowTransition/Transitiontable.js
3232
- import React21, { useState as useState15, useRef as useRef5 } from "react";
3233
- import Link2 from "next/link";
3232
+ import React21, { useEffect as useEffect13, useRef as useRef5, useState as useState15 } from "react";
3233
+ import Swal9 from "sweetalert2";
3234
3234
 
3235
3235
  // src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
3236
- import React20, { useState as useState14 } from "react";
3236
+ import React20, { useEffect as useEffect12, useState as useState14 } from "react";
3237
3237
  import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
3238
- function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3238
+ var rowsFrom = (response) => {
3239
+ var _a, _b, _c, _d, _e, _f, _g;
3240
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
3241
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
3242
+ };
3243
+ var lookupEndpoint = (name, fallback) => {
3244
+ var _a, _b, _c, _d;
3245
+ try {
3246
+ return (_d = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b[name]) == null ? void 0 : _c.getList) != null ? _d : fallback;
3247
+ } catch (e) {
3248
+ return fallback;
3249
+ }
3250
+ };
3251
+ function AddWorkTransitionStepModal({ onClose, onSave, editData }) {
3252
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
3239
3253
  const [formData, setFormData] = useState14({
3240
- workflow: "",
3241
- fromStep: "",
3242
- toStep: "",
3243
- actionCode: "",
3244
- actionName: "",
3254
+ workflow: String((_b = (_a = editData == null ? void 0 : editData.workflowId) != null ? _a : editData == null ? void 0 : editData.WorkflowId) != null ? _b : ""),
3255
+ fromStep: String((_f = (_e = (_d = (_c = editData == null ? void 0 : editData.fromWorkflowStepId) != null ? _c : editData == null ? void 0 : editData.FromWorkflowStepId) != null ? _d : editData == null ? void 0 : editData.fromStepId) != null ? _e : editData == null ? void 0 : editData.FromStepId) != null ? _f : ""),
3256
+ toStep: String((_j = (_i = (_h = (_g = editData == null ? void 0 : editData.toWorkflowStepId) != null ? _g : editData == null ? void 0 : editData.ToWorkflowStepId) != null ? _h : editData == null ? void 0 : editData.toStepId) != null ? _i : editData == null ? void 0 : editData.ToStepId) != null ? _j : ""),
3257
+ actionCode: (_l = (_k = editData == null ? void 0 : editData.actionCode) != null ? _k : editData == null ? void 0 : editData.ActionCode) != null ? _l : "",
3258
+ actionName: (_n = (_m = editData == null ? void 0 : editData.actionName) != null ? _m : editData == null ? void 0 : editData.ActionName) != null ? _n : "",
3245
3259
  sequenceNo: "",
3246
3260
  isDefault: false,
3247
3261
  requireComment: false,
3248
- status: "active"
3262
+ status: ((_p = (_o = editData == null ? void 0 : editData.isActive) != null ? _o : editData == null ? void 0 : editData.IsActive) != null ? _p : true) ? "active" : "inactive"
3249
3263
  });
3250
3264
  const [errors, setErrors] = useState14({});
3265
+ const [workflows, setWorkflows] = useState14([]);
3266
+ const [isSubmitting, setIsSubmitting] = useState14(false);
3267
+ useEffect12(() => {
3268
+ let active = true;
3269
+ (async () => {
3270
+ try {
3271
+ const service = getApiService();
3272
+ const workflowResult = await service.get(lookupEndpoint("workflow", "/api/flowcore/WorkFlow/GetList"));
3273
+ if (!active) return;
3274
+ setWorkflows(rowsFrom(workflowResult));
3275
+ } catch (error) {
3276
+ if (active) setErrors((current) => __spreadProps(__spreadValues({}, current), { lookup: (error == null ? void 0 : error.message) || "Unable to load workflows." }));
3277
+ }
3278
+ })();
3279
+ return () => {
3280
+ active = false;
3281
+ };
3282
+ }, []);
3251
3283
  const validateForm = () => {
3252
3284
  const newErrors = {};
3253
3285
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -3255,18 +3287,20 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3255
3287
  if (!formData.toStep) newErrors.toStep = "To Step is required.";
3256
3288
  if (!formData.actionCode.trim()) newErrors.actionCode = "Action Code is required.";
3257
3289
  if (!formData.actionName.trim()) newErrors.actionName = "Action Name is required.";
3258
- if (!formData.sequenceNo) newErrors.sequenceNo = "Sequence No is required.";
3259
3290
  setErrors(newErrors);
3260
3291
  return Object.keys(newErrors).length === 0;
3261
3292
  };
3262
- const handleSubmit = (e) => {
3293
+ const handleSubmit = async (e) => {
3294
+ var _a2, _b2, _c2;
3263
3295
  e.preventDefault();
3264
- if (validateForm()) {
3265
- if (onSubmit) {
3266
- onSubmit(formData);
3267
- } else {
3268
- console.log("Form Submitted Successfully:", formData);
3269
- }
3296
+ if (!validateForm() || !onSave) return;
3297
+ const isEdit = Boolean(editData);
3298
+ const payload = isEdit ? { transitionId: (_a2 = editData.transitionId) != null ? _a2 : editData.TransitionId, workflowId: Number(formData.workflow), fromWorkflowStepId: Number(formData.fromStep), toWorkflowStepId: Number(formData.toStep), actionCode: formData.actionCode.trim(), actionName: formData.actionName.trim(), isActive: formData.status === "active", updatedBy: (_c2 = (_b2 = editData.updatedBy) != null ? _b2 : editData.createdBy) != null ? _c2 : "System" } : { workflowId: Number(formData.workflow), fromWorkflowStepId: Number(formData.fromStep), toWorkflowStepId: Number(formData.toStep), actionCode: formData.actionCode.trim(), actionName: formData.actionName.trim(), createdBy: "System" };
3299
+ setIsSubmitting(true);
3300
+ try {
3301
+ if (await onSave(payload, isEdit)) onClose();
3302
+ } finally {
3303
+ setIsSubmitting(false);
3270
3304
  }
3271
3305
  };
3272
3306
  const handleChange = (field, value) => {
@@ -3325,8 +3359,12 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3325
3359
  className: `fc:w-full fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:border fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${errors.workflow ? "fc:border-red-500 fc:text-slate-800" : "fc:border-slate-200 fc:text-slate-700 hover:fc:border-slate-300"}`,
3326
3360
  children: [
3327
3361
  /* @__PURE__ */ jsx20("option", { value: "", children: "Select Workflow" }),
3328
- /* @__PURE__ */ jsx20("option", { value: "building", children: "Building Permission" }),
3329
- /* @__PURE__ */ jsx20("option", { value: "trade", children: "Trade License" })
3362
+ workflows.map((workflow) => {
3363
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3364
+ const id = (_b2 = (_a2 = workflow.workflowId) != null ? _a2 : workflow.WorkflowId) != null ? _b2 : workflow.id;
3365
+ const name = (_h2 = (_g2 = (_f2 = (_e2 = (_d2 = (_c2 = workflow.workflowName) != null ? _c2 : workflow.WorkflowName) != null ? _d2 : workflow.name) != null ? _e2 : workflow.Name) != null ? _f2 : workflow.workflowCode) != null ? _g2 : workflow.WorkflowCode) != null ? _h2 : `Workflow ${id}`;
3366
+ return /* @__PURE__ */ jsx20("option", { value: String(id), children: name }, id);
3367
+ })
3330
3368
  ]
3331
3369
  }
3332
3370
  ),
@@ -3348,8 +3386,8 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3348
3386
  className: `fc:w-full fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:border fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${errors.fromStep ? "fc:border-red-500 fc:text-slate-800" : "fc:border-slate-200 fc:text-slate-700 hover:fc:border-slate-300"}`,
3349
3387
  children: [
3350
3388
  /* @__PURE__ */ jsx20("option", { value: "", children: "Select From Step" }),
3351
- /* @__PURE__ */ jsx20("option", { value: "scrutiny", children: "Scrutiny" }),
3352
- /* @__PURE__ */ jsx20("option", { value: "inspection", children: "Inspection" })
3389
+ /* @__PURE__ */ jsx20("option", { value: "1", children: "Scrutiny" }),
3390
+ /* @__PURE__ */ jsx20("option", { value: "2", children: "Inspection" })
3353
3391
  ]
3354
3392
  }
3355
3393
  ),
@@ -3373,8 +3411,8 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3373
3411
  className: `fc:w-full fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:border fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${errors.toStep ? "fc:border-red-500 fc:text-slate-800" : "fc:border-slate-200 fc:text-slate-700 hover:fc:border-slate-300"}`,
3374
3412
  children: [
3375
3413
  /* @__PURE__ */ jsx20("option", { value: "", children: "Select To Step" }),
3376
- /* @__PURE__ */ jsx20("option", { value: "approval", children: "Approval" }),
3377
- /* @__PURE__ */ jsx20("option", { value: "completed", children: "Completed" })
3414
+ /* @__PURE__ */ jsx20("option", { value: "3", children: "Approval" }),
3415
+ /* @__PURE__ */ jsx20("option", { value: "4", children: "Completed" })
3378
3416
  ]
3379
3417
  }
3380
3418
  ),
@@ -3599,183 +3637,130 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3599
3637
  }
3600
3638
 
3601
3639
  // src/components/WorkFlowTransition/Transitiontable.js
3602
- import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
3603
- var WorkflowTransition = [{
3604
- TransitionId: 1,
3605
- workflowId: 1,
3606
- FromStepId: 2,
3607
- ToStepId: 1,
3608
- ActionCode: "APPROVE",
3609
- ActionName: "APPROVE"
3610
- }, {
3611
- TransitionId: 1,
3612
- workflowId: 1,
3613
- FromStepId: 2,
3614
- ToStepId: 1,
3615
- ActionCode: "APPROVE",
3616
- ActionName: "APPROVE"
3617
- }, {
3618
- TransitionId: 1,
3619
- workflowId: 1,
3620
- FromStepId: 2,
3621
- ToStepId: 1,
3622
- ActionCode: "APPROVE",
3623
- ActionName: "APPROVE"
3624
- }, {
3625
- TransitionId: 1,
3626
- workflowId: 1,
3627
- FromStepId: 2,
3628
- ToStepId: 1,
3629
- ActionCode: "APPROVE",
3630
- ActionName: "APPROVE"
3631
- }, {
3632
- TransitionId: 1,
3633
- workflowId: 1,
3634
- FromStepId: 2,
3635
- ToStepId: 1,
3636
- ActionCode: "APPROVE",
3637
- ActionName: "APPROVE"
3638
- }, {
3639
- TransitionId: 1,
3640
- workflowId: 1,
3641
- FromStepId: 2,
3642
- ToStepId: 1,
3643
- ActionCode: "APPROVE",
3644
- ActionName: "APPROVE"
3645
- }, {
3646
- TransitionId: 1,
3647
- workflowId: 1,
3648
- FromStepId: 2,
3649
- ToStepId: 1,
3650
- ActionCode: "APPROVE",
3651
- ActionName: "APPROVE"
3652
- }, {
3653
- TransitionId: 1,
3654
- workflowId: 1,
3655
- FromStepId: 2,
3656
- ToStepId: 1,
3657
- ActionCode: "APPROVE",
3658
- ActionName: "APPROVE"
3659
- }, {
3660
- TransitionId: 1,
3661
- workflowId: 1,
3662
- FromStepId: 2,
3663
- ToStepId: 1,
3664
- ActionCode: "RETURN",
3665
- ActionName: "APPROVE"
3666
- }, {
3667
- TransitionId: 1,
3668
- workflowId: 1,
3669
- FromStepId: 2,
3670
- ToStepId: 1,
3671
- ActionCode: "APPROVE",
3672
- ActionName: "RETURN"
3673
- }];
3640
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
3641
+ var PATHS = { create: "/api/flowcore/WorkflowTransition/Create", update: "/api/flowcore/WorkflowTransition/Update", getById: "/api/flowcore/WorkflowTransition/GetById", getList: "/api/flowcore/WorkflowTransition/GetList" };
3642
+ var getRows = (response) => {
3643
+ var _a, _b, _c, _d, _e, _f, _g;
3644
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
3645
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
3646
+ };
3647
+ var getEndpoint = (action) => {
3648
+ var _a, _b, _c, _d;
3649
+ try {
3650
+ const endpoints = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
3651
+ const configured = (_d = (_b = endpoints == null ? void 0 : endpoints.WorkflowTransition) == null ? void 0 : _b[action]) != null ? _d : (_c = endpoints == null ? void 0 : endpoints.workflowTransition) == null ? void 0 : _c[action];
3652
+ if (configured) return configured;
3653
+ } catch (e) {
3654
+ }
3655
+ return PATHS[action];
3656
+ };
3657
+ var getByIdUrl = (id) => {
3658
+ const endpoint2 = getEndpoint("getById");
3659
+ return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
3660
+ };
3661
+ var normalise = (item) => {
3662
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3663
+ return __spreadProps(__spreadValues({}, item), { transitionId: (_b = (_a = item.transitionId) != null ? _a : item.TransitionId) != null ? _b : item.id, workflowId: (_d = (_c = item.workflowId) != null ? _c : item.WorkflowId) != null ? _d : "", fromWorkflowStepId: (_h = (_g = (_f = (_e = item.fromWorkflowStepId) != null ? _e : item.FromWorkflowStepId) != null ? _f : item.fromStepId) != null ? _g : item.FromStepId) != null ? _h : "", toWorkflowStepId: (_l = (_k = (_j = (_i = item.toWorkflowStepId) != null ? _i : item.ToWorkflowStepId) != null ? _j : item.toStepId) != null ? _k : item.ToStepId) != null ? _l : "", actionCode: (_n = (_m = item.actionCode) != null ? _m : item.ActionCode) != null ? _n : "", actionName: (_p = (_o = item.actionName) != null ? _o : item.ActionName) != null ? _p : "", isActive: (_r = (_q = item.isActive) != null ? _q : item.IsActive) != null ? _r : true });
3664
+ };
3674
3665
  function WorkFlowTransition() {
3675
- const handleRefresh = () => {
3676
- console.log("Refresh clicked");
3677
- };
3678
- const handleDownload = () => {
3679
- console.log("Download clicked");
3680
- };
3681
3666
  const tableRef = useRef5(null);
3667
+ const [rows, setRows] = useState15([]);
3682
3668
  const [showModal, setShowModal] = useState15(false);
3669
+ const [editingTransition, setEditingTransition] = useState15(null);
3683
3670
  const [pageSize, setPageSize] = useState15(5);
3684
- const [sortConfig, setSortConfig] = useState15({
3685
- key: "",
3686
- direction: "asc"
3687
- });
3688
- const handleSort = (key) => {
3689
- let direction = "asc";
3690
- if (sortConfig.key === key && sortConfig.direction === "asc") {
3691
- direction = "desc";
3671
+ const [search, setSearch] = useState15("");
3672
+ const [sortConfig, setSortConfig] = useState15({ key: "", direction: "asc" });
3673
+ const [refreshKey, setRefreshKey] = useState15(0);
3674
+ const refresh = () => setRefreshKey((value) => value + 1);
3675
+ useEffect13(() => {
3676
+ (async () => {
3677
+ var _a, _b;
3678
+ try {
3679
+ setRows(getRows(await getApiService().get(getEndpoint("getList"))).map(normalise));
3680
+ } catch (error) {
3681
+ await Swal9.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load workflow transitions.", "error");
3682
+ }
3683
+ })();
3684
+ }, [refreshKey]);
3685
+ const saveTransition = async (payload, isEdit) => {
3686
+ var _a, _b;
3687
+ try {
3688
+ await getApiService()[isEdit ? "put" : "post"](getEndpoint(isEdit ? "update" : "create"), payload);
3689
+ await Swal9.fire("Success", `Workflow transition ${isEdit ? "updated" : "created"} successfully.`, "success");
3690
+ refresh();
3691
+ return true;
3692
+ } catch (error) {
3693
+ await Swal9.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} workflow transition.`, "error");
3694
+ return false;
3692
3695
  }
3693
- setSortConfig({
3694
- key,
3695
- direction
3696
- });
3697
3696
  };
3698
- return /* @__PURE__ */ jsxs20(Fragment5, { children: [
3699
- /* @__PURE__ */ jsxs20("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: [
3700
- /* @__PURE__ */ jsx21(CommonHeader, { title: "WorkFlow Transition", breadcrumbs: [{
3701
- label: "Dashboard",
3702
- href: "/dashboard"
3703
- }, {
3704
- label: "Masters",
3705
- href: "/masters"
3706
- }, {
3707
- label: "Workflow Transition",
3708
- href: "/workflowTransition"
3709
- }], buttonText: "Add Workflow Transition", onButtonClick: () => setShowModal(true) }),
3710
- /* @__PURE__ */ jsxs20("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
3711
- /* @__PURE__ */ jsxs20("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
3712
- /* @__PURE__ */ jsxs20("div", { className: "fc:relative fc:max-w-xs fc:w-full", children: [
3713
- /* @__PURE__ */ jsx21("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__ */ jsx21("svg", { className: "fc:w-4 fc:h-5 fc:text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
3714
- /* @__PURE__ */ jsx21("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" })
3715
- ] }),
3716
- /* @__PURE__ */ jsxs20("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold", children: [
3717
- /* @__PURE__ */ jsx21(Refresh_default, { onRefresh: handleRefresh }),
3718
- /* @__PURE__ */ jsx21(Download_default, { targetRef: tableRef, fileName: "workflow-transition" }),
3719
- /* @__PURE__ */ jsxs20("select", { value: pageSize, onChange: (e) => setPageSize(Number(e.target.value)), className: "fc:inline-flex fc:items-center fc:px-4 fc:py-2 fc:rounded-xl fc:bg-white fc:text-slate-700 fc:text-[14px] fc:font-semibold fc:border fc:border-slate-200 focus:fc:fc:outline-none fc:cursor-pointer fc:shadow-md", children: [
3720
- /* @__PURE__ */ jsx21("option", { value: 5, children: "5 Rows" }),
3721
- /* @__PURE__ */ jsx21("option", { value: 10, children: "10 Rows" }),
3722
- /* @__PURE__ */ jsx21("option", { value: 25, children: "25 Rows" })
3723
- ] })
3697
+ const editTransition = async (transition) => {
3698
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3699
+ try {
3700
+ const result = await getApiService().get(getByIdUrl(transition.transitionId));
3701
+ const data = (_f = (_e = (_d = (_b = getRows(result)[0]) != null ? _b : (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data) != null ? _d : (_c = result == null ? void 0 : result.data) == null ? void 0 : _c.result) != null ? _e : result == null ? void 0 : result.data) != null ? _f : result;
3702
+ setEditingTransition(normalise(data));
3703
+ setShowModal(true);
3704
+ } catch (error) {
3705
+ await Swal9.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load workflow transition details.", "error");
3706
+ }
3707
+ };
3708
+ const columns = [["Transition ID", "transitionId"], ["Workflow ID", "workflowId"], ["From Step ID", "fromWorkflowStepId"], ["To Step ID", "toWorkflowStepId"], ["Action Code", "actionCode"], ["Action Name", "actionName"]];
3709
+ const visibleRows = rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
3710
+ var _a, _b;
3711
+ if (!sortConfig.key) return 0;
3712
+ const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
3713
+ return sortConfig.direction === "asc" ? result : -result;
3714
+ });
3715
+ const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
3716
+ return /* @__PURE__ */ jsxs20("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: [
3717
+ /* @__PURE__ */ jsx21(CommonHeader, { title: "Workflow Transition", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Masters", href: "/masters" }, { label: "Workflow Transition", href: "/workflowTransition" }], buttonText: "Add Workflow Transition", onButtonClick: () => {
3718
+ setEditingTransition(null);
3719
+ setShowModal(true);
3720
+ } }),
3721
+ /* @__PURE__ */ jsxs20("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
3722
+ /* @__PURE__ */ jsxs20("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
3723
+ /* @__PURE__ */ jsx21("input", { value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search workflow transitions...", className: "fc:max-w-xs fc:w-full fc:px-4 fc:py-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-sm" }),
3724
+ /* @__PURE__ */ jsxs20("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
3725
+ /* @__PURE__ */ jsx21(Refresh_default, { onRefresh: refresh }),
3726
+ /* @__PURE__ */ jsx21(Download_default, { targetRef: tableRef, fileName: "workflow-transition" }),
3727
+ /* @__PURE__ */ jsxs20("select", { value: pageSize, onChange: (event) => setPageSize(Number(event.target.value)), className: "fc:px-4 fc:py-2 fc:rounded-xl fc:border fc:border-slate-200", children: [
3728
+ /* @__PURE__ */ jsx21("option", { value: 5, children: "5 Rows" }),
3729
+ /* @__PURE__ */ jsx21("option", { value: 10, children: "10 Rows" }),
3730
+ /* @__PURE__ */ jsx21("option", { value: 25, children: "25 Rows" })
3724
3731
  ] })
3725
- ] }),
3726
- /* @__PURE__ */ jsxs20("div", { className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden fc:bg-white fc:shadow-md", children: [
3727
- /* @__PURE__ */ jsx21("div", { className: "fc:max-h-[350px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ jsxs20("table", { className: "fc:min-w-max fc:w-full fc:border-collapse", children: [
3728
- /* @__PURE__ */ jsx21("thead", { className: "fc:bg-slate-50 fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ jsx21("tr", { className: "fc:text-[11px] fc:font-bold fc:uppercase fc:tracking-wider fc:text-slate-400", children: [{
3729
- label: "TransitionId",
3730
- key: "TransitionId"
3731
- }, {
3732
- label: "WorkflowId",
3733
- key: "workflowId"
3734
- }, {
3735
- label: "FromStepId",
3736
- key: "FromStepId"
3737
- }, {
3738
- label: "ToStepId",
3739
- key: "ToStepId"
3740
- }, {
3741
- label: "ActionCode",
3742
- key: "ActionCode"
3743
- }, {
3744
- label: "ActionName",
3745
- key: "ActionName"
3746
- }].map((column) => /* @__PURE__ */ jsx21("th", { onClick: () => handleSort(column.key), className: "fc:px-6 fc:py-4 fc:text-left fc:text-xs fc:font-bold fc:text-slate-500 fc:uppercase fc:tracking-wider fc:cursor-pointer fc:select-none hover:fc:fc:bg-slate-100 fc:transition-colors", children: /* @__PURE__ */ jsxs20("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
3747
- /* @__PURE__ */ jsx21("span", { children: column.label }),
3748
- /* @__PURE__ */ jsx21("span", { className: "fc:text-gray-400 fc:text-xs", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
3749
- ] }) }, column.key)) }) }),
3750
- /* @__PURE__ */ jsx21("tbody", { children: WorkflowTransition.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs20("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: [
3751
- /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:p-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.TransitionId }),
3752
- /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
3753
- /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.FromStepId }),
3754
- /* @__PURE__ */ jsx21("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.ToStepId }),
3755
- /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx21("span", { className: `fc:inline-flex fc:items-center fc:text-[14px] fc:text-slate-500 fc:font-semibold fc:rounded-full fc:px-3 fc:py-1 ${item.ActionCode === "APPROVE" ? "bg-green-100 text-green-700" : "bg-red-100 text-red-700"}`, children: item.ActionCode }) }),
3756
- /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx21("span", { className: `fc:inline-flex fc:items-center fc:rounded-full fc:px-3 fc:py-1 fc:text-[14px] fc:text-slate-500 fc:font-semibold ${item.ActionName === "APPROVE" ? "bg-green-100 text-green-700" : "bg-red-100 text-red-700"}`, children: item.ActionName }) })
3757
- ] }, item.TransitionId)) })
3758
- ] }) }),
3759
- " "
3760
- ] }),
3761
- /* @__PURE__ */ jsxs20("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: [
3762
- /* @__PURE__ */ jsx21(Footer, {}),
3763
- " "
3764
3732
  ] })
3765
- ] })
3733
+ ] }),
3734
+ /* @__PURE__ */ jsx21("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ jsxs20("table", { className: "fc:min-w-max fc:w-full", children: [
3735
+ /* @__PURE__ */ jsx21("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ jsxs20("tr", { children: [
3736
+ columns.map(([label, key]) => /* @__PURE__ */ jsxs20("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
3737
+ label,
3738
+ " ",
3739
+ sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
3740
+ ] }, key)),
3741
+ /* @__PURE__ */ jsx21("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
3742
+ ] }) }),
3743
+ /* @__PURE__ */ jsx21("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs20("tr", { className: "fc:border-t fc:border-slate-100", children: [
3744
+ columns.map(([, key]) => /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item[key] }, key)),
3745
+ /* @__PURE__ */ jsx21("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx21("button", { onClick: () => editTransition(item), className: "fc:bg-blue-50 hover:fc:bg-blue-100 fc:text-blue-600 fc:px-3 fc:py-1 fc:rounded-lg fc:text-xs fc:font-semibold", children: "Edit" }) })
3746
+ ] }, item.transitionId)) })
3747
+ ] }) }),
3748
+ /* @__PURE__ */ jsx21(Footer, {})
3766
3749
  ] }),
3767
- showModal && /* @__PURE__ */ jsx21(AddWorkTransitionStepModal, { onClose: () => setShowModal(false) }),
3768
- " "
3750
+ showModal && /* @__PURE__ */ jsx21(AddWorkTransitionStepModal, { editData: editingTransition, onClose: () => {
3751
+ setShowModal(false);
3752
+ setEditingTransition(null);
3753
+ }, onSave: saveTransition })
3769
3754
  ] });
3770
3755
  }
3771
3756
 
3772
3757
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3773
- import React27, { useState as useState19, useRef as useRef6, useEffect as useEffect15 } from "react";
3774
- import Swal10 from "sweetalert2";
3758
+ import React27, { useState as useState19, useRef as useRef6, useEffect as useEffect17 } from "react";
3759
+ import Swal11 from "sweetalert2";
3775
3760
 
3776
3761
  // src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
3777
- import React22, { useEffect as useEffect12, useState as useState16 } from "react";
3778
- import Swal9 from "sweetalert2";
3762
+ import React22, { useEffect as useEffect14, useState as useState16 } from "react";
3763
+ import Swal10 from "sweetalert2";
3779
3764
  import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
3780
3765
  function AddUserHierarchyNodeMappingModal({
3781
3766
  isOpen,
@@ -3790,7 +3775,7 @@ function AddUserHierarchyNodeMappingModal({
3790
3775
  const [isLoadingWorkflowSteps, setIsLoadingWorkflowSteps] = useState16(false);
3791
3776
  const [hierarchyNodesError, setHierarchyNodesError] = useState16("");
3792
3777
  const [workflowStepsError, setWorkflowStepsError] = useState16("");
3793
- useEffect12(() => {
3778
+ useEffect14(() => {
3794
3779
  if (!isOpen) return;
3795
3780
  const loadData = async () => {
3796
3781
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
@@ -3836,7 +3821,7 @@ function AddUserHierarchyNodeMappingModal({
3836
3821
  const handleSave = async () => {
3837
3822
  if (!onSave) return;
3838
3823
  if (!formData.workflowStepId) {
3839
- await Swal9.fire("Required field", "Please select a workflow step.", "warning");
3824
+ await Swal10.fire("Required field", "Please select a workflow step.", "warning");
3840
3825
  return;
3841
3826
  }
3842
3827
  setIsSubmitting(true);
@@ -3861,7 +3846,7 @@ function AddUserHierarchyNodeMappingModal({
3861
3846
  /* @__PURE__ */ jsxs21("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
3862
3847
  /* @__PURE__ */ jsx22("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm", children: /* @__PURE__ */ jsx22("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx22("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }) }) }),
3863
3848
  /* @__PURE__ */ jsxs21("div", { children: [
3864
- /* @__PURE__ */ jsx22("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow Step Hierarchy Mapping " }),
3849
+ /* @__PURE__ */ jsx22("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow Hierarchy Mapping " }),
3865
3850
  /* @__PURE__ */ jsx22("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Map a consumer user to a hierarchy node" })
3866
3851
  ] })
3867
3852
  ] }),
@@ -4002,10 +3987,10 @@ function MappingSearchBar({
4002
3987
  }
4003
3988
 
4004
3989
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
4005
- import React26, { useState as useState18, useEffect as useEffect14 } from "react";
3990
+ import React26, { useState as useState18, useEffect as useEffect16 } from "react";
4006
3991
 
4007
3992
  // src/components/user-hierarchy-node-mapping/edit-mapping.jsx
4008
- import React24, { useEffect as useEffect13, useState as useState17 } from "react";
3993
+ import React24, { useEffect as useEffect15, useState as useState17 } from "react";
4009
3994
  import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
4010
3995
  function EditUserHierarchyNodeMappingModal({
4011
3996
  isOpen,
@@ -4024,7 +4009,7 @@ function EditUserHierarchyNodeMappingModal({
4024
4009
  const [workflowSteps, setWorkflowSteps] = useState17([]);
4025
4010
  const [isLoadingWorkflowSteps, setIsLoadingWorkflowSteps] = useState17(false);
4026
4011
  const [workflowStepsError, setWorkflowStepsError] = useState17("");
4027
- useEffect13(() => {
4012
+ useEffect15(() => {
4028
4013
  if (!isOpen) return;
4029
4014
  const loadWorkflowSteps = async () => {
4030
4015
  var _a, _b, _c, _d, _e, _f, _g, _h;
@@ -4050,7 +4035,7 @@ function EditUserHierarchyNodeMappingModal({
4050
4035
  };
4051
4036
  loadWorkflowSteps();
4052
4037
  }, [isOpen]);
4053
- useEffect13(() => {
4038
+ useEffect15(() => {
4054
4039
  var _a, _b;
4055
4040
  if (selectedMapping) {
4056
4041
  setFormData({
@@ -4352,7 +4337,7 @@ function UserHierarchyNodeMappingTable({
4352
4337
  onDelete
4353
4338
  }) {
4354
4339
  const [data, setData] = useState18(apiData || []);
4355
- useEffect14(() => {
4340
+ useEffect16(() => {
4356
4341
  setData(apiData || []);
4357
4342
  }, [apiData]);
4358
4343
  const [sortOrder, setSortOrder] = useState18("asc");
@@ -4372,7 +4357,7 @@ function UserHierarchyNodeMappingTable({
4372
4357
  const query = (searchQuery || "").toLowerCase();
4373
4358
  return String(item.mappingId).toLowerCase().includes(query) || String(item.externalUserId).toLowerCase().includes(query) || String(item.hierarchyNodeId).toLowerCase().includes(query) || item.roleCode.toLowerCase().includes(query);
4374
4359
  });
4375
- useEffect14(() => {
4360
+ useEffect16(() => {
4376
4361
  if (setTotalEntries) setTotalEntries(filteredData.length);
4377
4362
  }, [filteredData.length, setTotalEntries]);
4378
4363
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -4502,17 +4487,17 @@ import { jsx as jsx27, jsxs as jsxs26 } from "react/jsx-runtime";
4502
4487
  function User_hierarchy_mapping_main() {
4503
4488
  const [refreshkey, setRefreshKey] = useState19(0);
4504
4489
  const [apiData, setApiData] = useState19([]);
4505
- useEffect15(() => {
4490
+ useEffect17(() => {
4506
4491
  (async () => {
4507
4492
  var _a, _b, _c, _d, _e, _f, _g;
4508
4493
  try {
4509
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c.getList;
4510
- if (!endpoint) throw new Error("Workflow Step Hierarchy Mapping list endpoint is not configured.");
4511
- const result = await getApiService().post(endpoint, {});
4494
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c.getList;
4495
+ if (!endpoint2) throw new Error("Workflow Step Hierarchy Mapping list endpoint is not configured.");
4496
+ const result = await getApiService().post(endpoint2, {});
4512
4497
  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;
4513
4498
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
4514
4499
  } catch (error) {
4515
- await Swal10.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 Step Hierarchy Mappings.", "error");
4500
+ await Swal11.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 Step Hierarchy Mappings.", "error");
4516
4501
  }
4517
4502
  })();
4518
4503
  }, [refreshkey]);
@@ -4532,8 +4517,8 @@ function User_hierarchy_mapping_main() {
4532
4517
  const saveMapping = async (payload, isEdit = false) => {
4533
4518
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4534
4519
  try {
4535
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
4536
- if (!endpoint) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
4520
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
4521
+ if (!endpoint2) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
4537
4522
  const requestPayload = isEdit ? {
4538
4523
  workflowStepUserMappingId: Number(
4539
4524
  (_f = (_e = (_d = payload.workflowStepUserMappingId) != null ? _d : payload.WorkFlowStepUserMappingId) != null ? _e : payload.mappingId) != null ? _f : payload.id
@@ -4546,18 +4531,18 @@ function User_hierarchy_mapping_main() {
4546
4531
  isActive: (_g = payload.isActive) != null ? _g : true,
4547
4532
  updatedBy: payload.updatedBy || "System"
4548
4533
  } : payload;
4549
- await getApiService()[isEdit ? "put" : "post"](endpoint, requestPayload);
4550
- await Swal10.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
4534
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, requestPayload);
4535
+ await Swal11.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
4551
4536
  handleRefresh();
4552
4537
  return true;
4553
4538
  } catch (error) {
4554
- await Swal10.fire("Error", ((_i = (_h = error == null ? void 0 : error.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
4539
+ await Swal11.fire("Error", ((_i = (_h = error == null ? void 0 : error.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
4555
4540
  return false;
4556
4541
  }
4557
4542
  };
4558
4543
  return /* @__PURE__ */ jsxs26("div", { className: "fc:min-h-screen fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
4559
4544
  /* @__PURE__ */ jsxs26("div", { className: "fc:w-full fc:space-y-5", children: [
4560
- /* @__PURE__ */ jsx27(CommonHeader, { title: "Workflow Step User Mapping", breadcrumbs: [{
4545
+ /* @__PURE__ */ jsx27(CommonHeader, { title: "Workflow Hierarchy Mapping", breadcrumbs: [{
4561
4546
  label: "Dashboard",
4562
4547
  href: "/dashboard"
4563
4548
  }, {
@@ -4567,8 +4552,8 @@ function User_hierarchy_mapping_main() {
4567
4552
  label: "Hierarchy",
4568
4553
  href: "/hierarchy"
4569
4554
  }, {
4570
- label: "User Hierarchy Mapping",
4571
- href: "/user hierarchy mapping"
4555
+ label: "Workflow Hierarchy Mapping",
4556
+ href: "/Workflow-Hierarchy-Mapping"
4572
4557
  }], buttonText: "Add Mapping", onButtonClick: () => setModalOpen(true) }),
4573
4558
  /* @__PURE__ */ jsxs26("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:shadow-sm fc:space-y-5", children: [
4574
4559
  /* @__PURE__ */ jsxs26("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
@@ -4593,7 +4578,7 @@ function User_hierarchy_mapping_main() {
4593
4578
 
4594
4579
  // src/components/document-configuration/DocumentConfigurationmain.jsx
4595
4580
  import React33, { useState as useState23, useRef as useRef7 } from "react";
4596
- import Swal12 from "sweetalert2";
4581
+ import Swal13 from "sweetalert2";
4597
4582
 
4598
4583
  // src/components/document-configuration/SearchBar.jsx
4599
4584
  import React28 from "react";
@@ -4613,11 +4598,11 @@ function SearchBar3({
4613
4598
  }
4614
4599
 
4615
4600
  // src/components/document-configuration/DocumentConfigurationTable.jsx
4616
- import React31, { useState as useState21, useEffect as useEffect17 } from "react";
4617
- import Swal11 from "sweetalert2";
4601
+ import React31, { useState as useState21, useEffect as useEffect19 } from "react";
4602
+ import Swal12 from "sweetalert2";
4618
4603
 
4619
4604
  // src/components/document-configuration/Edit.jsx
4620
- import React29, { useState as useState20, useEffect as useEffect16 } from "react";
4605
+ import React29, { useState as useState20, useEffect as useEffect18 } from "react";
4621
4606
  import { jsx as jsx29, jsxs as jsxs28 } from "react/jsx-runtime";
4622
4607
  function EditDocumentConfiguration({
4623
4608
  isOpen,
@@ -4638,15 +4623,15 @@ function EditDocumentConfiguration({
4638
4623
  const [workflowSteps, setWorkflowSteps] = useState20([]);
4639
4624
  const [loadingSteps, setLoadingSteps] = useState20(false);
4640
4625
  const [isSubmitting, setIsSubmitting] = useState20(false);
4641
- useEffect16(() => {
4626
+ useEffect18(() => {
4642
4627
  if (!isOpen) return;
4643
4628
  (async () => {
4644
4629
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4645
4630
  try {
4646
4631
  setLoadingSteps(true);
4647
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
4648
- if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
4649
- const result = await getApiService().get(endpoint);
4632
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
4633
+ if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
4634
+ const result = await getApiService().get(endpoint2);
4650
4635
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
4651
4636
  setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
4652
4637
  } catch (_) {
@@ -4656,7 +4641,7 @@ function EditDocumentConfiguration({
4656
4641
  }
4657
4642
  })();
4658
4643
  }, [isOpen]);
4659
- useEffect16(() => {
4644
+ useEffect18(() => {
4660
4645
  if (initialData) {
4661
4646
  const sizeParts = (initialData.maxSize || "10 MB").split(" ");
4662
4647
  setFormData({
@@ -5106,18 +5091,18 @@ function DocumentConfigTable({
5106
5091
  var _a, _b, _c, _d, _e;
5107
5092
  try {
5108
5093
  setIsLoading(true);
5109
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
5110
- if (!endpoint) throw new Error("Document Configuration list endpoint is not configured.");
5111
- const result = await getApiService().post(endpoint, {});
5094
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
5095
+ if (!endpoint2) throw new Error("Document Configuration list endpoint is not configured.");
5096
+ const result = await getApiService().post(endpoint2, {});
5112
5097
  setData(unwrapRows(result).map(toUiItem));
5113
5098
  } catch (error) {
5114
5099
  setData([]);
5115
- await Swal11.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 load document configurations.", "error");
5100
+ await Swal12.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 load document configurations.", "error");
5116
5101
  } finally {
5117
5102
  setIsLoading(false);
5118
5103
  }
5119
5104
  };
5120
- useEffect17(() => {
5105
+ useEffect19(() => {
5121
5106
  loadData();
5122
5107
  }, []);
5123
5108
  const handleSort = (columnKey) => {
@@ -5135,7 +5120,7 @@ function DocumentConfigTable({
5135
5120
  const query = (searchQuery || "").toLowerCase();
5136
5121
  return String(item.docName).toLowerCase().includes(query) || String(item.extensions).toLowerCase().includes(query) || String(item.stepId).toLowerCase().includes(query);
5137
5122
  });
5138
- useEffect17(() => {
5123
+ useEffect19(() => {
5139
5124
  if (setTotalEntries) setTotalEntries(filteredData.length);
5140
5125
  }, [filteredData.length, setTotalEntries]);
5141
5126
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5147,22 +5132,22 @@ function DocumentConfigTable({
5147
5132
  },
5148
5133
  (_, i) => i + 1
5149
5134
  );
5150
- const buildGetByIdUrl = (endpoint, id) => {
5151
- if (endpoint.includes("{id}")) return endpoint.replace("{id}", encodeURIComponent(id));
5152
- return `${endpoint.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
5135
+ const buildGetByIdUrl = (endpoint2, id) => {
5136
+ if (endpoint2.includes("{id}")) return endpoint2.replace("{id}", encodeURIComponent(id));
5137
+ return `${endpoint2.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
5153
5138
  };
5154
5139
  const handleEdit = async (item) => {
5155
5140
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5156
5141
  try {
5157
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
5158
- if (!endpoint) throw new Error("Document Configuration get-by-id endpoint is not configured.");
5159
- const url = typeof endpoint === "function" ? endpoint(item.id) : buildGetByIdUrl(endpoint, item.id);
5142
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
5143
+ if (!endpoint2) throw new Error("Document Configuration get-by-id endpoint is not configured.");
5144
+ const url = typeof endpoint2 === "function" ? endpoint2(item.id) : buildGetByIdUrl(endpoint2, item.id);
5160
5145
  const result = await getApiService().get(url);
5161
5146
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
5162
5147
  setSelectedItem(toUiItem(value != null ? value : item));
5163
5148
  setIsEditOpen(true);
5164
5149
  } catch (error) {
5165
- await Swal11.fire("Error", ((_j = (_i = error == null ? void 0 : error.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (error == null ? void 0 : error.message) || "Unable to load document configuration.", "error");
5150
+ await Swal12.fire("Error", ((_j = (_i = error == null ? void 0 : error.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (error == null ? void 0 : error.message) || "Unable to load document configuration.", "error");
5166
5151
  }
5167
5152
  };
5168
5153
  const handleDelete = (item) => {
@@ -5172,13 +5157,13 @@ function DocumentConfigTable({
5172
5157
  const handleSaveEdit = async (updatedData) => {
5173
5158
  var _a, _b, _c, _d, _e, _f;
5174
5159
  try {
5175
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5176
- if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
5160
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5161
+ if (!endpoint2) throw new Error("Document Configuration update endpoint is not configured.");
5177
5162
  const maxSizeMB = Number.parseFloat((_d = updatedData.maxSizeNum) != null ? _d : updatedData.maxSize);
5178
5163
  if (!Number.isFinite(maxSizeMB) || maxSizeMB <= 0) {
5179
5164
  throw new Error("Please enter a valid maximum size in MB.");
5180
5165
  }
5181
- await getApiService().put(endpoint, {
5166
+ await getApiService().put(endpoint2, {
5182
5167
  documentConfigurationId: updatedData.id,
5183
5168
  documentName: updatedData.docName.trim(),
5184
5169
  allowedExtensions: updatedData.extensions.trim(),
@@ -5187,12 +5172,12 @@ function DocumentConfigTable({
5187
5172
  isActive: updatedData.status === "Active",
5188
5173
  updatedBy: "System"
5189
5174
  });
5190
- await Swal11.fire("Success", "Document configuration updated successfully.", "success");
5175
+ await Swal12.fire("Success", "Document configuration updated successfully.", "success");
5191
5176
  setIsEditOpen(false);
5192
5177
  await loadData();
5193
5178
  return true;
5194
5179
  } catch (error) {
5195
- await Swal11.fire("Error", ((_f = (_e = error == null ? void 0 : error.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
5180
+ await Swal12.fire("Error", ((_f = (_e = error == null ? void 0 : error.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
5196
5181
  return false;
5197
5182
  }
5198
5183
  };
@@ -5373,7 +5358,7 @@ function DocumentConfigTable({
5373
5358
  }
5374
5359
 
5375
5360
  // src/components/document-configuration/AddDocumentConfigurationModal.jsx
5376
- import React32, { useEffect as useEffect18, useState as useState22 } from "react";
5361
+ import React32, { useEffect as useEffect20, useState as useState22 } from "react";
5377
5362
  import { jsx as jsx32, jsxs as jsxs31 } from "react/jsx-runtime";
5378
5363
  function AddDocumentConfigModal({
5379
5364
  isOpen,
@@ -5390,7 +5375,7 @@ function AddDocumentConfigModal({
5390
5375
  const [workflowSteps, setWorkflowSteps] = useState22([]);
5391
5376
  const [loadingSteps, setLoadingSteps] = useState22(false);
5392
5377
  const [isSubmitting, setIsSubmitting] = useState22(false);
5393
- useEffect18(() => {
5378
+ useEffect20(() => {
5394
5379
  if (!isOpen) return;
5395
5380
  (async () => {
5396
5381
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
@@ -5398,9 +5383,9 @@ function AddDocumentConfigModal({
5398
5383
  setLoadingSteps(true);
5399
5384
  const { getApiEndpoints: getApiEndpoints2 } = await import("./ApiEndpointsProvider-MDQW2LEP.mjs");
5400
5385
  const { getApiService: getApiService2 } = await import("./ApiServicepackage-PJH24ZGU.mjs");
5401
- const endpoint = (_c = (_b = (_a = getApiEndpoints2()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
5402
- if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
5403
- const result = await getApiService2().get(endpoint);
5386
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints2()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
5387
+ if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
5388
+ const result = await getApiService2().get(endpoint2);
5404
5389
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
5405
5390
  setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
5406
5391
  } catch (_) {
@@ -5410,7 +5395,7 @@ function AddDocumentConfigModal({
5410
5395
  }
5411
5396
  })();
5412
5397
  }, [isOpen]);
5413
- useEffect18(() => {
5398
+ useEffect20(() => {
5414
5399
  if (!isOpen) {
5415
5400
  setDocumentName("");
5416
5401
  setStepId("");
@@ -5587,15 +5572,15 @@ function DocumentConfigurationmain() {
5587
5572
  const handleCreate = async (payload) => {
5588
5573
  var _a, _b, _c, _d, _e;
5589
5574
  try {
5590
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
5591
- if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
5592
- await getApiService().post(endpoint, payload);
5593
- await Swal12.fire("Success", "Document configuration created successfully.", "success");
5575
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
5576
+ if (!endpoint2) throw new Error("Document Configuration create endpoint is not configured.");
5577
+ await getApiService().post(endpoint2, payload);
5578
+ await Swal13.fire("Success", "Document configuration created successfully.", "success");
5594
5579
  setModalOpen(false);
5595
5580
  handleRefresh();
5596
5581
  return true;
5597
5582
  } catch (error) {
5598
- await Swal12.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 create document configuration.", "error");
5583
+ await Swal13.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 create document configuration.", "error");
5599
5584
  return false;
5600
5585
  }
5601
5586
  };
@@ -5658,7 +5643,7 @@ function SearchBar4({
5658
5643
  }
5659
5644
 
5660
5645
  // src/components/audit-log/AuditLogTable.jsx
5661
- import React35, { useState as useState24, useEffect as useEffect19 } from "react";
5646
+ import React35, { useState as useState24, useEffect as useEffect21 } from "react";
5662
5647
  import { jsx as jsx35, jsxs as jsxs34 } from "react/jsx-runtime";
5663
5648
  function AuditLogTable({
5664
5649
  pageSize,
@@ -5886,7 +5871,7 @@ function AuditLogTable({
5886
5871
  const query = (searchQuery || "").toLowerCase();
5887
5872
  return item.logId.toLowerCase().includes(query) || item.user.toLowerCase().includes(query) || item.section.toLowerCase().includes(query) || item.action.toLowerCase().includes(query);
5888
5873
  });
5889
- useEffect19(() => {
5874
+ useEffect21(() => {
5890
5875
  if (setTotalEntries) setTotalEntries(filteredData.length);
5891
5876
  }, [filteredData.length, setTotalEntries]);
5892
5877
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6174,7 +6159,7 @@ function SearchBar5({
6174
6159
  }
6175
6160
 
6176
6161
  // src/components/movement-history/MovementHistoryTable.jsx
6177
- import React39, { useState as useState27, useEffect as useEffect20 } from "react";
6162
+ import React39, { useState as useState27, useEffect as useEffect22 } from "react";
6178
6163
  import { jsx as jsx39, jsxs as jsxs38 } from "react/jsx-runtime";
6179
6164
  function MovementHistoryTable({
6180
6165
  pageSize,
@@ -6402,7 +6387,7 @@ function MovementHistoryTable({
6402
6387
  const query = (searchQuery || "").toLowerCase();
6403
6388
  return item.movementHistoryId.toLowerCase().includes(query) || item.name.toLowerCase().includes(query) || item.toStepId.toLowerCase().includes(query);
6404
6389
  });
6405
- useEffect20(() => {
6390
+ useEffect22(() => {
6406
6391
  if (setTotalEntries) setTotalEntries(filteredData.length);
6407
6392
  }, [filteredData.length, setTotalEntries]);
6408
6393
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6654,7 +6639,7 @@ function MovementHistorymain() {
6654
6639
 
6655
6640
  // src/components/task-permission/TaskPermissionMain.jsx
6656
6641
  import React46, { useState as useState33, useRef as useRef10 } from "react";
6657
- import Swal14 from "sweetalert2";
6642
+ import Swal15 from "sweetalert2";
6658
6643
 
6659
6644
  // src/components/task-permission/SearchBar.js
6660
6645
  import React42 from "react";
@@ -6685,7 +6670,7 @@ function SearchBar6({
6685
6670
  }
6686
6671
 
6687
6672
  // src/components/task-permission/Table.js
6688
- import React43, { useState as useState30, useEffect as useEffect21 } from "react";
6673
+ import React43, { useState as useState30, useEffect as useEffect23 } from "react";
6689
6674
  import { jsx as jsx43, jsxs as jsxs42 } from "react/jsx-runtime";
6690
6675
  function Table({
6691
6676
  pageSize,
@@ -6713,7 +6698,7 @@ function Table({
6713
6698
  });
6714
6699
  return map;
6715
6700
  }, [workflowSteps]);
6716
- useEffect21(() => {
6701
+ useEffect23(() => {
6717
6702
  (async () => {
6718
6703
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
6719
6704
  try {
@@ -6764,7 +6749,7 @@ function Table({
6764
6749
  const totalPages = Math.max(Math.ceil(sorted.length / pageSize), 1);
6765
6750
  const startIndex = (currentPage - 1) * pageSize;
6766
6751
  const visibleData = sorted.slice(startIndex, startIndex + pageSize);
6767
- useEffect21(() => {
6752
+ useEffect23(() => {
6768
6753
  if (setTotalEntries) setTotalEntries(filtered.length);
6769
6754
  }, [filtered.length]);
6770
6755
  const pageNumbers = Array.from({ length: totalPages }, (_, i) => i + 1);
@@ -6782,6 +6767,12 @@ function Table({
6782
6767
  { label: "Can Edit", key: "canEdit" },
6783
6768
  { label: "Can Approve", key: "canApprove" },
6784
6769
  { label: "Can Reject", key: "canReject" },
6770
+ { label: "Can Forward", key: "canForward" },
6771
+ { label: "Can Free Forward", key: "canFreeForward" },
6772
+ { label: "Can Return", key: "canReturn" },
6773
+ { label: "Can Return To Applicant", key: "canReturnToApplicant" },
6774
+ { label: "Can Delegate", key: "canDelegate" },
6775
+ { label: "Can Hold", key: "canHold" },
6785
6776
  { label: "Active", key: "isActive" }
6786
6777
  ];
6787
6778
  return /* @__PURE__ */ jsxs42("div", { className: "fc:space-y-5", children: [
@@ -6806,7 +6797,7 @@ function Table({
6806
6797
  /* @__PURE__ */ jsx43("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: isLoading ? /* @__PURE__ */ jsx43("tr", { children: /* @__PURE__ */ jsx43(
6807
6798
  "td",
6808
6799
  {
6809
- colSpan: 9,
6800
+ colSpan: columns.length + 2,
6810
6801
  className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm",
6811
6802
  children: /* @__PURE__ */ jsxs42("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
6812
6803
  /* @__PURE__ */ jsxs42(
@@ -6838,15 +6829,15 @@ function Table({
6838
6829
  ]
6839
6830
  }
6840
6831
  ),
6841
- "Loading task permissions..."
6832
+ "Loading step permissions..."
6842
6833
  ] })
6843
6834
  }
6844
6835
  ) }) : visibleData.length === 0 ? /* @__PURE__ */ jsx43("tr", { children: /* @__PURE__ */ jsx43(
6845
6836
  "td",
6846
6837
  {
6847
- colSpan: 9,
6838
+ colSpan: columns.length + 2,
6848
6839
  className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm",
6849
- children: "No task permissions found."
6840
+ children: "No step permissions found."
6850
6841
  }
6851
6842
  ) }) : visibleData.map((item, index) => {
6852
6843
  var _a, _b, _c, _d;
@@ -6862,6 +6853,12 @@ function Table({
6862
6853
  /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canEdit }) }),
6863
6854
  /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canApprove }) }),
6864
6855
  /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canReject }) }),
6856
+ /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canForward }) }),
6857
+ /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canFreeForward }) }),
6858
+ /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canReturn }) }),
6859
+ /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canReturnToApplicant }) }),
6860
+ /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canDelegate }) }),
6861
+ /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.canHold }) }),
6865
6862
  /* @__PURE__ */ jsx43("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx43(BoolBadge, { val: item.isActive }) }),
6866
6863
  /* @__PURE__ */ jsx43("td", { className: "fc:sticky fc:right-0 fc:bg-white fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsxs42("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
6867
6864
  /* @__PURE__ */ jsx43(
@@ -6922,8 +6919,8 @@ function Table({
6922
6919
  }
6923
6920
 
6924
6921
  // src/components/task-permission/Popup.js
6925
- import React44, { useState as useState31, useEffect as useEffect22 } from "react";
6926
- import Swal13 from "sweetalert2";
6922
+ import React44, { useState as useState31, useEffect as useEffect24 } from "react";
6923
+ import Swal14 from "sweetalert2";
6927
6924
  import { jsx as jsx44, jsxs as jsxs43 } from "react/jsx-runtime";
6928
6925
  function Popup({ isOpen, onClose, onSave }) {
6929
6926
  const [formData, setFormData] = useState31({
@@ -6931,21 +6928,28 @@ function Popup({ isOpen, onClose, onSave }) {
6931
6928
  canView: false,
6932
6929
  canEdit: false,
6933
6930
  canApprove: false,
6934
- canReject: false
6931
+ canReject: false,
6932
+ canForward: false,
6933
+ canFreeForward: false,
6934
+ canReturn: false,
6935
+ canReturnToApplicant: false,
6936
+ canDelegate: false,
6937
+ canHold: false,
6938
+ isActive: true
6935
6939
  });
6936
6940
  const [errors, setErrors] = useState31({});
6937
6941
  const [isSubmitting, setIsSubmitting] = useState31(false);
6938
6942
  const [workflowSteps, setWorkflowSteps] = useState31([]);
6939
6943
  const [loadingSteps, setLoadingSteps] = useState31(false);
6940
- useEffect22(() => {
6944
+ useEffect24(() => {
6941
6945
  if (!isOpen) return;
6942
6946
  (async () => {
6943
6947
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6944
6948
  try {
6945
6949
  setLoadingSteps(true);
6946
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
6947
- if (!endpoint) return;
6948
- const result = await getApiService().get(endpoint);
6950
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
6951
+ if (!endpoint2) return;
6952
+ const result = await getApiService().get(endpoint2);
6949
6953
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
6950
6954
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
6951
6955
  setWorkflowSteps(rows);
@@ -6955,9 +6959,22 @@ function Popup({ isOpen, onClose, onSave }) {
6955
6959
  }
6956
6960
  })();
6957
6961
  }, [isOpen]);
6958
- useEffect22(() => {
6962
+ useEffect24(() => {
6959
6963
  if (!isOpen) {
6960
- setFormData({ workflowStepId: "", canView: false, canEdit: false, canApprove: false, canReject: false });
6964
+ setFormData({
6965
+ workflowStepId: "",
6966
+ canView: false,
6967
+ canEdit: false,
6968
+ canApprove: false,
6969
+ canReject: false,
6970
+ canForward: false,
6971
+ canFreeForward: false,
6972
+ canReturn: false,
6973
+ canReturnToApplicant: false,
6974
+ canDelegate: false,
6975
+ canHold: false,
6976
+ isActive: true
6977
+ });
6961
6978
  setErrors({});
6962
6979
  }
6963
6980
  }, [isOpen]);
@@ -6978,31 +6995,44 @@ function Popup({ isOpen, onClose, onSave }) {
6978
6995
  if (!validate()) return;
6979
6996
  try {
6980
6997
  setIsSubmitting(true);
6981
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.create;
6982
- if (!endpoint) throw new Error("Task Permission create endpoint is not configured.");
6998
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.create;
6999
+ if (!endpoint2) throw new Error("Step Permission create endpoint is not configured.");
6983
7000
  const payload = {
6984
7001
  workflowStepId: Number(formData.workflowStepId) || 0,
6985
7002
  canView: Boolean(formData.canView),
6986
7003
  canEdit: Boolean(formData.canEdit),
6987
7004
  canApprove: Boolean(formData.canApprove),
6988
7005
  canReject: Boolean(formData.canReject),
7006
+ canForward: Boolean(formData.canForward),
7007
+ canFreeForward: Boolean(formData.canFreeForward),
7008
+ canReturn: Boolean(formData.canReturn),
7009
+ canReturnToApplicant: Boolean(formData.canReturnToApplicant),
7010
+ canDelegate: Boolean(formData.canDelegate),
7011
+ canHold: Boolean(formData.canHold),
7012
+ isActive: Boolean(formData.isActive),
6989
7013
  createdBy: "System"
6990
7014
  };
6991
- await getApiService().post(endpoint, payload);
7015
+ await getApiService().post(endpoint2, payload);
6992
7016
  onClose();
6993
7017
  await (onSave == null ? void 0 : onSave());
6994
7018
  } catch (error) {
6995
- 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 task permission.";
6996
- await Swal13.fire("Error", msg, "error");
7019
+ 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 step permission.";
7020
+ await Swal14.fire("Error", msg, "error");
6997
7021
  } finally {
6998
7022
  setIsSubmitting(false);
6999
7023
  }
7000
7024
  };
7001
7025
  const permissionCards = [
7002
- { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs", field: "canView" },
7003
- { icon: "\u2713", title: "Can Approve", desc: "Pass states", field: "canApprove" },
7004
- { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify props", field: "canEdit" },
7005
- { icon: "\u2715", title: "Can Reject", desc: "Cancel tasks", field: "canReject" }
7026
+ { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs & details", field: "canView" },
7027
+ { icon: "\u2713", title: "Can Approve", desc: "Pass states & approve", field: "canApprove" },
7028
+ { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify properties", field: "canEdit" },
7029
+ { icon: "\u2715", title: "Can Reject", desc: "Cancel / reject tasks", field: "canReject" },
7030
+ { icon: "\u27A1\uFE0F", title: "Can Forward", desc: "Forward to next step", field: "canForward" },
7031
+ { icon: "\u23E9", title: "Can Free Forward", desc: "Forward freely to any step", field: "canFreeForward" },
7032
+ { icon: "\u21A9\uFE0F", title: "Can Return", desc: "Return to previous step", field: "canReturn" },
7033
+ { icon: "\u{1F464}", title: "Can Return To Applicant", desc: "Send back to applicant", field: "canReturnToApplicant" },
7034
+ { icon: "\u{1F465}", title: "Can Delegate", desc: "Reassign or delegate task", field: "canDelegate" },
7035
+ { icon: "\u23F8\uFE0F", title: "Can Hold", desc: "Put execution on hold", field: "canHold" }
7006
7036
  ];
7007
7037
  return /* @__PURE__ */ jsxs43("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
7008
7038
  /* @__PURE__ */ jsx44("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
@@ -7011,7 +7041,7 @@ function Popup({ isOpen, onClose, onSave }) {
7011
7041
  /* @__PURE__ */ jsxs43("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
7012
7042
  /* @__PURE__ */ jsx44("div", { className: "fc:w-12 fc:h-12 fc:bg-blue-50 fc:text-blue-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm fc:text-xl", children: "\u{1F511}" }),
7013
7043
  /* @__PURE__ */ jsxs43("div", { children: [
7014
- /* @__PURE__ */ jsx44("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Task Permission" }),
7044
+ /* @__PURE__ */ jsx44("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Step Permission" }),
7015
7045
  /* @__PURE__ */ jsx44("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Configure step details and initial user control access rules" })
7016
7046
  ] })
7017
7047
  ] }),
@@ -7081,6 +7111,30 @@ function Popup({ isOpen, onClose, onSave }) {
7081
7111
  }
7082
7112
  )
7083
7113
  ] }, field)) })
7114
+ ] }),
7115
+ /* @__PURE__ */ jsxs43("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-4", children: [
7116
+ /* @__PURE__ */ jsxs43("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-blue-600 fc:text-sm fc:font-bold fc:border-b fc:border-slate-50 fc:pb-3", children: [
7117
+ /* @__PURE__ */ jsx44("span", { children: "\u{1F518}" }),
7118
+ /* @__PURE__ */ jsx44("span", { children: "Status" })
7119
+ ] }),
7120
+ /* @__PURE__ */ jsx44("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [{ label: "Active", val: true }, { label: "Inactive", val: false }].map(({ label, val }) => /* @__PURE__ */ jsxs43(
7121
+ "div",
7122
+ {
7123
+ onClick: () => handleChange("isActive", val),
7124
+ className: `fc:flex fc:items-center fc:gap-3 fc:p-3.5 fc:rounded-xl fc:border fc:cursor-pointer fc:transition-all ${formData.isActive === val ? val ? "fc:border-emerald-500 fc:bg-emerald-50/40 fc:ring-1 fc:ring-emerald-500/20" : "fc:border-slate-400 fc:bg-slate-100/60 fc:ring-1 fc:ring-slate-400/20" : "fc:border-slate-200 fc:bg-white hover:fc:bg-slate-50/60"}`,
7125
+ children: [
7126
+ /* @__PURE__ */ jsx44(
7127
+ "div",
7128
+ {
7129
+ className: `fc:w-3.5 fc:h-3.5 fc:rounded-full fc:border fc:flex fc:items-center fc:justify-center ${formData.isActive === val ? val ? "fc:border-emerald-500 fc:bg-emerald-500" : "fc:border-slate-600 fc:bg-slate-600" : "fc:border-slate-300"}`,
7130
+ children: formData.isActive === val && /* @__PURE__ */ jsx44("div", { className: "fc:w-1.5 fc:h-1.5 fc:bg-white fc:rounded-full" })
7131
+ }
7132
+ ),
7133
+ /* @__PURE__ */ jsx44("span", { className: "fc:text-xs fc:font-bold fc:text-slate-800", children: label })
7134
+ ]
7135
+ },
7136
+ label
7137
+ )) })
7084
7138
  ] })
7085
7139
  ] }),
7086
7140
  /* @__PURE__ */ jsxs43("div", { className: "fc:p-5 fc:bg-white fc:border-t fc:border-slate-100 fc:flex fc:items-center fc:justify-end fc:gap-3 fc:px-8", children: [
@@ -7115,7 +7169,7 @@ function Popup({ isOpen, onClose, onSave }) {
7115
7169
  }
7116
7170
 
7117
7171
  // src/components/task-permission/EditTaskPermissionModal.js
7118
- import React45, { useState as useState32, useEffect as useEffect23 } from "react";
7172
+ import React45, { useState as useState32, useEffect as useEffect25 } from "react";
7119
7173
  import { jsx as jsx45, jsxs as jsxs44 } from "react/jsx-runtime";
7120
7174
  function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpdate }) {
7121
7175
  var _a;
@@ -7125,6 +7179,12 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7125
7179
  canEdit: false,
7126
7180
  canApprove: false,
7127
7181
  canReject: false,
7182
+ canForward: false,
7183
+ canFreeForward: false,
7184
+ canReturn: false,
7185
+ canReturnToApplicant: false,
7186
+ canDelegate: false,
7187
+ canHold: false,
7128
7188
  isActive: true,
7129
7189
  updatedBy: "System"
7130
7190
  });
@@ -7132,15 +7192,15 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7132
7192
  const [isSubmitting, setIsSubmitting] = useState32(false);
7133
7193
  const [workflowSteps, setWorkflowSteps] = useState32([]);
7134
7194
  const [loadingSteps, setLoadingSteps] = useState32(false);
7135
- useEffect23(() => {
7195
+ useEffect25(() => {
7136
7196
  if (!isOpen) return;
7137
7197
  (async () => {
7138
7198
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7139
7199
  try {
7140
7200
  setLoadingSteps(true);
7141
- const endpoint = (_c = (_b = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
7142
- if (!endpoint) return;
7143
- const result = await getApiService().get(endpoint);
7201
+ const endpoint2 = (_c = (_b = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
7202
+ if (!endpoint2) return;
7203
+ const result = await getApiService().get(endpoint2);
7144
7204
  const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
7145
7205
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
7146
7206
  setWorkflowSteps(rows);
@@ -7150,8 +7210,8 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7150
7210
  }
7151
7211
  })();
7152
7212
  }, [isOpen]);
7153
- useEffect23(() => {
7154
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
7213
+ useEffect25(() => {
7214
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
7155
7215
  if (selectedData) {
7156
7216
  setFormData({
7157
7217
  workflowStepId: (_b = (_a2 = selectedData.workflowStepId) != null ? _a2 : selectedData.WorkflowStepId) != null ? _b : "",
@@ -7159,8 +7219,14 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7159
7219
  canEdit: (_f = (_e = selectedData.canEdit) != null ? _e : selectedData.CanEdit) != null ? _f : false,
7160
7220
  canApprove: (_h = (_g = selectedData.canApprove) != null ? _g : selectedData.CanApprove) != null ? _h : false,
7161
7221
  canReject: (_j = (_i = selectedData.canReject) != null ? _i : selectedData.CanReject) != null ? _j : false,
7162
- isActive: (_l = (_k = selectedData.isActive) != null ? _k : selectedData.IsActive) != null ? _l : true,
7163
- updatedBy: (_n = (_m = selectedData.updatedBy) != null ? _m : selectedData.UpdatedBy) != null ? _n : "System"
7222
+ canForward: (_l = (_k = selectedData.canForward) != null ? _k : selectedData.CanForward) != null ? _l : false,
7223
+ canFreeForward: (_n = (_m = selectedData.canFreeForward) != null ? _m : selectedData.CanFreeForward) != null ? _n : false,
7224
+ canReturn: (_p = (_o = selectedData.canReturn) != null ? _o : selectedData.CanReturn) != null ? _p : false,
7225
+ canReturnToApplicant: (_r = (_q = selectedData.canReturnToApplicant) != null ? _q : selectedData.CanReturnToApplicant) != null ? _r : false,
7226
+ canDelegate: (_t = (_s = selectedData.canDelegate) != null ? _s : selectedData.CanDelegate) != null ? _t : false,
7227
+ canHold: (_v = (_u = selectedData.canHold) != null ? _u : selectedData.CanHold) != null ? _v : false,
7228
+ isActive: (_x = (_w = selectedData.isActive) != null ? _w : selectedData.IsActive) != null ? _x : true,
7229
+ updatedBy: (_z = (_y = selectedData.updatedBy) != null ? _y : selectedData.UpdatedBy) != null ? _z : "System"
7164
7230
  });
7165
7231
  setErrors({});
7166
7232
  }
@@ -7188,6 +7254,12 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7188
7254
  canEdit: Boolean(formData.canEdit),
7189
7255
  canApprove: Boolean(formData.canApprove),
7190
7256
  canReject: Boolean(formData.canReject),
7257
+ canForward: Boolean(formData.canForward),
7258
+ canFreeForward: Boolean(formData.canFreeForward),
7259
+ canReturn: Boolean(formData.canReturn),
7260
+ canReturnToApplicant: Boolean(formData.canReturnToApplicant),
7261
+ canDelegate: Boolean(formData.canDelegate),
7262
+ canHold: Boolean(formData.canHold),
7191
7263
  isActive: Boolean(formData.isActive),
7192
7264
  updatedBy: String(formData.updatedBy).trim() || "System"
7193
7265
  });
@@ -7199,10 +7271,16 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7199
7271
  }
7200
7272
  };
7201
7273
  const permissionCards = [
7202
- { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs", field: "canView" },
7203
- { icon: "\u2713", title: "Can Approve", desc: "Pass states", field: "canApprove" },
7204
- { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify props", field: "canEdit" },
7205
- { icon: "\u2715", title: "Can Reject", desc: "Cancel tasks", field: "canReject" }
7274
+ { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs & details", field: "canView" },
7275
+ { icon: "\u2713", title: "Can Approve", desc: "Pass states & approve", field: "canApprove" },
7276
+ { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify properties", field: "canEdit" },
7277
+ { icon: "\u2715", title: "Can Reject", desc: "Cancel / reject tasks", field: "canReject" },
7278
+ { icon: "\u27A1\uFE0F", title: "Can Forward", desc: "Forward to next step", field: "canForward" },
7279
+ { icon: "\u23E9", title: "Can Free Forward", desc: "Forward freely to any step", field: "canFreeForward" },
7280
+ { icon: "\u21A9\uFE0F", title: "Can Return", desc: "Return to previous step", field: "canReturn" },
7281
+ { icon: "\u{1F464}", title: "Can Return To Applicant", desc: "Send back to applicant", field: "canReturnToApplicant" },
7282
+ { icon: "\u{1F465}", title: "Can Delegate", desc: "Reassign or delegate task", field: "canDelegate" },
7283
+ { icon: "\u23F8\uFE0F", title: "Can Hold", desc: "Put execution on hold", field: "canHold" }
7206
7284
  ];
7207
7285
  return /* @__PURE__ */ jsxs44("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
7208
7286
  /* @__PURE__ */ jsx45("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
@@ -7211,7 +7289,7 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7211
7289
  /* @__PURE__ */ jsxs44("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
7212
7290
  /* @__PURE__ */ jsx45("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm fc:text-xl", children: "\u{1F511}" }),
7213
7291
  /* @__PURE__ */ jsxs44("div", { children: [
7214
- /* @__PURE__ */ jsx45("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Task Permission" }),
7292
+ /* @__PURE__ */ jsx45("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Step Permission" }),
7215
7293
  /* @__PURE__ */ jsxs44("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: [
7216
7294
  "Update step access rules \u2014 ID: ",
7217
7295
  /* @__PURE__ */ jsxs44("span", { className: "fc:font-bold fc:text-slate-600", children: [
@@ -7377,29 +7455,35 @@ function TaskPermissionMain() {
7377
7455
  const handleUpdateApi = async (item) => {
7378
7456
  var _a, _b, _c, _d, _e, _f, _g;
7379
7457
  try {
7380
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.update;
7381
- if (!endpoint) throw new Error("Task Permission update endpoint is not configured.");
7382
- await getApiService().put(endpoint, {
7458
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.update;
7459
+ if (!endpoint2) throw new Error("Step Permission update endpoint is not configured.");
7460
+ await getApiService().put(endpoint2, {
7383
7461
  taskPermissionId: (_e = (_d = item.taskPermissionId) != null ? _d : item.TaskPermissionId) != null ? _e : 0,
7384
7462
  workflowStepId: Number(item.workflowStepId) || 0,
7385
7463
  canView: Boolean(item.canView),
7386
7464
  canEdit: Boolean(item.canEdit),
7387
7465
  canApprove: Boolean(item.canApprove),
7388
7466
  canReject: Boolean(item.canReject),
7467
+ canForward: Boolean(item.canForward),
7468
+ canFreeForward: Boolean(item.canFreeForward),
7469
+ canReturn: Boolean(item.canReturn),
7470
+ canReturnToApplicant: Boolean(item.canReturnToApplicant),
7471
+ canDelegate: Boolean(item.canDelegate),
7472
+ canHold: Boolean(item.canHold),
7389
7473
  isActive: Boolean(item.isActive),
7390
7474
  updatedBy: item.updatedBy || "System"
7391
7475
  });
7392
7476
  handleRefresh();
7393
7477
  return true;
7394
7478
  } catch (error) {
7395
- await Swal14.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 update task permission.", "error");
7479
+ await Swal15.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 update step permission.", "error");
7396
7480
  return false;
7397
7481
  }
7398
7482
  };
7399
7483
  const handleDeleteApi = async (item) => {
7400
7484
  var _a;
7401
- const confirm = await Swal14.fire({
7402
- title: "Delete Task Permission?",
7485
+ const confirm = await Swal15.fire({
7486
+ title: "Delete Step Permission?",
7403
7487
  text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
7404
7488
  icon: "warning",
7405
7489
  showCancelButton: true,
@@ -7408,11 +7492,11 @@ function TaskPermissionMain() {
7408
7492
  });
7409
7493
  if (!confirm.isConfirmed) return;
7410
7494
  const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
7411
- if (ok) await Swal14.fire("Deleted", "Task permission has been deactivated.", "success");
7495
+ if (ok) await Swal15.fire("Deleted", "Step permission has been deactivated.", "success");
7412
7496
  };
7413
7497
  return /* @__PURE__ */ jsxs45("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
7414
7498
  /* @__PURE__ */ jsxs45("div", { className: "fc:w-full fc:space-y-5", children: [
7415
- /* @__PURE__ */ jsx46(CommonHeader, { title: "Task Permission", breadcrumbs: [{
7499
+ /* @__PURE__ */ jsx46(CommonHeader, { title: "Step Permission", breadcrumbs: [{
7416
7500
  label: "Dashboard",
7417
7501
  href: "/dashboard"
7418
7502
  }, {
@@ -7422,9 +7506,9 @@ function TaskPermissionMain() {
7422
7506
  label: "Permissions",
7423
7507
  href: "/permissions"
7424
7508
  }, {
7425
- label: "TaskPermission",
7426
- href: "/task-permission"
7427
- }], buttonText: "Add Task Permission", onButtonClick: () => setShowModal(true) }),
7509
+ label: "StepPermission",
7510
+ href: "/step-permission"
7511
+ }], buttonText: "Add Step Permission", onButtonClick: () => setShowModal(true) }),
7428
7512
  /* @__PURE__ */ jsxs45("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:shadow-sm fc:space-y-5", children: [
7429
7513
  /* @__PURE__ */ jsxs45("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
7430
7514
  /* @__PURE__ */ jsx46("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ jsx46(SearchBar6, { searchQuery, setSearchQuery, setCurrentPage }) }),
@@ -7461,7 +7545,7 @@ function TaskPermissionMain() {
7461
7545
  isOpen: showModal,
7462
7546
  onClose: () => setShowModal(false),
7463
7547
  onSave: async () => {
7464
- await Swal14.fire("Success", "Task permission created successfully.", "success");
7548
+ await Swal15.fire("Success", "Step permission created successfully.", "success");
7465
7549
  handleRefresh();
7466
7550
  }
7467
7551
  }
@@ -7473,7 +7557,7 @@ function TaskPermissionMain() {
7473
7557
  onClose: () => setIsEditOpen(false),
7474
7558
  selectedData: selectedItem,
7475
7559
  onSave: async () => {
7476
- await Swal14.fire("Success", "Task permission updated successfully.", "success");
7560
+ await Swal15.fire("Success", "Step permission updated successfully.", "success");
7477
7561
  handleRefresh();
7478
7562
  },
7479
7563
  onUpdate: handleUpdateApi
@@ -7514,7 +7598,7 @@ function SearchBar7({
7514
7598
  }
7515
7599
 
7516
7600
  // src/components/Workflow-Setting/Table.js
7517
- import React48, { useState as useState34, useEffect as useEffect24 } from "react";
7601
+ import React48, { useState as useState34, useEffect as useEffect26 } from "react";
7518
7602
  import { jsx as jsx48, jsxs as jsxs47 } from "react/jsx-runtime";
7519
7603
  function Table2({
7520
7604
  pageSize,
@@ -7761,7 +7845,7 @@ function Table2({
7761
7845
  }
7762
7846
  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);
7763
7847
  });
7764
- useEffect24(() => {
7848
+ useEffect26(() => {
7765
7849
  if (setTotalEntries) setTotalEntries(filteredData.length);
7766
7850
  }, [filteredData.length, setTotalEntries]);
7767
7851
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -8037,7 +8121,7 @@ function SearchBar8({
8037
8121
  }
8038
8122
 
8039
8123
  // src/components/notification/Table.js
8040
- import React52, { useState as useState37, useEffect as useEffect25 } from "react";
8124
+ import React52, { useState as useState37, useEffect as useEffect27 } from "react";
8041
8125
  import { jsx as jsx52, jsxs as jsxs51 } from "react/jsx-runtime";
8042
8126
  function Table3({
8043
8127
  pageSize,
@@ -8284,7 +8368,7 @@ function Table3({
8284
8368
  }
8285
8369
  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);
8286
8370
  });
8287
- useEffect25(() => {
8371
+ useEffect27(() => {
8288
8372
  if (setTotalEntries) setTotalEntries(filteredData.length);
8289
8373
  }, [filteredData.length, setTotalEntries]);
8290
8374
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -8570,10 +8654,10 @@ function TaskInstanceSearchBar({
8570
8654
  }
8571
8655
 
8572
8656
  // src/components/task-instance/taskinstancetable.jsx
8573
- import React58, { useState as useState41, useEffect as useEffect27 } from "react";
8657
+ import React58, { useState as useState41, useEffect as useEffect29 } from "react";
8574
8658
 
8575
8659
  // src/components/task-instance/edit-instance.jsx
8576
- import React56, { useEffect as useEffect26, useState as useState40 } from "react";
8660
+ import React56, { useEffect as useEffect28, useState as useState40 } from "react";
8577
8661
  import { jsx as jsx56, jsxs as jsxs55 } from "react/jsx-runtime";
8578
8662
  function EditTaskInstanceModal({
8579
8663
  isOpen,
@@ -8589,7 +8673,7 @@ function EditTaskInstanceModal({
8589
8673
  escalatedOn: "",
8590
8674
  slaStatus: ""
8591
8675
  });
8592
- useEffect26(() => {
8676
+ useEffect28(() => {
8593
8677
  if (selectedTask) {
8594
8678
  setFormData({
8595
8679
  assignedUserId: selectedTask.assignedUserId || selectedTask.assigned_user_id || "",
@@ -9110,7 +9194,7 @@ function TaskInstanceTable({
9110
9194
  const query = (searchQuery || "").toLowerCase();
9111
9195
  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);
9112
9196
  });
9113
- useEffect27(() => {
9197
+ useEffect29(() => {
9114
9198
  if (setTotalEntries) setTotalEntries(filteredData.length);
9115
9199
  }, [filteredData.length, setTotalEntries]);
9116
9200
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -9479,7 +9563,7 @@ function CommentSearchBar({
9479
9563
  }
9480
9564
 
9481
9565
  // src/components/comment/commenttable.jsx
9482
- import React62, { useState as useState43, useEffect as useEffect28 } from "react";
9566
+ import React62, { useState as useState43, useEffect as useEffect30 } from "react";
9483
9567
  import { jsx as jsx62, jsxs as jsxs61 } from "react/jsx-runtime";
9484
9568
  function CommentTable({
9485
9569
  pageSize,
@@ -9707,7 +9791,7 @@ function CommentTable({
9707
9791
  const query = (searchQuery || "").toLowerCase();
9708
9792
  return String(item.commentId).toLowerCase().includes(query) || String(item.taskInstanceId).toLowerCase().includes(query) || item.comment.toLowerCase().includes(query) || String(item.commentedBy).toLowerCase().includes(query);
9709
9793
  });
9710
- useEffect28(() => {
9794
+ useEffect30(() => {
9711
9795
  if (setTotalEntries) setTotalEntries(filteredData.length);
9712
9796
  }, [filteredData.length, setTotalEntries]);
9713
9797
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -10042,8 +10126,8 @@ function Comment_main() {
10042
10126
  }
10043
10127
 
10044
10128
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
10045
- import React70, { useState as useState49, useRef as useRef15, useEffect as useEffect31 } from "react";
10046
- import Swal15 from "sweetalert2";
10129
+ import React70, { useState as useState49, useRef as useRef15, useEffect as useEffect33 } from "react";
10130
+ import Swal16 from "sweetalert2";
10047
10131
 
10048
10132
  // src/components/hierarchy-node/SearchBar.jsx
10049
10133
  import React65 from "react";
@@ -10082,10 +10166,10 @@ function SearchBar9({ searchQuery, setSearchQuery }) {
10082
10166
  }
10083
10167
 
10084
10168
  // src/components/hierarchy-node/HierarchyTable.jsx
10085
- import React68, { useState as useState47, useEffect as useEffect30 } from "react";
10169
+ import React68, { useState as useState47, useEffect as useEffect32 } from "react";
10086
10170
 
10087
10171
  // src/components/hierarchy-node/AddEditModal.jsx
10088
- import React66, { useEffect as useEffect29, useState as useState46 } from "react";
10172
+ import React66, { useEffect as useEffect31, useState as useState46 } from "react";
10089
10173
  import { jsx as jsx66, jsxs as jsxs65 } from "react/jsx-runtime";
10090
10174
  function AddEditModal({
10091
10175
  isOpen,
@@ -10103,7 +10187,7 @@ function AddEditModal({
10103
10187
  externalEntityId: "",
10104
10188
  isActive: true
10105
10189
  });
10106
- useEffect29(() => {
10190
+ useEffect31(() => {
10107
10191
  if (editData) {
10108
10192
  setFormData(editData);
10109
10193
  }
@@ -10326,7 +10410,7 @@ function HierarchyTable({
10326
10410
  const [currentPage, setCurrentPage] = useState47(1);
10327
10411
  ;
10328
10412
  const [data, setData] = useState47(apiData || []);
10329
- useEffect30(() => {
10413
+ useEffect32(() => {
10330
10414
  setData(apiData || []);
10331
10415
  }, [apiData]);
10332
10416
  const filteredData = data.filter(
@@ -10343,7 +10427,7 @@ function HierarchyTable({
10343
10427
  const [editOpen, setEditOpen] = useState47(false);
10344
10428
  const [deleteOpen, setDeleteOpen] = useState47(false);
10345
10429
  const [selectedNode, setSelectedNode] = useState47(null);
10346
- useEffect30(() => {
10430
+ useEffect32(() => {
10347
10431
  setCurrentPage(1);
10348
10432
  }, [searchQuery, pageSize]);
10349
10433
  const handleSort = (column) => {
@@ -10637,17 +10721,17 @@ function HierarchyNodeMain() {
10637
10721
  const [searchQuery, setSearchQuery] = useState49("");
10638
10722
  const [apiData, setApiData] = useState49([]);
10639
10723
  const [refreshKey, setRefreshKey] = useState49(0);
10640
- useEffect31(() => {
10724
+ useEffect33(() => {
10641
10725
  (async () => {
10642
10726
  var _a, _b, _c, _d, _e, _f, _g;
10643
10727
  try {
10644
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c.getList;
10645
- if (!endpoint) throw Error("Hierarchy node list endpoint is not configured.");
10646
- const result = await getApiService().get(endpoint);
10728
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c.getList;
10729
+ if (!endpoint2) throw Error("Hierarchy node list endpoint is not configured.");
10730
+ const result = await getApiService().get(endpoint2);
10647
10731
  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;
10648
10732
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
10649
10733
  } catch (error) {
10650
- await Swal15.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");
10734
+ await Swal16.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");
10651
10735
  }
10652
10736
  })();
10653
10737
  }, [refreshKey]);
@@ -10657,14 +10741,14 @@ function HierarchyNodeMain() {
10657
10741
  const saveNode = async (payload, isEdit = false) => {
10658
10742
  var _a, _b, _c, _d, _e;
10659
10743
  try {
10660
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
10661
- if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
10662
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
10663
- await Swal15.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
10744
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
10745
+ if (!endpoint2) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
10746
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
10747
+ await Swal16.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
10664
10748
  handleRefresh();
10665
10749
  return true;
10666
10750
  } catch (error) {
10667
- await Swal15.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");
10751
+ await Swal16.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");
10668
10752
  return false;
10669
10753
  }
10670
10754
  };
@@ -11373,8 +11457,8 @@ function UploadedDocumentMain() {
11373
11457
  }
11374
11458
 
11375
11459
  // src/components/BuisnessEntity/BusinessEntitymain.js
11376
- import React80, { useEffect as useEffect32, useRef as useRef18, useState as useState55 } from "react";
11377
- import Swal16 from "sweetalert2";
11460
+ import React80, { useEffect as useEffect34, useRef as useRef18, useState as useState55 } from "react";
11461
+ import Swal17 from "sweetalert2";
11378
11462
 
11379
11463
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
11380
11464
  import React79, { useState as useState54 } from "react";
@@ -11705,15 +11789,15 @@ var getBusinessEntityEndpoint = (action) => {
11705
11789
  }
11706
11790
  };
11707
11791
  var getBusinessEntityByIdEndpoint = (id) => {
11708
- const endpoint = getBusinessEntityEndpoint("getById");
11709
- return typeof endpoint === "function" ? endpoint(id) : `${endpoint}/${id}`;
11792
+ const endpoint2 = getBusinessEntityEndpoint("getById");
11793
+ return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
11710
11794
  };
11711
- var getRows = (response) => {
11795
+ var getRows2 = (response) => {
11712
11796
  var _a, _b, _c, _d, _e, _f, _g;
11713
11797
  const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
11714
11798
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
11715
11799
  };
11716
- var normalise = (item) => {
11800
+ var normalise2 = (item) => {
11717
11801
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
11718
11802
  return __spreadProps(__spreadValues({}, item), {
11719
11803
  businessEntityId: (_b = (_a = item.businessEntityId) != null ? _a : item.BusinessEntityId) != null ? _b : item.id,
@@ -11733,15 +11817,15 @@ function BusinessEntity() {
11733
11817
  const [search, setSearch] = useState55("");
11734
11818
  const [sortConfig, setSortConfig] = useState55({ key: "", direction: "asc" });
11735
11819
  const [refreshKey, setRefreshKey] = useState55(0);
11736
- useEffect32(() => {
11820
+ useEffect34(() => {
11737
11821
  const load = async () => {
11738
11822
  var _a, _b;
11739
11823
  try {
11740
- const endpoint = getBusinessEntityEndpoint("getList");
11741
- const response = await getApiService().get(endpoint);
11742
- setRows(getRows(response).map(normalise));
11824
+ const endpoint2 = getBusinessEntityEndpoint("getList");
11825
+ const response = await getApiService().get(endpoint2);
11826
+ setRows(getRows2(response).map(normalise2));
11743
11827
  } catch (error) {
11744
- await Swal16.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load business entities.", "error");
11828
+ await Swal17.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load business entities.", "error");
11745
11829
  }
11746
11830
  };
11747
11831
  load();
@@ -11750,13 +11834,13 @@ function BusinessEntity() {
11750
11834
  const saveEntity = async (payload, isEdit) => {
11751
11835
  var _a, _b;
11752
11836
  try {
11753
- const endpoint = getBusinessEntityEndpoint(isEdit ? "update" : "create");
11754
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
11755
- await Swal16.fire("Success", `Business entity ${isEdit ? "updated" : "created"} successfully.`, "success");
11837
+ const endpoint2 = getBusinessEntityEndpoint(isEdit ? "update" : "create");
11838
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
11839
+ await Swal17.fire("Success", `Business entity ${isEdit ? "updated" : "created"} successfully.`, "success");
11756
11840
  refresh();
11757
11841
  return true;
11758
11842
  } catch (error) {
11759
- await Swal16.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} business entity.`, "error");
11843
+ await Swal17.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} business entity.`, "error");
11760
11844
  return false;
11761
11845
  }
11762
11846
  };
@@ -11764,11 +11848,11 @@ function BusinessEntity() {
11764
11848
  var _a, _b, _c, _d, _e, _f, _g, _h;
11765
11849
  try {
11766
11850
  const response = await getApiService().get(getBusinessEntityByIdEndpoint(entity.businessEntityId));
11767
- const data = (_f = (_e = (_d = (_b = getRows(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
11768
- setEditingEntity(normalise(data));
11851
+ const data = (_f = (_e = (_d = (_b = getRows2(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
11852
+ setEditingEntity(normalise2(data));
11769
11853
  setShowModal(true);
11770
11854
  } catch (error) {
11771
- await Swal16.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load business entity details.", "error");
11855
+ await Swal17.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load business entity details.", "error");
11772
11856
  }
11773
11857
  };
11774
11858
  const visibleRows = rows.filter((item) => [item.entityType, item.entityKey, item.displayNumber, item.displayTitle].join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
@@ -11825,11 +11909,11 @@ function BusinessEntity() {
11825
11909
  }
11826
11910
 
11827
11911
  // src/components/FileInstance/FileInstancemain.js
11828
- import React82, { useEffect as useEffect34, useRef as useRef19, useState as useState57 } from "react";
11829
- import Swal17 from "sweetalert2";
11912
+ import React82, { useEffect as useEffect36, useRef as useRef19, useState as useState57 } from "react";
11913
+ import Swal18 from "sweetalert2";
11830
11914
 
11831
11915
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
11832
- import React81, { useEffect as useEffect33, useMemo, useState as useState56 } from "react";
11916
+ import React81, { useEffect as useEffect35, useMemo, useState as useState56 } from "react";
11833
11917
  import { jsx as jsx81, jsxs as jsxs80 } from "react/jsx-runtime";
11834
11918
  var LOOKUP_ENDPOINTS = {
11835
11919
  workflow: "/api/flowcore/WorkFlow/GetList",
@@ -11869,7 +11953,7 @@ function AddFileInstanceModal({ onClose, onSave, editData }) {
11869
11953
  const [businessEntities, setBusinessEntities] = useState56([]);
11870
11954
  const [hierarchyNodes, setHierarchyNodes] = useState56([]);
11871
11955
  const [isLoadingLookups, setIsLoadingLookups] = useState56(true);
11872
- useEffect33(() => {
11956
+ useEffect35(() => {
11873
11957
  let isMounted = true;
11874
11958
  const loadLookups = async () => {
11875
11959
  try {
@@ -12228,15 +12312,15 @@ var getFileInstanceEndpoint = (action) => {
12228
12312
  }
12229
12313
  };
12230
12314
  var getFileInstanceByIdEndpoint = (id) => {
12231
- const endpoint = getFileInstanceEndpoint("getById");
12232
- return typeof endpoint === "function" ? endpoint(id) : `${endpoint}/${id}`;
12315
+ const endpoint2 = getFileInstanceEndpoint("getById");
12316
+ return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
12233
12317
  };
12234
- var getRows2 = (response) => {
12318
+ var getRows3 = (response) => {
12235
12319
  var _a, _b, _c, _d, _e, _f, _g;
12236
12320
  const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
12237
12321
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
12238
12322
  };
12239
- var normalise2 = (item) => {
12323
+ var normalise3 = (item) => {
12240
12324
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
12241
12325
  return __spreadProps(__spreadValues({}, item), { fileInstanceId: (_b = (_a = item.fileInstanceId) != null ? _a : item.FileInstanceId) != null ? _b : item.id, workflowId: (_d = (_c = item.workflowId) != null ? _c : item.WorkflowId) != null ? _d : "", businessEntityType: (_f = (_e = item.businessEntityType) != null ? _e : item.BusinessEntityType) != null ? _f : "", businessEntityId: (_h = (_g = item.businessEntityId) != null ? _g : item.BusinessEntityId) != null ? _h : "", hierarchyNodeId: (_j = (_i = item.hierarchyNodeId) != null ? _i : item.HierarchyNodeId) != null ? _j : "", currentStepId: (_l = (_k = item.currentStepId) != null ? _k : item.CurrentStepId) != null ? _l : "", currentTaskInstanceId: (_n = (_m = item.currentTaskInstanceId) != null ? _m : item.CurrentTaskInstanceId) != null ? _n : "", status: (_p = (_o = item.status) != null ? _o : item.Status) != null ? _p : "", priority: (_r = (_q = item.priority) != null ? _q : item.Priority) != null ? _r : "", isActive: (_t = (_s = item.isActive) != null ? _s : item.IsActive) != null ? _t : true });
12242
12326
  };
@@ -12249,14 +12333,14 @@ function FileInstance() {
12249
12333
  const [search, setSearch] = useState57("");
12250
12334
  const [sortConfig, setSortConfig] = useState57({ key: "", direction: "asc" });
12251
12335
  const [refreshKey, setRefreshKey] = useState57(0);
12252
- useEffect34(() => {
12336
+ useEffect36(() => {
12253
12337
  const load = async () => {
12254
12338
  var _a, _b;
12255
12339
  try {
12256
12340
  const response = await getApiService().get(getFileInstanceEndpoint("getList"));
12257
- setRows(getRows2(response).map(normalise2));
12341
+ setRows(getRows3(response).map(normalise3));
12258
12342
  } catch (error) {
12259
- await Swal17.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load file instances.", "error");
12343
+ await Swal18.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load file instances.", "error");
12260
12344
  }
12261
12345
  };
12262
12346
  load();
@@ -12265,13 +12349,13 @@ function FileInstance() {
12265
12349
  const saveFile = async (payload, isEdit) => {
12266
12350
  var _a, _b;
12267
12351
  try {
12268
- const endpoint = getFileInstanceEndpoint(isEdit ? "update" : "create");
12269
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
12270
- await Swal17.fire("Success", `File instance ${isEdit ? "updated" : "created"} successfully.`, "success");
12352
+ const endpoint2 = getFileInstanceEndpoint(isEdit ? "update" : "create");
12353
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
12354
+ await Swal18.fire("Success", `File instance ${isEdit ? "updated" : "created"} successfully.`, "success");
12271
12355
  refresh();
12272
12356
  return true;
12273
12357
  } catch (error) {
12274
- await Swal17.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} file instance.`, "error");
12358
+ await Swal18.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} file instance.`, "error");
12275
12359
  return false;
12276
12360
  }
12277
12361
  };
@@ -12279,11 +12363,11 @@ function FileInstance() {
12279
12363
  var _a, _b, _c, _d, _e, _f, _g, _h;
12280
12364
  try {
12281
12365
  const response = await getApiService().get(getFileInstanceByIdEndpoint(file.fileInstanceId));
12282
- const data = (_f = (_e = (_d = (_b = getRows2(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
12283
- setEditingFile(normalise2(data));
12366
+ const data = (_f = (_e = (_d = (_b = getRows3(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
12367
+ setEditingFile(normalise3(data));
12284
12368
  setShowModal(true);
12285
12369
  } catch (error) {
12286
- await Swal17.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load file instance details.", "error");
12370
+ await Swal18.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load file instance details.", "error");
12287
12371
  }
12288
12372
  };
12289
12373
  const columns = [["FileInstanceId", "fileInstanceId"], ["WorkflowId", "workflowId"], ["BusinessEntityType", "businessEntityType"], ["BusinessEntityId", "businessEntityId"], ["HierarchyNodeId", "hierarchyNodeId"], ["CurrentStepId", "currentStepId"], ["CurrentTaskInstanceId", "currentTaskInstanceId"], ["Status", "status"], ["Priority", "priority"]];
@@ -12336,7 +12420,8 @@ function FileInstance() {
12336
12420
  }
12337
12421
 
12338
12422
  // src/components/assignment-rule/AssignmentRuleMain.jsx
12339
- import React86, { useState as useState60, useRef as useRef20 } from "react";
12423
+ import React86, { useEffect as useEffect39, useRef as useRef20, useState as useState60 } from "react";
12424
+ import Swal19 from "sweetalert2";
12340
12425
 
12341
12426
  // src/components/assignment-rule/SearchBar.js
12342
12427
  import React83 from "react";
@@ -12359,379 +12444,180 @@ function SearchBar12({
12359
12444
  }
12360
12445
 
12361
12446
  // src/components/assignment-rule/Table.js
12362
- import React84, { useState as useState58, useEffect as useEffect35 } from "react";
12447
+ import React84, { useEffect as useEffect37, useMemo as useMemo2, useState as useState58 } from "react";
12363
12448
  import { jsx as jsx84, jsxs as jsxs83 } from "react/jsx-runtime";
12364
- function Table4({
12365
- pageSize,
12366
- searchQuery = "",
12367
- currentPage,
12368
- setCurrentPage,
12369
- setTotalEntries
12370
- }) {
12371
- const initialData = [{
12372
- id: 1,
12373
- workflowStepId: "1",
12374
- assignmentType: "Hierarchy",
12375
- hierarchyNodeType: "Block",
12376
- dynamicFunctionId: "N/A",
12377
- isPoolEnabled: true
12378
- }, {
12379
- id: 2,
12380
- workflowStepId: "2",
12381
- assignmentType: "Dynamic",
12382
- hierarchyNodeType: "District",
12383
- dynamicFunctionId: "1",
12384
- isPoolEnabled: false
12385
- }, {
12386
- id: 3,
12387
- workflowStepId: "3",
12388
- assignmentType: "Hierarchy",
12389
- hierarchyNodeType: "District",
12390
- dynamicFunctionId: "N/A",
12391
- isPoolEnabled: true
12392
- }, {
12393
- id: 4,
12394
- workflowStepId: "4",
12395
- assignmentType: "Dynamic",
12396
- hierarchyNodeType: "Block",
12397
- dynamicFunctionId: "2",
12398
- isPoolEnabled: false
12399
- }, {
12400
- id: 5,
12401
- workflowStepId: "5",
12402
- assignmentType: "Hierarchy",
12403
- hierarchyNodeType: "Block",
12404
- dynamicFunctionId: "N/A",
12405
- isPoolEnabled: true
12406
- }, {
12407
- id: 6,
12408
- workflowStepId: "6",
12409
- assignmentType: "Dynamic",
12410
- hierarchyNodeType: "District",
12411
- dynamicFunctionId: "4",
12412
- isPoolEnabled: true
12413
- }, {
12414
- id: 7,
12415
- workflowStepId: "7",
12416
- assignmentType: "Dynamic",
12417
- hierarchyNodeType: "District",
12418
- dynamicFunctionId: "4",
12419
- isPoolEnabled: true
12420
- }, {
12421
- id: 8,
12422
- workflowStepId: "8",
12423
- assignmentType: "Dynamic",
12424
- hierarchyNodeType: "District",
12425
- dynamicFunctionId: "4",
12426
- isPoolEnabled: true
12427
- }, {
12428
- id: 9,
12429
- workflowStepId: "9",
12430
- assignmentType: "Dynamic",
12431
- hierarchyNodeType: "District",
12432
- dynamicFunctionId: "4",
12433
- isPoolEnabled: true
12434
- }, {
12435
- id: 10,
12436
- workflowStepId: "10",
12437
- assignmentType: "Hierarchy",
12438
- hierarchyNodeType: "District",
12439
- dynamicFunctionId: "4",
12440
- isPoolEnabled: true
12441
- }, {
12442
- id: 11,
12443
- workflowStepId: "11",
12444
- assignmentType: "Dynamic",
12445
- hierarchyNodeType: "District",
12446
- dynamicFunctionId: "4",
12447
- isPoolEnabled: true
12448
- }, {
12449
- id: 12,
12450
- workflowStepId: "12",
12451
- assignmentType: "Dynamic",
12452
- hierarchyNodeType: "District",
12453
- dynamicFunctionId: "4",
12454
- isPoolEnabled: true
12455
- }, {
12456
- id: 13,
12457
- workflowStepId: "13",
12458
- assignmentType: "Dynamic",
12459
- hierarchyNodeType: "District",
12460
- dynamicFunctionId: "4",
12461
- isPoolEnabled: true
12462
- }, {
12463
- id: 14,
12464
- workflowStepId: "14",
12465
- assignmentType: "Dynamic",
12466
- hierarchyNodeType: "District",
12467
- dynamicFunctionId: "4",
12468
- isPoolEnabled: true
12469
- }];
12470
- const [data, setData] = useState58(initialData);
12471
- const [sortOrder, setSortOrder] = useState58("asc");
12472
- const [sortKey, setSortKey] = useState58("workflowStepId");
12473
- const [selectedItem, setSelectedItem] = useState58(null);
12474
- const [isEditModalOpen, setIsEditModalOpen] = useState58(false);
12475
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState58(false);
12476
- const handleEdit = (item) => {
12477
- setSelectedItem(item);
12478
- setIsEditModalOpen(true);
12479
- };
12480
- const handleDelete = (item) => {
12481
- setSelectedItem(item);
12482
- setIsDeleteModalOpen(true);
12483
- };
12484
- const confirmDelete = () => {
12485
- if (selectedItem) {
12486
- setData((prevData) => prevData.filter((item) => item.id !== selectedItem.id));
12487
- }
12488
- setIsDeleteModalOpen(false);
12489
- setSelectedItem(null);
12490
- };
12491
- const handleSaveEdit = (e) => {
12492
- e.preventDefault();
12493
- const formData = new FormData(e.target);
12494
- const updatedAssignmentType = formData.get("assignmentType");
12495
- const updatedNodeType = formData.get("nodeType");
12496
- const updatedDynamicFunctionId = formData.get("dynamicFunctionId");
12497
- setData((prevData) => prevData.map((item) => item.id === selectedItem.id ? __spreadProps(__spreadValues({}, item), {
12498
- assignmentType: updatedAssignmentType,
12499
- nodeType: updatedNodeType,
12500
- dynamicFunctionId: updatedDynamicFunctionId
12501
- }) : item));
12502
- setIsEditModalOpen(false);
12503
- setSelectedItem(null);
12504
- };
12505
- const handleSort = (columnKey) => {
12506
- const isAsc = sortKey === columnKey && sortOrder === "asc";
12507
- setSortOrder(isAsc ? "desc" : "asc");
12508
- setSortKey(columnKey);
12509
- const sortedData = [...data].sort((a, b) => {
12510
- let valA = a[columnKey];
12511
- let valB = b[columnKey];
12512
- if (typeof valA === "number" && typeof valB === "number") {
12513
- return isAsc ? valA - valB : valB - valA;
12514
- }
12515
- valA = valA ? valA.toString().toLowerCase() : "";
12516
- valB = valB ? valB.toString().toLowerCase() : "";
12517
- if (valA < valB) return isAsc ? -1 : 1;
12518
- if (valA > valB) return isAsc ? 1 : -1;
12519
- return 0;
12520
- });
12521
- setData(sortedData);
12522
- };
12523
- const filteredData = data.filter((item) => {
12524
- if (!searchQuery || searchQuery.trim() === "") return true;
12525
- const query = searchQuery.toLowerCase().trim();
12526
- 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);
12449
+ function Table4({ pageSize, searchQuery = "", currentPage, setCurrentPage, setTotalEntries, rows = [], loading, onEdit, onDelete }) {
12450
+ const [sort, setSort] = useState58({ key: "workflowStepId", direction: "asc" });
12451
+ const filteredRows = useMemo2(() => rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(searchQuery.toLowerCase().trim())), [rows, searchQuery]);
12452
+ useEffect37(() => {
12453
+ setTotalEntries == null ? void 0 : setTotalEntries(filteredRows.length);
12454
+ if (currentPage > Math.max(1, Math.ceil(filteredRows.length / pageSize))) setCurrentPage(1);
12455
+ }, [filteredRows.length, pageSize, currentPage, setCurrentPage, setTotalEntries]);
12456
+ const sortedRows = [...filteredRows].sort((a, b) => {
12457
+ var _a, _b;
12458
+ const result = String((_a = a[sort.key]) != null ? _a : "").localeCompare(String((_b = b[sort.key]) != null ? _b : ""), void 0, { numeric: true });
12459
+ return sort.direction === "asc" ? result : -result;
12527
12460
  });
12528
- useEffect35(() => {
12529
- if (setTotalEntries) setTotalEntries(filteredData.length);
12530
- }, [filteredData.length, setTotalEntries]);
12531
- const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
12532
- const startIndex = (currentPage - 1) * pageSize;
12533
- const visibleData = filteredData.slice(startIndex, startIndex + pageSize);
12534
- const pageNumbers = Array.from({
12535
- length: totalPages
12536
- }, (_, i) => i + 1);
12537
- const toggleStatus = (id) => {
12538
- setData((prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
12539
- isPoolEnabled: !item.isPoolEnabled
12540
- }) : item));
12541
- };
12542
- return /* @__PURE__ */ jsxs83("div", { className: "fc:space-y-5", children: [
12543
- /* @__PURE__ */ jsx84("div", { className: "fc:w-full fc:overflow-x-auto fc:border fc:border-slate-200 fc:rounded-2xl fc:shadow-sm fc:max-h-[420px] fc:overflow-y-auto", children: /* @__PURE__ */ jsxs83("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-auto", children: [
12544
- /* @__PURE__ */ jsx84("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50 fc:shadow-[0_1px_0_0_rgba(226,232,240,1)]", children: /* @__PURE__ */ jsxs83("tr", { className: "fc:text-xs fc:font-medium fc:uppercase fc:tracking-wider fc:text-slate-500", children: [
12545
- /* @__PURE__ */ jsx84("th", { className: "fc:py-4 fc:px-4 fc:w-16 fc:text-center fc:bg-slate-50", children: "S.NO" }),
12546
- /* @__PURE__ */ jsxs83("th", { onClick: () => handleSort("workflowStepId"), className: "fc:py-4 fc:px-5 fc:text-s fc:cursor-pointer fc:select-none fc:bg-slate-50 fc:whitespace-nowrap", children: [
12547
- "WORKFLOW STEP ID ",
12548
- sortKey === "workflowStepId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12549
- ] }),
12550
- /* @__PURE__ */ jsxs83("th", { onClick: () => handleSort("assignmentType"), className: "fc:py-4 fc:px-5 fc:text-s fc:cursor-pointer fc:select-none fc:bg-slate-50 fc:whitespace-nowrap", children: [
12551
- "ASSIGNMENT TYPE ",
12552
- sortKey === "assignmentType" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12553
- ] }),
12554
- /* @__PURE__ */ jsxs83("th", { onClick: () => handleSort("hierarchyNodeType"), className: "fc:py-4 fc:px-5 fc:text-s fc:cursor-pointer fc:select-none fc:bg-slate-50 fc:whitespace-nowrap", children: [
12555
- "NODE TYPE ",
12556
- sortKey === "hierarchyNodeType" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12557
- ] }),
12558
- /* @__PURE__ */ jsxs83("th", { onClick: () => handleSort("dynamicFunctionId"), className: "fc:py-4 fc:px-5 fc:text-s fc:cursor-pointer fc:select-none fc:bg-slate-50 fc:whitespace-nowrap fc:text-center", children: [
12559
- "DYNAMIC FUNCTION ID ",
12560
- sortKey === "dynamicFunctionId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12561
- ] }),
12562
- /* @__PURE__ */ jsx84("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "POOL ENABLED" }),
12563
- /* @__PURE__ */ jsx84("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "ACTION" })
12461
+ const totalPages = Math.max(1, Math.ceil(sortedRows.length / pageSize));
12462
+ const visibleRows = sortedRows.slice((currentPage - 1) * pageSize, currentPage * pageSize);
12463
+ const sortBy = (key) => setSort((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
12464
+ const heading = (label, key) => /* @__PURE__ */ jsxs83("th", { onClick: () => sortBy(key), className: "fc:cursor-pointer fc:whitespace-nowrap fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-left fc:text-xs", children: [
12465
+ label,
12466
+ " ",
12467
+ sort.key === key ? sort.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
12468
+ ] });
12469
+ return /* @__PURE__ */ jsxs83("div", { className: "fc:space-y-4", children: [
12470
+ /* @__PURE__ */ jsx84("div", { className: "fc:max-h-[420px] fc:overflow-auto fc:rounded-2xl fc:border fc:border-slate-200", children: /* @__PURE__ */ jsxs83("table", { className: "fc:w-full fc:bg-white fc:text-left", children: [
12471
+ /* @__PURE__ */ jsx84("thead", { className: "fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ jsxs83("tr", { children: [
12472
+ /* @__PURE__ */ jsx84("th", { className: "fc:bg-slate-50 fc:px-4 fc:py-4 fc:text-xs", children: "S.NO" }),
12473
+ heading("WORKFLOW STEP ID", "workflowStepId"),
12474
+ heading("ASSIGNMENT TYPE", "assignmentType"),
12475
+ heading("NODE TYPE", "hierarchyNodeType"),
12476
+ /* @__PURE__ */ jsx84("th", { className: "fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-xs", children: "POOL ENABLED" }),
12477
+ /* @__PURE__ */ jsx84("th", { className: "fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-xs", children: "ACTION" })
12564
12478
  ] }) }),
12565
- /* @__PURE__ */ jsxs83("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-s fc:text-slate-600", children: [
12566
- visibleData.map((item, index) => /* @__PURE__ */ jsxs83("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
12567
- /* @__PURE__ */ jsx84("td", { className: "fc:py-4 fc:px-4 fc:text-center fc:font-medium fc:text-slate-400", children: startIndex + index + 1 }),
12568
- /* @__PURE__ */ jsxs83("td", { className: "fc:py-4 fc:px-5 fc:text-[14px] fc:font-medium fc:whitespace-nowrap", children: [
12569
- "STEP-",
12570
- item.workflowStepId
12571
- ] }),
12572
- /* @__PURE__ */ jsx84("td", { className: "fc:py-4 fc:px-5 fc:text-slate-900 fc:text-[14px] fc:font-medium fc:whitespace-nowrap", children: /* @__PURE__ */ jsx84("span", { className: `fc:px-2 fc:py-0.5 fc:rounded fc:text-xs fc:font-medium${item.assignmentType === "Hierarchy" ? "bg-indigo-50 text-indigo-700 border border-indigo-100" : "bg-amber-50 text-amber-700 border border-amber-100"}`, children: item.assignmentType }) }),
12573
- /* @__PURE__ */ jsx84("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:font-medium fc:whitespace-nowrap", children: item.hierarchyNodeType }),
12574
- /* @__PURE__ */ jsx84("td", { className: "fc:py-4 fc:px-5 fc:text-slate-800 fc:font-medium fc:text-center fc:whitespace-nowrap", children: item.dynamicFunctionId === "N/A" ? /* @__PURE__ */ jsx84("span", { className: "fc:text-slate-400 fc:font-normal", children: "N/A" }) : /* @__PURE__ */ jsxs83("span", { className: "fc:bg-slate-100 fc:text-slate-700 fc:px-2 fc:py-0.5 fc:rounded fc:text-xs", children: [
12575
- "FN-",
12576
- item.dynamicFunctionId
12577
- ] }) }),
12578
- /* @__PURE__ */ jsx84("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx84(
12579
- "button",
12580
- {
12581
- type: "button",
12582
- onClick: () => toggleStatus(item.id),
12583
- className: `fc:relative fc:inline-flex fc:h-5.5 fc:w-10 fc:shrink-0 fc:cursor-pointer fc:rounded-full fc:border-2 fc:border-transparent fc:transition-colors fc:duration-200 fc:ease-in-out fc:outline-none ${item.isPoolEnabled ? "fc:bg-blue-600" : "fc:bg-gray-300"}`,
12584
- children: /* @__PURE__ */ jsx84(
12585
- "span",
12586
- {
12587
- className: `fc:pointer-events-none fc:inline-block fc:h-4.5 fc:w-4.5 fc:transform fc:rounded-full fc:bg-white fc:shadow fc:ring-0 fc:transition fc:duration-200 fc:ease-in-out ${item.isPoolEnabled ? "fc:translate-x-4.5" : "fc:translate-x-0"}`
12588
- }
12589
- )
12590
- }
12591
- ) }),
12592
- /* @__PURE__ */ jsx84("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsxs83("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
12593
- /* @__PURE__ */ jsx84("button", { type: "button", onClick: () => handleEdit(item), className: "fc:px-3.5 fc:py-1 fc:text-xs fc:font-bold fc:text-blue-600 fc:bg-blue-50 hover:fc:fc:bg-blue-100 fc:rounded-full fc:transition-colors", children: "Edit" }),
12594
- /* @__PURE__ */ jsx84("button", { type: "button", onClick: () => handleDelete(item), className: "fc:px-3.5 fc:py-1 fc:text-xs fc:font-bold fc:text-rose-600 fc:bg-rose-50 hover:fc:fc:bg-rose-100 fc:rounded-full fc:transition-colors", children: "Delete" })
12595
- ] }) })
12596
- ] }, item.id)),
12597
- visibleData.length === 0 && /* @__PURE__ */ jsx84("tr", { children: /* @__PURE__ */ jsx84("td", { colSpan: "6", className: "fc:py-8 fc:text-center fc:text-slate-400 fc:text-xs fc:font-medium fc:bg-slate-50/30", children: "No matching assignment rules found." }) })
12598
- ] })
12599
- ] }) }),
12600
- /* @__PURE__ */ jsxs83("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
12601
- /* @__PURE__ */ jsx84("button", { onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)), disabled: currentPage === 1, className: "fc:px-2.5 fc:py-1 fc:text-slate-500 hover:fc:fc:text-slate-900 fc:mr-2 disabled:fc:fc:opacity-40", children: "\u2039 Prev" }),
12602
- pageNumbers.map((pageNumber) => /* @__PURE__ */ jsx84("button", { onClick: () => setCurrentPage(pageNumber), className: `fc:px-3 fc:py-1 fc:text-center fc:rounded fc:transition-all fc:min-w-[28px]${currentPage === pageNumber ? "bg-blue-600 text-white font-medium shadow-sm" : "text-slate-600 hover:bg-slate-100"}`, children: pageNumber }, pageNumber)),
12603
- /* @__PURE__ */ jsx84("button", { onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)), disabled: currentPage === totalPages, className: "fc:px-2.5 fc:py-1 fc:text-slate-500 hover:fc:fc:text-slate-900 fc:ml-2 disabled:fc:fc:opacity-40", children: "Next \u203A" })
12604
- ] }),
12605
- isEditModalOpen && selectedItem && /* @__PURE__ */ jsx84("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/40 fc:backdrop-blur-sm", children: /* @__PURE__ */ jsxs83("div", { className: "fc:bg-white fc:rounded-2xl fc:p-6 fc:w-full fc:max-w-md fc:shadow-2xl fc:transition-all", children: [
12606
- /* @__PURE__ */ jsx84("h3", { className: "fc:text-lg fc:font-bold fc:text-slate-800 fc:mb-4", children: "Edit Workflow Step" }),
12607
- /* @__PURE__ */ jsxs83("form", { onSubmit: handleSaveEdit, className: "fc:space-y-4", children: [
12608
- /* @__PURE__ */ jsxs83("div", { children: [
12609
- /* @__PURE__ */ jsx84("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Workflow Step ID" }),
12610
- /* @__PURE__ */ jsx84("input", { type: "text", value: selectedItem.workflowStepId || `STEP-${selectedItem.id}`, disabled: true, className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:bg-slate-100 fc:font-medium fc:text-slate-500 fc:cursor-not-allowed" })
12611
- ] }),
12612
- /* @__PURE__ */ jsxs83("div", { children: [
12613
- /* @__PURE__ */ jsx84("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Assignment Type" }),
12614
- /* @__PURE__ */ jsxs83("select", { name: "assignmentType", defaultValue: selectedItem.assignmentType || "Hierarchy", className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:outline-none focus:fc:fc:border-blue-500 fc:bg-white fc:font-medium fc:text-slate-700", children: [
12615
- /* @__PURE__ */ jsx84("option", { value: "Hierarchy", children: "Hierarchy" }),
12616
- /* @__PURE__ */ jsx84("option", { value: "Dynamic", children: "Dynamic" })
12617
- ] })
12618
- ] }),
12619
- /* @__PURE__ */ jsxs83("div", { children: [
12620
- /* @__PURE__ */ jsx84("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Node Type" }),
12621
- /* @__PURE__ */ jsxs83("select", { name: "nodeType", defaultValue: selectedItem.nodeType || "Block", className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:outline-none focus:fc:fc:border-blue-500 fc:bg-white fc:font-medium fc:text-slate-700", children: [
12622
- /* @__PURE__ */ jsx84("option", { value: "Block", children: "Block" }),
12623
- /* @__PURE__ */ jsx84("option", { value: "District", children: "District" }),
12624
- /* @__PURE__ */ jsx84("option", { value: "State", children: "State" })
12625
- ] })
12626
- ] }),
12627
- /* @__PURE__ */ jsxs83("div", { children: [
12628
- /* @__PURE__ */ jsx84("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Dynamic Function ID" }),
12629
- /* @__PURE__ */ jsx84("input", { type: "text", name: "dynamicFunctionId", defaultValue: selectedItem.dynamicFunctionId || "N/A", placeholder: "e.g. FN-1 or N/A", required: true, className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:outline-none focus:fc:fc:border-blue-500 fc:font-medium fc:text-slate-700" })
12630
- ] }),
12631
- /* @__PURE__ */ jsxs83("div", { className: "fc:flex fc:justify-end fc:gap-3 fc:mt-6", children: [
12632
- /* @__PURE__ */ jsx84("button", { type: "button", onClick: () => setIsEditModalOpen(false), className: "fc:px-4 fc:py-2 fc:text-xs fc:font-medium fc:text-slate-600 hover:fc:fc:bg-slate-100 fc:rounded-lg fc:transition", children: "Cancel" }),
12633
- /* @__PURE__ */ jsx84("button", { type: "submit", className: "fc:px-4 fc:py-2 fc:text-xs fc:font-medium fc:text-white fc:bg-blue-600 hover:fc:fc:bg-blue-700 fc:rounded-lg fc:transition fc:shadow-sm", children: "Save Changes" })
12479
+ /* @__PURE__ */ jsx84("tbody", { children: loading ? /* @__PURE__ */ jsx84("tr", { children: /* @__PURE__ */ jsx84("td", { colSpan: "6", className: "fc:p-8 fc:text-center fc:text-sm fc:text-slate-500", children: "Loading assignment rules..." }) }) : visibleRows.length === 0 ? /* @__PURE__ */ jsx84("tr", { children: /* @__PURE__ */ jsx84("td", { colSpan: "6", className: "fc:p-8 fc:text-center fc:text-sm fc:text-slate-400", children: "No assignment rules found." }) }) : visibleRows.map((item, index) => /* @__PURE__ */ jsxs83("tr", { className: "fc:border-t fc:border-slate-100", children: [
12480
+ /* @__PURE__ */ jsx84("td", { className: "fc:px-4 fc:py-4 fc:text-center fc:text-sm", children: (currentPage - 1) * pageSize + index + 1 }),
12481
+ /* @__PURE__ */ jsx84("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.workflowStepId }),
12482
+ /* @__PURE__ */ jsx84("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.assignmentType }),
12483
+ /* @__PURE__ */ jsx84("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.hierarchyNodeType }),
12484
+ /* @__PURE__ */ jsx84("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.isPoolEnabled ? "Yes" : "No" }),
12485
+ /* @__PURE__ */ jsxs83("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: [
12486
+ /* @__PURE__ */ jsx84("button", { type: "button", onClick: () => onEdit(item), className: "fc:mr-2 fc:rounded-lg fc:bg-blue-50 fc:px-3 fc:py-1 fc:text-blue-600", children: "Edit" }),
12487
+ /* @__PURE__ */ jsx84("button", { type: "button", onClick: () => onDelete(item), className: "fc:rounded-lg fc:bg-rose-50 fc:px-3 fc:py-1 fc:text-rose-600", children: "Delete" })
12634
12488
  ] })
12635
- ] })
12489
+ ] }, item.assignmentRuleId)) })
12636
12490
  ] }) }),
12637
- isDeleteModalOpen && selectedItem && /* @__PURE__ */ jsx84("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/40 fc:backdrop-blur-sm", children: /* @__PURE__ */ jsxs83("div", { className: "fc:bg-white fc:rounded-2xl fc:p-6 fc:w-full fc:max-w-sm fc:shadow-2xl fc:text-center", children: [
12638
- /* @__PURE__ */ jsx84("div", { className: "fc:w-12 fc:h-12 fc:bg-rose-100 fc:text-rose-600 fc:rounded-full fc:flex fc:items-center fc:justify-center fc:mx-auto fc:mb-3 fc:text-xl fc:font-bold", children: "!" }),
12639
- /* @__PURE__ */ jsx84("h3", { className: "fc:text-lg fc:font-bold fc:text-slate-800", children: "Delete Workflow Step?" }),
12640
- /* @__PURE__ */ jsxs83("p", { className: "fc:text-xs fc:text-slate-500 fc:mt-2", children: [
12641
- "Are you sure you want to delete the workflow step ",
12642
- /* @__PURE__ */ jsx84("span", { className: "fc:font-bold fc:text-slate-700", children: selectedItem.workflowStepId || `STEP-${selectedItem.id}` }),
12643
- "?"
12491
+ /* @__PURE__ */ jsxs83("div", { className: "fc:flex fc:justify-end fc:gap-2 fc:text-sm", children: [
12492
+ /* @__PURE__ */ jsx84("button", { type: "button", disabled: currentPage === 1, onClick: () => setCurrentPage((page) => Math.max(1, page - 1)), className: "fc:px-3 fc:py-1 disabled:fc:opacity-40", children: "Prev" }),
12493
+ /* @__PURE__ */ jsxs83("span", { className: "fc:px-2 fc:py-1", children: [
12494
+ currentPage,
12495
+ " / ",
12496
+ totalPages
12644
12497
  ] }),
12645
- /* @__PURE__ */ jsxs83("div", { className: "fc:flex fc:justify-center fc:gap-3 fc:mt-6", children: [
12646
- /* @__PURE__ */ jsx84("button", { type: "button", onClick: () => setIsDeleteModalOpen(false), className: "fc:px-4 fc:py-2 fc:text-xs fc:font-semibold fc:text-slate-600 hover:fc:fc:bg-slate-100 fc:rounded-lg fc:transition", children: "Cancel" }),
12647
- /* @__PURE__ */ jsx84("button", { type: "button", onClick: confirmDelete, className: "fc:px-4 fc:py-2 fc:text-xs fc:font-semibold fc:text-white fc:bg-rose-600 hover:fc:fc:bg-rose-700 fc:rounded-lg fc:transition fc:shadow-sm", children: "Delete" })
12648
- ] })
12649
- ] }) })
12498
+ /* @__PURE__ */ jsx84("button", { type: "button", disabled: currentPage === totalPages, onClick: () => setCurrentPage((page) => Math.min(totalPages, page + 1)), className: "fc:px-3 fc:py-1 disabled:fc:opacity-40", children: "Next" })
12499
+ ] })
12650
12500
  ] });
12651
12501
  }
12652
12502
 
12653
12503
  // src/components/assignment-rule/Popup.js
12654
- import React85, { useState as useState59 } from "react";
12504
+ import React85, { useEffect as useEffect38, useState as useState59 } from "react";
12655
12505
  import { jsx as jsx85, jsxs as jsxs84 } from "react/jsx-runtime";
12656
- function Popup4({
12657
- isOpen,
12658
- onClose,
12659
- onSave
12660
- }) {
12506
+ var rowsFrom2 = (response) => {
12507
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12508
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
12509
+ const rows = Array.isArray(value) ? value : (_i = (_h = (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : value == null ? void 0 : value.data) != null ? _h : value == null ? void 0 : value.result) != null ? _i : [];
12510
+ return Array.isArray(rows) ? rows : [];
12511
+ };
12512
+ var formFrom = (item) => {
12513
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12514
+ return {
12515
+ workflowStepId: String((_b = (_a = item == null ? void 0 : item.workflowStepId) != null ? _a : item == null ? void 0 : item.WorkflowStepId) != null ? _b : ""),
12516
+ assignmentType: (_d = (_c = item == null ? void 0 : item.assignmentType) != null ? _c : item == null ? void 0 : item.AssignmentType) != null ? _d : "",
12517
+ hierarchyNodeType: (_f = (_e = item == null ? void 0 : item.hierarchyNodeType) != null ? _e : item == null ? void 0 : item.HierarchyNodeType) != null ? _f : "",
12518
+ isPoolEnabled: Boolean((_h = (_g = item == null ? void 0 : item.isPoolEnabled) != null ? _g : item == null ? void 0 : item.IsPoolEnabled) != null ? _h : false)
12519
+ };
12520
+ };
12521
+ function Popup4({ isOpen, onClose, onSave, editData }) {
12522
+ const [formData, setFormData] = useState59(() => formFrom(editData));
12523
+ const [workflowSteps, setWorkflowSteps] = useState59([]);
12524
+ const [loadingSteps, setLoadingSteps] = useState59(false);
12525
+ const [error, setError] = useState59("");
12526
+ const [saving, setSaving] = useState59(false);
12527
+ useEffect38(() => {
12528
+ if (!isOpen) return;
12529
+ setFormData(formFrom(editData));
12530
+ setError("");
12531
+ let active = true;
12532
+ (async () => {
12533
+ var _a, _b, _c, _d, _e;
12534
+ try {
12535
+ setLoadingSteps(true);
12536
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
12537
+ if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
12538
+ const result = await getApiService().get(endpoint2);
12539
+ if (active) setWorkflowSteps(rowsFrom2(result));
12540
+ } catch (requestError) {
12541
+ if (active) setError(((_e = (_d = requestError == null ? void 0 : requestError.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (requestError == null ? void 0 : requestError.message) || "Unable to load workflow steps.");
12542
+ } finally {
12543
+ if (active) setLoadingSteps(false);
12544
+ }
12545
+ })();
12546
+ return () => {
12547
+ active = false;
12548
+ };
12549
+ }, [isOpen, editData]);
12661
12550
  if (!isOpen) return null;
12662
- const [workflowStepId, setWorkflowStepId] = useState59("");
12663
- const [assignmentType, setAssignmentType] = useState59("");
12664
- const [hierarchyNodeType, setHierarchyNodeType] = useState59("");
12665
- const [dynamicFunctionId, setDynamicFunctionId] = useState59("");
12666
- const [isPoolEnabled, setIsPoolEnabled] = useState59(false);
12667
- const handleSubmit = (e) => {
12668
- e.preventDefault();
12669
- if (!workflowStepId || !assignmentType || !hierarchyNodeType) {
12670
- alert("Please fill out all required fields!");
12551
+ const change = (field, value) => setFormData((current) => __spreadProps(__spreadValues({}, current), { [field]: value }));
12552
+ const submit = async (event) => {
12553
+ var _a, _b;
12554
+ event.preventDefault();
12555
+ if (!formData.workflowStepId || !formData.assignmentType || !formData.hierarchyNodeType) {
12556
+ setError("Please fill all required fields.");
12671
12557
  return;
12672
12558
  }
12673
- onSave({
12674
- workflowStepId,
12675
- assignmentType,
12676
- hierarchyNodeType,
12677
- dynamicFunctionId: dynamicFunctionId || "N/A",
12678
- isPoolEnabled
12679
- });
12680
- setWorkflowStepId("");
12681
- setAssignmentType("");
12682
- setHierarchyNodeType("");
12683
- setDynamicFunctionId("");
12684
- setIsPoolEnabled(false);
12685
- onClose();
12559
+ const isEdit = Boolean(editData);
12560
+ const payload = isEdit ? { assignmentRuleId: (_b = (_a = editData.assignmentRuleId) != null ? _a : editData.AssignmentRuleId) != null ? _b : editData.id, workflowStepId: Number(formData.workflowStepId), assignmentType: formData.assignmentType, hierarchyNodeType: formData.hierarchyNodeType, isPoolEnabled: Boolean(formData.isPoolEnabled) } : { workflowStepId: Number(formData.workflowStepId), assignmentType: formData.assignmentType, hierarchyNodeType: formData.hierarchyNodeType, isPoolEnabled: Boolean(formData.isPoolEnabled) };
12561
+ setSaving(true);
12562
+ try {
12563
+ if (await onSave(payload, isEdit)) onClose();
12564
+ } finally {
12565
+ setSaving(false);
12566
+ }
12686
12567
  };
12687
12568
  return /* @__PURE__ */ jsxs84("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
12688
- /* @__PURE__ */ jsx85("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity", onClick: onClose }),
12689
- /* @__PURE__ */ jsxs84("div", { className: "fc:relative fc:w-full fc:max-w-2xl fc:bg-white fc:rounded-3xl fc:shadow-2xl fc:flex fc:flex-col fc:z-10 fc:max-h-[90vh] fc:overflow-hidden", children: [
12690
- /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-8 fc:py-5 fc:border-b fc:border-slate-100", children: [
12691
- /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:items-center fc:gap-3", children: [
12692
- /* @__PURE__ */ jsx85("div", { className: "fc:w-10 fc:h-10 fc:bg-blue-50 fc:text-blue-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:text-lg", children: "\u2696\uFE0F" }),
12693
- /* @__PURE__ */ jsxs84("div", { children: [
12694
- /* @__PURE__ */ jsx85("h2", { className: "fc:text-lg fc:font-extrabold fc:text-slate-800", children: "Add Assignment Rule" }),
12695
- /* @__PURE__ */ jsx85("p", { className: "fc:text-[10px] fc:text-slate-400", children: "Configure core task routing constraints" })
12569
+ /* @__PURE__ */ jsx85("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
12570
+ /* @__PURE__ */ jsxs84("form", { onSubmit: submit, className: "fc:relative fc:z-10 fc:w-full fc:max-w-2xl fc:overflow-hidden fc:rounded-3xl fc:bg-white fc:shadow-2xl", children: [
12571
+ /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:items-center fc:justify-between fc:border-b fc:border-slate-100 fc:px-8 fc:py-5", children: [
12572
+ /* @__PURE__ */ jsxs84("div", { children: [
12573
+ /* @__PURE__ */ jsx85("h2", { className: "fc:text-lg fc:font-extrabold fc:text-slate-800", children: editData ? "Edit Assignment Rule" : "Add Assignment Rule" }),
12574
+ /* @__PURE__ */ jsx85("p", { className: "fc:text-[10px] fc:text-slate-400", children: "Configure core task routing constraints" })
12575
+ ] }),
12576
+ /* @__PURE__ */ jsx85("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 fc:text-sm fc:font-semibold", children: "\u2715" })
12577
+ ] }),
12578
+ /* @__PURE__ */ jsxs84("div", { className: "fc:space-y-4 fc:bg-slate-50/30 fc:p-6", children: [
12579
+ /* @__PURE__ */ jsxs84("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
12580
+ "Workflow Step ID *",
12581
+ /* @__PURE__ */ jsxs84("select", { required: true, disabled: loadingSteps, value: formData.workflowStepId, onChange: (event) => change("workflowStepId", event.target.value), className: "fc:mt-1 fc:w-full fc:rounded-xl fc:border fc:border-slate-200 fc:bg-white fc:p-2.5 fc:text-xs", children: [
12582
+ /* @__PURE__ */ jsx85("option", { value: "", children: loadingSteps ? "Loading workflow steps..." : "Select Workflow Step" }),
12583
+ workflowSteps.map((step) => {
12584
+ var _a, _b, _c, _d, _e, _f;
12585
+ const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
12586
+ const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.stepCode) != null ? _e : step.StepCode) != null ? _f : `Step ${id}`;
12587
+ return /* @__PURE__ */ jsxs84("option", { value: String(id), children: [
12588
+ id,
12589
+ " - ",
12590
+ name
12591
+ ] }, id);
12592
+ })
12696
12593
  ] })
12697
12594
  ] }),
12698
- /* @__PURE__ */ jsx85("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 hover:fc:fc:text-slate-600 fc:font-semibold fc:text-sm", children: "\u2715" })
12699
- ] }),
12700
- /* @__PURE__ */ jsxs84("form", { onSubmit: handleSubmit, className: "fc:flex fc:flex-col fc:overflow-hidden", children: [
12701
- /* @__PURE__ */ jsxs84("div", { className: "fc:p-6 fc:space-y-4 fc:overflow-y-auto fc:bg-slate-50/30", children: [
12702
- /* @__PURE__ */ jsxs84("div", { children: [
12703
- /* @__PURE__ */ jsx85("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Workflow Step ID *" }),
12704
- /* @__PURE__ */ jsx85("input", { type: "text", placeholder: "e.g., STEP-1", value: workflowStepId, onChange: (e) => setWorkflowStepId(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:placeholder-slate-400 focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500" })
12705
- ] }),
12706
- /* @__PURE__ */ jsxs84("div", { children: [
12707
- /* @__PURE__ */ jsx85("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Assignment Type *" }),
12708
- /* @__PURE__ */ jsxs84("select", { value: assignmentType, onChange: (e) => setAssignmentType(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:bg-white fc:text-slate-700 focus:fc:fc:border-blue-500", children: [
12709
- /* @__PURE__ */ jsx85("option", { value: "", children: "Select Assignment Engine Type" }),
12710
- /* @__PURE__ */ jsx85("option", { value: "Hierarchy", children: "Hierarchy" }),
12711
- /* @__PURE__ */ jsx85("option", { value: "Dynamic", children: "Dynamic" })
12712
- ] })
12713
- ] }),
12714
- /* @__PURE__ */ jsxs84("div", { children: [
12715
- /* @__PURE__ */ jsx85("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Hierarchy Node Type *" }),
12716
- /* @__PURE__ */ jsxs84("select", { value: hierarchyNodeType, onChange: (e) => setHierarchyNodeType(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:bg-white fc:text-slate-700 focus:fc:fc:border-blue-500", children: [
12717
- /* @__PURE__ */ jsx85("option", { value: "", children: "Select Node Level" }),
12718
- /* @__PURE__ */ jsx85("option", { value: "Block", children: "Block" }),
12719
- /* @__PURE__ */ jsx85("option", { value: "District", children: "District" })
12720
- ] })
12721
- ] }),
12722
- /* @__PURE__ */ jsxs84("div", { children: [
12723
- /* @__PURE__ */ jsx85("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Dynamic Function ID" }),
12724
- /* @__PURE__ */ jsx85("input", { type: "text", placeholder: "e.g., 1, 2", value: dynamicFunctionId, onChange: (e) => setDynamicFunctionId(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:placeholder-slate-400 focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500" })
12725
- ] }),
12726
- /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:items-center fc:gap-2 fc:pt-1", children: [
12727
- /* @__PURE__ */ jsx85("input", { type: "checkbox", id: "isPoolEnabled", checked: isPoolEnabled, onChange: (e) => setIsPoolEnabled(e.target.checked), className: "fc:w-4 fc:h-4 fc:text-blue-600 fc:border-slate-300 fc:rounded focus:fc:fc:ring-blue-500" }),
12728
- /* @__PURE__ */ jsx85("label", { htmlFor: "isPoolEnabled", className: "fc:text-xs fc:font-bold fc:text-slate-700 fc:select-none fc:cursor-pointer", children: "Enable Task Pooling" })
12595
+ /* @__PURE__ */ jsxs84("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
12596
+ "Assignment Type *",
12597
+ /* @__PURE__ */ jsxs84("select", { required: true, value: formData.assignmentType, onChange: (event) => change("assignmentType", event.target.value), className: "fc:mt-1 fc:w-full fc:rounded-xl fc:border fc:border-slate-200 fc:bg-white fc:p-2.5 fc:text-xs", children: [
12598
+ /* @__PURE__ */ jsx85("option", { value: "", children: "Select Assignment Engine Type" }),
12599
+ /* @__PURE__ */ jsx85("option", { value: "Hierarchy", children: "Hierarchy" }),
12600
+ /* @__PURE__ */ jsx85("option", { value: "Dynamic", children: "Dynamic" })
12729
12601
  ] })
12730
12602
  ] }),
12731
- /* @__PURE__ */ jsxs84("div", { className: "fc:p-4 fc:bg-white fc:border-t fc:border-slate-100 fc:flex fc:items-center fc:justify-end fc:gap-2.5 fc:px-6", children: [
12732
- /* @__PURE__ */ jsx85("button", { type: "button", onClick: onClose, className: "fc:px-4 fc:py-2 fc:border fc:border-slate-200 fc:text-slate-600 fc:text-xs fc:font-bold fc:rounded-xl hover:fc:fc:bg-slate-50", children: "Cancel" }),
12733
- /* @__PURE__ */ jsx85("button", { type: "submit", className: "fc:px-5 fc:py-2 fc:bg-blue-600 hover:fc:fc:bg-blue-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-blue-500/10", children: "Save Rule" })
12734
- ] })
12603
+ /* @__PURE__ */ jsxs84("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
12604
+ "Hierarchy Node Type *",
12605
+ /* @__PURE__ */ jsxs84("select", { required: true, value: formData.hierarchyNodeType, onChange: (event) => change("hierarchyNodeType", event.target.value), className: "fc:mt-1 fc:w-full fc:rounded-xl fc:border fc:border-slate-200 fc:bg-white fc:p-2.5 fc:text-xs", children: [
12606
+ /* @__PURE__ */ jsx85("option", { value: "", children: "Select Node Level" }),
12607
+ /* @__PURE__ */ jsx85("option", { value: "Block", children: "Block" }),
12608
+ /* @__PURE__ */ jsx85("option", { value: "District", children: "District" }),
12609
+ /* @__PURE__ */ jsx85("option", { value: "State", children: "State" })
12610
+ ] })
12611
+ ] }),
12612
+ /* @__PURE__ */ jsxs84("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-slate-700", children: [
12613
+ /* @__PURE__ */ jsx85("input", { type: "checkbox", checked: formData.isPoolEnabled, onChange: (event) => change("isPoolEnabled", event.target.checked), className: "fc:h-4 fc:w-4" }),
12614
+ "Enable Task Pooling"
12615
+ ] }),
12616
+ error && /* @__PURE__ */ jsx85("p", { className: "fc:text-xs fc:text-red-500", children: error })
12617
+ ] }),
12618
+ /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:justify-end fc:gap-2.5 fc:border-t fc:border-slate-100 fc:bg-white fc:px-6 fc:py-4", children: [
12619
+ /* @__PURE__ */ jsx85("button", { type: "button", onClick: onClose, className: "fc:rounded-xl fc:border fc:border-slate-200 fc:px-4 fc:py-2 fc:text-xs", children: "Cancel" }),
12620
+ /* @__PURE__ */ jsx85("button", { disabled: saving || loadingSteps, type: "submit", className: "fc:rounded-xl fc:bg-blue-600 fc:px-5 fc:py-2 fc:text-xs fc:font-bold fc:text-white", children: saving ? "Saving..." : editData ? "Update Rule" : "Save Rule" })
12735
12621
  ] })
12736
12622
  ] })
12737
12623
  ] });
@@ -12739,77 +12625,148 @@ function Popup4({
12739
12625
 
12740
12626
  // src/components/assignment-rule/AssignmentRuleMain.jsx
12741
12627
  import { jsx as jsx86, jsxs as jsxs85 } from "react/jsx-runtime";
12628
+ var getRows4 = (response) => {
12629
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12630
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
12631
+ const rows = Array.isArray(value) ? value : (_i = (_h = (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : value == null ? void 0 : value.data) != null ? _h : value == null ? void 0 : value.result) != null ? _i : [];
12632
+ return Array.isArray(rows) ? rows : [];
12633
+ };
12634
+ var endpoint = (action) => {
12635
+ var _a, _b, _c, _d, _e;
12636
+ const assignmentRule = (_e = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.assignmentRule) != null ? _e : (_d = (_c = getApiEndpoints()) == null ? void 0 : _c.flowCore) == null ? void 0 : _d.AssignmentRule;
12637
+ const value = assignmentRule == null ? void 0 : assignmentRule[action];
12638
+ if (!value) throw new Error(`Assignment Rule ${action} endpoint is not configured.`);
12639
+ return value;
12640
+ };
12641
+ var byId = (id) => {
12642
+ const value = endpoint("getById");
12643
+ return typeof value === "function" ? value(id) : `${value}/${id}`;
12644
+ };
12645
+ var normalise4 = (item) => {
12646
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12647
+ return __spreadProps(__spreadValues({}, item), { assignmentRuleId: (_b = (_a = item.assignmentRuleId) != null ? _a : item.AssignmentRuleId) != null ? _b : item.id, workflowStepId: (_d = (_c = item.workflowStepId) != null ? _c : item.WorkflowStepId) != null ? _d : "", assignmentType: (_f = (_e = item.assignmentType) != null ? _e : item.AssignmentType) != null ? _f : "", hierarchyNodeType: (_h = (_g = item.hierarchyNodeType) != null ? _g : item.HierarchyNodeType) != null ? _h : "", isPoolEnabled: Boolean((_j = (_i = item.isPoolEnabled) != null ? _i : item.IsPoolEnabled) != null ? _j : false) });
12648
+ };
12742
12649
  function AssignmentRuleMain() {
12743
- const [refreshkey, setRefreshKey] = useState60(0);
12744
- const handleRefresh = () => {
12745
- console.log("Table data refreshed!");
12746
- setRefreshKey((prev) => prev + 1);
12747
- };
12748
12650
  const tableRef = useRef20(null);
12749
- const [showModal, setShowModal] = useState60(false);
12651
+ const [rows, setRows] = useState60([]);
12652
+ const [modalOpen, setModalOpen] = useState60(false);
12653
+ const [editingRule, setEditingRule] = useState60(null);
12750
12654
  const [pageSize, setPageSize] = useState60(10);
12751
12655
  const [searchQuery, setSearchQuery] = useState60("");
12752
12656
  const [currentPage, setCurrentPage] = useState60(1);
12753
12657
  const [totalEntries, setTotalEntries] = useState60(0);
12754
- const handlePageSizeChange = (e) => {
12755
- setPageSize(Number(e.target.value));
12756
- setCurrentPage(1);
12658
+ const [loading, setLoading] = useState60(true);
12659
+ const [refreshKey, setRefreshKey] = useState60(0);
12660
+ const refresh = () => setRefreshKey((value) => value + 1);
12661
+ useEffect39(() => {
12662
+ let active = true;
12663
+ const load = async () => {
12664
+ var _a, _b;
12665
+ setLoading(true);
12666
+ try {
12667
+ const response = await getApiService().get(endpoint("getList"));
12668
+ if (active) setRows(getRows4(response).map(normalise4));
12669
+ } catch (error) {
12670
+ if (active) await Swal19.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load assignment rules.", "error");
12671
+ } finally {
12672
+ if (active) setLoading(false);
12673
+ }
12674
+ };
12675
+ load();
12676
+ return () => {
12677
+ active = false;
12678
+ };
12679
+ }, [refreshKey]);
12680
+ const save = async (payload, isEdit) => {
12681
+ var _a, _b;
12682
+ try {
12683
+ await getApiService()[isEdit ? "put" : "post"](endpoint(isEdit ? "update" : "create"), payload);
12684
+ await Swal19.fire("Success", `Assignment rule ${isEdit ? "updated" : "created"} successfully.`, "success");
12685
+ refresh();
12686
+ return true;
12687
+ } catch (error) {
12688
+ await Swal19.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} assignment rule.`, "error");
12689
+ return false;
12690
+ }
12757
12691
  };
12758
- return (
12759
- // <div className="min-h-screen bg-slate-50 p-4 md:p-6">
12760
- /* @__PURE__ */ jsxs85("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
12761
- /* @__PURE__ */ jsxs85("div", { className: "fc:w-full fc:space-y-5", children: [
12762
- /* @__PURE__ */ jsx86(CommonHeader, { title: "Assignment Rule", breadcrumbs: [{
12763
- label: "Dashboard",
12764
- href: "/dashboard"
12765
- }, {
12766
- label: "Masters",
12767
- href: "/masters"
12768
- }, {
12769
- label: "Permissions",
12770
- href: "/permissions"
12771
- }, {
12772
- label: "AssignmentRule",
12773
- href: "/assignment-rule"
12774
- }], buttonText: "Add Assignment Rule", onButtonClick: () => setShowModal(true) }),
12775
- /* @__PURE__ */ jsxs85("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:shadow-sm fc:space-y-5", children: [
12776
- /* @__PURE__ */ jsxs85("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
12777
- /* @__PURE__ */ jsx86("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ jsx86(SearchBar12, { searchQuery, setSearchQuery, setCurrentPage }) }),
12778
- /* @__PURE__ */ jsxs85("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
12779
- /* @__PURE__ */ jsx86(Refresh_default, { onRefresh: handleRefresh }),
12780
- /* @__PURE__ */ jsx86(Download_default, { targetRef: tableRef, fileName: "document-configuration" }),
12781
- /* @__PURE__ */ jsxs85("select", { value: pageSize, onChange: handlePageSizeChange, className: "fc:border fc:border-slate-200 fc:rounded-lg fc:px-3 fc:py-2 fc:text-sm fc:bg-white fc:cursor-pointer fc:outline-none fc:shadow-sm fc:text-slate-700", children: [
12782
- /* @__PURE__ */ jsx86("option", { value: 5, children: "5 Rows" }),
12783
- /* @__PURE__ */ jsx86("option", { value: 10, children: "10 Rows" }),
12784
- /* @__PURE__ */ jsx86("option", { value: 20, children: "20 Rows" }),
12785
- /* @__PURE__ */ jsx86("option", { value: 25, children: "25 Rows" })
12786
- ] })
12692
+ const edit = async (item) => {
12693
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12694
+ try {
12695
+ const response = await getApiService().get(byId(item.assignmentRuleId));
12696
+ const data = (_f = (_e = (_d = (_b = getRows4(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
12697
+ setEditingRule(normalise4(data));
12698
+ setModalOpen(true);
12699
+ } catch (error) {
12700
+ await Swal19.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load assignment rule details.", "error");
12701
+ }
12702
+ };
12703
+ const remove = async (item) => {
12704
+ var _a, _b;
12705
+ const confirmation = await Swal19.fire({ title: "Delete Assignment Rule?", text: "This rule will be marked inactive.", icon: "warning", showCancelButton: true, confirmButtonText: "Yes, Delete", confirmButtonColor: "#e11d48" });
12706
+ if (!confirmation.isConfirmed) return;
12707
+ try {
12708
+ await getApiService().put(endpoint("update"), { assignmentRuleId: item.assignmentRuleId, workflowStepId: Number(item.workflowStepId), assignmentType: item.assignmentType, hierarchyNodeType: item.hierarchyNodeType, isPoolEnabled: false });
12709
+ await Swal19.fire("Deleted", "Assignment rule deleted successfully.", "success");
12710
+ refresh();
12711
+ } catch (error) {
12712
+ await Swal19.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to delete assignment rule.", "error");
12713
+ }
12714
+ };
12715
+ const openCreate = () => {
12716
+ setEditingRule(null);
12717
+ setModalOpen(true);
12718
+ };
12719
+ return /* @__PURE__ */ jsxs85("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:p-6", children: [
12720
+ /* @__PURE__ */ jsxs85("div", { className: "fc:w-full fc:space-y-5", children: [
12721
+ /* @__PURE__ */ jsx86(CommonHeader, { title: "Assignment Rule", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Masters", href: "/masters" }, { label: "Permissions", href: "/permissions" }, { label: "AssignmentRule", href: "/assignment-rule" }], buttonText: "Add Assignment Rule", onButtonClick: openCreate }),
12722
+ /* @__PURE__ */ jsxs85("div", { className: "fc:space-y-5 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:bg-white fc:p-6", children: [
12723
+ /* @__PURE__ */ jsxs85("div", { className: "fc:flex fc:w-full fc:items-center fc:justify-between fc:gap-4", children: [
12724
+ /* @__PURE__ */ jsx86("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ jsx86(SearchBar12, { searchQuery, setSearchQuery: (value) => {
12725
+ setSearchQuery(value);
12726
+ setCurrentPage(1);
12727
+ } }) }),
12728
+ /* @__PURE__ */ jsxs85("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
12729
+ /* @__PURE__ */ jsx86(Refresh_default, { onRefresh: refresh }),
12730
+ /* @__PURE__ */ jsx86(Download_default, { targetRef: tableRef, fileName: "assignment-rules" }),
12731
+ /* @__PURE__ */ jsxs85("select", { value: pageSize, onChange: (event) => {
12732
+ setPageSize(Number(event.target.value));
12733
+ setCurrentPage(1);
12734
+ }, className: "fc:rounded-lg fc:border fc:border-slate-200 fc:px-3 fc:py-2 fc:text-sm", children: [
12735
+ /* @__PURE__ */ jsx86("option", { value: 5, children: "5 Rows" }),
12736
+ /* @__PURE__ */ jsx86("option", { value: 10, children: "10 Rows" }),
12737
+ /* @__PURE__ */ jsx86("option", { value: 20, children: "20 Rows" }),
12738
+ /* @__PURE__ */ jsx86("option", { value: 25, children: "25 Rows" })
12787
12739
  ] })
12788
- ] }),
12789
- /* @__PURE__ */ jsx86("div", { ref: tableRef, children: /* @__PURE__ */ jsx86(Table4, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries }, refreshkey) })
12790
- ] })
12791
- ] }),
12792
- /* @__PURE__ */ jsx86(Popup4, { isOpen: showModal, onClose: () => setShowModal(false) })
12793
- ] })
12794
- );
12740
+ ] })
12741
+ ] }),
12742
+ /* @__PURE__ */ jsx86("div", { ref: tableRef, children: /* @__PURE__ */ jsx86(Table4, { rows, loading, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: edit, onDelete: remove }) })
12743
+ ] })
12744
+ ] }),
12745
+ /* @__PURE__ */ jsx86(Popup4, { isOpen: modalOpen, editData: editingRule, onClose: () => {
12746
+ setModalOpen(false);
12747
+ setEditingRule(null);
12748
+ }, onSave: save })
12749
+ ] });
12795
12750
  }
12796
12751
 
12797
12752
  // src/components/Workflow_Step_Hierarchy_Mapping/Workflow_Step_Hierarchy_Mapping_Main.jsx
12798
- import React87, { useEffect as useEffect36, useMemo as useMemo2, useRef as useRef21, useState as useState61 } from "react";
12799
- import Swal18 from "sweetalert2";
12753
+ import React87, { useEffect as useEffect40, useMemo as useMemo3, useRef as useRef21, useState as useState61 } from "react";
12754
+ import Swal20 from "sweetalert2";
12800
12755
  import { jsx as jsx87, jsxs as jsxs86 } from "react/jsx-runtime";
12801
- var emptyForm = { workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
12802
- var getRows3 = (result) => {
12756
+ var emptyForm = { workflowId: "", workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
12757
+ var getRows5 = (result) => {
12803
12758
  var _a, _b, _c, _d, _e, _f, _g;
12804
12759
  const value = (_e = (_d = (_c = (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data) != null ? _c : (_b = result == null ? void 0 : result.data) == null ? void 0 : _b.result) != null ? _d : result == null ? void 0 : result.data) != null ? _e : result;
12805
12760
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
12806
12761
  };
12807
12762
  function Workflow_Step_Hierarchy_Mapping_Main() {
12763
+ var _a, _b, _c, _d, _e, _f;
12808
12764
  const tableRef = useRef21(null);
12809
12765
  const [mappings, setMappings] = useState61([]);
12810
- const [workflowSteps, setWorkflowSteps] = useState61([]);
12766
+ const [workflows, setWorkflows] = useState61([]);
12811
12767
  const [hierarchyNodes, setHierarchyNodes] = useState61([]);
12812
12768
  const [isLoading, setIsLoading] = useState61(false);
12769
+ const [isLoadingLookups, setIsLoadingLookups] = useState61(false);
12813
12770
  const [refreshKey, setRefreshKey] = useState61(0);
12814
12771
  const [searchQuery, setSearchQuery] = useState61("");
12815
12772
  const [pageSize, setPageSize] = useState61(10);
@@ -12819,60 +12776,86 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12819
12776
  const [formData, setFormData] = useState61(emptyForm);
12820
12777
  const [isSaving, setIsSaving] = useState61(false);
12821
12778
  const mappingEndpoints = () => {
12822
- var _a;
12823
- const flowCore = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
12779
+ var _a2;
12780
+ const flowCore = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore;
12824
12781
  return (flowCore == null ? void 0 : flowCore.WorkflowStepHierarchyMapping) || (flowCore == null ? void 0 : flowCore.workflowStepHierarchyMapping) || (flowCore == null ? void 0 : flowCore.WorkflowStepHierarchyMappings) || (flowCore == null ? void 0 : flowCore.workflowStepHierarchyMappings) || (flowCore == null ? void 0 : flowCore.WorkflowStepUserMapping) || (flowCore == null ? void 0 : flowCore.workflowStepUserMapping);
12825
12782
  };
12826
- const workflowStepMap = useMemo2(
12783
+ const workflowMap = useMemo3(
12827
12784
  () => Object.fromEntries(
12828
- workflowSteps.map((step) => {
12829
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12830
- const id = (_d = (_c = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.workflowId) != null ? _c : step.WorkflowId) != null ? _d : step.id;
12831
- const name = (_k = (_j = (_i = (_h = (_g = (_f = (_e = step.stepName) != null ? _e : step.StepName) != null ? _f : step.workflowStepName) != null ? _g : step.WorkflowStepName) != null ? _h : step.workflowName) != null ? _i : step.WorkflowName) != null ? _j : step.name) != null ? _k : `Step ${id}`;
12785
+ workflows.map((wf) => {
12786
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
12787
+ const id = (_d2 = (_c2 = (_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id) != null ? _c2 : wf.workflowStepId) != null ? _d2 : wf.WorkflowStepId;
12788
+ const name = (_i = (_h = (_g = (_f2 = (_e2 = wf.workflowName) != null ? _e2 : wf.WorkflowName) != null ? _f2 : wf.name) != null ? _g : wf.stepName) != null ? _h : wf.StepName) != null ? _i : `Workflow ${id}`;
12832
12789
  return [id, name];
12833
12790
  })
12834
12791
  ),
12835
- [workflowSteps]
12792
+ [workflows]
12836
12793
  );
12837
- const hierarchyNodeMap = useMemo2(
12794
+ const hierarchyNodeMap = useMemo3(
12838
12795
  () => Object.fromEntries(
12839
12796
  hierarchyNodes.map((node) => {
12840
- var _a, _b, _c, _d, _e, _f;
12841
- const id = (_b = (_a = node.hierarchyNodeId) != null ? _a : node.HierarchyNodeId) != null ? _b : node.id;
12842
- const name = (_f = (_e = (_d = (_c = node.nodeName) != null ? _c : node.NodeName) != null ? _d : node.hierarchyNodeName) != null ? _e : node.HierarchyNodeName) != null ? _f : `Node ${id}`;
12797
+ var _a2, _b2, _c2, _d2, _e2, _f2;
12798
+ const id = (_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id;
12799
+ const name = (_f2 = (_e2 = (_d2 = (_c2 = node.nodeName) != null ? _c2 : node.NodeName) != null ? _d2 : node.hierarchyNodeName) != null ? _e2 : node.HierarchyNodeName) != null ? _f2 : `Node ${id}`;
12843
12800
  return [id, name];
12844
12801
  })
12845
12802
  ),
12846
12803
  [hierarchyNodes]
12847
12804
  );
12848
- useEffect36(() => {
12805
+ useEffect40(() => {
12806
+ if (!isModalOpen) return;
12807
+ const loadLookups = async () => {
12808
+ var _a2, _b2, _c2, _d2, _e2, _f2;
12809
+ setIsLoadingLookups(true);
12810
+ try {
12811
+ const flowCore = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore;
12812
+ const workflowEndpoint = ((_b2 = flowCore == null ? void 0 : flowCore.workflow) == null ? void 0 : _b2.getList) || ((_c2 = flowCore == null ? void 0 : flowCore.WorkFlow) == null ? void 0 : _c2.getList) || ((_d2 = flowCore == null ? void 0 : flowCore.workFlow) == null ? void 0 : _d2.getList);
12813
+ const nodeEndpoint = ((_e2 = flowCore == null ? void 0 : flowCore.hierarchyNode) == null ? void 0 : _e2.getList) || ((_f2 = flowCore == null ? void 0 : flowCore.HierarchyNode) == null ? void 0 : _f2.getList);
12814
+ const [workflowResult, hierarchyNodeResult] = await Promise.all([
12815
+ workflowEndpoint ? getApiService().get(workflowEndpoint).catch(async (err) => {
12816
+ var _a3;
12817
+ if (((_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.status) === 405) {
12818
+ return await getApiService().post(workflowEndpoint, {});
12819
+ }
12820
+ throw err;
12821
+ }) : Promise.resolve(null),
12822
+ nodeEndpoint ? getApiService().get(nodeEndpoint).catch(async (err) => {
12823
+ var _a3;
12824
+ if (((_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.status) === 405) {
12825
+ return await getApiService().post(nodeEndpoint, {});
12826
+ }
12827
+ throw err;
12828
+ }) : Promise.resolve(null)
12829
+ ]);
12830
+ setWorkflows(workflowResult ? getRows5(workflowResult) : []);
12831
+ setHierarchyNodes(
12832
+ hierarchyNodeResult ? getRows5(hierarchyNodeResult) : []
12833
+ );
12834
+ } catch (error) {
12835
+ console.error("Unable to load workflow or hierarchy node lookup options:", error);
12836
+ } finally {
12837
+ setIsLoadingLookups(false);
12838
+ }
12839
+ };
12840
+ loadLookups();
12841
+ }, [isModalOpen]);
12842
+ useEffect40(() => {
12849
12843
  const loadData = async () => {
12850
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12844
+ var _a2, _b2;
12851
12845
  setIsLoading(true);
12852
12846
  try {
12853
12847
  const endpoints = mappingEndpoints();
12854
12848
  const mappingEndpoint = (endpoints == null ? void 0 : endpoints.getList) || (endpoints == null ? void 0 : endpoints.GetList);
12855
- const flowCore = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
12856
12849
  if (!mappingEndpoint)
12857
12850
  throw new Error(
12858
12851
  "Workflow step hierarchy mapping list endpoint is not configured."
12859
12852
  );
12860
- const stepEndpoint = ((_b = flowCore == null ? void 0 : flowCore.workflowStep) == null ? void 0 : _b.getList) || ((_c = flowCore == null ? void 0 : flowCore.WorkFlowStep) == null ? void 0 : _c.getList) || ((_d = flowCore == null ? void 0 : flowCore.workFlowStep) == null ? void 0 : _d.getList) || ((_e = flowCore == null ? void 0 : flowCore.workflow) == null ? void 0 : _e.getList) || ((_f = flowCore == null ? void 0 : flowCore.Workflow) == null ? void 0 : _f.getList);
12861
- const nodeEndpoint = ((_g = flowCore == null ? void 0 : flowCore.hierarchyNode) == null ? void 0 : _g.getList) || ((_h = flowCore == null ? void 0 : flowCore.HierarchyNode) == null ? void 0 : _h.getList);
12862
- const [mappingResult, workflowStepResult, hierarchyNodeResult] = await Promise.all([
12863
- getApiService().get(mappingEndpoint),
12864
- stepEndpoint ? getApiService().get(stepEndpoint) : Promise.resolve(null),
12865
- nodeEndpoint ? getApiService().get(nodeEndpoint) : Promise.resolve(null)
12866
- ]);
12867
- setMappings(getRows3(mappingResult));
12868
- setWorkflowSteps(workflowStepResult ? getRows3(workflowStepResult) : []);
12869
- setHierarchyNodes(
12870
- hierarchyNodeResult ? getRows3(hierarchyNodeResult) : []
12871
- );
12853
+ const mappingResult = await getApiService().get(mappingEndpoint);
12854
+ setMappings(getRows5(mappingResult));
12872
12855
  } catch (error) {
12873
- await Swal18.fire(
12856
+ await Swal20.fire(
12874
12857
  "Error",
12875
- ((_j = (_i = error == null ? void 0 : error.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (error == null ? void 0 : error.message) || "Unable to load workflow step hierarchy mappings.",
12858
+ ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || (error == null ? void 0 : error.message) || "Unable to load workflow step hierarchy mappings.",
12876
12859
  "error"
12877
12860
  );
12878
12861
  } finally {
@@ -12882,51 +12865,55 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12882
12865
  loadData();
12883
12866
  }, [refreshKey]);
12884
12867
  const openModal = (mapping = null) => {
12885
- var _a, _b, _c, _d, _e, _f, _g, _h;
12868
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
12886
12869
  setEditingMapping(mapping);
12887
12870
  setFormData(
12888
12871
  mapping ? {
12872
+ workflowId: String(
12873
+ (_d2 = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId) != null ? _d2 : ""
12874
+ ),
12889
12875
  workflowStepId: String(
12890
- (_d = (_c = (_b = (_a = mapping.workflowStepId) != null ? _a : mapping.WorkflowStepId) != null ? _b : mapping.workflowId) != null ? _c : mapping.WorkflowId) != null ? _d : ""
12876
+ (_h = (_g = (_f2 = (_e2 = mapping.workflowStepId) != null ? _e2 : mapping.WorkflowStepId) != null ? _f2 : mapping.workflowId) != null ? _g : mapping.WorkflowId) != null ? _h : ""
12891
12877
  ),
12892
12878
  hierarchyNodeId: String(
12893
- (_f = (_e = mapping.hierarchyNodeId) != null ? _e : mapping.HierarchyNodeId) != null ? _f : ""
12879
+ (_j = (_i = mapping.hierarchyNodeId) != null ? _i : mapping.HierarchyNodeId) != null ? _j : ""
12894
12880
  ),
12895
- isActive: String((_h = (_g = mapping.isActive) != null ? _g : mapping.IsActive) != null ? _h : true)
12881
+ isActive: String((_l = (_k = mapping.isActive) != null ? _k : mapping.IsActive) != null ? _l : true)
12896
12882
  } : emptyForm
12897
12883
  );
12898
12884
  setIsModalOpen(true);
12899
12885
  };
12900
12886
  const handleSave = async (event) => {
12901
- var _a, _b, _c;
12887
+ var _a2, _b2, _c2;
12902
12888
  event.preventDefault();
12903
- if (!formData.workflowStepId || !formData.hierarchyNodeId)
12904
- return Swal18.fire(
12889
+ const selectedWorkflowId = formData.workflowId || formData.workflowStepId;
12890
+ if (!selectedWorkflowId || !formData.hierarchyNodeId)
12891
+ return Swal20.fire(
12905
12892
  "Required fields",
12906
- "Please select a workflow step and hierarchy node.",
12893
+ "Please select a workflow and hierarchy node.",
12907
12894
  "warning"
12908
12895
  );
12909
12896
  setIsSaving(true);
12910
12897
  try {
12911
12898
  const endpoints = mappingEndpoints();
12912
- const endpoint = editingMapping ? (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update) : (endpoints == null ? void 0 : endpoints.create) || (endpoints == null ? void 0 : endpoints.Create);
12913
- if (!endpoint)
12899
+ const endpoint2 = editingMapping ? (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update) : (endpoints == null ? void 0 : endpoints.create) || (endpoints == null ? void 0 : endpoints.Create);
12900
+ if (!endpoint2)
12914
12901
  throw new Error(
12915
12902
  `Workflow step hierarchy mapping ${editingMapping ? "update" : "create"} endpoint is not configured.`
12916
12903
  );
12917
- const idValue = Number(formData.workflowStepId);
12904
+ const idValue = Number(selectedWorkflowId);
12918
12905
  const nodeValue = Number(formData.hierarchyNodeId);
12919
12906
  const payload = __spreadValues({
12920
12907
  workflowId: idValue,
12921
12908
  workflowStepId: idValue,
12922
12909
  hierarchyNodeId: nodeValue,
12923
- isActive: formData.isActive === "true"
12910
+ isActive: formData.isActive === "true" || formData.isActive === true
12924
12911
  }, editingMapping ? {
12925
- workflowStepHierarchyMappingId: (_a = editingMapping.workflowStepHierarchyMappingId) != null ? _a : editingMapping.WorkflowStepHierarchyMappingId,
12912
+ workflowStepHierarchyMappingId: (_a2 = editingMapping.workflowStepHierarchyMappingId) != null ? _a2 : editingMapping.WorkflowStepHierarchyMappingId,
12926
12913
  updatedBy: "System"
12927
12914
  } : { createdBy: "System" });
12928
- await getApiService()[editingMapping ? "put" : "post"](endpoint, payload);
12929
- await Swal18.fire(
12915
+ await getApiService()[editingMapping ? "put" : "post"](endpoint2, payload);
12916
+ await Swal20.fire(
12930
12917
  "Success",
12931
12918
  `Workflow step hierarchy mapping ${editingMapping ? "updated" : "created"} successfully.`,
12932
12919
  "success"
@@ -12934,9 +12921,9 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12934
12921
  setIsModalOpen(false);
12935
12922
  setRefreshKey((previous) => previous + 1);
12936
12923
  } catch (error) {
12937
- await Swal18.fire(
12924
+ await Swal20.fire(
12938
12925
  "Error",
12939
- ((_c = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || (error == null ? void 0 : error.message) || "Unable to save workflow step hierarchy mapping.",
12926
+ ((_c2 = (_b2 = error == null ? void 0 : error.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (error == null ? void 0 : error.message) || "Unable to save workflow step hierarchy mapping.",
12940
12927
  "error"
12941
12928
  );
12942
12929
  } finally {
@@ -12944,8 +12931,8 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12944
12931
  }
12945
12932
  };
12946
12933
  const handleDelete = async (mapping) => {
12947
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12948
- const confirmation = await Swal18.fire({
12934
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
12935
+ const confirmation = await Swal20.fire({
12949
12936
  title: "Delete mapping?",
12950
12937
  text: "This mapping will be marked inactive.",
12951
12938
  icon: "warning",
@@ -12956,18 +12943,18 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12956
12943
  if (!confirmation.isConfirmed) return;
12957
12944
  try {
12958
12945
  const endpoints = mappingEndpoints();
12959
- const endpoint = (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update);
12960
- if (!endpoint)
12946
+ const endpoint2 = (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update);
12947
+ if (!endpoint2)
12961
12948
  throw new Error(
12962
12949
  "Workflow step hierarchy mapping update endpoint is not configured."
12963
12950
  );
12964
12951
  const stepId = Number(
12965
- (_d = (_c = (_b = (_a = mapping.workflowId) != null ? _a : mapping.WorkflowId) != null ? _b : mapping.workflowStepId) != null ? _c : mapping.WorkflowStepId) != null ? _d : 0
12952
+ (_d2 = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId) != null ? _d2 : 0
12966
12953
  );
12967
12954
  const nodeId = Number(
12968
- (_f = (_e = mapping.hierarchyNodeId) != null ? _e : mapping.HierarchyNodeId) != null ? _f : 0
12955
+ (_f2 = (_e2 = mapping.hierarchyNodeId) != null ? _e2 : mapping.HierarchyNodeId) != null ? _f2 : 0
12969
12956
  );
12970
- await getApiService().put(endpoint, {
12957
+ await getApiService().put(endpoint2, {
12971
12958
  workflowStepHierarchyMappingId: (_g = mapping.workflowStepHierarchyMappingId) != null ? _g : mapping.WorkflowStepHierarchyMappingId,
12972
12959
  workflowId: stepId,
12973
12960
  workflowStepId: stepId,
@@ -12975,14 +12962,14 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12975
12962
  isActive: false,
12976
12963
  updatedBy: "System"
12977
12964
  });
12978
- await Swal18.fire(
12965
+ await Swal20.fire(
12979
12966
  "Deleted",
12980
12967
  "Workflow step hierarchy mapping has been deactivated.",
12981
12968
  "success"
12982
12969
  );
12983
12970
  setRefreshKey((previous) => previous + 1);
12984
12971
  } catch (error) {
12985
- await Swal18.fire(
12972
+ await Swal20.fire(
12986
12973
  "Error",
12987
12974
  ((_i = (_h = error == null ? void 0 : error.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) || (error == null ? void 0 : error.message) || "Unable to delete workflow step hierarchy mapping.",
12988
12975
  "error"
@@ -12990,11 +12977,11 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12990
12977
  }
12991
12978
  };
12992
12979
  const filteredMappings = mappings.filter((mapping) => {
12993
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
12980
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o;
12994
12981
  const query = searchQuery.trim().toLowerCase();
12995
- const stepId = (_c = (_b = (_a = mapping.workflowStepId) != null ? _a : mapping.WorkflowStepId) != null ? _b : mapping.workflowId) != null ? _c : mapping.WorkflowId;
12996
- const nodeId = (_d = mapping.hierarchyNodeId) != null ? _d : mapping.HierarchyNodeId;
12997
- const stepName = (_j = (_i = (_h = (_g = (_f = (_e = mapping.workflowStepName) != null ? _e : mapping.WorkflowStepName) != null ? _f : mapping.workflowName) != null ? _g : mapping.WorkflowName) != null ? _h : mapping.stepName) != null ? _i : mapping.StepName) != null ? _j : workflowStepMap[stepId];
12982
+ const stepId = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId;
12983
+ const nodeId = (_d2 = mapping.hierarchyNodeId) != null ? _d2 : mapping.HierarchyNodeId;
12984
+ const stepName = (_j = (_i = (_h = (_g = (_f2 = (_e2 = mapping.workflowName) != null ? _e2 : mapping.WorkflowName) != null ? _f2 : mapping.workflowStepName) != null ? _g : mapping.WorkflowStepName) != null ? _h : mapping.stepName) != null ? _i : mapping.StepName) != null ? _j : workflowMap[stepId];
12998
12985
  const nodeName = (_n = (_m = (_l = (_k = mapping.hierarchyNodeName) != null ? _k : mapping.HierarchyNodeName) != null ? _l : mapping.nodeName) != null ? _m : mapping.NodeName) != null ? _n : hierarchyNodeMap[nodeId];
12999
12986
  return !query || [
13000
12987
  (_o = mapping.workflowStepHierarchyMappingId) != null ? _o : mapping.WorkflowStepHierarchyMappingId,
@@ -13078,8 +13065,8 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13078
13065
  /* @__PURE__ */ jsx87("thead", { children: /* @__PURE__ */ jsxs86("tr", { className: "fc:bg-slate-100 fc:text-slate-600", children: [
13079
13066
  /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "#" }),
13080
13067
  /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "Mapping ID" }),
13081
- /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "Workflow Step" }),
13082
- /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "Hierarchy Node" }),
13068
+ /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "Workflow Name" }),
13069
+ /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "Hierarchy Node Name" }),
13083
13070
  /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-left", children: "Active" }),
13084
13071
  /* @__PURE__ */ jsx87("th", { className: "fc:p-3 fc:text-center", children: "Actions" })
13085
13072
  ] }) }),
@@ -13098,11 +13085,11 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13098
13085
  children: "No workflow step hierarchy mappings found."
13099
13086
  }
13100
13087
  ) }) : visibleMappings.map((mapping, index) => {
13101
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
13102
- const stepId = (_c = (_b = (_a = mapping.workflowStepId) != null ? _a : mapping.WorkflowStepId) != null ? _b : mapping.workflowId) != null ? _c : mapping.WorkflowId;
13103
- const nodeId = (_d = mapping.hierarchyNodeId) != null ? _d : mapping.HierarchyNodeId;
13104
- const active = (_e = mapping.isActive) != null ? _e : mapping.IsActive;
13105
- const stepDisplayName = (_l = (_k = (_j = (_i = (_h = (_g = (_f = mapping.workflowStepName) != null ? _f : mapping.WorkflowStepName) != null ? _g : mapping.workflowName) != null ? _h : mapping.WorkflowName) != null ? _i : mapping.stepName) != null ? _j : mapping.StepName) != null ? _k : workflowStepMap[stepId]) != null ? _l : stepId ? `Step ${stepId}` : "-";
13088
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
13089
+ const stepId = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId;
13090
+ const nodeId = (_d2 = mapping.hierarchyNodeId) != null ? _d2 : mapping.HierarchyNodeId;
13091
+ const active = (_e2 = mapping.isActive) != null ? _e2 : mapping.IsActive;
13092
+ const stepDisplayName = (_l = (_k = (_j = (_i = (_h = (_g = (_f2 = mapping.workflowName) != null ? _f2 : mapping.WorkflowName) != null ? _g : mapping.workflowStepName) != null ? _h : mapping.WorkflowStepName) != null ? _i : mapping.stepName) != null ? _j : mapping.StepName) != null ? _k : workflowMap[stepId]) != null ? _l : stepId ? `Workflow ${stepId}` : "-";
13106
13093
  const nodeDisplayName = (_q = (_p = (_o = (_n = (_m = mapping.hierarchyNodeName) != null ? _m : mapping.HierarchyNodeName) != null ? _n : mapping.nodeName) != null ? _o : mapping.NodeName) != null ? _p : hierarchyNodeMap[nodeId]) != null ? _q : nodeId ? `Node ${nodeId}` : "-";
13107
13094
  return /* @__PURE__ */ jsxs86(
13108
13095
  "tr",
@@ -13194,26 +13181,31 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13194
13181
  /* @__PURE__ */ jsx87("button", { type: "button", onClick: () => setIsModalOpen(false), children: "\xD7" })
13195
13182
  ] }),
13196
13183
  /* @__PURE__ */ jsxs86("div", { children: [
13197
- /* @__PURE__ */ jsx87("label", { className: "fc:block fc:mb-1.5 fc:text-sm fc:font-semibold", children: "Workflow Step *" }),
13184
+ /* @__PURE__ */ jsx87("label", { className: "fc:block fc:mb-1.5 fc:text-sm fc:font-semibold", children: "Workflow *" }),
13198
13185
  /* @__PURE__ */ jsxs86(
13199
13186
  "select",
13200
13187
  {
13201
- value: formData.workflowStepId,
13188
+ value: formData.workflowId || formData.workflowStepId,
13202
13189
  onChange: (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), {
13190
+ workflowId: event.target.value,
13203
13191
  workflowStepId: event.target.value
13204
13192
  })),
13205
13193
  className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-2.5",
13206
13194
  children: [
13207
- /* @__PURE__ */ jsx87("option", { value: "", children: "Select workflow step" }),
13208
- workflowSteps.map((step) => {
13209
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
13210
- const id = (_d = (_c = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.workflowId) != null ? _c : step.WorkflowId) != null ? _d : step.id;
13211
- const name = (_k = (_j = (_i = (_h = (_g = (_f = (_e = step.stepName) != null ? _e : step.StepName) != null ? _f : step.workflowStepName) != null ? _g : step.WorkflowStepName) != null ? _h : step.workflowName) != null ? _i : step.WorkflowName) != null ? _j : step.name) != null ? _k : `Step ${id}`;
13212
- return /* @__PURE__ */ jsxs86("option", { value: id, children: [
13213
- id,
13214
- " - ",
13215
- name
13216
- ] }, id);
13195
+ /* @__PURE__ */ jsx87("option", { value: "", children: isLoadingLookups ? "Loading workflows..." : "Select workflow" }),
13196
+ Boolean(
13197
+ (formData.workflowId || formData.workflowStepId) && !workflows.some(
13198
+ (wf) => {
13199
+ var _a2, _b2;
13200
+ return String((_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id) === String(formData.workflowId || formData.workflowStepId);
13201
+ }
13202
+ )
13203
+ ) && /* @__PURE__ */ jsx87("option", { value: formData.workflowId || formData.workflowStepId, children: (_c = (_b = (_a = editingMapping == null ? void 0 : editingMapping.workflowName) != null ? _a : editingMapping == null ? void 0 : editingMapping.WorkflowName) != null ? _b : editingMapping == null ? void 0 : editingMapping.stepName) != null ? _c : `Workflow ${formData.workflowId || formData.workflowStepId}` }),
13204
+ workflows.map((wf) => {
13205
+ var _a2, _b2, _c2, _d2, _e2;
13206
+ const id = (_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id;
13207
+ const name = (_e2 = (_d2 = (_c2 = wf.workflowName) != null ? _c2 : wf.WorkflowName) != null ? _d2 : wf.name) != null ? _e2 : `Workflow ${id}`;
13208
+ return /* @__PURE__ */ jsx87("option", { value: id, children: name }, id);
13217
13209
  })
13218
13210
  ]
13219
13211
  }
@@ -13230,15 +13222,20 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13230
13222
  })),
13231
13223
  className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-2.5",
13232
13224
  children: [
13233
- /* @__PURE__ */ jsx87("option", { value: "", children: "Select hierarchy node" }),
13225
+ /* @__PURE__ */ jsx87("option", { value: "", children: isLoadingLookups ? "Loading hierarchy nodes..." : "Select hierarchy node" }),
13226
+ Boolean(
13227
+ formData.hierarchyNodeId && !hierarchyNodes.some(
13228
+ (node) => {
13229
+ var _a2, _b2;
13230
+ return String((_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id) === String(formData.hierarchyNodeId);
13231
+ }
13232
+ )
13233
+ ) && /* @__PURE__ */ jsx87("option", { value: formData.hierarchyNodeId, children: (_f = (_e = (_d = editingMapping == null ? void 0 : editingMapping.hierarchyNodeName) != null ? _d : editingMapping == null ? void 0 : editingMapping.HierarchyNodeName) != null ? _e : editingMapping == null ? void 0 : editingMapping.nodeName) != null ? _f : `Node ${formData.hierarchyNodeId}` }),
13234
13234
  hierarchyNodes.map((node) => {
13235
- var _a, _b, _c;
13236
- const id = (_b = (_a = node.hierarchyNodeId) != null ? _a : node.HierarchyNodeId) != null ? _b : node.id;
13237
- const name = (_c = node.nodeName) != null ? _c : node.NodeName;
13238
- return /* @__PURE__ */ jsxs86("option", { value: id, children: [
13239
- id,
13240
- name ? ` - ${name}` : ""
13241
- ] }, id);
13235
+ var _a2, _b2, _c2, _d2, _e2;
13236
+ const id = (_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id;
13237
+ const name = (_e2 = (_d2 = (_c2 = node.nodeName) != null ? _c2 : node.NodeName) != null ? _d2 : node.hierarchyNodeName) != null ? _e2 : node.HierarchyNodeName;
13238
+ return /* @__PURE__ */ jsx87("option", { value: id, children: name ? name : `Node ${id}` }, id);
13242
13239
  })
13243
13240
  ]
13244
13241
  }
@@ -13289,7 +13286,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13289
13286
  }
13290
13287
 
13291
13288
  // src/components/Sidebar.jsx
13292
- import { Fragment as Fragment6, jsx as jsx88, jsxs as jsxs87 } from "react/jsx-runtime";
13289
+ import { Fragment as Fragment5, jsx as jsx88, jsxs as jsxs87 } from "react/jsx-runtime";
13293
13290
  var workflowItems = [
13294
13291
  // Menu Name testing // component or page-Use function name
13295
13292
  {
@@ -13314,8 +13311,8 @@ var workflowItems = [
13314
13311
  }
13315
13312
  ];
13316
13313
  var permissionItems = [{
13317
- name: "Task Permission",
13318
- component: "Task_permission_main",
13314
+ name: "Step Permission",
13315
+ component: "step_permission_main",
13319
13316
  icon: RiUserSettingsLine
13320
13317
  }, {
13321
13318
  name: "Assignment Rule",
@@ -13334,7 +13331,7 @@ var hierarchyItems = [
13334
13331
  icon: RiUserSharedLine
13335
13332
  },
13336
13333
  {
13337
- name: "Workflow Step User Mapping",
13334
+ name: "Workflow Hierarchy Mapping",
13338
13335
  component: "User_hierarchy_mapping_main",
13339
13336
  icon: RiUserSharedLine
13340
13337
  },
@@ -13395,7 +13392,8 @@ function Sidebar({
13395
13392
  childrens
13396
13393
  }) {
13397
13394
  const router = useRouter();
13398
- const [workflowOpen, setWorkflowOpen] = useState62(false);
13395
+ const [activeComponent, setActiveComponent] = useState62("workflowType");
13396
+ const [workflowOpen, setWorkflowOpen] = useState62(true);
13399
13397
  const [permissionOpen, setPermissionOpen] = useState62(false);
13400
13398
  const [hierarchyOpen, setHierarchyOpen] = useState62(false);
13401
13399
  const [documentOpen, setDocumentOpen] = useState62(false);
@@ -13403,14 +13401,25 @@ function Sidebar({
13403
13401
  const [tasksOpen, setTasksOpen] = useState62(false);
13404
13402
  const [trackingOpen, setTrackingOpen] = useState62(false);
13405
13403
  const [communicationOpen, setCommunicationOpen] = useState62(false);
13406
- const [activeComponent, setActiveComponent] = useState62("workflowType");
13407
- const renderMenuItemold = (item) => {
13408
- const Icon = item.icon;
13409
- return /* @__PURE__ */ jsxs87("button", { type: "button", className: `fc:flex fc:h-[48px] fc:w-full fc:items-center fc:gap-[8px] fc:rounded-[9px] fc:px-[8px] fc:text-left fc:transition-colors fc:duration-150${router.pathname === item.path ? "bg-blue-50 text-blue-600" : "text-[#344261] hover:bg-[#F6F8FC]"}`, onClick: () => router.push(item.path), children: [
13410
- /* @__PURE__ */ jsx88("span", { className: "fc:flex fc:h-[20px] fc:w-[20px] fc:shrink-0 fc:items-center fc:justify-center fc:rounded-[6px] fc:text-[#405170]", children: /* @__PURE__ */ jsx88(Icon, { size: 17 }) }),
13411
- /* @__PURE__ */ jsx88("span", { className: "fc:flex-1 fc:whitespace-nowrap fc:text-[13px] fc:font-medium fc:leading-[20px]", children: item.name })
13412
- ] }, item.name);
13413
- };
13404
+ useEffect41(() => {
13405
+ if (workflowItems.some((item) => item.component === activeComponent)) {
13406
+ setWorkflowOpen(true);
13407
+ } else if (permissionItems.some((item) => item.component === activeComponent)) {
13408
+ setPermissionOpen(true);
13409
+ } else if (hierarchyItems.some((item) => item.component === activeComponent)) {
13410
+ setHierarchyOpen(true);
13411
+ } else if (documentItems.some((item) => item.component === activeComponent)) {
13412
+ setDocumentOpen(true);
13413
+ } else if (fileItems.some((item) => item.component === activeComponent)) {
13414
+ setFilesOpen(true);
13415
+ } else if (taskItems.some((item) => item.component === activeComponent)) {
13416
+ setTasksOpen(true);
13417
+ } else if (trackingItems.some((item) => item.component === activeComponent)) {
13418
+ setTrackingOpen(true);
13419
+ } else if (communicationItems.some((item) => item.component === activeComponent)) {
13420
+ setCommunicationOpen(true);
13421
+ }
13422
+ }, [activeComponent]);
13414
13423
  const renderMenuItem = (item) => {
13415
13424
  const Icon = item.icon;
13416
13425
  const handleClick = () => {
@@ -13424,10 +13433,27 @@ function Sidebar({
13424
13433
  router.push(item.path);
13425
13434
  }
13426
13435
  };
13427
- return /* @__PURE__ */ jsxs87("button", { onClick: handleClick, className: `fc:flex fc:h-[48px] fc:w-full fc:min-w-0 fc:items-center fc:gap-[6px] fc:rounded-[9px] fc:px-[6px]${item.component ? activeComponent === item.component ? "bg-blue-50 text-blue-600" : "text-[#344261] hover:bg-[#F6F8FC]" : router.pathname === item.path ? "bg-blue-50 text-blue-600" : "text-[#344261] hover:bg-[#F6F8FC]"}`, children: [
13428
- /* @__PURE__ */ jsx88(Icon, { size: 16 }),
13429
- /* @__PURE__ */ jsx88("span", { className: "fc:min-w-0 fc:flex-1 fc:whitespace-nowrap fc:text-[13px] fc:font-medium fc:leading-[20px]", children: item.name })
13430
- ] }, item.name);
13436
+ const isActive = item.component ? activeComponent === item.component : router.pathname === item.path;
13437
+ return /* @__PURE__ */ jsxs87(
13438
+ "button",
13439
+ {
13440
+ type: "button",
13441
+ onClick: handleClick,
13442
+ title: item.name,
13443
+ className: `group fc:flex flex fc:h-[36px] h-[36px] fc:w-full w-full fc:min-w-0 min-w-0 fc:items-center items-center fc:gap-[8px] gap-[8px] fc:rounded-[7px] rounded-[7px] fc:px-[8px] px-[8px] fc:text-left text-left fc:transition-all transition-all fc:duration-150 duration-150 ${isActive ? "fc:bg-blue-50 bg-blue-50 fc:text-blue-600 text-blue-600 fc:font-semibold font-semibold" : "fc:text-[#405170] text-[#405170] hover:fc:bg-[#F6F8FC] hover:bg-[#F6F8FC] hover:fc:text-[#101318] hover:text-[#101318]"}`,
13444
+ children: [
13445
+ /* @__PURE__ */ jsx88(
13446
+ "span",
13447
+ {
13448
+ className: `fc:flex flex fc:h-[18px] h-[18px] fc:w-[18px] w-[18px] fc:shrink-0 shrink-0 fc:items-center items-center fc:justify-center justify-center fc:transition-colors transition-colors ${isActive ? "fc:text-blue-600 text-blue-600" : "fc:text-[#64748B] text-[#64748B] group-hover:fc:text-[#101318] group-hover:text-[#101318]"}`,
13449
+ children: /* @__PURE__ */ jsx88(Icon, { size: 16 })
13450
+ }
13451
+ ),
13452
+ /* @__PURE__ */ jsx88("span", { className: "fc:min-w-0 min-w-0 fc:flex-1 flex-1 fc:truncate truncate fc:text-[13px] text-[13px] fc:leading-[18px] leading-[18px] fc:text-left text-left", children: item.name })
13453
+ ]
13454
+ },
13455
+ item.name
13456
+ );
13431
13457
  };
13432
13458
  const renderContent = () => {
13433
13459
  switch (activeComponent) {
@@ -13445,7 +13471,7 @@ function Sidebar({
13445
13471
  return /* @__PURE__ */ jsx88(Workflow_Step_Hierarchy_Mapping_Main, {});
13446
13472
  case "DocumentConfigurationmain":
13447
13473
  return /* @__PURE__ */ jsx88(DocumentConfigurationmain, {});
13448
- case "Task_permission_main":
13474
+ case "step_permission_main":
13449
13475
  return /* @__PURE__ */ jsx88(TaskPermissionMain, {});
13450
13476
  case "AssignmentRuleMain":
13451
13477
  return /* @__PURE__ */ jsx88(AssignmentRuleMain, {});
@@ -13476,18 +13502,61 @@ function Sidebar({
13476
13502
  }
13477
13503
  };
13478
13504
  const renderDropdown = (title, open, setOpen, items, HeadingIcon) => {
13479
- return /* @__PURE__ */ jsxs87("div", { className: "fc:mb-2", children: [
13480
- /* @__PURE__ */ jsxs87("button", { type: "button", onClick: () => setOpen(!open), className: "fc:flex fc:h-[50px] fc:w-full fc:items-center fc:justify-between fc:rounded-[9px] fc:px-[17px] fc:text-left fc:text-[#344261] fc:transition-colors fc:duration-150 hover:fc:fc:bg-[#F6F8FC]", children: [
13481
- /* @__PURE__ */ jsxs87("div", { className: "fc:flex fc:items-center fc:gap-[8px]", children: [
13482
- HeadingIcon && /* @__PURE__ */ jsx88(HeadingIcon, { size: 18, className: "fc:text-[#405170] fc:shrink-0" }),
13483
- /* @__PURE__ */ jsx88("span", { className: "fc:text-[16px] fc:font-semibold", children: title })
13484
- ] }),
13485
- open ? /* @__PURE__ */ jsx88(RiArrowDownSLine, { size: 18 }) : /* @__PURE__ */ jsx88(RiArrowRightSLine, { size: 18 })
13486
- ] }),
13487
- open && /* @__PURE__ */ jsx88("div", { className: "fc:ml-[2px] fc:border-l fc:border-[#E5E9F1] fc:pl-[2px]", children: items.map(renderMenuItem) })
13505
+ const hasActiveChild = items.some(
13506
+ (item) => item.component ? activeComponent === item.component : router.pathname === item.path
13507
+ );
13508
+ return /* @__PURE__ */ jsxs87("div", { className: "fc:mb-1 mb-1", children: [
13509
+ /* @__PURE__ */ jsxs87(
13510
+ "button",
13511
+ {
13512
+ type: "button",
13513
+ onClick: () => setOpen(!open),
13514
+ className: `fc:flex flex fc:h-[42px] h-[42px] fc:w-full w-full fc:items-center items-center fc:justify-between justify-between fc:rounded-[8px] rounded-[8px] fc:px-[10px] px-[10px] fc:text-left text-left fc:transition-colors transition-colors fc:duration-150 duration-150 hover:fc:bg-[#F6F8FC] hover:bg-[#F6F8FC] ${hasActiveChild && !open ? "fc:bg-blue-50/60 bg-blue-50/60 fc:text-blue-600 text-blue-600" : "fc:text-[#344261] text-[#344261]"}`,
13515
+ children: [
13516
+ /* @__PURE__ */ jsxs87("div", { className: "fc:flex flex fc:items-center items-center fc:gap-[10px] gap-[10px] fc:min-w-0 min-w-0", children: [
13517
+ HeadingIcon && /* @__PURE__ */ jsx88(
13518
+ HeadingIcon,
13519
+ {
13520
+ size: 18,
13521
+ className: `fc:shrink-0 shrink-0 fc:transition-colors transition-colors ${hasActiveChild ? "fc:text-blue-600 text-blue-600" : "fc:text-[#405170] text-[#405170]"}`
13522
+ }
13523
+ ),
13524
+ /* @__PURE__ */ jsx88("span", { className: `fc:text-[14px] text-[14px] fc:font-semibold font-semibold fc:truncate truncate ${hasActiveChild && !open ? "fc:text-blue-600 text-blue-600" : "fc:text-[#273657] text-[#273657]"}`, children: title })
13525
+ ] }),
13526
+ /* @__PURE__ */ jsx88(
13527
+ "span",
13528
+ {
13529
+ className: `fc:text-[#7E8B9E] text-[#7E8B9E] fc:shrink-0 shrink-0 fc:ml-2 ml-2 fc:transition-transform transition-transform fc:duration-200 duration-200 ${open ? "fc:rotate-90 rotate-90 fc:text-[#344261] text-[#344261]" : "rotate-0"}`,
13530
+ children: /* @__PURE__ */ jsx88(RiArrowRightSLine, { size: 18 })
13531
+ }
13532
+ )
13533
+ ]
13534
+ }
13535
+ ),
13536
+ /* @__PURE__ */ jsx88(
13537
+ "div",
13538
+ {
13539
+ style: {
13540
+ display: "grid",
13541
+ gridTemplateRows: open ? "1fr" : "0fr",
13542
+ transition: "grid-template-rows 220ms cubic-bezier(0.4, 0, 0.2, 1)"
13543
+ },
13544
+ children: /* @__PURE__ */ jsx88(
13545
+ "div",
13546
+ {
13547
+ style: {
13548
+ overflow: "hidden",
13549
+ opacity: open ? 1 : 0,
13550
+ transition: "opacity 180ms ease-in-out"
13551
+ },
13552
+ children: /* @__PURE__ */ jsx88("div", { className: "fc:ml-[18px] ml-[18px] fc:mt-0.5 mt-0.5 fc:mb-1 mb-1 fc:border-l-2 border-l-2 fc:border-[#E5E9F1] border-[#E5E9F1] fc:pl-[8px] pl-[8px] fc:space-y-0.5 space-y-0.5", children: items.map(renderMenuItem) })
13553
+ }
13554
+ )
13555
+ }
13556
+ )
13488
13557
  ] });
13489
13558
  };
13490
- return /* @__PURE__ */ jsxs87(Fragment6, { children: [
13559
+ return /* @__PURE__ */ jsxs87(Fragment5, { children: [
13491
13560
  /* @__PURE__ */ jsxs87("aside", { className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`, children: [
13492
13561
  /* @__PURE__ */ jsxs87("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
13493
13562
  /* @__PURE__ */ jsxs87("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
@@ -13502,31 +13571,31 @@ function Sidebar({
13502
13571
  /* @__PURE__ */ jsx88("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
13503
13572
  ] })
13504
13573
  ] }),
13505
- /* @__PURE__ */ jsx88("button", { type: "button", onClick: onToggle, className: "fc:flex fc:h-8 fc:w-8 fc:items-center fc:justify-center fc:rounded-lg hover:fc:fc:bg-gray-100", children: /* @__PURE__ */ jsx88(RiMenuLine, { size: 18 }) })
13574
+ /* @__PURE__ */ jsx88("button", { type: "button", onClick: onToggle, className: "fc:flex flex fc:h-8 h-8 fc:w-8 w-8 fc:items-center items-center fc:justify-center justify-center fc:rounded-lg rounded-lg hover:fc:bg-gray-100 hover:bg-gray-100 fc:transition-colors transition-colors", children: /* @__PURE__ */ jsx88(RiMenuLine, { size: 18 }) })
13506
13575
  ] }),
13507
- /* @__PURE__ */ jsxs87("div", { className: "fc:min-h-0 fc:flex-1 fc:overflow-y-auto fc:overflow-x-hidden fc:px-[27px] fc:pb-[30px] fc:pt-[31px]", children: [
13508
- /* @__PURE__ */ jsx88("p", { className: "fc:mb-[19px] fc:ml-[15px] fc:text-[14px] fc:font-bold fc:uppercase fc:leading-[20px] fc:tracking-[0.2px] fc:text-[#3C4D74]", children: "Configuration Masters" }),
13509
- /* @__PURE__ */ jsxs87("div", { className: "fc:flex fc:flex-col fc:gap-[3px]", children: [
13576
+ /* @__PURE__ */ jsxs87("div", { className: "fc:min-h-0 min-h-0 fc:flex-1 flex-1 fc:overflow-y-auto overflow-y-auto fc:overflow-x-hidden overflow-x-hidden fc:px-[12px] px-[12px] fc:pb-[24px] pb-[24px] fc:pt-[20px] pt-[20px]", children: [
13577
+ /* @__PURE__ */ jsx88("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Configuration Masters" }),
13578
+ /* @__PURE__ */ jsxs87("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
13510
13579
  renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, RiNodeTree),
13511
13580
  renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, RiShieldUserLine),
13512
13581
  renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, RiFileSettingsLine),
13513
13582
  renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, RiNodeTree)
13514
13583
  ] }),
13515
- /* @__PURE__ */ jsx88("p", { className: "fc:mb-[19px] fc:ml-[15px] fc:mt-[39px] fc:text-[14px] fc:font-bold fc:uppercase fc:leading-[20px] fc:tracking-[0.2px] fc:text-[#3C4D74]", children: "Runtime" }),
13516
- /* @__PURE__ */ jsxs87("div", { className: "fc:flex fc:flex-col fc:gap-[3px]", children: [
13584
+ /* @__PURE__ */ jsx88("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:mt-[24px] mt-[24px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Runtime" }),
13585
+ /* @__PURE__ */ jsxs87("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
13517
13586
  renderDropdown("Files", filesOpen, setFilesOpen, fileItems, RiFolder3Line),
13518
13587
  renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, RiCheckboxCircleLine),
13519
13588
  renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, RiRouteLine),
13520
13589
  renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, RiMessage2Line)
13521
13590
  ] })
13522
13591
  ] }),
13523
- /* @__PURE__ */ jsx88("div", { className: "fc:shrink-0 fc:bg-white fc:px-[27px] fc:pb-[34px] fc:pt-[18px]", children: /* @__PURE__ */ jsxs87("button", { type: "button", className: "fc:flex fc:h-[66px] fc:w-full fc:items-center fc:gap-[18px] fc:rounded-[10px] fc:border fc:border-[#E1E5ED] fc:bg-white fc:px-[23px] fc:text-left fc:text-[16px] fc:font-semibold fc:text-[#2D3A58] fc:shadow-sm hover:fc:fc:bg-[#F7F8FC] fc:transition", children: [
13592
+ /* @__PURE__ */ jsx88("div", { className: "fc:shrink-0 shrink-0 fc:bg-white bg-white fc:px-[12px] px-[12px] fc:pb-[20px] pb-[20px] fc:pt-[12px] pt-[12px]", children: /* @__PURE__ */ jsxs87("button", { type: "button", className: "fc:flex flex fc:h-[50px] h-[50px] fc:w-full w-full fc:items-center items-center fc:gap-[12px] gap-[12px] fc:rounded-[10px] rounded-[10px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:px-[14px] px-[14px] fc:text-left text-left fc:text-[15px] text-[15px] fc:font-semibold font-semibold fc:text-[#2D3A58] text-[#2D3A58] fc:shadow-sm shadow-sm hover:fc:bg-[#F7F8FC] hover:bg-[#F7F8FC] fc:transition transition", children: [
13524
13593
  /* @__PURE__ */ jsx88(RiSettings4Line, { size: 20 }),
13525
13594
  /* @__PURE__ */ jsx88("span", { children: "Settings" })
13526
13595
  ] }) })
13527
13596
  ] }),
13528
- /* @__PURE__ */ jsx88("div", { className: "fc:flex-1 fc:overflow-auto fc:bg-[#F5F7FB]", children: renderContent() }),
13529
- !isOpen && /* @__PURE__ */ jsx88("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fc:left-[px] fc:top-[30px] fc:z-[100] fc:flex fc:h-[46px] fc:w-[46px] fc:items-center fc:justify-center fc:rounded-[9px] fc:border fc:border-[#E1E5ED] fc:bg-white fc:text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors hover:fc:bg-gray-100", children: /* @__PURE__ */ jsx88(RiMenuLine, { size: 18 }) })
13597
+ /* @__PURE__ */ jsx88("div", { className: "fc:flex-1 flex-1 fc:overflow-auto overflow-auto fc:bg-[#F5F7FB] bg-[#F5F7FB]", children: renderContent() }),
13598
+ !isOpen && /* @__PURE__ */ jsx88("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fixed fc:left-[16px] left-[16px] fc:top-[30px] top-[30px] fc:z-[100] z-[100] fc:flex flex fc:h-[46px] h-[46px] fc:w-[46px] w-[46px] fc:items-center items-center fc:justify-center justify-center fc:rounded-[9px] rounded-[9px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:text-[#344261] text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors transition-colors hover:fc:bg-gray-100 hover:bg-gray-100", children: /* @__PURE__ */ jsx88(RiMenuLine, { size: 18 }) })
13530
13599
  ] });
13531
13600
  }
13532
13601