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.
package/dist/pkg-index.js CHANGED
@@ -1235,10 +1235,10 @@ function Workflow() {
1235
1235
  (async () => {
1236
1236
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1237
1237
  try {
1238
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
1238
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
1239
1239
  const typeEndpoint = (_f = (_e = (_d = getApiEndpoints()) == null ? void 0 : _d.flowCore) == null ? void 0 : _e.workflowType) == null ? void 0 : _f.getList;
1240
- if (!endpoint) throw Error("Workflow list endpoint is not configured.");
1241
- const [result, types] = await Promise.all([getApiService().get(endpoint), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
1240
+ if (!endpoint2) throw Error("Workflow list endpoint is not configured.");
1241
+ const [result, types] = await Promise.all([getApiService().get(endpoint2), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
1242
1242
  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;
1243
1243
  const rows = Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || [];
1244
1244
  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;
@@ -1261,9 +1261,9 @@ function Workflow() {
1261
1261
  const handleCreateApi = async (workflowPayload) => {
1262
1262
  var _a, _b, _c, _d, _e;
1263
1263
  try {
1264
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
1265
- if (!endpoint) throw new Error("Workflow create endpoint is not configured.");
1266
- await getApiService().post(endpoint, workflowPayload);
1264
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
1265
+ if (!endpoint2) throw new Error("Workflow create endpoint is not configured.");
1266
+ await getApiService().post(endpoint2, workflowPayload);
1267
1267
  await import_sweetalert23.default.fire("Success", "Workflow created successfully.", "success");
1268
1268
  handleRefresh();
1269
1269
  return true;
@@ -1275,9 +1275,9 @@ function Workflow() {
1275
1275
  const handleUpdateApi = async (workflowPayload) => {
1276
1276
  var _a, _b, _c, _d, _e;
1277
1277
  try {
1278
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
1279
- if (!endpoint) throw new Error("Workflow update endpoint is not configured.");
1280
- await getApiService().put(endpoint, workflowPayload);
1278
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
1279
+ if (!endpoint2) throw new Error("Workflow update endpoint is not configured.");
1280
+ await getApiService().put(endpoint2, workflowPayload);
1281
1281
  await import_sweetalert23.default.fire("Success", "Workflow updated successfully.", "success");
1282
1282
  handleRefresh();
1283
1283
  return true;
@@ -1982,9 +1982,9 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1982
1982
  setIsSubmitting(true);
1983
1983
  setSubmitError("");
1984
1984
  const endpoints = getApiEndpoints();
1985
- const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
1986
- if (!endpoint) throw new Error("Create workflow type endpoint is not configured.");
1987
- const response = await getApiService().post(endpoint, payload);
1985
+ const endpoint2 = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
1986
+ if (!endpoint2) throw new Error("Create workflow type endpoint is not configured.");
1987
+ const response = await getApiService().post(endpoint2, payload);
1988
1988
  const resData = (_c = response == null ? void 0 : response.data) != null ? _c : response;
1989
1989
  if ((resData == null ? void 0 : resData.success) === false) {
1990
1990
  const apiErrors = Array.isArray(resData == null ? void 0 : resData.errors) && resData.errors.length > 0 ? resData.errors : null;
@@ -2068,9 +2068,9 @@ function WorkflowTypeMains() {
2068
2068
  const handleUpdateApi = async (item) => {
2069
2069
  var _a, _b, _c, _d;
2070
2070
  try {
2071
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
2072
- if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
2073
- 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" });
2071
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
2072
+ if (!endpoint2) throw new Error("Workflow type update endpoint is not configured.");
2073
+ 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" });
2074
2074
  await import_sweetalert25.default.fire("Success", "Workflow type updated successfully.", "success");
2075
2075
  handleRefresh();
2076
2076
  return true;
@@ -2102,9 +2102,9 @@ function WorkflowTypeMains() {
2102
2102
  (async () => {
2103
2103
  var _a, _b, _c, _d, _e, _f, _g;
2104
2104
  try {
2105
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.getList;
2106
- if (!endpoint) throw new Error("Workflow type list endpoint is not configured.");
2107
- const result = await getApiService().get(endpoint);
2105
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.getList;
2106
+ if (!endpoint2) throw new Error("Workflow type list endpoint is not configured.");
2107
+ const result = await getApiService().get(endpoint2);
2108
2108
  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;
2109
2109
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
2110
2110
  } catch (error) {
@@ -2219,9 +2219,9 @@ function AddWorkflowStepModal({ onClose, onSave }) {
2219
2219
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2220
2220
  try {
2221
2221
  setLoadingWorkflows(true);
2222
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2223
- if (!endpoint) return;
2224
- const result = await getApiService().get(endpoint);
2222
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2223
+ if (!endpoint2) return;
2224
+ const result = await getApiService().get(endpoint2);
2225
2225
  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;
2226
2226
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
2227
2227
  setWorkflows(rows);
@@ -2571,8 +2571,8 @@ function AddWorkflowStepModal({ onClose, onSave }) {
2571
2571
  if (!validateForm()) return;
2572
2572
  try {
2573
2573
  setIsSubmitting(true);
2574
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
2575
- if (!endpoint) throw new Error("Workflow step create endpoint is not configured.");
2574
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
2575
+ if (!endpoint2) throw new Error("Workflow step create endpoint is not configured.");
2576
2576
  const payload = {
2577
2577
  workflowId: Number(formData.workflow) || 0,
2578
2578
  stepCode: formData.stepCode.trim().toUpperCase(),
@@ -2586,7 +2586,7 @@ function AddWorkflowStepModal({ onClose, onSave }) {
2586
2586
  excludeHolidays: Boolean(formData.excludeHolidays),
2587
2587
  createdBy: "System"
2588
2588
  };
2589
- await getApiService().post(endpoint, payload);
2589
+ await getApiService().post(endpoint2, payload);
2590
2590
  onClose();
2591
2591
  await (onSave == null ? void 0 : onSave());
2592
2592
  } catch (error) {
@@ -2639,9 +2639,9 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
2639
2639
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2640
2640
  try {
2641
2641
  setLoadingWorkflows(true);
2642
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2643
- if (!endpoint) return;
2644
- const result = await getApiService().get(endpoint);
2642
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
2643
+ if (!endpoint2) return;
2644
+ const result = await getApiService().get(endpoint2);
2645
2645
  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;
2646
2646
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
2647
2647
  setWorkflows(rows);
@@ -2695,8 +2695,8 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
2695
2695
  if (!validate()) return;
2696
2696
  try {
2697
2697
  setIsSubmitting(true);
2698
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
2699
- if (!endpoint) throw new Error("Workflow step update endpoint is not configured.");
2698
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
2699
+ if (!endpoint2) throw new Error("Workflow step update endpoint is not configured.");
2700
2700
  const payload = {
2701
2701
  workflowStepId: (_e = (_d = selectedData == null ? void 0 : selectedData.workflowStepId) != null ? _d : selectedData == null ? void 0 : selectedData.WorkflowStepId) != null ? _e : 0,
2702
2702
  workflowId: Number(formData.workflowId) || 0,
@@ -2712,7 +2712,7 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
2712
2712
  isActive: Boolean(formData.isActive),
2713
2713
  updatedBy: String(formData.updatedBy).trim() || "System"
2714
2714
  };
2715
- await getApiService().put(endpoint, payload);
2715
+ await getApiService().put(endpoint2, payload);
2716
2716
  onClose();
2717
2717
  await (onSave == null ? void 0 : onSave());
2718
2718
  } catch (error) {
@@ -3093,9 +3093,9 @@ function WorkflowStep() {
3093
3093
  const handleUpdateApi = async (item) => {
3094
3094
  var _a, _b, _c, _d, _e, _f, _g;
3095
3095
  try {
3096
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
3097
- if (!endpoint) throw new Error("Workflow step update endpoint is not configured.");
3098
- await getApiService().put(endpoint, {
3096
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
3097
+ if (!endpoint2) throw new Error("Workflow step update endpoint is not configured.");
3098
+ await getApiService().put(endpoint2, {
3099
3099
  workflowStepId: (_e = (_d = item.workflowStepId) != null ? _d : item.WorkflowStepId) != null ? _e : 0,
3100
3100
  workflowId: Number(item.workflowId) || 0,
3101
3101
  stepCode: String(item.stepCode).trim().toUpperCase(),
@@ -3360,24 +3360,58 @@ function WorkflowStep() {
3360
3360
 
3361
3361
  // src/components/WorkFlowTransition/Transitiontable.js
3362
3362
  var import_react21 = __toESM(require("react"));
3363
- var import_link2 = __toESM(require("next/link"));
3363
+ var import_sweetalert29 = __toESM(require("sweetalert2"));
3364
3364
 
3365
3365
  // src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
3366
3366
  var import_react20 = __toESM(require("react"));
3367
+ init_ApiEndpointsProvider();
3368
+ init_ApiServicepackage();
3367
3369
  var import_jsx_runtime20 = require("react/jsx-runtime");
3368
- function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3370
+ var rowsFrom = (response) => {
3371
+ var _a, _b, _c, _d, _e, _f, _g;
3372
+ 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;
3373
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
3374
+ };
3375
+ var lookupEndpoint = (name, fallback) => {
3376
+ var _a, _b, _c, _d;
3377
+ try {
3378
+ return (_d = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b[name]) == null ? void 0 : _c.getList) != null ? _d : fallback;
3379
+ } catch (e) {
3380
+ return fallback;
3381
+ }
3382
+ };
3383
+ function AddWorkTransitionStepModal({ onClose, onSave, editData }) {
3384
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
3369
3385
  const [formData, setFormData] = (0, import_react20.useState)({
3370
- workflow: "",
3371
- fromStep: "",
3372
- toStep: "",
3373
- actionCode: "",
3374
- actionName: "",
3386
+ workflow: String((_b = (_a = editData == null ? void 0 : editData.workflowId) != null ? _a : editData == null ? void 0 : editData.WorkflowId) != null ? _b : ""),
3387
+ 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 : ""),
3388
+ 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 : ""),
3389
+ actionCode: (_l = (_k = editData == null ? void 0 : editData.actionCode) != null ? _k : editData == null ? void 0 : editData.ActionCode) != null ? _l : "",
3390
+ actionName: (_n = (_m = editData == null ? void 0 : editData.actionName) != null ? _m : editData == null ? void 0 : editData.ActionName) != null ? _n : "",
3375
3391
  sequenceNo: "",
3376
3392
  isDefault: false,
3377
3393
  requireComment: false,
3378
- status: "active"
3394
+ status: ((_p = (_o = editData == null ? void 0 : editData.isActive) != null ? _o : editData == null ? void 0 : editData.IsActive) != null ? _p : true) ? "active" : "inactive"
3379
3395
  });
3380
3396
  const [errors, setErrors] = (0, import_react20.useState)({});
3397
+ const [workflows, setWorkflows] = (0, import_react20.useState)([]);
3398
+ const [isSubmitting, setIsSubmitting] = (0, import_react20.useState)(false);
3399
+ (0, import_react20.useEffect)(() => {
3400
+ let active = true;
3401
+ (async () => {
3402
+ try {
3403
+ const service = getApiService();
3404
+ const workflowResult = await service.get(lookupEndpoint("workflow", "/api/flowcore/WorkFlow/GetList"));
3405
+ if (!active) return;
3406
+ setWorkflows(rowsFrom(workflowResult));
3407
+ } catch (error) {
3408
+ if (active) setErrors((current) => __spreadProps(__spreadValues({}, current), { lookup: (error == null ? void 0 : error.message) || "Unable to load workflows." }));
3409
+ }
3410
+ })();
3411
+ return () => {
3412
+ active = false;
3413
+ };
3414
+ }, []);
3381
3415
  const validateForm = () => {
3382
3416
  const newErrors = {};
3383
3417
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -3385,18 +3419,20 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3385
3419
  if (!formData.toStep) newErrors.toStep = "To Step is required.";
3386
3420
  if (!formData.actionCode.trim()) newErrors.actionCode = "Action Code is required.";
3387
3421
  if (!formData.actionName.trim()) newErrors.actionName = "Action Name is required.";
3388
- if (!formData.sequenceNo) newErrors.sequenceNo = "Sequence No is required.";
3389
3422
  setErrors(newErrors);
3390
3423
  return Object.keys(newErrors).length === 0;
3391
3424
  };
3392
- const handleSubmit = (e) => {
3425
+ const handleSubmit = async (e) => {
3426
+ var _a2, _b2, _c2;
3393
3427
  e.preventDefault();
3394
- if (validateForm()) {
3395
- if (onSubmit) {
3396
- onSubmit(formData);
3397
- } else {
3398
- console.log("Form Submitted Successfully:", formData);
3399
- }
3428
+ if (!validateForm() || !onSave) return;
3429
+ const isEdit = Boolean(editData);
3430
+ 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" };
3431
+ setIsSubmitting(true);
3432
+ try {
3433
+ if (await onSave(payload, isEdit)) onClose();
3434
+ } finally {
3435
+ setIsSubmitting(false);
3400
3436
  }
3401
3437
  };
3402
3438
  const handleChange = (field, value) => {
@@ -3455,8 +3491,12 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3455
3491
  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"}`,
3456
3492
  children: [
3457
3493
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select Workflow" }),
3458
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "building", children: "Building Permission" }),
3459
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "trade", children: "Trade License" })
3494
+ workflows.map((workflow) => {
3495
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
3496
+ const id = (_b2 = (_a2 = workflow.workflowId) != null ? _a2 : workflow.WorkflowId) != null ? _b2 : workflow.id;
3497
+ 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}`;
3498
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: String(id), children: name }, id);
3499
+ })
3460
3500
  ]
3461
3501
  }
3462
3502
  ),
@@ -3478,8 +3518,8 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3478
3518
  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"}`,
3479
3519
  children: [
3480
3520
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select From Step" }),
3481
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "scrutiny", children: "Scrutiny" }),
3482
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "inspection", children: "Inspection" })
3521
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "1", children: "Scrutiny" }),
3522
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "2", children: "Inspection" })
3483
3523
  ]
3484
3524
  }
3485
3525
  ),
@@ -3503,8 +3543,8 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3503
3543
  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"}`,
3504
3544
  children: [
3505
3545
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select To Step" }),
3506
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "approval", children: "Approval" }),
3507
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "completed", children: "Completed" })
3546
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "3", children: "Approval" }),
3547
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "4", children: "Completed" })
3508
3548
  ]
3509
3549
  }
3510
3550
  ),
@@ -3729,185 +3769,134 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
3729
3769
  }
3730
3770
 
3731
3771
  // src/components/WorkFlowTransition/Transitiontable.js
3772
+ init_ApiEndpointsProvider();
3773
+ init_ApiServicepackage();
3732
3774
  var import_jsx_runtime21 = require("react/jsx-runtime");
3733
- var WorkflowTransition = [{
3734
- TransitionId: 1,
3735
- workflowId: 1,
3736
- FromStepId: 2,
3737
- ToStepId: 1,
3738
- ActionCode: "APPROVE",
3739
- ActionName: "APPROVE"
3740
- }, {
3741
- TransitionId: 1,
3742
- workflowId: 1,
3743
- FromStepId: 2,
3744
- ToStepId: 1,
3745
- ActionCode: "APPROVE",
3746
- ActionName: "APPROVE"
3747
- }, {
3748
- TransitionId: 1,
3749
- workflowId: 1,
3750
- FromStepId: 2,
3751
- ToStepId: 1,
3752
- ActionCode: "APPROVE",
3753
- ActionName: "APPROVE"
3754
- }, {
3755
- TransitionId: 1,
3756
- workflowId: 1,
3757
- FromStepId: 2,
3758
- ToStepId: 1,
3759
- ActionCode: "APPROVE",
3760
- ActionName: "APPROVE"
3761
- }, {
3762
- TransitionId: 1,
3763
- workflowId: 1,
3764
- FromStepId: 2,
3765
- ToStepId: 1,
3766
- ActionCode: "APPROVE",
3767
- ActionName: "APPROVE"
3768
- }, {
3769
- TransitionId: 1,
3770
- workflowId: 1,
3771
- FromStepId: 2,
3772
- ToStepId: 1,
3773
- ActionCode: "APPROVE",
3774
- ActionName: "APPROVE"
3775
- }, {
3776
- TransitionId: 1,
3777
- workflowId: 1,
3778
- FromStepId: 2,
3779
- ToStepId: 1,
3780
- ActionCode: "APPROVE",
3781
- ActionName: "APPROVE"
3782
- }, {
3783
- TransitionId: 1,
3784
- workflowId: 1,
3785
- FromStepId: 2,
3786
- ToStepId: 1,
3787
- ActionCode: "APPROVE",
3788
- ActionName: "APPROVE"
3789
- }, {
3790
- TransitionId: 1,
3791
- workflowId: 1,
3792
- FromStepId: 2,
3793
- ToStepId: 1,
3794
- ActionCode: "RETURN",
3795
- ActionName: "APPROVE"
3796
- }, {
3797
- TransitionId: 1,
3798
- workflowId: 1,
3799
- FromStepId: 2,
3800
- ToStepId: 1,
3801
- ActionCode: "APPROVE",
3802
- ActionName: "RETURN"
3803
- }];
3775
+ var PATHS = { create: "/api/flowcore/WorkflowTransition/Create", update: "/api/flowcore/WorkflowTransition/Update", getById: "/api/flowcore/WorkflowTransition/GetById", getList: "/api/flowcore/WorkflowTransition/GetList" };
3776
+ var getRows = (response) => {
3777
+ var _a, _b, _c, _d, _e, _f, _g;
3778
+ 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;
3779
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
3780
+ };
3781
+ var getEndpoint = (action) => {
3782
+ var _a, _b, _c, _d;
3783
+ try {
3784
+ const endpoints = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
3785
+ 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];
3786
+ if (configured) return configured;
3787
+ } catch (e) {
3788
+ }
3789
+ return PATHS[action];
3790
+ };
3791
+ var getByIdUrl = (id) => {
3792
+ const endpoint2 = getEndpoint("getById");
3793
+ return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
3794
+ };
3795
+ var normalise = (item) => {
3796
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
3797
+ 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 });
3798
+ };
3804
3799
  function WorkFlowTransition() {
3805
- const handleRefresh = () => {
3806
- console.log("Refresh clicked");
3807
- };
3808
- const handleDownload = () => {
3809
- console.log("Download clicked");
3810
- };
3811
3800
  const tableRef = (0, import_react21.useRef)(null);
3801
+ const [rows, setRows] = (0, import_react21.useState)([]);
3812
3802
  const [showModal, setShowModal] = (0, import_react21.useState)(false);
3803
+ const [editingTransition, setEditingTransition] = (0, import_react21.useState)(null);
3813
3804
  const [pageSize, setPageSize] = (0, import_react21.useState)(5);
3814
- const [sortConfig, setSortConfig] = (0, import_react21.useState)({
3815
- key: "",
3816
- direction: "asc"
3817
- });
3818
- const handleSort = (key) => {
3819
- let direction = "asc";
3820
- if (sortConfig.key === key && sortConfig.direction === "asc") {
3821
- direction = "desc";
3805
+ const [search, setSearch] = (0, import_react21.useState)("");
3806
+ const [sortConfig, setSortConfig] = (0, import_react21.useState)({ key: "", direction: "asc" });
3807
+ const [refreshKey, setRefreshKey] = (0, import_react21.useState)(0);
3808
+ const refresh = () => setRefreshKey((value) => value + 1);
3809
+ (0, import_react21.useEffect)(() => {
3810
+ (async () => {
3811
+ var _a, _b;
3812
+ try {
3813
+ setRows(getRows(await getApiService().get(getEndpoint("getList"))).map(normalise));
3814
+ } catch (error) {
3815
+ await import_sweetalert29.default.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");
3816
+ }
3817
+ })();
3818
+ }, [refreshKey]);
3819
+ const saveTransition = async (payload, isEdit) => {
3820
+ var _a, _b;
3821
+ try {
3822
+ await getApiService()[isEdit ? "put" : "post"](getEndpoint(isEdit ? "update" : "create"), payload);
3823
+ await import_sweetalert29.default.fire("Success", `Workflow transition ${isEdit ? "updated" : "created"} successfully.`, "success");
3824
+ refresh();
3825
+ return true;
3826
+ } catch (error) {
3827
+ await import_sweetalert29.default.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");
3828
+ return false;
3822
3829
  }
3823
- setSortConfig({
3824
- key,
3825
- direction
3826
- });
3827
3830
  };
3828
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
3829
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
3830
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CommonHeader, { title: "WorkFlow Transition", breadcrumbs: [{
3831
- label: "Dashboard",
3832
- href: "/dashboard"
3833
- }, {
3834
- label: "Masters",
3835
- href: "/masters"
3836
- }, {
3837
- label: "Workflow Transition",
3838
- href: "/workflowTransition"
3839
- }], buttonText: "Add Workflow Transition", onButtonClick: () => setShowModal(true) }),
3840
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("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: [
3841
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
3842
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:relative fc:max-w-xs fc:w-full", children: [
3843
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:absolute fc:inset-y-0 fc:left-0 fc:flex fc:items-center fc:pl-3.5 fc:pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("svg", { className: "fc:w-4 fc:h-5 fc:text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
3844
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "text", placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:shadow-md fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
3845
- ] }),
3846
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold", children: [
3847
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Refresh_default, { onRefresh: handleRefresh }),
3848
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Download_default, { targetRef: tableRef, fileName: "workflow-transition" }),
3849
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("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: [
3850
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 5, children: "5 Rows" }),
3851
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 10, children: "10 Rows" }),
3852
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 25, children: "25 Rows" })
3853
- ] })
3831
+ const editTransition = async (transition) => {
3832
+ var _a, _b, _c, _d, _e, _f, _g, _h;
3833
+ try {
3834
+ const result = await getApiService().get(getByIdUrl(transition.transitionId));
3835
+ 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;
3836
+ setEditingTransition(normalise(data));
3837
+ setShowModal(true);
3838
+ } catch (error) {
3839
+ await import_sweetalert29.default.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");
3840
+ }
3841
+ };
3842
+ const columns = [["Transition ID", "transitionId"], ["Workflow ID", "workflowId"], ["From Step ID", "fromWorkflowStepId"], ["To Step ID", "toWorkflowStepId"], ["Action Code", "actionCode"], ["Action Name", "actionName"]];
3843
+ const visibleRows = rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
3844
+ var _a, _b;
3845
+ if (!sortConfig.key) return 0;
3846
+ const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
3847
+ return sortConfig.direction === "asc" ? result : -result;
3848
+ });
3849
+ const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
3850
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
3851
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CommonHeader, { title: "Workflow Transition", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Masters", href: "/masters" }, { label: "Workflow Transition", href: "/workflowTransition" }], buttonText: "Add Workflow Transition", onButtonClick: () => {
3852
+ setEditingTransition(null);
3853
+ setShowModal(true);
3854
+ } }),
3855
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("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: [
3856
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
3857
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3858
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
3859
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Refresh_default, { onRefresh: refresh }),
3860
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Download_default, { targetRef: tableRef, fileName: "workflow-transition" }),
3861
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("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: [
3862
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 5, children: "5 Rows" }),
3863
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 10, children: "10 Rows" }),
3864
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 25, children: "25 Rows" })
3854
3865
  ] })
3855
- ] }),
3856
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden fc:bg-white fc:shadow-md", children: [
3857
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "fc:max-h-[350px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("table", { className: "fc:min-w-max fc:w-full fc:border-collapse", children: [
3858
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { className: "fc:bg-slate-50 fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "fc:text-[11px] fc:font-bold fc:uppercase fc:tracking-wider fc:text-slate-400", children: [{
3859
- label: "TransitionId",
3860
- key: "TransitionId"
3861
- }, {
3862
- label: "WorkflowId",
3863
- key: "workflowId"
3864
- }, {
3865
- label: "FromStepId",
3866
- key: "FromStepId"
3867
- }, {
3868
- label: "ToStepId",
3869
- key: "ToStepId"
3870
- }, {
3871
- label: "ActionCode",
3872
- key: "ActionCode"
3873
- }, {
3874
- label: "ActionName",
3875
- key: "ActionName"
3876
- }].map((column) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
3877
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: column.label }),
3878
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-gray-400 fc:text-xs", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
3879
- ] }) }, column.key)) }) }),
3880
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: WorkflowTransition.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
3881
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:p-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.TransitionId }),
3882
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
3883
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.FromStepId }),
3884
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.ToStepId }),
3885
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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 }) }),
3886
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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 }) })
3887
- ] }, item.TransitionId)) })
3888
- ] }) }),
3889
- " "
3890
- ] }),
3891
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: [
3892
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Footer, {}),
3893
- " "
3894
3866
  ] })
3895
- ] })
3867
+ ] }),
3868
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("table", { className: "fc:min-w-max fc:w-full", children: [
3869
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("tr", { children: [
3870
+ columns.map(([label, key]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
3871
+ label,
3872
+ " ",
3873
+ sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
3874
+ ] }, key)),
3875
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
3876
+ ] }) }),
3877
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("tr", { className: "fc:border-t fc:border-slate-100", children: [
3878
+ columns.map(([, key]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item[key] }, key)),
3879
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }) })
3880
+ ] }, item.transitionId)) })
3881
+ ] }) }),
3882
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Footer, {})
3896
3883
  ] }),
3897
- showModal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AddWorkTransitionStepModal, { onClose: () => setShowModal(false) }),
3898
- " "
3884
+ showModal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AddWorkTransitionStepModal, { editData: editingTransition, onClose: () => {
3885
+ setShowModal(false);
3886
+ setEditingTransition(null);
3887
+ }, onSave: saveTransition })
3899
3888
  ] });
3900
3889
  }
3901
3890
 
3902
3891
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3903
3892
  var import_react27 = __toESM(require("react"));
3904
- var import_sweetalert210 = __toESM(require("sweetalert2"));
3893
+ var import_sweetalert211 = __toESM(require("sweetalert2"));
3905
3894
  init_ApiEndpointsProvider();
3906
3895
  init_ApiServicepackage();
3907
3896
 
3908
3897
  // src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
3909
3898
  var import_react22 = __toESM(require("react"));
3910
- var import_sweetalert29 = __toESM(require("sweetalert2"));
3899
+ var import_sweetalert210 = __toESM(require("sweetalert2"));
3911
3900
  init_ApiEndpointsProvider();
3912
3901
  init_ApiServicepackage();
3913
3902
  var import_jsx_runtime22 = require("react/jsx-runtime");
@@ -3970,7 +3959,7 @@ function AddUserHierarchyNodeMappingModal({
3970
3959
  const handleSave = async () => {
3971
3960
  if (!onSave) return;
3972
3961
  if (!formData.workflowStepId) {
3973
- await import_sweetalert29.default.fire("Required field", "Please select a workflow step.", "warning");
3962
+ await import_sweetalert210.default.fire("Required field", "Please select a workflow step.", "warning");
3974
3963
  return;
3975
3964
  }
3976
3965
  setIsSubmitting(true);
@@ -3995,7 +3984,7 @@ function AddUserHierarchyNodeMappingModal({
3995
3984
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
3996
3985
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("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__ */ (0, import_jsx_runtime22.jsx)("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("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" }) }) }),
3997
3986
  /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
3998
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow Step Hierarchy Mapping " }),
3987
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow Hierarchy Mapping " }),
3999
3988
  /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Map a consumer user to a hierarchy node" })
4000
3989
  ] })
4001
3990
  ] }),
@@ -4642,13 +4631,13 @@ function User_hierarchy_mapping_main() {
4642
4631
  (async () => {
4643
4632
  var _a, _b, _c, _d, _e, _f, _g;
4644
4633
  try {
4645
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c.getList;
4646
- if (!endpoint) throw new Error("Workflow Step Hierarchy Mapping list endpoint is not configured.");
4647
- const result = await getApiService().post(endpoint, {});
4634
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c.getList;
4635
+ if (!endpoint2) throw new Error("Workflow Step Hierarchy Mapping list endpoint is not configured.");
4636
+ const result = await getApiService().post(endpoint2, {});
4648
4637
  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;
4649
4638
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
4650
4639
  } catch (error) {
4651
- await import_sweetalert210.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load Workflow Step Hierarchy Mappings.", "error");
4640
+ await import_sweetalert211.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load Workflow Step Hierarchy Mappings.", "error");
4652
4641
  }
4653
4642
  })();
4654
4643
  }, [refreshkey]);
@@ -4668,8 +4657,8 @@ function User_hierarchy_mapping_main() {
4668
4657
  const saveMapping = async (payload, isEdit = false) => {
4669
4658
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4670
4659
  try {
4671
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
4672
- if (!endpoint) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
4660
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
4661
+ if (!endpoint2) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
4673
4662
  const requestPayload = isEdit ? {
4674
4663
  workflowStepUserMappingId: Number(
4675
4664
  (_f = (_e = (_d = payload.workflowStepUserMappingId) != null ? _d : payload.WorkFlowStepUserMappingId) != null ? _e : payload.mappingId) != null ? _f : payload.id
@@ -4682,18 +4671,18 @@ function User_hierarchy_mapping_main() {
4682
4671
  isActive: (_g = payload.isActive) != null ? _g : true,
4683
4672
  updatedBy: payload.updatedBy || "System"
4684
4673
  } : payload;
4685
- await getApiService()[isEdit ? "put" : "post"](endpoint, requestPayload);
4686
- await import_sweetalert210.default.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
4674
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, requestPayload);
4675
+ await import_sweetalert211.default.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
4687
4676
  handleRefresh();
4688
4677
  return true;
4689
4678
  } catch (error) {
4690
- await import_sweetalert210.default.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");
4679
+ await import_sweetalert211.default.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");
4691
4680
  return false;
4692
4681
  }
4693
4682
  };
4694
4683
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:min-h-screen fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
4695
4684
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
4696
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CommonHeader, { title: "Workflow Step User Mapping", breadcrumbs: [{
4685
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CommonHeader, { title: "Workflow Hierarchy Mapping", breadcrumbs: [{
4697
4686
  label: "Dashboard",
4698
4687
  href: "/dashboard"
4699
4688
  }, {
@@ -4703,8 +4692,8 @@ function User_hierarchy_mapping_main() {
4703
4692
  label: "Hierarchy",
4704
4693
  href: "/hierarchy"
4705
4694
  }, {
4706
- label: "User Hierarchy Mapping",
4707
- href: "/user hierarchy mapping"
4695
+ label: "Workflow Hierarchy Mapping",
4696
+ href: "/Workflow-Hierarchy-Mapping"
4708
4697
  }], buttonText: "Add Mapping", onButtonClick: () => setModalOpen(true) }),
4709
4698
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("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: [
4710
4699
  /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
@@ -4729,7 +4718,7 @@ function User_hierarchy_mapping_main() {
4729
4718
 
4730
4719
  // src/components/document-configuration/DocumentConfigurationmain.jsx
4731
4720
  var import_react33 = __toESM(require("react"));
4732
- var import_sweetalert212 = __toESM(require("sweetalert2"));
4721
+ var import_sweetalert213 = __toESM(require("sweetalert2"));
4733
4722
  init_ApiEndpointsProvider();
4734
4723
  init_ApiServicepackage();
4735
4724
 
@@ -4752,7 +4741,7 @@ function SearchBar3({
4752
4741
 
4753
4742
  // src/components/document-configuration/DocumentConfigurationTable.jsx
4754
4743
  var import_react31 = __toESM(require("react"));
4755
- var import_sweetalert211 = __toESM(require("sweetalert2"));
4744
+ var import_sweetalert212 = __toESM(require("sweetalert2"));
4756
4745
 
4757
4746
  // src/components/document-configuration/Edit.jsx
4758
4747
  var import_react29 = __toESM(require("react"));
@@ -4784,9 +4773,9 @@ function EditDocumentConfiguration({
4784
4773
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
4785
4774
  try {
4786
4775
  setLoadingSteps(true);
4787
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
4788
- if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
4789
- const result = await getApiService().get(endpoint);
4776
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
4777
+ if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
4778
+ const result = await getApiService().get(endpoint2);
4790
4779
  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;
4791
4780
  setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
4792
4781
  } catch (_) {
@@ -5248,13 +5237,13 @@ function DocumentConfigTable({
5248
5237
  var _a, _b, _c, _d, _e;
5249
5238
  try {
5250
5239
  setIsLoading(true);
5251
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
5252
- if (!endpoint) throw new Error("Document Configuration list endpoint is not configured.");
5253
- const result = await getApiService().post(endpoint, {});
5240
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
5241
+ if (!endpoint2) throw new Error("Document Configuration list endpoint is not configured.");
5242
+ const result = await getApiService().post(endpoint2, {});
5254
5243
  setData(unwrapRows(result).map(toUiItem));
5255
5244
  } catch (error) {
5256
5245
  setData([]);
5257
- await import_sweetalert211.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to load document configurations.", "error");
5246
+ await import_sweetalert212.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to load document configurations.", "error");
5258
5247
  } finally {
5259
5248
  setIsLoading(false);
5260
5249
  }
@@ -5289,22 +5278,22 @@ function DocumentConfigTable({
5289
5278
  },
5290
5279
  (_, i) => i + 1
5291
5280
  );
5292
- const buildGetByIdUrl = (endpoint, id) => {
5293
- if (endpoint.includes("{id}")) return endpoint.replace("{id}", encodeURIComponent(id));
5294
- return `${endpoint.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
5281
+ const buildGetByIdUrl = (endpoint2, id) => {
5282
+ if (endpoint2.includes("{id}")) return endpoint2.replace("{id}", encodeURIComponent(id));
5283
+ return `${endpoint2.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
5295
5284
  };
5296
5285
  const handleEdit = async (item) => {
5297
5286
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
5298
5287
  try {
5299
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
5300
- if (!endpoint) throw new Error("Document Configuration get-by-id endpoint is not configured.");
5301
- const url = typeof endpoint === "function" ? endpoint(item.id) : buildGetByIdUrl(endpoint, item.id);
5288
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
5289
+ if (!endpoint2) throw new Error("Document Configuration get-by-id endpoint is not configured.");
5290
+ const url = typeof endpoint2 === "function" ? endpoint2(item.id) : buildGetByIdUrl(endpoint2, item.id);
5302
5291
  const result = await getApiService().get(url);
5303
5292
  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;
5304
5293
  setSelectedItem(toUiItem(value != null ? value : item));
5305
5294
  setIsEditOpen(true);
5306
5295
  } catch (error) {
5307
- await import_sweetalert211.default.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");
5296
+ await import_sweetalert212.default.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");
5308
5297
  }
5309
5298
  };
5310
5299
  const handleDelete = (item) => {
@@ -5314,13 +5303,13 @@ function DocumentConfigTable({
5314
5303
  const handleSaveEdit = async (updatedData) => {
5315
5304
  var _a, _b, _c, _d, _e, _f;
5316
5305
  try {
5317
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5318
- if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
5306
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5307
+ if (!endpoint2) throw new Error("Document Configuration update endpoint is not configured.");
5319
5308
  const maxSizeMB = Number.parseFloat((_d = updatedData.maxSizeNum) != null ? _d : updatedData.maxSize);
5320
5309
  if (!Number.isFinite(maxSizeMB) || maxSizeMB <= 0) {
5321
5310
  throw new Error("Please enter a valid maximum size in MB.");
5322
5311
  }
5323
- await getApiService().put(endpoint, {
5312
+ await getApiService().put(endpoint2, {
5324
5313
  documentConfigurationId: updatedData.id,
5325
5314
  documentName: updatedData.docName.trim(),
5326
5315
  allowedExtensions: updatedData.extensions.trim(),
@@ -5329,12 +5318,12 @@ function DocumentConfigTable({
5329
5318
  isActive: updatedData.status === "Active",
5330
5319
  updatedBy: "System"
5331
5320
  });
5332
- await import_sweetalert211.default.fire("Success", "Document configuration updated successfully.", "success");
5321
+ await import_sweetalert212.default.fire("Success", "Document configuration updated successfully.", "success");
5333
5322
  setIsEditOpen(false);
5334
5323
  await loadData();
5335
5324
  return true;
5336
5325
  } catch (error) {
5337
- await import_sweetalert211.default.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");
5326
+ await import_sweetalert212.default.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");
5338
5327
  return false;
5339
5328
  }
5340
5329
  };
@@ -5540,9 +5529,9 @@ function AddDocumentConfigModal({
5540
5529
  setLoadingSteps(true);
5541
5530
  const { getApiEndpoints: getApiEndpoints2 } = await Promise.resolve().then(() => (init_ApiEndpointsProvider(), ApiEndpointsProvider_exports));
5542
5531
  const { getApiService: getApiService2 } = await Promise.resolve().then(() => (init_ApiServicepackage(), ApiServicepackage_exports));
5543
- const endpoint = (_c = (_b = (_a = getApiEndpoints2()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
5544
- if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
5545
- const result = await getApiService2().get(endpoint);
5532
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints2()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
5533
+ if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
5534
+ const result = await getApiService2().get(endpoint2);
5546
5535
  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;
5547
5536
  setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
5548
5537
  } catch (_) {
@@ -5729,15 +5718,15 @@ function DocumentConfigurationmain() {
5729
5718
  const handleCreate = async (payload) => {
5730
5719
  var _a, _b, _c, _d, _e;
5731
5720
  try {
5732
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
5733
- if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
5734
- await getApiService().post(endpoint, payload);
5735
- await import_sweetalert212.default.fire("Success", "Document configuration created successfully.", "success");
5721
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
5722
+ if (!endpoint2) throw new Error("Document Configuration create endpoint is not configured.");
5723
+ await getApiService().post(endpoint2, payload);
5724
+ await import_sweetalert213.default.fire("Success", "Document configuration created successfully.", "success");
5736
5725
  setModalOpen(false);
5737
5726
  handleRefresh();
5738
5727
  return true;
5739
5728
  } catch (error) {
5740
- await import_sweetalert212.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create document configuration.", "error");
5729
+ await import_sweetalert213.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create document configuration.", "error");
5741
5730
  return false;
5742
5731
  }
5743
5732
  };
@@ -6796,7 +6785,7 @@ function MovementHistorymain() {
6796
6785
 
6797
6786
  // src/components/task-permission/TaskPermissionMain.jsx
6798
6787
  var import_react46 = __toESM(require("react"));
6799
- var import_sweetalert214 = __toESM(require("sweetalert2"));
6788
+ var import_sweetalert215 = __toESM(require("sweetalert2"));
6800
6789
 
6801
6790
  // src/components/task-permission/SearchBar.js
6802
6791
  var import_react42 = __toESM(require("react"));
@@ -6926,6 +6915,12 @@ function Table({
6926
6915
  { label: "Can Edit", key: "canEdit" },
6927
6916
  { label: "Can Approve", key: "canApprove" },
6928
6917
  { label: "Can Reject", key: "canReject" },
6918
+ { label: "Can Forward", key: "canForward" },
6919
+ { label: "Can Free Forward", key: "canFreeForward" },
6920
+ { label: "Can Return", key: "canReturn" },
6921
+ { label: "Can Return To Applicant", key: "canReturnToApplicant" },
6922
+ { label: "Can Delegate", key: "canDelegate" },
6923
+ { label: "Can Hold", key: "canHold" },
6929
6924
  { label: "Active", key: "isActive" }
6930
6925
  ];
6931
6926
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "fc:space-y-5", children: [
@@ -6950,7 +6945,7 @@ function Table({
6950
6945
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6951
6946
  "td",
6952
6947
  {
6953
- colSpan: 9,
6948
+ colSpan: columns.length + 2,
6954
6949
  className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm",
6955
6950
  children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
6956
6951
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
@@ -6982,15 +6977,15 @@ function Table({
6982
6977
  ]
6983
6978
  }
6984
6979
  ),
6985
- "Loading task permissions..."
6980
+ "Loading step permissions..."
6986
6981
  ] })
6987
6982
  }
6988
6983
  ) }) : visibleData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
6989
6984
  "td",
6990
6985
  {
6991
- colSpan: 9,
6986
+ colSpan: columns.length + 2,
6992
6987
  className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm",
6993
- children: "No task permissions found."
6988
+ children: "No step permissions found."
6994
6989
  }
6995
6990
  ) }) : visibleData.map((item, index) => {
6996
6991
  var _a, _b, _c, _d;
@@ -7006,6 +7001,12 @@ function Table({
7006
7001
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canEdit }) }),
7007
7002
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canApprove }) }),
7008
7003
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canReject }) }),
7004
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canForward }) }),
7005
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canFreeForward }) }),
7006
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canReturn }) }),
7007
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canReturnToApplicant }) }),
7008
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canDelegate }) }),
7009
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canHold }) }),
7009
7010
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.isActive }) }),
7010
7011
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:sticky fc:right-0 fc:bg-white fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
7011
7012
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
@@ -7067,7 +7068,7 @@ function Table({
7067
7068
 
7068
7069
  // src/components/task-permission/Popup.js
7069
7070
  var import_react44 = __toESM(require("react"));
7070
- var import_sweetalert213 = __toESM(require("sweetalert2"));
7071
+ var import_sweetalert214 = __toESM(require("sweetalert2"));
7071
7072
  init_ApiEndpointsProvider();
7072
7073
  init_ApiServicepackage();
7073
7074
  var import_jsx_runtime44 = require("react/jsx-runtime");
@@ -7077,7 +7078,14 @@ function Popup({ isOpen, onClose, onSave }) {
7077
7078
  canView: false,
7078
7079
  canEdit: false,
7079
7080
  canApprove: false,
7080
- canReject: false
7081
+ canReject: false,
7082
+ canForward: false,
7083
+ canFreeForward: false,
7084
+ canReturn: false,
7085
+ canReturnToApplicant: false,
7086
+ canDelegate: false,
7087
+ canHold: false,
7088
+ isActive: true
7081
7089
  });
7082
7090
  const [errors, setErrors] = (0, import_react44.useState)({});
7083
7091
  const [isSubmitting, setIsSubmitting] = (0, import_react44.useState)(false);
@@ -7089,9 +7097,9 @@ function Popup({ isOpen, onClose, onSave }) {
7089
7097
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7090
7098
  try {
7091
7099
  setLoadingSteps(true);
7092
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
7093
- if (!endpoint) return;
7094
- const result = await getApiService().get(endpoint);
7100
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
7101
+ if (!endpoint2) return;
7102
+ const result = await getApiService().get(endpoint2);
7095
7103
  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;
7096
7104
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
7097
7105
  setWorkflowSteps(rows);
@@ -7103,7 +7111,20 @@ function Popup({ isOpen, onClose, onSave }) {
7103
7111
  }, [isOpen]);
7104
7112
  (0, import_react44.useEffect)(() => {
7105
7113
  if (!isOpen) {
7106
- setFormData({ workflowStepId: "", canView: false, canEdit: false, canApprove: false, canReject: false });
7114
+ setFormData({
7115
+ workflowStepId: "",
7116
+ canView: false,
7117
+ canEdit: false,
7118
+ canApprove: false,
7119
+ canReject: false,
7120
+ canForward: false,
7121
+ canFreeForward: false,
7122
+ canReturn: false,
7123
+ canReturnToApplicant: false,
7124
+ canDelegate: false,
7125
+ canHold: false,
7126
+ isActive: true
7127
+ });
7107
7128
  setErrors({});
7108
7129
  }
7109
7130
  }, [isOpen]);
@@ -7124,31 +7145,44 @@ function Popup({ isOpen, onClose, onSave }) {
7124
7145
  if (!validate()) return;
7125
7146
  try {
7126
7147
  setIsSubmitting(true);
7127
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.create;
7128
- if (!endpoint) throw new Error("Task Permission create endpoint is not configured.");
7148
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.create;
7149
+ if (!endpoint2) throw new Error("Step Permission create endpoint is not configured.");
7129
7150
  const payload = {
7130
7151
  workflowStepId: Number(formData.workflowStepId) || 0,
7131
7152
  canView: Boolean(formData.canView),
7132
7153
  canEdit: Boolean(formData.canEdit),
7133
7154
  canApprove: Boolean(formData.canApprove),
7134
7155
  canReject: Boolean(formData.canReject),
7156
+ canForward: Boolean(formData.canForward),
7157
+ canFreeForward: Boolean(formData.canFreeForward),
7158
+ canReturn: Boolean(formData.canReturn),
7159
+ canReturnToApplicant: Boolean(formData.canReturnToApplicant),
7160
+ canDelegate: Boolean(formData.canDelegate),
7161
+ canHold: Boolean(formData.canHold),
7162
+ isActive: Boolean(formData.isActive),
7135
7163
  createdBy: "System"
7136
7164
  };
7137
- await getApiService().post(endpoint, payload);
7165
+ await getApiService().post(endpoint2, payload);
7138
7166
  onClose();
7139
7167
  await (onSave == null ? void 0 : onSave());
7140
7168
  } catch (error) {
7141
- 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.";
7142
- await import_sweetalert213.default.fire("Error", msg, "error");
7169
+ 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.";
7170
+ await import_sweetalert214.default.fire("Error", msg, "error");
7143
7171
  } finally {
7144
7172
  setIsSubmitting(false);
7145
7173
  }
7146
7174
  };
7147
7175
  const permissionCards = [
7148
- { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs", field: "canView" },
7149
- { icon: "\u2713", title: "Can Approve", desc: "Pass states", field: "canApprove" },
7150
- { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify props", field: "canEdit" },
7151
- { icon: "\u2715", title: "Can Reject", desc: "Cancel tasks", field: "canReject" }
7176
+ { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs & details", field: "canView" },
7177
+ { icon: "\u2713", title: "Can Approve", desc: "Pass states & approve", field: "canApprove" },
7178
+ { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify properties", field: "canEdit" },
7179
+ { icon: "\u2715", title: "Can Reject", desc: "Cancel / reject tasks", field: "canReject" },
7180
+ { icon: "\u27A1\uFE0F", title: "Can Forward", desc: "Forward to next step", field: "canForward" },
7181
+ { icon: "\u23E9", title: "Can Free Forward", desc: "Forward freely to any step", field: "canFreeForward" },
7182
+ { icon: "\u21A9\uFE0F", title: "Can Return", desc: "Return to previous step", field: "canReturn" },
7183
+ { icon: "\u{1F464}", title: "Can Return To Applicant", desc: "Send back to applicant", field: "canReturnToApplicant" },
7184
+ { icon: "\u{1F465}", title: "Can Delegate", desc: "Reassign or delegate task", field: "canDelegate" },
7185
+ { icon: "\u23F8\uFE0F", title: "Can Hold", desc: "Put execution on hold", field: "canHold" }
7152
7186
  ];
7153
7187
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
7154
7188
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
@@ -7157,7 +7191,7 @@ function Popup({ isOpen, onClose, onSave }) {
7157
7191
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
7158
7192
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("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}" }),
7159
7193
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
7160
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Task Permission" }),
7194
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Step Permission" }),
7161
7195
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Configure step details and initial user control access rules" })
7162
7196
  ] })
7163
7197
  ] }),
@@ -7227,6 +7261,30 @@ function Popup({ isOpen, onClose, onSave }) {
7227
7261
  }
7228
7262
  )
7229
7263
  ] }, field)) })
7264
+ ] }),
7265
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("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: [
7266
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("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: [
7267
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "\u{1F518}" }),
7268
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Status" })
7269
+ ] }),
7270
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [{ label: "Active", val: true }, { label: "Inactive", val: false }].map(({ label, val }) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
7271
+ "div",
7272
+ {
7273
+ onClick: () => handleChange("isActive", val),
7274
+ 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"}`,
7275
+ children: [
7276
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
7277
+ "div",
7278
+ {
7279
+ 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"}`,
7280
+ children: formData.isActive === val && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:w-1.5 fc:h-1.5 fc:bg-white fc:rounded-full" })
7281
+ }
7282
+ ),
7283
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fc:text-xs fc:font-bold fc:text-slate-800", children: label })
7284
+ ]
7285
+ },
7286
+ label
7287
+ )) })
7230
7288
  ] })
7231
7289
  ] }),
7232
7290
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("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: [
@@ -7273,6 +7331,12 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7273
7331
  canEdit: false,
7274
7332
  canApprove: false,
7275
7333
  canReject: false,
7334
+ canForward: false,
7335
+ canFreeForward: false,
7336
+ canReturn: false,
7337
+ canReturnToApplicant: false,
7338
+ canDelegate: false,
7339
+ canHold: false,
7276
7340
  isActive: true,
7277
7341
  updatedBy: "System"
7278
7342
  });
@@ -7286,9 +7350,9 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7286
7350
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
7287
7351
  try {
7288
7352
  setLoadingSteps(true);
7289
- const endpoint = (_c = (_b = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
7290
- if (!endpoint) return;
7291
- const result = await getApiService().get(endpoint);
7353
+ const endpoint2 = (_c = (_b = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
7354
+ if (!endpoint2) return;
7355
+ const result = await getApiService().get(endpoint2);
7292
7356
  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;
7293
7357
  const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
7294
7358
  setWorkflowSteps(rows);
@@ -7299,7 +7363,7 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7299
7363
  })();
7300
7364
  }, [isOpen]);
7301
7365
  (0, import_react45.useEffect)(() => {
7302
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
7366
+ 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;
7303
7367
  if (selectedData) {
7304
7368
  setFormData({
7305
7369
  workflowStepId: (_b = (_a2 = selectedData.workflowStepId) != null ? _a2 : selectedData.WorkflowStepId) != null ? _b : "",
@@ -7307,8 +7371,14 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7307
7371
  canEdit: (_f = (_e = selectedData.canEdit) != null ? _e : selectedData.CanEdit) != null ? _f : false,
7308
7372
  canApprove: (_h = (_g = selectedData.canApprove) != null ? _g : selectedData.CanApprove) != null ? _h : false,
7309
7373
  canReject: (_j = (_i = selectedData.canReject) != null ? _i : selectedData.CanReject) != null ? _j : false,
7310
- isActive: (_l = (_k = selectedData.isActive) != null ? _k : selectedData.IsActive) != null ? _l : true,
7311
- updatedBy: (_n = (_m = selectedData.updatedBy) != null ? _m : selectedData.UpdatedBy) != null ? _n : "System"
7374
+ canForward: (_l = (_k = selectedData.canForward) != null ? _k : selectedData.CanForward) != null ? _l : false,
7375
+ canFreeForward: (_n = (_m = selectedData.canFreeForward) != null ? _m : selectedData.CanFreeForward) != null ? _n : false,
7376
+ canReturn: (_p = (_o = selectedData.canReturn) != null ? _o : selectedData.CanReturn) != null ? _p : false,
7377
+ canReturnToApplicant: (_r = (_q = selectedData.canReturnToApplicant) != null ? _q : selectedData.CanReturnToApplicant) != null ? _r : false,
7378
+ canDelegate: (_t = (_s = selectedData.canDelegate) != null ? _s : selectedData.CanDelegate) != null ? _t : false,
7379
+ canHold: (_v = (_u = selectedData.canHold) != null ? _u : selectedData.CanHold) != null ? _v : false,
7380
+ isActive: (_x = (_w = selectedData.isActive) != null ? _w : selectedData.IsActive) != null ? _x : true,
7381
+ updatedBy: (_z = (_y = selectedData.updatedBy) != null ? _y : selectedData.UpdatedBy) != null ? _z : "System"
7312
7382
  });
7313
7383
  setErrors({});
7314
7384
  }
@@ -7336,6 +7406,12 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7336
7406
  canEdit: Boolean(formData.canEdit),
7337
7407
  canApprove: Boolean(formData.canApprove),
7338
7408
  canReject: Boolean(formData.canReject),
7409
+ canForward: Boolean(formData.canForward),
7410
+ canFreeForward: Boolean(formData.canFreeForward),
7411
+ canReturn: Boolean(formData.canReturn),
7412
+ canReturnToApplicant: Boolean(formData.canReturnToApplicant),
7413
+ canDelegate: Boolean(formData.canDelegate),
7414
+ canHold: Boolean(formData.canHold),
7339
7415
  isActive: Boolean(formData.isActive),
7340
7416
  updatedBy: String(formData.updatedBy).trim() || "System"
7341
7417
  });
@@ -7347,10 +7423,16 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7347
7423
  }
7348
7424
  };
7349
7425
  const permissionCards = [
7350
- { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs", field: "canView" },
7351
- { icon: "\u2713", title: "Can Approve", desc: "Pass states", field: "canApprove" },
7352
- { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify props", field: "canEdit" },
7353
- { icon: "\u2715", title: "Can Reject", desc: "Cancel tasks", field: "canReject" }
7426
+ { icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs & details", field: "canView" },
7427
+ { icon: "\u2713", title: "Can Approve", desc: "Pass states & approve", field: "canApprove" },
7428
+ { icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify properties", field: "canEdit" },
7429
+ { icon: "\u2715", title: "Can Reject", desc: "Cancel / reject tasks", field: "canReject" },
7430
+ { icon: "\u27A1\uFE0F", title: "Can Forward", desc: "Forward to next step", field: "canForward" },
7431
+ { icon: "\u23E9", title: "Can Free Forward", desc: "Forward freely to any step", field: "canFreeForward" },
7432
+ { icon: "\u21A9\uFE0F", title: "Can Return", desc: "Return to previous step", field: "canReturn" },
7433
+ { icon: "\u{1F464}", title: "Can Return To Applicant", desc: "Send back to applicant", field: "canReturnToApplicant" },
7434
+ { icon: "\u{1F465}", title: "Can Delegate", desc: "Reassign or delegate task", field: "canDelegate" },
7435
+ { icon: "\u23F8\uFE0F", title: "Can Hold", desc: "Put execution on hold", field: "canHold" }
7354
7436
  ];
7355
7437
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
7356
7438
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
@@ -7359,7 +7441,7 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
7359
7441
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
7360
7442
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("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}" }),
7361
7443
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
7362
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Task Permission" }),
7444
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Step Permission" }),
7363
7445
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: [
7364
7446
  "Update step access rules \u2014 ID: ",
7365
7447
  /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "fc:font-bold fc:text-slate-600", children: [
@@ -7527,29 +7609,35 @@ function TaskPermissionMain() {
7527
7609
  const handleUpdateApi = async (item) => {
7528
7610
  var _a, _b, _c, _d, _e, _f, _g;
7529
7611
  try {
7530
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.update;
7531
- if (!endpoint) throw new Error("Task Permission update endpoint is not configured.");
7532
- await getApiService().put(endpoint, {
7612
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.update;
7613
+ if (!endpoint2) throw new Error("Step Permission update endpoint is not configured.");
7614
+ await getApiService().put(endpoint2, {
7533
7615
  taskPermissionId: (_e = (_d = item.taskPermissionId) != null ? _d : item.TaskPermissionId) != null ? _e : 0,
7534
7616
  workflowStepId: Number(item.workflowStepId) || 0,
7535
7617
  canView: Boolean(item.canView),
7536
7618
  canEdit: Boolean(item.canEdit),
7537
7619
  canApprove: Boolean(item.canApprove),
7538
7620
  canReject: Boolean(item.canReject),
7621
+ canForward: Boolean(item.canForward),
7622
+ canFreeForward: Boolean(item.canFreeForward),
7623
+ canReturn: Boolean(item.canReturn),
7624
+ canReturnToApplicant: Boolean(item.canReturnToApplicant),
7625
+ canDelegate: Boolean(item.canDelegate),
7626
+ canHold: Boolean(item.canHold),
7539
7627
  isActive: Boolean(item.isActive),
7540
7628
  updatedBy: item.updatedBy || "System"
7541
7629
  });
7542
7630
  handleRefresh();
7543
7631
  return true;
7544
7632
  } catch (error) {
7545
- await import_sweetalert214.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to update task permission.", "error");
7633
+ await import_sweetalert215.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to update step permission.", "error");
7546
7634
  return false;
7547
7635
  }
7548
7636
  };
7549
7637
  const handleDeleteApi = async (item) => {
7550
7638
  var _a;
7551
- const confirm = await import_sweetalert214.default.fire({
7552
- title: "Delete Task Permission?",
7639
+ const confirm = await import_sweetalert215.default.fire({
7640
+ title: "Delete Step Permission?",
7553
7641
  text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
7554
7642
  icon: "warning",
7555
7643
  showCancelButton: true,
@@ -7558,11 +7646,11 @@ function TaskPermissionMain() {
7558
7646
  });
7559
7647
  if (!confirm.isConfirmed) return;
7560
7648
  const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
7561
- if (ok) await import_sweetalert214.default.fire("Deleted", "Task permission has been deactivated.", "success");
7649
+ if (ok) await import_sweetalert215.default.fire("Deleted", "Step permission has been deactivated.", "success");
7562
7650
  };
7563
7651
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
7564
7652
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
7565
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CommonHeader, { title: "Task Permission", breadcrumbs: [{
7653
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CommonHeader, { title: "Step Permission", breadcrumbs: [{
7566
7654
  label: "Dashboard",
7567
7655
  href: "/dashboard"
7568
7656
  }, {
@@ -7572,9 +7660,9 @@ function TaskPermissionMain() {
7572
7660
  label: "Permissions",
7573
7661
  href: "/permissions"
7574
7662
  }, {
7575
- label: "TaskPermission",
7576
- href: "/task-permission"
7577
- }], buttonText: "Add Task Permission", onButtonClick: () => setShowModal(true) }),
7663
+ label: "StepPermission",
7664
+ href: "/step-permission"
7665
+ }], buttonText: "Add Step Permission", onButtonClick: () => setShowModal(true) }),
7578
7666
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("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: [
7579
7667
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
7580
7668
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SearchBar6, { searchQuery, setSearchQuery, setCurrentPage }) }),
@@ -7611,7 +7699,7 @@ function TaskPermissionMain() {
7611
7699
  isOpen: showModal,
7612
7700
  onClose: () => setShowModal(false),
7613
7701
  onSave: async () => {
7614
- await import_sweetalert214.default.fire("Success", "Task permission created successfully.", "success");
7702
+ await import_sweetalert215.default.fire("Success", "Step permission created successfully.", "success");
7615
7703
  handleRefresh();
7616
7704
  }
7617
7705
  }
@@ -7623,7 +7711,7 @@ function TaskPermissionMain() {
7623
7711
  onClose: () => setIsEditOpen(false),
7624
7712
  selectedData: selectedItem,
7625
7713
  onSave: async () => {
7626
- await import_sweetalert214.default.fire("Success", "Task permission updated successfully.", "success");
7714
+ await import_sweetalert215.default.fire("Success", "Step permission updated successfully.", "success");
7627
7715
  handleRefresh();
7628
7716
  },
7629
7717
  onUpdate: handleUpdateApi
@@ -10193,7 +10281,7 @@ function Comment_main() {
10193
10281
 
10194
10282
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
10195
10283
  var import_react70 = __toESM(require("react"));
10196
- var import_sweetalert215 = __toESM(require("sweetalert2"));
10284
+ var import_sweetalert216 = __toESM(require("sweetalert2"));
10197
10285
  init_ApiEndpointsProvider();
10198
10286
  init_ApiServicepackage();
10199
10287
 
@@ -10793,13 +10881,13 @@ function HierarchyNodeMain() {
10793
10881
  (async () => {
10794
10882
  var _a, _b, _c, _d, _e, _f, _g;
10795
10883
  try {
10796
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c.getList;
10797
- if (!endpoint) throw Error("Hierarchy node list endpoint is not configured.");
10798
- const result = await getApiService().get(endpoint);
10884
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c.getList;
10885
+ if (!endpoint2) throw Error("Hierarchy node list endpoint is not configured.");
10886
+ const result = await getApiService().get(endpoint2);
10799
10887
  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;
10800
10888
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
10801
10889
  } catch (error) {
10802
- await import_sweetalert215.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
10890
+ await import_sweetalert216.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
10803
10891
  }
10804
10892
  })();
10805
10893
  }, [refreshKey]);
@@ -10809,14 +10897,14 @@ function HierarchyNodeMain() {
10809
10897
  const saveNode = async (payload, isEdit = false) => {
10810
10898
  var _a, _b, _c, _d, _e;
10811
10899
  try {
10812
- const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
10813
- if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
10814
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
10815
- await import_sweetalert215.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
10900
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
10901
+ if (!endpoint2) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
10902
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
10903
+ await import_sweetalert216.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
10816
10904
  handleRefresh();
10817
10905
  return true;
10818
10906
  } catch (error) {
10819
- await import_sweetalert215.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
10907
+ await import_sweetalert216.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
10820
10908
  return false;
10821
10909
  }
10822
10910
  };
@@ -11526,7 +11614,7 @@ function UploadedDocumentMain() {
11526
11614
 
11527
11615
  // src/components/BuisnessEntity/BusinessEntitymain.js
11528
11616
  var import_react80 = __toESM(require("react"));
11529
- var import_sweetalert216 = __toESM(require("sweetalert2"));
11617
+ var import_sweetalert217 = __toESM(require("sweetalert2"));
11530
11618
 
11531
11619
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
11532
11620
  var import_react79 = __toESM(require("react"));
@@ -11859,15 +11947,15 @@ var getBusinessEntityEndpoint = (action) => {
11859
11947
  }
11860
11948
  };
11861
11949
  var getBusinessEntityByIdEndpoint = (id) => {
11862
- const endpoint = getBusinessEntityEndpoint("getById");
11863
- return typeof endpoint === "function" ? endpoint(id) : `${endpoint}/${id}`;
11950
+ const endpoint2 = getBusinessEntityEndpoint("getById");
11951
+ return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
11864
11952
  };
11865
- var getRows = (response) => {
11953
+ var getRows2 = (response) => {
11866
11954
  var _a, _b, _c, _d, _e, _f, _g;
11867
11955
  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;
11868
11956
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
11869
11957
  };
11870
- var normalise = (item) => {
11958
+ var normalise2 = (item) => {
11871
11959
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
11872
11960
  return __spreadProps(__spreadValues({}, item), {
11873
11961
  businessEntityId: (_b = (_a = item.businessEntityId) != null ? _a : item.BusinessEntityId) != null ? _b : item.id,
@@ -11891,11 +11979,11 @@ function BusinessEntity() {
11891
11979
  const load = async () => {
11892
11980
  var _a, _b;
11893
11981
  try {
11894
- const endpoint = getBusinessEntityEndpoint("getList");
11895
- const response = await getApiService().get(endpoint);
11896
- setRows(getRows(response).map(normalise));
11982
+ const endpoint2 = getBusinessEntityEndpoint("getList");
11983
+ const response = await getApiService().get(endpoint2);
11984
+ setRows(getRows2(response).map(normalise2));
11897
11985
  } catch (error) {
11898
- await import_sweetalert216.default.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");
11986
+ await import_sweetalert217.default.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");
11899
11987
  }
11900
11988
  };
11901
11989
  load();
@@ -11904,13 +11992,13 @@ function BusinessEntity() {
11904
11992
  const saveEntity = async (payload, isEdit) => {
11905
11993
  var _a, _b;
11906
11994
  try {
11907
- const endpoint = getBusinessEntityEndpoint(isEdit ? "update" : "create");
11908
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
11909
- await import_sweetalert216.default.fire("Success", `Business entity ${isEdit ? "updated" : "created"} successfully.`, "success");
11995
+ const endpoint2 = getBusinessEntityEndpoint(isEdit ? "update" : "create");
11996
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
11997
+ await import_sweetalert217.default.fire("Success", `Business entity ${isEdit ? "updated" : "created"} successfully.`, "success");
11910
11998
  refresh();
11911
11999
  return true;
11912
12000
  } catch (error) {
11913
- await import_sweetalert216.default.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");
12001
+ await import_sweetalert217.default.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");
11914
12002
  return false;
11915
12003
  }
11916
12004
  };
@@ -11918,11 +12006,11 @@ function BusinessEntity() {
11918
12006
  var _a, _b, _c, _d, _e, _f, _g, _h;
11919
12007
  try {
11920
12008
  const response = await getApiService().get(getBusinessEntityByIdEndpoint(entity.businessEntityId));
11921
- 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;
11922
- setEditingEntity(normalise(data));
12009
+ 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;
12010
+ setEditingEntity(normalise2(data));
11923
12011
  setShowModal(true);
11924
12012
  } catch (error) {
11925
- await import_sweetalert216.default.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");
12013
+ await import_sweetalert217.default.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");
11926
12014
  }
11927
12015
  };
11928
12016
  const visibleRows = rows.filter((item) => [item.entityType, item.entityKey, item.displayNumber, item.displayTitle].join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
@@ -11980,7 +12068,7 @@ function BusinessEntity() {
11980
12068
 
11981
12069
  // src/components/FileInstance/FileInstancemain.js
11982
12070
  var import_react82 = __toESM(require("react"));
11983
- var import_sweetalert217 = __toESM(require("sweetalert2"));
12071
+ var import_sweetalert218 = __toESM(require("sweetalert2"));
11984
12072
 
11985
12073
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
11986
12074
  var import_react81 = __toESM(require("react"));
@@ -12386,15 +12474,15 @@ var getFileInstanceEndpoint = (action) => {
12386
12474
  }
12387
12475
  };
12388
12476
  var getFileInstanceByIdEndpoint = (id) => {
12389
- const endpoint = getFileInstanceEndpoint("getById");
12390
- return typeof endpoint === "function" ? endpoint(id) : `${endpoint}/${id}`;
12477
+ const endpoint2 = getFileInstanceEndpoint("getById");
12478
+ return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
12391
12479
  };
12392
- var getRows2 = (response) => {
12480
+ var getRows3 = (response) => {
12393
12481
  var _a, _b, _c, _d, _e, _f, _g;
12394
12482
  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;
12395
12483
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
12396
12484
  };
12397
- var normalise2 = (item) => {
12485
+ var normalise3 = (item) => {
12398
12486
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
12399
12487
  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 });
12400
12488
  };
@@ -12412,9 +12500,9 @@ function FileInstance() {
12412
12500
  var _a, _b;
12413
12501
  try {
12414
12502
  const response = await getApiService().get(getFileInstanceEndpoint("getList"));
12415
- setRows(getRows2(response).map(normalise2));
12503
+ setRows(getRows3(response).map(normalise3));
12416
12504
  } catch (error) {
12417
- await import_sweetalert217.default.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");
12505
+ await import_sweetalert218.default.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");
12418
12506
  }
12419
12507
  };
12420
12508
  load();
@@ -12423,13 +12511,13 @@ function FileInstance() {
12423
12511
  const saveFile = async (payload, isEdit) => {
12424
12512
  var _a, _b;
12425
12513
  try {
12426
- const endpoint = getFileInstanceEndpoint(isEdit ? "update" : "create");
12427
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
12428
- await import_sweetalert217.default.fire("Success", `File instance ${isEdit ? "updated" : "created"} successfully.`, "success");
12514
+ const endpoint2 = getFileInstanceEndpoint(isEdit ? "update" : "create");
12515
+ await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
12516
+ await import_sweetalert218.default.fire("Success", `File instance ${isEdit ? "updated" : "created"} successfully.`, "success");
12429
12517
  refresh();
12430
12518
  return true;
12431
12519
  } catch (error) {
12432
- await import_sweetalert217.default.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");
12520
+ await import_sweetalert218.default.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");
12433
12521
  return false;
12434
12522
  }
12435
12523
  };
@@ -12437,11 +12525,11 @@ function FileInstance() {
12437
12525
  var _a, _b, _c, _d, _e, _f, _g, _h;
12438
12526
  try {
12439
12527
  const response = await getApiService().get(getFileInstanceByIdEndpoint(file.fileInstanceId));
12440
- 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;
12441
- setEditingFile(normalise2(data));
12528
+ 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;
12529
+ setEditingFile(normalise3(data));
12442
12530
  setShowModal(true);
12443
12531
  } catch (error) {
12444
- await import_sweetalert217.default.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");
12532
+ await import_sweetalert218.default.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");
12445
12533
  }
12446
12534
  };
12447
12535
  const columns = [["FileInstanceId", "fileInstanceId"], ["WorkflowId", "workflowId"], ["BusinessEntityType", "businessEntityType"], ["BusinessEntityId", "businessEntityId"], ["HierarchyNodeId", "hierarchyNodeId"], ["CurrentStepId", "currentStepId"], ["CurrentTaskInstanceId", "currentTaskInstanceId"], ["Status", "status"], ["Priority", "priority"]];
@@ -12495,6 +12583,7 @@ function FileInstance() {
12495
12583
 
12496
12584
  // src/components/assignment-rule/AssignmentRuleMain.jsx
12497
12585
  var import_react86 = __toESM(require("react"));
12586
+ var import_sweetalert219 = __toESM(require("sweetalert2"));
12498
12587
 
12499
12588
  // src/components/assignment-rule/SearchBar.js
12500
12589
  var import_react83 = __toESM(require("react"));
@@ -12519,457 +12608,333 @@ function SearchBar12({
12519
12608
  // src/components/assignment-rule/Table.js
12520
12609
  var import_react84 = __toESM(require("react"));
12521
12610
  var import_jsx_runtime84 = require("react/jsx-runtime");
12522
- function Table4({
12523
- pageSize,
12524
- searchQuery = "",
12525
- currentPage,
12526
- setCurrentPage,
12527
- setTotalEntries
12528
- }) {
12529
- const initialData = [{
12530
- id: 1,
12531
- workflowStepId: "1",
12532
- assignmentType: "Hierarchy",
12533
- hierarchyNodeType: "Block",
12534
- dynamicFunctionId: "N/A",
12535
- isPoolEnabled: true
12536
- }, {
12537
- id: 2,
12538
- workflowStepId: "2",
12539
- assignmentType: "Dynamic",
12540
- hierarchyNodeType: "District",
12541
- dynamicFunctionId: "1",
12542
- isPoolEnabled: false
12543
- }, {
12544
- id: 3,
12545
- workflowStepId: "3",
12546
- assignmentType: "Hierarchy",
12547
- hierarchyNodeType: "District",
12548
- dynamicFunctionId: "N/A",
12549
- isPoolEnabled: true
12550
- }, {
12551
- id: 4,
12552
- workflowStepId: "4",
12553
- assignmentType: "Dynamic",
12554
- hierarchyNodeType: "Block",
12555
- dynamicFunctionId: "2",
12556
- isPoolEnabled: false
12557
- }, {
12558
- id: 5,
12559
- workflowStepId: "5",
12560
- assignmentType: "Hierarchy",
12561
- hierarchyNodeType: "Block",
12562
- dynamicFunctionId: "N/A",
12563
- isPoolEnabled: true
12564
- }, {
12565
- id: 6,
12566
- workflowStepId: "6",
12567
- assignmentType: "Dynamic",
12568
- hierarchyNodeType: "District",
12569
- dynamicFunctionId: "4",
12570
- isPoolEnabled: true
12571
- }, {
12572
- id: 7,
12573
- workflowStepId: "7",
12574
- assignmentType: "Dynamic",
12575
- hierarchyNodeType: "District",
12576
- dynamicFunctionId: "4",
12577
- isPoolEnabled: true
12578
- }, {
12579
- id: 8,
12580
- workflowStepId: "8",
12581
- assignmentType: "Dynamic",
12582
- hierarchyNodeType: "District",
12583
- dynamicFunctionId: "4",
12584
- isPoolEnabled: true
12585
- }, {
12586
- id: 9,
12587
- workflowStepId: "9",
12588
- assignmentType: "Dynamic",
12589
- hierarchyNodeType: "District",
12590
- dynamicFunctionId: "4",
12591
- isPoolEnabled: true
12592
- }, {
12593
- id: 10,
12594
- workflowStepId: "10",
12595
- assignmentType: "Hierarchy",
12596
- hierarchyNodeType: "District",
12597
- dynamicFunctionId: "4",
12598
- isPoolEnabled: true
12599
- }, {
12600
- id: 11,
12601
- workflowStepId: "11",
12602
- assignmentType: "Dynamic",
12603
- hierarchyNodeType: "District",
12604
- dynamicFunctionId: "4",
12605
- isPoolEnabled: true
12606
- }, {
12607
- id: 12,
12608
- workflowStepId: "12",
12609
- assignmentType: "Dynamic",
12610
- hierarchyNodeType: "District",
12611
- dynamicFunctionId: "4",
12612
- isPoolEnabled: true
12613
- }, {
12614
- id: 13,
12615
- workflowStepId: "13",
12616
- assignmentType: "Dynamic",
12617
- hierarchyNodeType: "District",
12618
- dynamicFunctionId: "4",
12619
- isPoolEnabled: true
12620
- }, {
12621
- id: 14,
12622
- workflowStepId: "14",
12623
- assignmentType: "Dynamic",
12624
- hierarchyNodeType: "District",
12625
- dynamicFunctionId: "4",
12626
- isPoolEnabled: true
12627
- }];
12628
- const [data, setData] = (0, import_react84.useState)(initialData);
12629
- const [sortOrder, setSortOrder] = (0, import_react84.useState)("asc");
12630
- const [sortKey, setSortKey] = (0, import_react84.useState)("workflowStepId");
12631
- const [selectedItem, setSelectedItem] = (0, import_react84.useState)(null);
12632
- const [isEditModalOpen, setIsEditModalOpen] = (0, import_react84.useState)(false);
12633
- const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react84.useState)(false);
12634
- const handleEdit = (item) => {
12635
- setSelectedItem(item);
12636
- setIsEditModalOpen(true);
12637
- };
12638
- const handleDelete = (item) => {
12639
- setSelectedItem(item);
12640
- setIsDeleteModalOpen(true);
12641
- };
12642
- const confirmDelete = () => {
12643
- if (selectedItem) {
12644
- setData((prevData) => prevData.filter((item) => item.id !== selectedItem.id));
12645
- }
12646
- setIsDeleteModalOpen(false);
12647
- setSelectedItem(null);
12648
- };
12649
- const handleSaveEdit = (e) => {
12650
- e.preventDefault();
12651
- const formData = new FormData(e.target);
12652
- const updatedAssignmentType = formData.get("assignmentType");
12653
- const updatedNodeType = formData.get("nodeType");
12654
- const updatedDynamicFunctionId = formData.get("dynamicFunctionId");
12655
- setData((prevData) => prevData.map((item) => item.id === selectedItem.id ? __spreadProps(__spreadValues({}, item), {
12656
- assignmentType: updatedAssignmentType,
12657
- nodeType: updatedNodeType,
12658
- dynamicFunctionId: updatedDynamicFunctionId
12659
- }) : item));
12660
- setIsEditModalOpen(false);
12661
- setSelectedItem(null);
12662
- };
12663
- const handleSort = (columnKey) => {
12664
- const isAsc = sortKey === columnKey && sortOrder === "asc";
12665
- setSortOrder(isAsc ? "desc" : "asc");
12666
- setSortKey(columnKey);
12667
- const sortedData = [...data].sort((a, b) => {
12668
- let valA = a[columnKey];
12669
- let valB = b[columnKey];
12670
- if (typeof valA === "number" && typeof valB === "number") {
12671
- return isAsc ? valA - valB : valB - valA;
12672
- }
12673
- valA = valA ? valA.toString().toLowerCase() : "";
12674
- valB = valB ? valB.toString().toLowerCase() : "";
12675
- if (valA < valB) return isAsc ? -1 : 1;
12676
- if (valA > valB) return isAsc ? 1 : -1;
12677
- return 0;
12678
- });
12679
- setData(sortedData);
12680
- };
12681
- const filteredData = data.filter((item) => {
12682
- if (!searchQuery || searchQuery.trim() === "") return true;
12683
- const query = searchQuery.toLowerCase().trim();
12684
- 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);
12685
- });
12611
+ function Table4({ pageSize, searchQuery = "", currentPage, setCurrentPage, setTotalEntries, rows = [], loading, onEdit, onDelete }) {
12612
+ const [sort, setSort] = (0, import_react84.useState)({ key: "workflowStepId", direction: "asc" });
12613
+ const filteredRows = (0, import_react84.useMemo)(() => rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(searchQuery.toLowerCase().trim())), [rows, searchQuery]);
12686
12614
  (0, import_react84.useEffect)(() => {
12687
- if (setTotalEntries) setTotalEntries(filteredData.length);
12688
- }, [filteredData.length, setTotalEntries]);
12689
- const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
12690
- const startIndex = (currentPage - 1) * pageSize;
12691
- const visibleData = filteredData.slice(startIndex, startIndex + pageSize);
12692
- const pageNumbers = Array.from({
12693
- length: totalPages
12694
- }, (_, i) => i + 1);
12695
- const toggleStatus = (id) => {
12696
- setData((prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
12697
- isPoolEnabled: !item.isPoolEnabled
12698
- }) : item));
12699
- };
12700
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:space-y-5", children: [
12701
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsxs)("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-auto", children: [
12702
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsxs)("tr", { className: "fc:text-xs fc:font-medium fc:uppercase fc:tracking-wider fc:text-slate-500", children: [
12703
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:py-4 fc:px-4 fc:w-16 fc:text-center fc:bg-slate-50", children: "S.NO" }),
12704
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12705
- "WORKFLOW STEP ID ",
12706
- sortKey === "workflowStepId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12707
- ] }),
12708
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12709
- "ASSIGNMENT TYPE ",
12710
- sortKey === "assignmentType" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12711
- ] }),
12712
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12713
- "NODE TYPE ",
12714
- sortKey === "hierarchyNodeType" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12715
- ] }),
12716
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12717
- "DYNAMIC FUNCTION ID ",
12718
- sortKey === "dynamicFunctionId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
12719
- ] }),
12720
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "POOL ENABLED" }),
12721
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "ACTION" })
12615
+ setTotalEntries == null ? void 0 : setTotalEntries(filteredRows.length);
12616
+ if (currentPage > Math.max(1, Math.ceil(filteredRows.length / pageSize))) setCurrentPage(1);
12617
+ }, [filteredRows.length, pageSize, currentPage, setCurrentPage, setTotalEntries]);
12618
+ const sortedRows = [...filteredRows].sort((a, b) => {
12619
+ var _a, _b;
12620
+ const result = String((_a = a[sort.key]) != null ? _a : "").localeCompare(String((_b = b[sort.key]) != null ? _b : ""), void 0, { numeric: true });
12621
+ return sort.direction === "asc" ? result : -result;
12622
+ });
12623
+ const totalPages = Math.max(1, Math.ceil(sortedRows.length / pageSize));
12624
+ const visibleRows = sortedRows.slice((currentPage - 1) * pageSize, currentPage * pageSize);
12625
+ const sortBy = (key) => setSort((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
12626
+ const heading = (label, key) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12627
+ label,
12628
+ " ",
12629
+ sort.key === key ? sort.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
12630
+ ] });
12631
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:space-y-4", children: [
12632
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "fc:max-h-[420px] fc:overflow-auto fc:rounded-2xl fc:border fc:border-slate-200", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("table", { className: "fc:w-full fc:bg-white fc:text-left", children: [
12633
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("thead", { className: "fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tr", { children: [
12634
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:bg-slate-50 fc:px-4 fc:py-4 fc:text-xs", children: "S.NO" }),
12635
+ heading("WORKFLOW STEP ID", "workflowStepId"),
12636
+ heading("ASSIGNMENT TYPE", "assignmentType"),
12637
+ heading("NODE TYPE", "hierarchyNodeType"),
12638
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-xs", children: "POOL ENABLED" }),
12639
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-xs", children: "ACTION" })
12722
12640
  ] }) }),
12723
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-s fc:text-slate-600", children: [
12724
- visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
12725
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-4 fc:text-center fc:font-medium fc:text-slate-400", children: startIndex + index + 1 }),
12726
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("td", { className: "fc:py-4 fc:px-5 fc:text-[14px] fc:font-medium fc:whitespace-nowrap", children: [
12727
- "STEP-",
12728
- item.workflowStepId
12729
- ] }),
12730
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-900 fc:text-[14px] fc:font-medium fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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 }) }),
12731
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:font-medium fc:whitespace-nowrap", children: item.hierarchyNodeType }),
12732
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsx)("span", { className: "fc:text-slate-400 fc:font-normal", children: "N/A" }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "fc:bg-slate-100 fc:text-slate-700 fc:px-2 fc:py-0.5 fc:rounded fc:text-xs", children: [
12733
- "FN-",
12734
- item.dynamicFunctionId
12735
- ] }) }),
12736
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
12737
- "button",
12738
- {
12739
- type: "button",
12740
- onClick: () => toggleStatus(item.id),
12741
- 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"}`,
12742
- children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
12743
- "span",
12744
- {
12745
- 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"}`
12746
- }
12747
- )
12748
- }
12749
- ) }),
12750
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
12751
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" }),
12752
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12753
- ] }) })
12754
- ] }, item.id)),
12755
- visibleData.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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." }) })
12756
- ] })
12757
- ] }) }),
12758
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12759
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" }),
12760
- pageNumbers.map((pageNumber) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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)),
12761
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12762
- ] }),
12763
- isEditModalOpen && selectedItem && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsxs)("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: [
12764
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("h3", { className: "fc:text-lg fc:font-bold fc:text-slate-800 fc:mb-4", children: "Edit Workflow Step" }),
12765
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("form", { onSubmit: handleSaveEdit, className: "fc:space-y-4", children: [
12766
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
12767
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Workflow Step ID" }),
12768
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12769
- ] }),
12770
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
12771
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Assignment Type" }),
12772
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12773
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "Hierarchy", children: "Hierarchy" }),
12774
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "Dynamic", children: "Dynamic" })
12775
- ] })
12776
- ] }),
12777
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
12778
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Node Type" }),
12779
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("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: [
12780
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "Block", children: "Block" }),
12781
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "District", children: "District" }),
12782
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "State", children: "State" })
12783
- ] })
12784
- ] }),
12785
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
12786
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Dynamic Function ID" }),
12787
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12788
- ] }),
12789
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-3 fc:mt-6", children: [
12790
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" }),
12791
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12641
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tbody", { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsxs)("tr", { className: "fc:border-t fc:border-slate-100", children: [
12642
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-4 fc:py-4 fc:text-center fc:text-sm", children: (currentPage - 1) * pageSize + index + 1 }),
12643
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.workflowStepId }),
12644
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.assignmentType }),
12645
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.hierarchyNodeType }),
12646
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.isPoolEnabled ? "Yes" : "No" }),
12647
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: [
12648
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" }),
12649
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12792
12650
  ] })
12793
- ] })
12651
+ ] }, item.assignmentRuleId)) })
12794
12652
  ] }) }),
12795
- isDeleteModalOpen && selectedItem && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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__ */ (0, import_jsx_runtime84.jsxs)("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: [
12796
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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: "!" }),
12797
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("h3", { className: "fc:text-lg fc:font-bold fc:text-slate-800", children: "Delete Workflow Step?" }),
12798
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("p", { className: "fc:text-xs fc:text-slate-500 fc:mt-2", children: [
12799
- "Are you sure you want to delete the workflow step ",
12800
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "fc:font-bold fc:text-slate-700", children: selectedItem.workflowStepId || `STEP-${selectedItem.id}` }),
12801
- "?"
12653
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-2 fc:text-sm", children: [
12654
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" }),
12655
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "fc:px-2 fc:py-1", children: [
12656
+ currentPage,
12657
+ " / ",
12658
+ totalPages
12802
12659
  ] }),
12803
- /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:justify-center fc:gap-3 fc:mt-6", children: [
12804
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" }),
12805
- /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12806
- ] })
12807
- ] }) })
12660
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("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" })
12661
+ ] })
12808
12662
  ] });
12809
12663
  }
12810
12664
 
12811
12665
  // src/components/assignment-rule/Popup.js
12812
12666
  var import_react85 = __toESM(require("react"));
12667
+ init_ApiEndpointsProvider();
12668
+ init_ApiServicepackage();
12813
12669
  var import_jsx_runtime85 = require("react/jsx-runtime");
12814
- function Popup4({
12815
- isOpen,
12816
- onClose,
12817
- onSave
12818
- }) {
12670
+ var rowsFrom2 = (response) => {
12671
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12672
+ 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;
12673
+ 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 : [];
12674
+ return Array.isArray(rows) ? rows : [];
12675
+ };
12676
+ var formFrom = (item) => {
12677
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12678
+ return {
12679
+ workflowStepId: String((_b = (_a = item == null ? void 0 : item.workflowStepId) != null ? _a : item == null ? void 0 : item.WorkflowStepId) != null ? _b : ""),
12680
+ assignmentType: (_d = (_c = item == null ? void 0 : item.assignmentType) != null ? _c : item == null ? void 0 : item.AssignmentType) != null ? _d : "",
12681
+ hierarchyNodeType: (_f = (_e = item == null ? void 0 : item.hierarchyNodeType) != null ? _e : item == null ? void 0 : item.HierarchyNodeType) != null ? _f : "",
12682
+ isPoolEnabled: Boolean((_h = (_g = item == null ? void 0 : item.isPoolEnabled) != null ? _g : item == null ? void 0 : item.IsPoolEnabled) != null ? _h : false)
12683
+ };
12684
+ };
12685
+ function Popup4({ isOpen, onClose, onSave, editData }) {
12686
+ const [formData, setFormData] = (0, import_react85.useState)(() => formFrom(editData));
12687
+ const [workflowSteps, setWorkflowSteps] = (0, import_react85.useState)([]);
12688
+ const [loadingSteps, setLoadingSteps] = (0, import_react85.useState)(false);
12689
+ const [error, setError] = (0, import_react85.useState)("");
12690
+ const [saving, setSaving] = (0, import_react85.useState)(false);
12691
+ (0, import_react85.useEffect)(() => {
12692
+ if (!isOpen) return;
12693
+ setFormData(formFrom(editData));
12694
+ setError("");
12695
+ let active = true;
12696
+ (async () => {
12697
+ var _a, _b, _c, _d, _e;
12698
+ try {
12699
+ setLoadingSteps(true);
12700
+ const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
12701
+ if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
12702
+ const result = await getApiService().get(endpoint2);
12703
+ if (active) setWorkflowSteps(rowsFrom2(result));
12704
+ } catch (requestError) {
12705
+ 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.");
12706
+ } finally {
12707
+ if (active) setLoadingSteps(false);
12708
+ }
12709
+ })();
12710
+ return () => {
12711
+ active = false;
12712
+ };
12713
+ }, [isOpen, editData]);
12819
12714
  if (!isOpen) return null;
12820
- const [workflowStepId, setWorkflowStepId] = (0, import_react85.useState)("");
12821
- const [assignmentType, setAssignmentType] = (0, import_react85.useState)("");
12822
- const [hierarchyNodeType, setHierarchyNodeType] = (0, import_react85.useState)("");
12823
- const [dynamicFunctionId, setDynamicFunctionId] = (0, import_react85.useState)("");
12824
- const [isPoolEnabled, setIsPoolEnabled] = (0, import_react85.useState)(false);
12825
- const handleSubmit = (e) => {
12826
- e.preventDefault();
12827
- if (!workflowStepId || !assignmentType || !hierarchyNodeType) {
12828
- alert("Please fill out all required fields!");
12715
+ const change = (field, value) => setFormData((current) => __spreadProps(__spreadValues({}, current), { [field]: value }));
12716
+ const submit = async (event) => {
12717
+ var _a, _b;
12718
+ event.preventDefault();
12719
+ if (!formData.workflowStepId || !formData.assignmentType || !formData.hierarchyNodeType) {
12720
+ setError("Please fill all required fields.");
12829
12721
  return;
12830
12722
  }
12831
- onSave({
12832
- workflowStepId,
12833
- assignmentType,
12834
- hierarchyNodeType,
12835
- dynamicFunctionId: dynamicFunctionId || "N/A",
12836
- isPoolEnabled
12837
- });
12838
- setWorkflowStepId("");
12839
- setAssignmentType("");
12840
- setHierarchyNodeType("");
12841
- setDynamicFunctionId("");
12842
- setIsPoolEnabled(false);
12843
- onClose();
12723
+ const isEdit = Boolean(editData);
12724
+ 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) };
12725
+ setSaving(true);
12726
+ try {
12727
+ if (await onSave(payload, isEdit)) onClose();
12728
+ } finally {
12729
+ setSaving(false);
12730
+ }
12844
12731
  };
12845
12732
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
12846
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity", onClick: onClose }),
12847
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12848
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-8 fc:py-5 fc:border-b fc:border-slate-100", children: [
12849
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-3", children: [
12850
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" }),
12851
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
12852
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("h2", { className: "fc:text-lg fc:font-extrabold fc:text-slate-800", children: "Add Assignment Rule" }),
12853
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400", children: "Configure core task routing constraints" })
12733
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
12734
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12735
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-between fc:border-b fc:border-slate-100 fc:px-8 fc:py-5", children: [
12736
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
12737
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("h2", { className: "fc:text-lg fc:font-extrabold fc:text-slate-800", children: editData ? "Edit Assignment Rule" : "Add Assignment Rule" }),
12738
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400", children: "Configure core task routing constraints" })
12739
+ ] }),
12740
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 fc:text-sm fc:font-semibold", children: "\u2715" })
12741
+ ] }),
12742
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:space-y-4 fc:bg-slate-50/30 fc:p-6", children: [
12743
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
12744
+ "Workflow Step ID *",
12745
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12746
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: loadingSteps ? "Loading workflow steps..." : "Select Workflow Step" }),
12747
+ workflowSteps.map((step) => {
12748
+ var _a, _b, _c, _d, _e, _f;
12749
+ const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
12750
+ const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.stepCode) != null ? _e : step.StepCode) != null ? _f : `Step ${id}`;
12751
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("option", { value: String(id), children: [
12752
+ id,
12753
+ " - ",
12754
+ name
12755
+ ] }, id);
12756
+ })
12854
12757
  ] })
12855
12758
  ] }),
12856
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 hover:fc:fc:text-slate-600 fc:font-semibold fc:text-sm", children: "\u2715" })
12857
- ] }),
12858
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("form", { onSubmit: handleSubmit, className: "fc:flex fc:flex-col fc:overflow-hidden", children: [
12859
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:p-6 fc:space-y-4 fc:overflow-y-auto fc:bg-slate-50/30", children: [
12860
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
12861
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Workflow Step ID *" }),
12862
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" })
12863
- ] }),
12864
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
12865
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Assignment Type *" }),
12866
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12867
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Assignment Engine Type" }),
12868
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Hierarchy", children: "Hierarchy" }),
12869
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Dynamic", children: "Dynamic" })
12870
- ] })
12871
- ] }),
12872
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
12873
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Hierarchy Node Type *" }),
12874
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12875
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Node Level" }),
12876
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Block", children: "Block" }),
12877
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "District", children: "District" })
12878
- ] })
12879
- ] }),
12880
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
12881
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Dynamic Function ID" }),
12882
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" })
12883
- ] }),
12884
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2 fc:pt-1", children: [
12885
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" }),
12886
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { htmlFor: "isPoolEnabled", className: "fc:text-xs fc:font-bold fc:text-slate-700 fc:select-none fc:cursor-pointer", children: "Enable Task Pooling" })
12759
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
12760
+ "Assignment Type *",
12761
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12762
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Assignment Engine Type" }),
12763
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Hierarchy", children: "Hierarchy" }),
12764
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Dynamic", children: "Dynamic" })
12887
12765
  ] })
12888
12766
  ] }),
12889
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12890
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" }),
12891
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" })
12892
- ] })
12767
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
12768
+ "Hierarchy Node Type *",
12769
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12770
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Node Level" }),
12771
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Block", children: "Block" }),
12772
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "District", children: "District" }),
12773
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "State", children: "State" })
12774
+ ] })
12775
+ ] }),
12776
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-slate-700", children: [
12777
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("input", { type: "checkbox", checked: formData.isPoolEnabled, onChange: (event) => change("isPoolEnabled", event.target.checked), className: "fc:h-4 fc:w-4" }),
12778
+ "Enable Task Pooling"
12779
+ ] }),
12780
+ error && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:text-xs fc:text-red-500", children: error })
12781
+ ] }),
12782
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("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: [
12783
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" }),
12784
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("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" })
12893
12785
  ] })
12894
12786
  ] })
12895
12787
  ] });
12896
12788
  }
12897
12789
 
12898
12790
  // src/components/assignment-rule/AssignmentRuleMain.jsx
12791
+ init_ApiEndpointsProvider();
12792
+ init_ApiServicepackage();
12899
12793
  var import_jsx_runtime86 = require("react/jsx-runtime");
12794
+ var getRows4 = (response) => {
12795
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12796
+ 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;
12797
+ 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 : [];
12798
+ return Array.isArray(rows) ? rows : [];
12799
+ };
12800
+ var endpoint = (action) => {
12801
+ var _a, _b, _c, _d, _e;
12802
+ 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;
12803
+ const value = assignmentRule == null ? void 0 : assignmentRule[action];
12804
+ if (!value) throw new Error(`Assignment Rule ${action} endpoint is not configured.`);
12805
+ return value;
12806
+ };
12807
+ var byId = (id) => {
12808
+ const value = endpoint("getById");
12809
+ return typeof value === "function" ? value(id) : `${value}/${id}`;
12810
+ };
12811
+ var normalise4 = (item) => {
12812
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12813
+ 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) });
12814
+ };
12900
12815
  function AssignmentRuleMain() {
12901
- const [refreshkey, setRefreshKey] = (0, import_react86.useState)(0);
12902
- const handleRefresh = () => {
12903
- console.log("Table data refreshed!");
12904
- setRefreshKey((prev) => prev + 1);
12905
- };
12906
12816
  const tableRef = (0, import_react86.useRef)(null);
12907
- const [showModal, setShowModal] = (0, import_react86.useState)(false);
12817
+ const [rows, setRows] = (0, import_react86.useState)([]);
12818
+ const [modalOpen, setModalOpen] = (0, import_react86.useState)(false);
12819
+ const [editingRule, setEditingRule] = (0, import_react86.useState)(null);
12908
12820
  const [pageSize, setPageSize] = (0, import_react86.useState)(10);
12909
12821
  const [searchQuery, setSearchQuery] = (0, import_react86.useState)("");
12910
12822
  const [currentPage, setCurrentPage] = (0, import_react86.useState)(1);
12911
12823
  const [totalEntries, setTotalEntries] = (0, import_react86.useState)(0);
12912
- const handlePageSizeChange = (e) => {
12913
- setPageSize(Number(e.target.value));
12914
- setCurrentPage(1);
12824
+ const [loading, setLoading] = (0, import_react86.useState)(true);
12825
+ const [refreshKey, setRefreshKey] = (0, import_react86.useState)(0);
12826
+ const refresh = () => setRefreshKey((value) => value + 1);
12827
+ (0, import_react86.useEffect)(() => {
12828
+ let active = true;
12829
+ const load = async () => {
12830
+ var _a, _b;
12831
+ setLoading(true);
12832
+ try {
12833
+ const response = await getApiService().get(endpoint("getList"));
12834
+ if (active) setRows(getRows4(response).map(normalise4));
12835
+ } catch (error) {
12836
+ if (active) await import_sweetalert219.default.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");
12837
+ } finally {
12838
+ if (active) setLoading(false);
12839
+ }
12840
+ };
12841
+ load();
12842
+ return () => {
12843
+ active = false;
12844
+ };
12845
+ }, [refreshKey]);
12846
+ const save = async (payload, isEdit) => {
12847
+ var _a, _b;
12848
+ try {
12849
+ await getApiService()[isEdit ? "put" : "post"](endpoint(isEdit ? "update" : "create"), payload);
12850
+ await import_sweetalert219.default.fire("Success", `Assignment rule ${isEdit ? "updated" : "created"} successfully.`, "success");
12851
+ refresh();
12852
+ return true;
12853
+ } catch (error) {
12854
+ await import_sweetalert219.default.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");
12855
+ return false;
12856
+ }
12915
12857
  };
12916
- return (
12917
- // <div className="min-h-screen bg-slate-50 p-4 md:p-6">
12918
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
12919
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
12920
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CommonHeader, { title: "Assignment Rule", breadcrumbs: [{
12921
- label: "Dashboard",
12922
- href: "/dashboard"
12923
- }, {
12924
- label: "Masters",
12925
- href: "/masters"
12926
- }, {
12927
- label: "Permissions",
12928
- href: "/permissions"
12929
- }, {
12930
- label: "AssignmentRule",
12931
- href: "/assignment-rule"
12932
- }], buttonText: "Add Assignment Rule", onButtonClick: () => setShowModal(true) }),
12933
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("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: [
12934
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
12935
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(SearchBar12, { searchQuery, setSearchQuery, setCurrentPage }) }),
12936
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
12937
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Refresh_default, { onRefresh: handleRefresh }),
12938
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Download_default, { targetRef: tableRef, fileName: "document-configuration" }),
12939
- /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("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: [
12940
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 5, children: "5 Rows" }),
12941
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 10, children: "10 Rows" }),
12942
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 20, children: "20 Rows" }),
12943
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 25, children: "25 Rows" })
12944
- ] })
12858
+ const edit = async (item) => {
12859
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12860
+ try {
12861
+ const response = await getApiService().get(byId(item.assignmentRuleId));
12862
+ 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;
12863
+ setEditingRule(normalise4(data));
12864
+ setModalOpen(true);
12865
+ } catch (error) {
12866
+ await import_sweetalert219.default.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");
12867
+ }
12868
+ };
12869
+ const remove = async (item) => {
12870
+ var _a, _b;
12871
+ const confirmation = await import_sweetalert219.default.fire({ title: "Delete Assignment Rule?", text: "This rule will be marked inactive.", icon: "warning", showCancelButton: true, confirmButtonText: "Yes, Delete", confirmButtonColor: "#e11d48" });
12872
+ if (!confirmation.isConfirmed) return;
12873
+ try {
12874
+ await getApiService().put(endpoint("update"), { assignmentRuleId: item.assignmentRuleId, workflowStepId: Number(item.workflowStepId), assignmentType: item.assignmentType, hierarchyNodeType: item.hierarchyNodeType, isPoolEnabled: false });
12875
+ await import_sweetalert219.default.fire("Deleted", "Assignment rule deleted successfully.", "success");
12876
+ refresh();
12877
+ } catch (error) {
12878
+ await import_sweetalert219.default.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");
12879
+ }
12880
+ };
12881
+ const openCreate = () => {
12882
+ setEditingRule(null);
12883
+ setModalOpen(true);
12884
+ };
12885
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:p-6", children: [
12886
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
12887
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(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 }),
12888
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:space-y-5 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:bg-white fc:p-6", children: [
12889
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:flex fc:w-full fc:items-center fc:justify-between fc:gap-4", children: [
12890
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(SearchBar12, { searchQuery, setSearchQuery: (value) => {
12891
+ setSearchQuery(value);
12892
+ setCurrentPage(1);
12893
+ } }) }),
12894
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
12895
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Refresh_default, { onRefresh: refresh }),
12896
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Download_default, { targetRef: tableRef, fileName: "assignment-rules" }),
12897
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("select", { value: pageSize, onChange: (event) => {
12898
+ setPageSize(Number(event.target.value));
12899
+ setCurrentPage(1);
12900
+ }, className: "fc:rounded-lg fc:border fc:border-slate-200 fc:px-3 fc:py-2 fc:text-sm", children: [
12901
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 5, children: "5 Rows" }),
12902
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 10, children: "10 Rows" }),
12903
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 20, children: "20 Rows" }),
12904
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 25, children: "25 Rows" })
12945
12905
  ] })
12946
- ] }),
12947
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Table4, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries }, refreshkey) })
12948
- ] })
12949
- ] }),
12950
- /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Popup4, { isOpen: showModal, onClose: () => setShowModal(false) })
12951
- ] })
12952
- );
12906
+ ] })
12907
+ ] }),
12908
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Table4, { rows, loading, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: edit, onDelete: remove }) })
12909
+ ] })
12910
+ ] }),
12911
+ /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Popup4, { isOpen: modalOpen, editData: editingRule, onClose: () => {
12912
+ setModalOpen(false);
12913
+ setEditingRule(null);
12914
+ }, onSave: save })
12915
+ ] });
12953
12916
  }
12954
12917
 
12955
12918
  // src/components/Workflow_Step_Hierarchy_Mapping/Workflow_Step_Hierarchy_Mapping_Main.jsx
12956
12919
  var import_react87 = __toESM(require("react"));
12957
- var import_sweetalert218 = __toESM(require("sweetalert2"));
12920
+ var import_sweetalert220 = __toESM(require("sweetalert2"));
12958
12921
  init_ApiEndpointsProvider();
12959
12922
  init_ApiServicepackage();
12960
12923
  var import_jsx_runtime87 = require("react/jsx-runtime");
12961
- var emptyForm = { workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
12962
- var getRows3 = (result) => {
12924
+ var emptyForm = { workflowId: "", workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
12925
+ var getRows5 = (result) => {
12963
12926
  var _a, _b, _c, _d, _e, _f, _g;
12964
12927
  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;
12965
12928
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
12966
12929
  };
12967
12930
  function Workflow_Step_Hierarchy_Mapping_Main() {
12931
+ var _a, _b, _c, _d, _e, _f;
12968
12932
  const tableRef = (0, import_react87.useRef)(null);
12969
12933
  const [mappings, setMappings] = (0, import_react87.useState)([]);
12970
- const [workflowSteps, setWorkflowSteps] = (0, import_react87.useState)([]);
12934
+ const [workflows, setWorkflows] = (0, import_react87.useState)([]);
12971
12935
  const [hierarchyNodes, setHierarchyNodes] = (0, import_react87.useState)([]);
12972
12936
  const [isLoading, setIsLoading] = (0, import_react87.useState)(false);
12937
+ const [isLoadingLookups, setIsLoadingLookups] = (0, import_react87.useState)(false);
12973
12938
  const [refreshKey, setRefreshKey] = (0, import_react87.useState)(0);
12974
12939
  const [searchQuery, setSearchQuery] = (0, import_react87.useState)("");
12975
12940
  const [pageSize, setPageSize] = (0, import_react87.useState)(10);
@@ -12979,60 +12944,86 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12979
12944
  const [formData, setFormData] = (0, import_react87.useState)(emptyForm);
12980
12945
  const [isSaving, setIsSaving] = (0, import_react87.useState)(false);
12981
12946
  const mappingEndpoints = () => {
12982
- var _a;
12983
- const flowCore = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
12947
+ var _a2;
12948
+ const flowCore = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore;
12984
12949
  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);
12985
12950
  };
12986
- const workflowStepMap = (0, import_react87.useMemo)(
12951
+ const workflowMap = (0, import_react87.useMemo)(
12987
12952
  () => Object.fromEntries(
12988
- workflowSteps.map((step) => {
12989
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
12990
- const id = (_d = (_c = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.workflowId) != null ? _c : step.WorkflowId) != null ? _d : step.id;
12991
- 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}`;
12953
+ workflows.map((wf) => {
12954
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
12955
+ const id = (_d2 = (_c2 = (_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id) != null ? _c2 : wf.workflowStepId) != null ? _d2 : wf.WorkflowStepId;
12956
+ 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}`;
12992
12957
  return [id, name];
12993
12958
  })
12994
12959
  ),
12995
- [workflowSteps]
12960
+ [workflows]
12996
12961
  );
12997
12962
  const hierarchyNodeMap = (0, import_react87.useMemo)(
12998
12963
  () => Object.fromEntries(
12999
12964
  hierarchyNodes.map((node) => {
13000
- var _a, _b, _c, _d, _e, _f;
13001
- const id = (_b = (_a = node.hierarchyNodeId) != null ? _a : node.HierarchyNodeId) != null ? _b : node.id;
13002
- const name = (_f = (_e = (_d = (_c = node.nodeName) != null ? _c : node.NodeName) != null ? _d : node.hierarchyNodeName) != null ? _e : node.HierarchyNodeName) != null ? _f : `Node ${id}`;
12965
+ var _a2, _b2, _c2, _d2, _e2, _f2;
12966
+ const id = (_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id;
12967
+ const name = (_f2 = (_e2 = (_d2 = (_c2 = node.nodeName) != null ? _c2 : node.NodeName) != null ? _d2 : node.hierarchyNodeName) != null ? _e2 : node.HierarchyNodeName) != null ? _f2 : `Node ${id}`;
13003
12968
  return [id, name];
13004
12969
  })
13005
12970
  ),
13006
12971
  [hierarchyNodes]
13007
12972
  );
12973
+ (0, import_react87.useEffect)(() => {
12974
+ if (!isModalOpen) return;
12975
+ const loadLookups = async () => {
12976
+ var _a2, _b2, _c2, _d2, _e2, _f2;
12977
+ setIsLoadingLookups(true);
12978
+ try {
12979
+ const flowCore = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore;
12980
+ 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);
12981
+ 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);
12982
+ const [workflowResult, hierarchyNodeResult] = await Promise.all([
12983
+ workflowEndpoint ? getApiService().get(workflowEndpoint).catch(async (err) => {
12984
+ var _a3;
12985
+ if (((_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.status) === 405) {
12986
+ return await getApiService().post(workflowEndpoint, {});
12987
+ }
12988
+ throw err;
12989
+ }) : Promise.resolve(null),
12990
+ nodeEndpoint ? getApiService().get(nodeEndpoint).catch(async (err) => {
12991
+ var _a3;
12992
+ if (((_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.status) === 405) {
12993
+ return await getApiService().post(nodeEndpoint, {});
12994
+ }
12995
+ throw err;
12996
+ }) : Promise.resolve(null)
12997
+ ]);
12998
+ setWorkflows(workflowResult ? getRows5(workflowResult) : []);
12999
+ setHierarchyNodes(
13000
+ hierarchyNodeResult ? getRows5(hierarchyNodeResult) : []
13001
+ );
13002
+ } catch (error) {
13003
+ console.error("Unable to load workflow or hierarchy node lookup options:", error);
13004
+ } finally {
13005
+ setIsLoadingLookups(false);
13006
+ }
13007
+ };
13008
+ loadLookups();
13009
+ }, [isModalOpen]);
13008
13010
  (0, import_react87.useEffect)(() => {
13009
13011
  const loadData = async () => {
13010
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
13012
+ var _a2, _b2;
13011
13013
  setIsLoading(true);
13012
13014
  try {
13013
13015
  const endpoints = mappingEndpoints();
13014
13016
  const mappingEndpoint = (endpoints == null ? void 0 : endpoints.getList) || (endpoints == null ? void 0 : endpoints.GetList);
13015
- const flowCore = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
13016
13017
  if (!mappingEndpoint)
13017
13018
  throw new Error(
13018
13019
  "Workflow step hierarchy mapping list endpoint is not configured."
13019
13020
  );
13020
- 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);
13021
- 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);
13022
- const [mappingResult, workflowStepResult, hierarchyNodeResult] = await Promise.all([
13023
- getApiService().get(mappingEndpoint),
13024
- stepEndpoint ? getApiService().get(stepEndpoint) : Promise.resolve(null),
13025
- nodeEndpoint ? getApiService().get(nodeEndpoint) : Promise.resolve(null)
13026
- ]);
13027
- setMappings(getRows3(mappingResult));
13028
- setWorkflowSteps(workflowStepResult ? getRows3(workflowStepResult) : []);
13029
- setHierarchyNodes(
13030
- hierarchyNodeResult ? getRows3(hierarchyNodeResult) : []
13031
- );
13021
+ const mappingResult = await getApiService().get(mappingEndpoint);
13022
+ setMappings(getRows5(mappingResult));
13032
13023
  } catch (error) {
13033
- await import_sweetalert218.default.fire(
13024
+ await import_sweetalert220.default.fire(
13034
13025
  "Error",
13035
- ((_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.",
13026
+ ((_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.",
13036
13027
  "error"
13037
13028
  );
13038
13029
  } finally {
@@ -13042,51 +13033,55 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13042
13033
  loadData();
13043
13034
  }, [refreshKey]);
13044
13035
  const openModal = (mapping = null) => {
13045
- var _a, _b, _c, _d, _e, _f, _g, _h;
13036
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
13046
13037
  setEditingMapping(mapping);
13047
13038
  setFormData(
13048
13039
  mapping ? {
13040
+ workflowId: String(
13041
+ (_d2 = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId) != null ? _d2 : ""
13042
+ ),
13049
13043
  workflowStepId: String(
13050
- (_d = (_c = (_b = (_a = mapping.workflowStepId) != null ? _a : mapping.WorkflowStepId) != null ? _b : mapping.workflowId) != null ? _c : mapping.WorkflowId) != null ? _d : ""
13044
+ (_h = (_g = (_f2 = (_e2 = mapping.workflowStepId) != null ? _e2 : mapping.WorkflowStepId) != null ? _f2 : mapping.workflowId) != null ? _g : mapping.WorkflowId) != null ? _h : ""
13051
13045
  ),
13052
13046
  hierarchyNodeId: String(
13053
- (_f = (_e = mapping.hierarchyNodeId) != null ? _e : mapping.HierarchyNodeId) != null ? _f : ""
13047
+ (_j = (_i = mapping.hierarchyNodeId) != null ? _i : mapping.HierarchyNodeId) != null ? _j : ""
13054
13048
  ),
13055
- isActive: String((_h = (_g = mapping.isActive) != null ? _g : mapping.IsActive) != null ? _h : true)
13049
+ isActive: String((_l = (_k = mapping.isActive) != null ? _k : mapping.IsActive) != null ? _l : true)
13056
13050
  } : emptyForm
13057
13051
  );
13058
13052
  setIsModalOpen(true);
13059
13053
  };
13060
13054
  const handleSave = async (event) => {
13061
- var _a, _b, _c;
13055
+ var _a2, _b2, _c2;
13062
13056
  event.preventDefault();
13063
- if (!formData.workflowStepId || !formData.hierarchyNodeId)
13064
- return import_sweetalert218.default.fire(
13057
+ const selectedWorkflowId = formData.workflowId || formData.workflowStepId;
13058
+ if (!selectedWorkflowId || !formData.hierarchyNodeId)
13059
+ return import_sweetalert220.default.fire(
13065
13060
  "Required fields",
13066
- "Please select a workflow step and hierarchy node.",
13061
+ "Please select a workflow and hierarchy node.",
13067
13062
  "warning"
13068
13063
  );
13069
13064
  setIsSaving(true);
13070
13065
  try {
13071
13066
  const endpoints = mappingEndpoints();
13072
- 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);
13073
- if (!endpoint)
13067
+ 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);
13068
+ if (!endpoint2)
13074
13069
  throw new Error(
13075
13070
  `Workflow step hierarchy mapping ${editingMapping ? "update" : "create"} endpoint is not configured.`
13076
13071
  );
13077
- const idValue = Number(formData.workflowStepId);
13072
+ const idValue = Number(selectedWorkflowId);
13078
13073
  const nodeValue = Number(formData.hierarchyNodeId);
13079
13074
  const payload = __spreadValues({
13080
13075
  workflowId: idValue,
13081
13076
  workflowStepId: idValue,
13082
13077
  hierarchyNodeId: nodeValue,
13083
- isActive: formData.isActive === "true"
13078
+ isActive: formData.isActive === "true" || formData.isActive === true
13084
13079
  }, editingMapping ? {
13085
- workflowStepHierarchyMappingId: (_a = editingMapping.workflowStepHierarchyMappingId) != null ? _a : editingMapping.WorkflowStepHierarchyMappingId,
13080
+ workflowStepHierarchyMappingId: (_a2 = editingMapping.workflowStepHierarchyMappingId) != null ? _a2 : editingMapping.WorkflowStepHierarchyMappingId,
13086
13081
  updatedBy: "System"
13087
13082
  } : { createdBy: "System" });
13088
- await getApiService()[editingMapping ? "put" : "post"](endpoint, payload);
13089
- await import_sweetalert218.default.fire(
13083
+ await getApiService()[editingMapping ? "put" : "post"](endpoint2, payload);
13084
+ await import_sweetalert220.default.fire(
13090
13085
  "Success",
13091
13086
  `Workflow step hierarchy mapping ${editingMapping ? "updated" : "created"} successfully.`,
13092
13087
  "success"
@@ -13094,9 +13089,9 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13094
13089
  setIsModalOpen(false);
13095
13090
  setRefreshKey((previous) => previous + 1);
13096
13091
  } catch (error) {
13097
- await import_sweetalert218.default.fire(
13092
+ await import_sweetalert220.default.fire(
13098
13093
  "Error",
13099
- ((_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.",
13094
+ ((_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.",
13100
13095
  "error"
13101
13096
  );
13102
13097
  } finally {
@@ -13104,8 +13099,8 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13104
13099
  }
13105
13100
  };
13106
13101
  const handleDelete = async (mapping) => {
13107
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
13108
- const confirmation = await import_sweetalert218.default.fire({
13102
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
13103
+ const confirmation = await import_sweetalert220.default.fire({
13109
13104
  title: "Delete mapping?",
13110
13105
  text: "This mapping will be marked inactive.",
13111
13106
  icon: "warning",
@@ -13116,18 +13111,18 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13116
13111
  if (!confirmation.isConfirmed) return;
13117
13112
  try {
13118
13113
  const endpoints = mappingEndpoints();
13119
- const endpoint = (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update);
13120
- if (!endpoint)
13114
+ const endpoint2 = (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update);
13115
+ if (!endpoint2)
13121
13116
  throw new Error(
13122
13117
  "Workflow step hierarchy mapping update endpoint is not configured."
13123
13118
  );
13124
13119
  const stepId = Number(
13125
- (_d = (_c = (_b = (_a = mapping.workflowId) != null ? _a : mapping.WorkflowId) != null ? _b : mapping.workflowStepId) != null ? _c : mapping.WorkflowStepId) != null ? _d : 0
13120
+ (_d2 = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId) != null ? _d2 : 0
13126
13121
  );
13127
13122
  const nodeId = Number(
13128
- (_f = (_e = mapping.hierarchyNodeId) != null ? _e : mapping.HierarchyNodeId) != null ? _f : 0
13123
+ (_f2 = (_e2 = mapping.hierarchyNodeId) != null ? _e2 : mapping.HierarchyNodeId) != null ? _f2 : 0
13129
13124
  );
13130
- await getApiService().put(endpoint, {
13125
+ await getApiService().put(endpoint2, {
13131
13126
  workflowStepHierarchyMappingId: (_g = mapping.workflowStepHierarchyMappingId) != null ? _g : mapping.WorkflowStepHierarchyMappingId,
13132
13127
  workflowId: stepId,
13133
13128
  workflowStepId: stepId,
@@ -13135,14 +13130,14 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13135
13130
  isActive: false,
13136
13131
  updatedBy: "System"
13137
13132
  });
13138
- await import_sweetalert218.default.fire(
13133
+ await import_sweetalert220.default.fire(
13139
13134
  "Deleted",
13140
13135
  "Workflow step hierarchy mapping has been deactivated.",
13141
13136
  "success"
13142
13137
  );
13143
13138
  setRefreshKey((previous) => previous + 1);
13144
13139
  } catch (error) {
13145
- await import_sweetalert218.default.fire(
13140
+ await import_sweetalert220.default.fire(
13146
13141
  "Error",
13147
13142
  ((_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.",
13148
13143
  "error"
@@ -13150,11 +13145,11 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13150
13145
  }
13151
13146
  };
13152
13147
  const filteredMappings = mappings.filter((mapping) => {
13153
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13148
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o;
13154
13149
  const query = searchQuery.trim().toLowerCase();
13155
- const stepId = (_c = (_b = (_a = mapping.workflowStepId) != null ? _a : mapping.WorkflowStepId) != null ? _b : mapping.workflowId) != null ? _c : mapping.WorkflowId;
13156
- const nodeId = (_d = mapping.hierarchyNodeId) != null ? _d : mapping.HierarchyNodeId;
13157
- 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];
13150
+ const stepId = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId;
13151
+ const nodeId = (_d2 = mapping.hierarchyNodeId) != null ? _d2 : mapping.HierarchyNodeId;
13152
+ 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];
13158
13153
  const nodeName = (_n = (_m = (_l = (_k = mapping.hierarchyNodeName) != null ? _k : mapping.HierarchyNodeName) != null ? _l : mapping.nodeName) != null ? _m : mapping.NodeName) != null ? _n : hierarchyNodeMap[nodeId];
13159
13154
  return !query || [
13160
13155
  (_o = mapping.workflowStepHierarchyMappingId) != null ? _o : mapping.WorkflowStepHierarchyMappingId,
@@ -13238,8 +13233,8 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13238
13233
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("tr", { className: "fc:bg-slate-100 fc:text-slate-600", children: [
13239
13234
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "#" }),
13240
13235
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Mapping ID" }),
13241
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Workflow Step" }),
13242
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Hierarchy Node" }),
13236
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Workflow Name" }),
13237
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Hierarchy Node Name" }),
13243
13238
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Active" }),
13244
13239
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-center", children: "Actions" })
13245
13240
  ] }) }),
@@ -13258,11 +13253,11 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13258
13253
  children: "No workflow step hierarchy mappings found."
13259
13254
  }
13260
13255
  ) }) : visibleMappings.map((mapping, index) => {
13261
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
13262
- const stepId = (_c = (_b = (_a = mapping.workflowStepId) != null ? _a : mapping.WorkflowStepId) != null ? _b : mapping.workflowId) != null ? _c : mapping.WorkflowId;
13263
- const nodeId = (_d = mapping.hierarchyNodeId) != null ? _d : mapping.HierarchyNodeId;
13264
- const active = (_e = mapping.isActive) != null ? _e : mapping.IsActive;
13265
- 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}` : "-";
13256
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
13257
+ const stepId = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId;
13258
+ const nodeId = (_d2 = mapping.hierarchyNodeId) != null ? _d2 : mapping.HierarchyNodeId;
13259
+ const active = (_e2 = mapping.isActive) != null ? _e2 : mapping.IsActive;
13260
+ 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}` : "-";
13266
13261
  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}` : "-";
13267
13262
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
13268
13263
  "tr",
@@ -13354,26 +13349,31 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13354
13349
  /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("button", { type: "button", onClick: () => setIsModalOpen(false), children: "\xD7" })
13355
13350
  ] }),
13356
13351
  /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { children: [
13357
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("label", { className: "fc:block fc:mb-1.5 fc:text-sm fc:font-semibold", children: "Workflow Step *" }),
13352
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("label", { className: "fc:block fc:mb-1.5 fc:text-sm fc:font-semibold", children: "Workflow *" }),
13358
13353
  /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
13359
13354
  "select",
13360
13355
  {
13361
- value: formData.workflowStepId,
13356
+ value: formData.workflowId || formData.workflowStepId,
13362
13357
  onChange: (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), {
13358
+ workflowId: event.target.value,
13363
13359
  workflowStepId: event.target.value
13364
13360
  })),
13365
13361
  className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-2.5",
13366
13362
  children: [
13367
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: "Select workflow step" }),
13368
- workflowSteps.map((step) => {
13369
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
13370
- const id = (_d = (_c = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.workflowId) != null ? _c : step.WorkflowId) != null ? _d : step.id;
13371
- 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}`;
13372
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("option", { value: id, children: [
13373
- id,
13374
- " - ",
13375
- name
13376
- ] }, id);
13363
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: isLoadingLookups ? "Loading workflows..." : "Select workflow" }),
13364
+ Boolean(
13365
+ (formData.workflowId || formData.workflowStepId) && !workflows.some(
13366
+ (wf) => {
13367
+ var _a2, _b2;
13368
+ return String((_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id) === String(formData.workflowId || formData.workflowStepId);
13369
+ }
13370
+ )
13371
+ ) && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("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}` }),
13372
+ workflows.map((wf) => {
13373
+ var _a2, _b2, _c2, _d2, _e2;
13374
+ const id = (_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id;
13375
+ const name = (_e2 = (_d2 = (_c2 = wf.workflowName) != null ? _c2 : wf.WorkflowName) != null ? _d2 : wf.name) != null ? _e2 : `Workflow ${id}`;
13376
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: id, children: name }, id);
13377
13377
  })
13378
13378
  ]
13379
13379
  }
@@ -13390,15 +13390,20 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13390
13390
  })),
13391
13391
  className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-2.5",
13392
13392
  children: [
13393
- /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: "Select hierarchy node" }),
13393
+ /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: isLoadingLookups ? "Loading hierarchy nodes..." : "Select hierarchy node" }),
13394
+ Boolean(
13395
+ formData.hierarchyNodeId && !hierarchyNodes.some(
13396
+ (node) => {
13397
+ var _a2, _b2;
13398
+ return String((_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id) === String(formData.hierarchyNodeId);
13399
+ }
13400
+ )
13401
+ ) && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("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}` }),
13394
13402
  hierarchyNodes.map((node) => {
13395
- var _a, _b, _c;
13396
- const id = (_b = (_a = node.hierarchyNodeId) != null ? _a : node.HierarchyNodeId) != null ? _b : node.id;
13397
- const name = (_c = node.nodeName) != null ? _c : node.NodeName;
13398
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("option", { value: id, children: [
13399
- id,
13400
- name ? ` - ${name}` : ""
13401
- ] }, id);
13403
+ var _a2, _b2, _c2, _d2, _e2;
13404
+ const id = (_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id;
13405
+ const name = (_e2 = (_d2 = (_c2 = node.nodeName) != null ? _c2 : node.NodeName) != null ? _d2 : node.hierarchyNodeName) != null ? _e2 : node.HierarchyNodeName;
13406
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: id, children: name ? name : `Node ${id}` }, id);
13402
13407
  })
13403
13408
  ]
13404
13409
  }
@@ -13474,8 +13479,8 @@ var workflowItems = [
13474
13479
  }
13475
13480
  ];
13476
13481
  var permissionItems = [{
13477
- name: "Task Permission",
13478
- component: "Task_permission_main",
13482
+ name: "Step Permission",
13483
+ component: "step_permission_main",
13479
13484
  icon: import_react89.RiUserSettingsLine
13480
13485
  }, {
13481
13486
  name: "Assignment Rule",
@@ -13494,7 +13499,7 @@ var hierarchyItems = [
13494
13499
  icon: import_react89.RiUserSharedLine
13495
13500
  },
13496
13501
  {
13497
- name: "Workflow Step User Mapping",
13502
+ name: "Workflow Hierarchy Mapping",
13498
13503
  component: "User_hierarchy_mapping_main",
13499
13504
  icon: import_react89.RiUserSharedLine
13500
13505
  },
@@ -13555,7 +13560,8 @@ function Sidebar({
13555
13560
  childrens
13556
13561
  }) {
13557
13562
  const router = (0, import_router.useRouter)();
13558
- const [workflowOpen, setWorkflowOpen] = (0, import_react88.useState)(false);
13563
+ const [activeComponent, setActiveComponent] = (0, import_react88.useState)("workflowType");
13564
+ const [workflowOpen, setWorkflowOpen] = (0, import_react88.useState)(true);
13559
13565
  const [permissionOpen, setPermissionOpen] = (0, import_react88.useState)(false);
13560
13566
  const [hierarchyOpen, setHierarchyOpen] = (0, import_react88.useState)(false);
13561
13567
  const [documentOpen, setDocumentOpen] = (0, import_react88.useState)(false);
@@ -13563,14 +13569,25 @@ function Sidebar({
13563
13569
  const [tasksOpen, setTasksOpen] = (0, import_react88.useState)(false);
13564
13570
  const [trackingOpen, setTrackingOpen] = (0, import_react88.useState)(false);
13565
13571
  const [communicationOpen, setCommunicationOpen] = (0, import_react88.useState)(false);
13566
- const [activeComponent, setActiveComponent] = (0, import_react88.useState)("workflowType");
13567
- const renderMenuItemold = (item) => {
13568
- const Icon = item.icon;
13569
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("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: [
13570
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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__ */ (0, import_jsx_runtime88.jsx)(Icon, { size: 17 }) }),
13571
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "fc:flex-1 fc:whitespace-nowrap fc:text-[13px] fc:font-medium fc:leading-[20px]", children: item.name })
13572
- ] }, item.name);
13573
- };
13572
+ (0, import_react88.useEffect)(() => {
13573
+ if (workflowItems.some((item) => item.component === activeComponent)) {
13574
+ setWorkflowOpen(true);
13575
+ } else if (permissionItems.some((item) => item.component === activeComponent)) {
13576
+ setPermissionOpen(true);
13577
+ } else if (hierarchyItems.some((item) => item.component === activeComponent)) {
13578
+ setHierarchyOpen(true);
13579
+ } else if (documentItems.some((item) => item.component === activeComponent)) {
13580
+ setDocumentOpen(true);
13581
+ } else if (fileItems.some((item) => item.component === activeComponent)) {
13582
+ setFilesOpen(true);
13583
+ } else if (taskItems.some((item) => item.component === activeComponent)) {
13584
+ setTasksOpen(true);
13585
+ } else if (trackingItems.some((item) => item.component === activeComponent)) {
13586
+ setTrackingOpen(true);
13587
+ } else if (communicationItems.some((item) => item.component === activeComponent)) {
13588
+ setCommunicationOpen(true);
13589
+ }
13590
+ }, [activeComponent]);
13574
13591
  const renderMenuItem = (item) => {
13575
13592
  const Icon = item.icon;
13576
13593
  const handleClick = () => {
@@ -13584,10 +13601,27 @@ function Sidebar({
13584
13601
  router.push(item.path);
13585
13602
  }
13586
13603
  };
13587
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("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: [
13588
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Icon, { size: 16 }),
13589
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "fc:min-w-0 fc:flex-1 fc:whitespace-nowrap fc:text-[13px] fc:font-medium fc:leading-[20px]", children: item.name })
13590
- ] }, item.name);
13604
+ const isActive = item.component ? activeComponent === item.component : router.pathname === item.path;
13605
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
13606
+ "button",
13607
+ {
13608
+ type: "button",
13609
+ onClick: handleClick,
13610
+ title: item.name,
13611
+ 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]"}`,
13612
+ children: [
13613
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
13614
+ "span",
13615
+ {
13616
+ 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]"}`,
13617
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Icon, { size: 16 })
13618
+ }
13619
+ ),
13620
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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 })
13621
+ ]
13622
+ },
13623
+ item.name
13624
+ );
13591
13625
  };
13592
13626
  const renderContent = () => {
13593
13627
  switch (activeComponent) {
@@ -13605,7 +13639,7 @@ function Sidebar({
13605
13639
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Workflow_Step_Hierarchy_Mapping_Main, {});
13606
13640
  case "DocumentConfigurationmain":
13607
13641
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DocumentConfigurationmain, {});
13608
- case "Task_permission_main":
13642
+ case "step_permission_main":
13609
13643
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(TaskPermissionMain, {});
13610
13644
  case "AssignmentRuleMain":
13611
13645
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(AssignmentRuleMain, {});
@@ -13636,15 +13670,58 @@ function Sidebar({
13636
13670
  }
13637
13671
  };
13638
13672
  const renderDropdown = (title, open, setOpen, items, HeadingIcon) => {
13639
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:mb-2", children: [
13640
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("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: [
13641
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-[8px]", children: [
13642
- HeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(HeadingIcon, { size: 18, className: "fc:text-[#405170] fc:shrink-0" }),
13643
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "fc:text-[16px] fc:font-semibold", children: title })
13644
- ] }),
13645
- open ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiArrowDownSLine, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiArrowRightSLine, { size: 18 })
13646
- ] }),
13647
- open && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:ml-[2px] fc:border-l fc:border-[#E5E9F1] fc:pl-[2px]", children: items.map(renderMenuItem) })
13673
+ const hasActiveChild = items.some(
13674
+ (item) => item.component ? activeComponent === item.component : router.pathname === item.path
13675
+ );
13676
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:mb-1 mb-1", children: [
13677
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
13678
+ "button",
13679
+ {
13680
+ type: "button",
13681
+ onClick: () => setOpen(!open),
13682
+ 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]"}`,
13683
+ children: [
13684
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex flex fc:items-center items-center fc:gap-[10px] gap-[10px] fc:min-w-0 min-w-0", children: [
13685
+ HeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
13686
+ HeadingIcon,
13687
+ {
13688
+ size: 18,
13689
+ className: `fc:shrink-0 shrink-0 fc:transition-colors transition-colors ${hasActiveChild ? "fc:text-blue-600 text-blue-600" : "fc:text-[#405170] text-[#405170]"}`
13690
+ }
13691
+ ),
13692
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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 })
13693
+ ] }),
13694
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
13695
+ "span",
13696
+ {
13697
+ 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"}`,
13698
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiArrowRightSLine, { size: 18 })
13699
+ }
13700
+ )
13701
+ ]
13702
+ }
13703
+ ),
13704
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
13705
+ "div",
13706
+ {
13707
+ style: {
13708
+ display: "grid",
13709
+ gridTemplateRows: open ? "1fr" : "0fr",
13710
+ transition: "grid-template-rows 220ms cubic-bezier(0.4, 0, 0.2, 1)"
13711
+ },
13712
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
13713
+ "div",
13714
+ {
13715
+ style: {
13716
+ overflow: "hidden",
13717
+ opacity: open ? 1 : 0,
13718
+ transition: "opacity 180ms ease-in-out"
13719
+ },
13720
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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) })
13721
+ }
13722
+ )
13723
+ }
13724
+ )
13648
13725
  ] });
13649
13726
  };
13650
13727
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
@@ -13662,31 +13739,31 @@ function Sidebar({
13662
13739
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
13663
13740
  ] })
13664
13741
  ] }),
13665
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiMenuLine, { size: 18 }) })
13742
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiMenuLine, { size: 18 }) })
13666
13743
  ] }),
13667
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("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: [
13668
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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" }),
13669
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex fc:flex-col fc:gap-[3px]", children: [
13744
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("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: [
13745
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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" }),
13746
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
13670
13747
  renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, import_react89.RiNodeTree),
13671
13748
  renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, import_react89.RiShieldUserLine),
13672
13749
  renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, import_react89.RiFileSettingsLine),
13673
13750
  renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, import_react89.RiNodeTree)
13674
13751
  ] }),
13675
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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" }),
13676
- /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex fc:flex-col fc:gap-[3px]", children: [
13752
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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" }),
13753
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
13677
13754
  renderDropdown("Files", filesOpen, setFilesOpen, fileItems, import_react89.RiFolder3Line),
13678
13755
  renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, import_react89.RiCheckboxCircleLine),
13679
13756
  renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, import_react89.RiRouteLine),
13680
13757
  renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, import_react89.RiMessage2Line)
13681
13758
  ] })
13682
13759
  ] }),
13683
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:shrink-0 fc:bg-white fc:px-[27px] fc:pb-[34px] fc:pt-[18px]", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("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: [
13760
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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__ */ (0, import_jsx_runtime88.jsxs)("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: [
13684
13761
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiSettings4Line, { size: 20 }),
13685
13762
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { children: "Settings" })
13686
13763
  ] }) })
13687
13764
  ] }),
13688
- /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:flex-1 fc:overflow-auto fc:bg-[#F5F7FB]", children: renderContent() }),
13689
- !isOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiMenuLine, { size: 18 }) })
13765
+ /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:flex-1 flex-1 fc:overflow-auto overflow-auto fc:bg-[#F5F7FB] bg-[#F5F7FB]", children: renderContent() }),
13766
+ !isOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("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__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiMenuLine, { size: 18 }) })
13690
13767
  ] });
13691
13768
  }
13692
13769