flowcore-fn 9.3.3 → 9.3.5

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.
Files changed (3) hide show
  1. package/dist/pkg-index.js +1107 -1119
  2. package/dist/pkg-index.mjs +1019 -1031
  3. package/package.json +1 -1
@@ -19,14 +19,13 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
 
21
21
  // src/components/Sidebar.jsx
22
- import { useState as useState56 } from "react";
22
+ import { useState as useState59 } from "react";
23
23
  import { RiFlowChart, RiShieldUserLine, RiFolder3Line, RiCheckboxCircleLine, RiRouteLine, RiMessage2Line, RiMenuLine, RiGitMergeLine, RiNodeTree, RiGitBranchLine, RiCornerDownRightLine, RiUserSettingsLine, RiFileShieldLine, RiUserSharedLine, RiSettings4Line, RiFileSettingsLine, RiFileList3Line, RiFileUploadLine, RiNotification4Line, RiDatabase2Line, RiChat3Line, RiCheckboxMultipleLine, RiShieldCheckLine, RiHistoryLine, RiArrowDownSLine, RiArrowRightSLine } from "@remixicon/react";
24
24
  import { useRouter } from "next/router";
25
25
 
26
26
  // src/components/workflow/WorkflowMain.jsx
27
- import React9, { useState as useState5, useRef as useRef2 } from "react";
28
- import { useEffect as useEffect3 } from "react";
29
- import Swal from "sweetalert2";
27
+ import React9, { useState as useState6, useRef as useRef2, useEffect as useEffect5 } from "react";
28
+ import Swal3 from "sweetalert2";
30
29
 
31
30
  // src/components/Service/ApiEndpointsProvider.js
32
31
  var STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
@@ -113,155 +112,11 @@ function SearchBar({ searchQuery, setSearchQuery }) {
113
112
  }
114
113
 
115
114
  // src/components/workflow/WorkflowTable.jsx
116
- import React4, { useState as useState2 } from "react";
117
-
118
- // src/components/workflow/AddEditModal.jsx
119
- import React2, { useEffect, useState } from "react";
120
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
121
- function AddEditModal({
122
- isOpen,
123
- onClose,
124
- onSave,
125
- editData
126
- }) {
127
- const [formData, setFormData] = useState({
128
- name: "",
129
- code: "",
130
- type: "",
131
- version: "",
132
- published: true,
133
- status: true
134
- });
135
- useEffect(() => {
136
- if (editData) {
137
- setFormData(editData);
138
- }
139
- }, [editData]);
140
- if (!isOpen) return null;
141
- const handleChange = (e) => {
142
- const { name, value, type, checked } = e.target;
143
- setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
144
- [name]: type === "checkbox" ? checked : value
145
- }));
146
- };
147
- const handleSave = () => {
148
- onSave(formData);
149
- onClose();
150
- };
151
- return /* @__PURE__ */ jsx2("div", { className: "fc:fixed fc:inset-0 fc:bg-black/40 fc:flex fc:items-center fc:justify-center fc:z-50", children: /* @__PURE__ */ jsxs2("div", { className: "fc:bg-white fc:w-[550px] fc:rounded-xl fc:shadow-xl fc:p-6", children: [
152
- /* @__PURE__ */ jsxs2("div", { className: "fc:flex fc:justify-between fc:items-center fc:mb-6", children: [
153
- /* @__PURE__ */ jsx2("h2", { className: "fc:text-xl fc:font-bold fc:text-slate-800", children: "Edit Workflow" }),
154
- /* @__PURE__ */ jsx2(
155
- "button",
156
- {
157
- onClick: onClose,
158
- className: "fc:text-slate-500 hover:fc:text-red-500 fc:text-xl",
159
- children: "\u2715"
160
- }
161
- )
162
- ] }),
163
- /* @__PURE__ */ jsxs2("div", { className: "fc:mb-4", children: [
164
- /* @__PURE__ */ jsx2("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Workflow Name" }),
165
- /* @__PURE__ */ jsx2(
166
- "input",
167
- {
168
- type: "text",
169
- name: "name",
170
- value: formData.name,
171
- onChange: handleChange,
172
- className: "fc:w-full fc:border fc:border-slate-300 fc:rounded-lg fc:px-3 fc:py-2 fc:outline-none focus:fc:border-blue-500"
173
- }
174
- )
175
- ] }),
176
- /* @__PURE__ */ jsxs2("div", { className: "fc:mb-4", children: [
177
- /* @__PURE__ */ jsx2("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Workflow Code" }),
178
- /* @__PURE__ */ jsx2(
179
- "input",
180
- {
181
- type: "text",
182
- name: "code",
183
- value: formData.code,
184
- onChange: handleChange,
185
- className: "fc:w-full fc:border fc:border-slate-300 fc:rounded-lg fc:px-3 fc:py-2 fc:outline-none focus:fc:border-blue-500"
186
- }
187
- )
188
- ] }),
189
- /* @__PURE__ */ jsxs2("div", { className: "fc:mb-4", children: [
190
- /* @__PURE__ */ jsx2("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Workflow Type" }),
191
- /* @__PURE__ */ jsx2(
192
- "input",
193
- {
194
- type: "text",
195
- name: "type",
196
- value: formData.type,
197
- onChange: handleChange,
198
- className: "fc:w-full fc:border fc:border-slate-300 fc:rounded-lg fc:px-3 fc:py-2 fc:outline-none focus:fc:border-blue-500"
199
- }
200
- )
201
- ] }),
202
- /* @__PURE__ */ jsxs2("div", { className: "fc:mb-4", children: [
203
- /* @__PURE__ */ jsx2("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Version" }),
204
- /* @__PURE__ */ jsx2(
205
- "input",
206
- {
207
- type: "number",
208
- name: "version",
209
- value: formData.version,
210
- onChange: handleChange,
211
- className: "fc:w-full fc:border fc:border-slate-300 fc:rounded-lg fc:px-3 fc:py-2 fc:outline-none focus:fc:border-blue-500"
212
- }
213
- )
214
- ] }),
215
- /* @__PURE__ */ jsxs2("div", { className: "fc:flex fc:items-center fc:gap-3 fc:mb-4", children: [
216
- /* @__PURE__ */ jsx2("label", { className: "fc:text-sm fc:font-medium", children: "Published" }),
217
- /* @__PURE__ */ jsx2(
218
- "input",
219
- {
220
- type: "checkbox",
221
- name: "published",
222
- checked: formData.published,
223
- onChange: handleChange
224
- }
225
- ),
226
- /* @__PURE__ */ jsx2("span", { children: formData.published ? "Yes" : "No" })
227
- ] }),
228
- /* @__PURE__ */ jsxs2("div", { className: "fc:flex fc:items-center fc:gap-3 fc:mb-8", children: [
229
- /* @__PURE__ */ jsx2("label", { className: "fc:text-sm fc:font-medium", children: "Status" }),
230
- /* @__PURE__ */ jsx2(
231
- "input",
232
- {
233
- type: "checkbox",
234
- name: "status",
235
- checked: formData.status,
236
- onChange: handleChange
237
- }
238
- ),
239
- /* @__PURE__ */ jsx2("span", { children: formData.status ? "Active" : "Inactive" })
240
- ] }),
241
- /* @__PURE__ */ jsxs2("div", { className: "fc:flex fc:justify-end fc:gap-3", children: [
242
- /* @__PURE__ */ jsx2(
243
- "button",
244
- {
245
- onClick: onClose,
246
- className: "fc:px-5 fc:py-2 fc:rounded-lg fc:border fc:border-slate-300 hover:fc:bg-slate-100",
247
- children: "Cancel"
248
- }
249
- ),
250
- /* @__PURE__ */ jsx2(
251
- "button",
252
- {
253
- onClick: handleSave,
254
- className: "fc:px-5 fc:py-2 fc:rounded-lg fc:bg-blue-600 hover:fc:bg-blue-700 fc:text-white",
255
- children: "Save"
256
- }
257
- )
258
- ] })
259
- ] }) });
260
- }
115
+ import React3, { useState, useEffect } from "react";
261
116
 
262
117
  // src/components/workflow/DeleteModal.jsx
263
- import React3 from "react";
264
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
118
+ import React2 from "react";
119
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
265
120
  function DeleteModal({
266
121
  isOpen,
267
122
  onClose,
@@ -269,10 +124,10 @@ function DeleteModal({
269
124
  workflowName = "Citizen Petition"
270
125
  }) {
271
126
  if (!isOpen) return null;
272
- return /* @__PURE__ */ jsxs3("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center", children: [
273
- /* @__PURE__ */ jsx3("div", { className: "fc:absolute fc:inset-0 fc:bg-black/25 fc:backdrop-blur-sm" }),
274
- /* @__PURE__ */ jsxs3("div", { className: "fc:relative fc:bg-white fc:w-[390px] fc:rounded-[22px] fc:shadow-2xl fc:px-8 fc:pt-7 fc:pb-6", children: [
275
- /* @__PURE__ */ jsx3(
127
+ return /* @__PURE__ */ jsxs2("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center", children: [
128
+ /* @__PURE__ */ jsx2("div", { className: "fc:absolute fc:inset-0 fc:bg-black/25 fc:backdrop-blur-sm" }),
129
+ /* @__PURE__ */ jsxs2("div", { className: "fc:relative fc:bg-white fc:w-[390px] fc:rounded-[22px] fc:shadow-2xl fc:px-8 fc:pt-7 fc:pb-6", children: [
130
+ /* @__PURE__ */ jsx2(
276
131
  "button",
277
132
  {
278
133
  onClick: onClose,
@@ -280,21 +135,21 @@ function DeleteModal({
280
135
  children: "\xD7"
281
136
  }
282
137
  ),
283
- /* @__PURE__ */ jsx3("div", { className: "fc:flex fc:justify-center", children: /* @__PURE__ */ jsx3("div", { className: "fc:w-12 fc:h-12 fc:bg-orange-50 fc:rounded-2xl fc:flex fc:items-center fc:justify-center", children: /* @__PURE__ */ jsx3("span", { className: "fc:text-2xl", children: "\u26A0\uFE0F" }) }) }),
284
- /* @__PURE__ */ jsx3("h2", { className: "fc:text-[31px] fc:font-semibold fc:text-center fc:mt-5 fc:text-gray-900", children: "Delete Workflow" }),
285
- /* @__PURE__ */ jsxs3("p", { className: "fc:text-center fc:text-gray-500 fc:text-sm fc:mt-3", children: [
138
+ /* @__PURE__ */ jsx2("div", { className: "fc:flex fc:justify-center", children: /* @__PURE__ */ jsx2("div", { className: "fc:w-12 fc:h-12 fc:bg-orange-50 fc:rounded-2xl fc:flex fc:items-center fc:justify-center", children: /* @__PURE__ */ jsx2("span", { className: "fc:text-2xl", children: "\u26A0\uFE0F" }) }) }),
139
+ /* @__PURE__ */ jsx2("h2", { className: "fc:text-[31px] fc:font-semibold fc:text-center fc:mt-5 fc:text-gray-900", children: "Delete Workflow" }),
140
+ /* @__PURE__ */ jsxs2("p", { className: "fc:text-center fc:text-gray-500 fc:text-sm fc:mt-3", children: [
286
141
  "Are you sure you want to delete",
287
142
  " ",
288
- /* @__PURE__ */ jsxs3("span", { className: "fc:font-semibold fc:text-gray-700", children: [
143
+ /* @__PURE__ */ jsxs2("span", { className: "fc:font-semibold fc:text-gray-700", children: [
289
144
  '"',
290
145
  workflowName,
291
146
  '"'
292
147
  ] }),
293
148
  "?"
294
149
  ] }),
295
- /* @__PURE__ */ jsx3("p", { className: "fc:text-center fc:text-gray-400 fc:text-sm fc:mt-1", children: "This action cannot be undone." }),
296
- /* @__PURE__ */ jsxs3("div", { className: "fc:flex fc:gap-3 fc:mt-8", children: [
297
- /* @__PURE__ */ jsx3(
150
+ /* @__PURE__ */ jsx2("p", { className: "fc:text-center fc:text-gray-400 fc:text-sm fc:mt-1", children: "This action cannot be undone." }),
151
+ /* @__PURE__ */ jsxs2("div", { className: "fc:flex fc:gap-3 fc:mt-8", children: [
152
+ /* @__PURE__ */ jsx2(
298
153
  "button",
299
154
  {
300
155
  onClick: onClose,
@@ -302,7 +157,7 @@ function DeleteModal({
302
157
  children: "Cancel"
303
158
  }
304
159
  ),
305
- /* @__PURE__ */ jsx3(
160
+ /* @__PURE__ */ jsx2(
306
161
  "button",
307
162
  {
308
163
  onClick: () => {
@@ -319,8 +174,8 @@ function DeleteModal({
319
174
  }
320
175
 
321
176
  // src/components/workflow/WorkflowTable.jsx
322
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
323
- function WorkflowTable({ pageSize, searchQuery, apiData }) {
177
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
178
+ function WorkflowTable({ pageSize, searchQuery, apiData, onEdit, onDeleteApi }) {
324
179
  const initialData = [
325
180
  {
326
181
  id: "1",
@@ -431,19 +286,18 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
431
286
  status: true
432
287
  }
433
288
  ];
434
- const [data, setData] = useState2(apiData || initialData);
435
- React4.useEffect(() => {
289
+ const [data, setData] = useState(apiData || initialData);
290
+ React3.useEffect(() => {
436
291
  if (apiData) setData(apiData);
437
292
  }, [apiData]);
438
293
  const filteredData = data.filter(
439
294
  (item) => item.name.toLowerCase().includes((searchQuery || "").toLowerCase()) || item.code.toLowerCase().includes((searchQuery || "").toLowerCase())
440
295
  );
441
- const [sortColumn, setSortColumn] = useState2("");
442
- const [sortDirection, setSortDirection] = useState2("asc");
443
- const [currentPage, setCurrentPage] = useState2(1);
444
- const [editOpen, setEditOpen] = useState2(false);
445
- const [deleteOpen, setDeleteOpen] = useState2(false);
446
- const [selectedWorkflow, setSelectedWorkflow] = useState2(null);
296
+ const [sortColumn, setSortColumn] = useState("");
297
+ const [sortDirection, setSortDirection] = useState("asc");
298
+ const [currentPage, setCurrentPage] = useState(1);
299
+ const [deleteOpen, setDeleteOpen] = useState(false);
300
+ const [selectedWorkflow, setSelectedWorkflow] = useState(null);
447
301
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
448
302
  const startIndex = (currentPage - 1) * pageSize;
449
303
  const visibleData = filteredData.slice(
@@ -469,8 +323,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
469
323
  };
470
324
  const getSortIcon = (column) => {
471
325
  if (sortColumn !== column)
472
- return /* @__PURE__ */ jsx4("span", { className: "fc:text-slate-500 fc:ml-1", children: "\u25B2" });
473
- return sortDirection === "asc" ? /* @__PURE__ */ jsx4("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25B2" }) : /* @__PURE__ */ jsx4("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25BC" });
326
+ return /* @__PURE__ */ jsx3("span", { className: "fc:text-slate-500 fc:ml-1", children: "\u25B2" });
327
+ return sortDirection === "asc" ? /* @__PURE__ */ jsx3("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25B2" }) : /* @__PURE__ */ jsx3("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25BC" });
474
328
  };
475
329
  const toggleSwitch = (id) => {
476
330
  setData(
@@ -482,22 +336,21 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
482
336
  );
483
337
  };
484
338
  const handleEdit = (workflow) => {
485
- setSelectedWorkflow(workflow);
486
- setEditOpen(true);
339
+ if (onEdit) {
340
+ onEdit(workflow);
341
+ return;
342
+ }
487
343
  };
488
344
  const handleDelete = (workflow) => {
489
345
  setSelectedWorkflow(workflow);
490
346
  setDeleteOpen(true);
491
347
  };
492
- const handleUpdate = (updatedWorkflow) => {
493
- setData(
494
- (prev) => prev.map(
495
- (item) => item.id === updatedWorkflow.id ? updatedWorkflow : item
496
- )
497
- );
498
- setEditOpen(false);
499
- };
500
- const confirmDelete = () => {
348
+ const confirmDelete = async () => {
349
+ if (onDeleteApi) {
350
+ await onDeleteApi(selectedWorkflow);
351
+ setDeleteOpen(false);
352
+ return;
353
+ }
501
354
  setData(
502
355
  (prev) => prev.filter(
503
356
  (item) => item.id !== selectedWorkflow.id
@@ -505,82 +358,82 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
505
358
  );
506
359
  setDeleteOpen(false);
507
360
  };
508
- return /* @__PURE__ */ jsx4(Fragment, { children: /* @__PURE__ */ jsxs4("div", { className: "fc:space-y-5", children: [
509
- /* @__PURE__ */ jsxs4("div", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden", children: [
510
- /* @__PURE__ */ jsx4("div", { className: "fc:max-h-[420px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ jsxs4("table", { className: "fc:w-full fc:border-collapse fc:bg-white", children: [
511
- /* @__PURE__ */ jsx4("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50", children: /* @__PURE__ */ jsxs4("tr", { className: "fc:border-b fc:border-slate-200 fc:text-xs fc:uppercase fc:text-slate-500", children: [
512
- /* @__PURE__ */ jsx4("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "S.No" }),
513
- /* @__PURE__ */ jsx4(
361
+ return /* @__PURE__ */ jsx3(Fragment, { children: /* @__PURE__ */ jsxs3("div", { className: "fc:space-y-5", children: [
362
+ /* @__PURE__ */ jsxs3("div", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden", children: [
363
+ /* @__PURE__ */ jsx3("div", { className: "fc:max-h-[420px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ jsxs3("table", { className: "fc:w-full fc:border-collapse fc:bg-white", children: [
364
+ /* @__PURE__ */ jsx3("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50", children: /* @__PURE__ */ jsxs3("tr", { className: "fc:border-b fc:border-slate-200 fc:text-xs fc:uppercase fc:text-slate-500", children: [
365
+ /* @__PURE__ */ jsx3("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "S.No" }),
366
+ /* @__PURE__ */ jsx3(
514
367
  "th",
515
368
  {
516
369
  onClick: () => handleSort("name"),
517
370
  className: "fc:px-5 fc:py-4 fc:cursor-pointer",
518
- children: /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:items-center", children: [
371
+ children: /* @__PURE__ */ jsxs3("div", { className: "fc:flex fc:items-center", children: [
519
372
  "Workflow Name",
520
373
  getSortIcon("name")
521
374
  ] })
522
375
  }
523
376
  ),
524
- /* @__PURE__ */ jsx4(
377
+ /* @__PURE__ */ jsx3(
525
378
  "th",
526
379
  {
527
380
  onClick: () => handleSort("code"),
528
381
  className: "fc:px-5 fc:py-4 fc:cursor-pointer",
529
- children: /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:items-center", children: [
382
+ children: /* @__PURE__ */ jsxs3("div", { className: "fc:flex fc:items-center", children: [
530
383
  "Workflow Code",
531
384
  getSortIcon("code")
532
385
  ] })
533
386
  }
534
387
  ),
535
- /* @__PURE__ */ jsx4(
388
+ /* @__PURE__ */ jsx3(
536
389
  "th",
537
390
  {
538
391
  onClick: () => handleSort("type"),
539
392
  className: "fc:px-5 fc:py-4 fc:cursor-pointer",
540
- children: /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:items-center", children: [
393
+ children: /* @__PURE__ */ jsxs3("div", { className: "fc:flex fc:items-center", children: [
541
394
  "Workflow Type",
542
395
  getSortIcon("type")
543
396
  ] })
544
397
  }
545
398
  ),
546
- /* @__PURE__ */ jsx4(
399
+ /* @__PURE__ */ jsx3(
547
400
  "th",
548
401
  {
549
402
  onClick: () => handleSort("version"),
550
403
  className: "fc:px-5 fc:py-4 fc:text-center fc:cursor-pointer",
551
- children: /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:justify-center fc:items-center", children: [
404
+ children: /* @__PURE__ */ jsxs3("div", { className: "fc:flex fc:justify-center fc:items-center", children: [
552
405
  "Version",
553
406
  getSortIcon("version")
554
407
  ] })
555
408
  }
556
409
  ),
557
- /* @__PURE__ */ jsx4("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Published" }),
558
- /* @__PURE__ */ jsx4("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Status" }),
559
- /* @__PURE__ */ jsx4("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Action" })
410
+ /* @__PURE__ */ jsx3("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Published" }),
411
+ /* @__PURE__ */ jsx3("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Status" }),
412
+ /* @__PURE__ */ jsx3("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Action" })
560
413
  ] }) }),
561
- /* @__PURE__ */ jsx4("tbody", { className: "fc:divide-y fc:divide-slate-100", children: visibleData.map((item, index) => /* @__PURE__ */ jsxs4(
414
+ /* @__PURE__ */ jsx3("tbody", { className: "fc:divide-y fc:divide-slate-100", children: visibleData.map((item, index) => /* @__PURE__ */ jsxs3(
562
415
  "tr",
563
416
  {
564
417
  className: "hover:fc:bg-slate-50",
565
418
  children: [
566
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: startIndex + index + 1 }),
567
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4 fc:font-semibold", children: item.name }),
568
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4", children: item.code }),
569
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4", children: item.type }),
570
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: item.version }),
571
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx4(
419
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: startIndex + index + 1 }),
420
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4 fc:font-semibold", children: item.name }),
421
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4", children: item.code }),
422
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4", children: item.type }),
423
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: item.version }),
424
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx3(
572
425
  "span",
573
426
  {
574
427
  className: `fc:px-3 fc:py-1 fc:rounded-md fc:text-xs ${item.published ? "fc:bg-green-100 fc:text-green-700" : "fc:bg-red-100 fc:text-red-700"}`,
575
428
  children: item.published ? "Yes" : "No"
576
429
  }
577
430
  ) }),
578
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx4(
431
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx3(
579
432
  "button",
580
433
  {
581
434
  onClick: () => toggleSwitch(item.id),
582
435
  className: `fc:w-11 fc:h-6 fc:rounded-full fc:relative ${item.status ? "fc:bg-blue-600" : "fc:bg-gray-300"}`,
583
- children: /* @__PURE__ */ jsx4(
436
+ children: /* @__PURE__ */ jsx3(
584
437
  "span",
585
438
  {
586
439
  className: `fc:absolute fc:top-0.5 fc:h-5 fc:w-5 fc:bg-white fc:rounded-full fc:transition-all ${item.status ? "fc:left-5" : "fc:left-0.5"}`
@@ -588,8 +441,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
588
441
  )
589
442
  }
590
443
  ) }),
591
- /* @__PURE__ */ jsx4("td", { className: "fc:px-5 fc:py-4", children: /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:justify-center fc:gap-2", children: [
592
- /* @__PURE__ */ jsx4(
444
+ /* @__PURE__ */ jsx3("td", { className: "fc:px-5 fc:py-4", children: /* @__PURE__ */ jsxs3("div", { className: "fc:flex fc:justify-center fc:gap-2", children: [
445
+ /* @__PURE__ */ jsx3(
593
446
  "button",
594
447
  {
595
448
  onClick: () => handleEdit(item),
@@ -597,7 +450,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
597
450
  children: "Edit"
598
451
  }
599
452
  ),
600
- /* @__PURE__ */ jsx4(
453
+ /* @__PURE__ */ jsx3(
601
454
  "button",
602
455
  {
603
456
  onClick: () => handleDelete(item),
@@ -611,8 +464,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
611
464
  item.id
612
465
  )) })
613
466
  ] }) }),
614
- /* @__PURE__ */ jsxs4("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: [
615
- /* @__PURE__ */ jsx4(
467
+ /* @__PURE__ */ jsxs3("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: [
468
+ /* @__PURE__ */ jsx3(
616
469
  "button",
617
470
  {
618
471
  onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
@@ -620,7 +473,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
620
473
  children: "\u2039 Prev"
621
474
  }
622
475
  ),
623
- Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ jsx4(
476
+ Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ jsx3(
624
477
  "button",
625
478
  {
626
479
  onClick: () => setCurrentPage(page),
@@ -629,7 +482,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
629
482
  },
630
483
  page
631
484
  )),
632
- /* @__PURE__ */ jsx4(
485
+ /* @__PURE__ */ jsx3(
633
486
  "button",
634
487
  {
635
488
  onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
@@ -637,7 +490,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
637
490
  children: "Next \u203A"
638
491
  }
639
492
  ),
640
- /* @__PURE__ */ jsx4(
493
+ /* @__PURE__ */ jsx3(
641
494
  "button",
642
495
  {
643
496
  onClick: () => setCurrentPage(totalPages),
@@ -647,16 +500,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
647
500
  )
648
501
  ] })
649
502
  ] }),
650
- /* @__PURE__ */ jsx4(
651
- AddEditModal,
652
- {
653
- isOpen: editOpen,
654
- editData: selectedWorkflow,
655
- onClose: () => setEditOpen(false),
656
- onSave: handleUpdate
657
- }
658
- ),
659
- /* @__PURE__ */ jsx4(
503
+ /* @__PURE__ */ jsx3(
660
504
  DeleteModal,
661
505
  {
662
506
  isOpen: deleteOpen,
@@ -669,26 +513,330 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
669
513
  }
670
514
 
671
515
  // src/components/workflow/AddWorkflowModal.jsx
672
- import React5 from "react";
673
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
516
+ import React4, { useEffect as useEffect2, useState as useState2 } from "react";
517
+ import Swal from "sweetalert2";
518
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
519
+ var INITIAL_FORM = {
520
+ workflowTypeId: "",
521
+ workflowCode: "",
522
+ workflowName: "",
523
+ version: "1",
524
+ published: "false",
525
+ status: "active",
526
+ defaultPriority: "medium",
527
+ description: ""
528
+ };
674
529
  function AddWorkflowModal({
675
530
  isOpen,
676
531
  onClose,
677
- workflowTypes = []
532
+ workflowTypes = [],
533
+ onSave
678
534
  }) {
535
+ const [formData, setFormData] = useState2(INITIAL_FORM);
536
+ const [errors, setErrors] = useState2({});
537
+ const [isSubmitting, setIsSubmitting] = useState2(false);
538
+ const [submitError, setSubmitError] = useState2("");
539
+ useEffect2(() => {
540
+ if (!isOpen) {
541
+ setFormData(INITIAL_FORM);
542
+ setErrors({});
543
+ setSubmitError("");
544
+ setIsSubmitting(false);
545
+ }
546
+ }, [isOpen]);
679
547
  if (!isOpen) return null;
548
+ const handleChange = (event) => {
549
+ const { name, value } = event.target;
550
+ if (name === "description" && value.length > 500) return;
551
+ setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [name]: value }));
552
+ setErrors((prev) => __spreadProps(__spreadValues({}, prev), { [name]: "" }));
553
+ setSubmitError("");
554
+ };
555
+ const validate = () => {
556
+ const nextErrors = {};
557
+ if (!formData.workflowTypeId) nextErrors.workflowTypeId = "Workflow type is required";
558
+ if (!formData.workflowCode.trim()) nextErrors.workflowCode = "Workflow code is required";
559
+ if (!formData.workflowName.trim()) nextErrors.workflowName = "Workflow name is required";
560
+ if (!formData.version.trim()) nextErrors.version = "Version is required";
561
+ setErrors(nextErrors);
562
+ return Object.keys(nextErrors).length === 0;
563
+ };
564
+ const handleSubmit = async (event) => {
565
+ var _a, _b;
566
+ event.preventDefault();
567
+ if (!validate()) return;
568
+ if (!onSave) {
569
+ setSubmitError("Save handler not configured.");
570
+ return;
571
+ }
572
+ const payload = {
573
+ workflowTypeId: formData.workflowTypeId,
574
+ workflowCode: formData.workflowCode.trim(),
575
+ workflowName: formData.workflowName.trim(),
576
+ version: formData.version.trim(),
577
+ published: formData.published === "true",
578
+ status: formData.status === "active",
579
+ defaultPriority: formData.defaultPriority,
580
+ description: formData.description.trim(),
581
+ createdBy: "System"
582
+ };
583
+ try {
584
+ setIsSubmitting(true);
585
+ const result = await onSave(payload);
586
+ if (result) {
587
+ onClose();
588
+ }
589
+ } catch (error) {
590
+ const message = ((_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 save workflow.";
591
+ setSubmitError(message);
592
+ await Swal.fire("Error", message, "error");
593
+ } finally {
594
+ setIsSubmitting(false);
595
+ }
596
+ };
597
+ return /* @__PURE__ */ jsxs4("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
598
+ /* @__PURE__ */ jsx4("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
599
+ /* @__PURE__ */ jsxs4("form", { onSubmit: handleSubmit, className: "fc:relative fc:w-full fc:max-w-4xl fc:bg-white fc:rounded-3xl fc:shadow-2xl fc:flex fc:flex-col fc:z-10 fc:max-h-[92vh] fc:overflow-hidden fc:animate-in fc:fade-in fc:zoom-in-95 fc:duration-200", children: [
600
+ /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-8 fc:py-6 fc:border-b fc:border-slate-100", children: [
601
+ /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
602
+ /* @__PURE__ */ jsx4("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__ */ jsx4("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx4("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" }) }) }),
603
+ /* @__PURE__ */ jsxs4("div", { children: [
604
+ /* @__PURE__ */ jsx4("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow" }),
605
+ /* @__PURE__ */ jsx4("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new workflow and configure its details" })
606
+ ] })
607
+ ] }),
608
+ /* @__PURE__ */ jsx4("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 hover:fc:fc:text-slate-600 hover:fc:fc:bg-slate-100 fc:p-2 fc:rounded-full fc:transition-all fc:text-sm fc:font-semibold", children: "\u2715" })
609
+ ] }),
610
+ /* @__PURE__ */ jsxs4("div", { className: "fc:p-8 fc:space-y-8 fc:overflow-y-auto fc:max-h-[calc(92vh-170px)] fc:bg-slate-50/30", children: [
611
+ /* @__PURE__ */ jsxs4("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
612
+ /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-indigo-600 fc:text-sm fc:font-bold fc:border-b fc:border-slate-50 fc:pb-3", children: [
613
+ /* @__PURE__ */ jsx4("span", { children: "\u{1F4CB}" }),
614
+ /* @__PURE__ */ jsx4("span", { children: "Workflow Information" })
615
+ ] }),
616
+ /* @__PURE__ */ jsxs4("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
617
+ /* @__PURE__ */ jsxs4("div", { children: [
618
+ /* @__PURE__ */ jsxs4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
619
+ "Workflow Type ",
620
+ /* @__PURE__ */ jsx4("span", { className: "fc:text-red-500", children: "*" })
621
+ ] }),
622
+ /* @__PURE__ */ jsxs4("select", { name: "workflowTypeId", value: formData.workflowTypeId, onChange: handleChange, className: inputClass(errors.workflowTypeId), children: [
623
+ /* @__PURE__ */ jsx4("option", { value: "", children: "Select workflow type" }),
624
+ workflowTypes.length > 0 ? workflowTypes.map((type) => {
625
+ var _a, _b;
626
+ const id = (_a = type.workflowTypeId) != null ? _a : type.WorkflowTypeId;
627
+ const label = (_b = type.workflowTypeName) != null ? _b : type.WorkflowTypeName;
628
+ return /* @__PURE__ */ jsx4("option", { value: id, children: label }, id);
629
+ }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
630
+ /* @__PURE__ */ jsx4("option", { value: "petition", children: "Petition" }),
631
+ /* @__PURE__ */ jsx4("option", { value: "building", children: "Building Permission" }),
632
+ /* @__PURE__ */ jsx4("option", { value: "leave", children: "Leave" })
633
+ ] })
634
+ ] }),
635
+ errors.workflowTypeId && /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowTypeId })
636
+ ] }),
637
+ /* @__PURE__ */ jsxs4("div", { children: [
638
+ /* @__PURE__ */ jsxs4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
639
+ "Workflow Code ",
640
+ /* @__PURE__ */ jsx4("span", { className: "fc:text-red-500", children: "*" })
641
+ ] }),
642
+ /* @__PURE__ */ jsx4("input", { name: "workflowCode", value: formData.workflowCode, onChange: handleChange, type: "text", placeholder: "Enter workflow code", className: inputClass(errors.workflowCode) }),
643
+ errors.workflowCode && /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowCode })
644
+ ] })
645
+ ] }),
646
+ /* @__PURE__ */ jsxs4("div", { children: [
647
+ /* @__PURE__ */ jsxs4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
648
+ "Workflow Name ",
649
+ /* @__PURE__ */ jsx4("span", { className: "fc:text-red-500", children: "*" })
650
+ ] }),
651
+ /* @__PURE__ */ jsx4("input", { name: "workflowName", value: formData.workflowName, onChange: handleChange, type: "text", placeholder: "Enter workflow name", className: inputClass(errors.workflowName) }),
652
+ errors.workflowName && /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowName })
653
+ ] }),
654
+ /* @__PURE__ */ jsxs4("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
655
+ /* @__PURE__ */ jsxs4("div", { children: [
656
+ /* @__PURE__ */ jsxs4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
657
+ "Version ",
658
+ /* @__PURE__ */ jsx4("span", { className: "fc:text-red-500", children: "*" })
659
+ ] }),
660
+ /* @__PURE__ */ jsx4("input", { name: "version", type: "text", value: formData.version, onChange: handleChange, className: inputClass(errors.version) }),
661
+ errors.version && /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.version })
662
+ ] }),
663
+ /* @__PURE__ */ jsxs4("div", { children: [
664
+ /* @__PURE__ */ jsxs4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
665
+ "Published ",
666
+ /* @__PURE__ */ jsx4("span", { className: "fc:text-red-500", children: "*" })
667
+ ] }),
668
+ /* @__PURE__ */ jsxs4("select", { name: "published", value: formData.published, onChange: handleChange, className: inputClass(), children: [
669
+ /* @__PURE__ */ jsx4("option", { value: "false", children: "No" }),
670
+ /* @__PURE__ */ jsx4("option", { value: "true", children: "Yes" })
671
+ ] }),
672
+ /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Make workflow active for use" })
673
+ ] })
674
+ ] })
675
+ ] }),
676
+ /* @__PURE__ */ jsxs4("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-3", children: [
677
+ /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:justify-between fc:items-center", children: [
678
+ /* @__PURE__ */ jsx4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: "Description" }),
679
+ /* @__PURE__ */ jsxs4("span", { className: "fc:text-[10px] fc:text-slate-400", children: [
680
+ formData.description.length,
681
+ " / 500"
682
+ ] })
683
+ ] }),
684
+ /* @__PURE__ */ jsx4("textarea", { name: "description", rows: 3, value: formData.description, onChange: handleChange, placeholder: "Enter workflow description (optional)", className: inputClass() }),
685
+ /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-400", children: "Provide additional information about this workflow" })
686
+ ] }),
687
+ /* @__PURE__ */ jsxs4("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
688
+ /* @__PURE__ */ jsxs4("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-indigo-600 fc:text-sm fc:font-bold fc:border-b fc:border-slate-50 fc:pb-3", children: [
689
+ /* @__PURE__ */ jsx4("span", { children: "\u2699\uFE0F" }),
690
+ /* @__PURE__ */ jsx4("span", { children: "Status & Settings" })
691
+ ] }),
692
+ /* @__PURE__ */ jsxs4("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
693
+ /* @__PURE__ */ jsxs4("div", { children: [
694
+ /* @__PURE__ */ jsxs4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
695
+ "Status ",
696
+ /* @__PURE__ */ jsx4("span", { className: "fc:text-red-500", children: "*" })
697
+ ] }),
698
+ /* @__PURE__ */ jsxs4("select", { name: "status", value: formData.status, onChange: handleChange, className: inputClass(), children: [
699
+ /* @__PURE__ */ jsx4("option", { value: "active", children: "Active" }),
700
+ /* @__PURE__ */ jsx4("option", { value: "inactive", children: "Inactive" })
701
+ ] }),
702
+ /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Set the initial status of this workflow" })
703
+ ] }),
704
+ /* @__PURE__ */ jsxs4("div", { children: [
705
+ /* @__PURE__ */ jsx4("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: "Default Priority" }),
706
+ /* @__PURE__ */ jsxs4("select", { name: "defaultPriority", value: formData.defaultPriority, onChange: handleChange, className: inputClass(), children: [
707
+ /* @__PURE__ */ jsx4("option", { value: "medium", children: "Medium" }),
708
+ /* @__PURE__ */ jsx4("option", { value: "high", children: "High" }),
709
+ /* @__PURE__ */ jsx4("option", { value: "low", children: "Low" })
710
+ ] }),
711
+ /* @__PURE__ */ jsx4("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Default priority for tasks in this workflow" })
712
+ ] })
713
+ ] })
714
+ ] })
715
+ ] }),
716
+ /* @__PURE__ */ jsxs4("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: [
717
+ /* @__PURE__ */ jsx4("button", { type: "button", onClick: onClose, disabled: isSubmitting, className: "fc:px-6 fc:py-2.5 fc:border fc:border-slate-200 fc:text-red-500 fc:text-xs fc:font-bold fc:rounded-xl hover:fc:fc:bg-slate-50 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u2715 Cancel" }),
718
+ /* @__PURE__ */ jsx4("button", { type: "submit", disabled: isSubmitting, className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/10 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: isSubmitting ? "Saving..." : "\u{1F4BE} Save Workflow" })
719
+ ] }),
720
+ submitError && /* @__PURE__ */ jsx4("div", { className: "fc:px-8 fc:pb-6", children: /* @__PURE__ */ jsx4("p", { className: "fc:text-sm fc:text-red-600", children: submitError }) })
721
+ ] })
722
+ ] });
723
+ }
724
+ var inputClass = (error) => `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:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/10 focus:fc:border-indigo-500 ${error ? "fc:border-red-500" : ""}`;
725
+
726
+ // src/components/workflow/EditWorkflowModal.jsx
727
+ import React5, { useEffect as useEffect3, useState as useState3 } from "react";
728
+ import Swal2 from "sweetalert2";
729
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
730
+ var INITIAL_FORM2 = {
731
+ workflowTypeId: "",
732
+ workflowCode: "",
733
+ workflowName: "",
734
+ version: "",
735
+ published: "false",
736
+ status: "active",
737
+ defaultPriority: "medium",
738
+ description: ""
739
+ };
740
+ function EditWorkflowModal({
741
+ isOpen,
742
+ onClose,
743
+ onSave,
744
+ workflowTypes = [],
745
+ editData = null
746
+ }) {
747
+ const [formData, setFormData] = useState3(INITIAL_FORM2);
748
+ const [errors, setErrors] = useState3({});
749
+ const [isSubmitting, setIsSubmitting] = useState3(false);
750
+ const [submitError, setSubmitError] = useState3("");
751
+ useEffect3(() => {
752
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
753
+ if (editData) {
754
+ setFormData({
755
+ workflowTypeId: (_d = (_c = (_a = editData.workflowTypeId) != null ? _a : editData.WorkflowTypeId) != null ? _c : (_b = editData.workflowType) == null ? void 0 : _b.workflowTypeId) != null ? _d : editData.workflowTypeId,
756
+ workflowCode: (_g = (_f = (_e = editData.workflowCode) != null ? _e : editData.WorkflowCode) != null ? _f : editData.code) != null ? _g : "",
757
+ workflowName: (_j = (_i = (_h = editData.workflowName) != null ? _h : editData.WorkflowName) != null ? _i : editData.name) != null ? _j : "",
758
+ version: (_m = (_l = (_k = editData.version) != null ? _k : editData.WorkflowVersion) != null ? _l : editData.workflowVersion) != null ? _m : "1",
759
+ published: ((_o = (_n = editData.published) != null ? _n : editData.isPublished) != null ? _o : editData.IsPublished) ? "true" : "false",
760
+ status: ((_q = (_p = editData.status) != null ? _p : editData.isActive) != null ? _q : editData.IsActive) ? "active" : "inactive",
761
+ defaultPriority: (_s = (_r = editData.defaultPriority) != null ? _r : editData.defaultPriority) != null ? _s : "medium",
762
+ description: (_u = (_t = editData.description) != null ? _t : editData.Description) != null ? _u : ""
763
+ });
764
+ setErrors({});
765
+ setSubmitError("");
766
+ }
767
+ }, [editData]);
768
+ useEffect3(() => {
769
+ if (!isOpen) {
770
+ setFormData(INITIAL_FORM2);
771
+ setErrors({});
772
+ setSubmitError("");
773
+ setIsSubmitting(false);
774
+ }
775
+ }, [isOpen]);
776
+ if (!isOpen) return null;
777
+ const handleChange = (event) => {
778
+ const { name, value } = event.target;
779
+ if (name === "description" && value.length > 500) return;
780
+ setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [name]: value }));
781
+ setErrors((prev) => __spreadProps(__spreadValues({}, prev), { [name]: "" }));
782
+ setSubmitError("");
783
+ };
784
+ const validate = () => {
785
+ const nextErrors = {};
786
+ if (!formData.workflowTypeId) nextErrors.workflowTypeId = "Workflow type is required";
787
+ if (!formData.workflowCode.trim()) nextErrors.workflowCode = "Workflow code is required";
788
+ if (!formData.workflowName.trim()) nextErrors.workflowName = "Workflow name is required";
789
+ if (!formData.version.trim()) nextErrors.version = "Version is required";
790
+ setErrors(nextErrors);
791
+ return Object.keys(nextErrors).length === 0;
792
+ };
793
+ const handleSubmit = async (event) => {
794
+ var _a, _b, _c, _d, _e, _f;
795
+ event.preventDefault();
796
+ if (!validate()) return;
797
+ if (!onSave) {
798
+ setSubmitError("Save handler not configured.");
799
+ return;
800
+ }
801
+ const workflowId = (_b = (_a = editData == null ? void 0 : editData.workflowId) != null ? _a : editData == null ? void 0 : editData.WorkflowId) != null ? _b : editData == null ? void 0 : editData.id;
802
+ const payload = {
803
+ workflowId,
804
+ workflowTypeId: formData.workflowTypeId,
805
+ workflowCode: formData.workflowCode.trim(),
806
+ workflowName: formData.workflowName.trim(),
807
+ version: formData.version.trim(),
808
+ published: formData.published === "true",
809
+ status: formData.status === "active",
810
+ defaultPriority: formData.defaultPriority,
811
+ description: formData.description.trim(),
812
+ updatedBy: (_d = (_c = editData == null ? void 0 : editData.updatedBy) != null ? _c : editData == null ? void 0 : editData.createdBy) != null ? _d : "System"
813
+ };
814
+ try {
815
+ setIsSubmitting(true);
816
+ const result = await onSave(payload);
817
+ if (result) {
818
+ onClose();
819
+ }
820
+ } catch (error) {
821
+ const message = ((_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 save workflow.";
822
+ setSubmitError(message);
823
+ await Swal2.fire("Error", message, "error");
824
+ } finally {
825
+ setIsSubmitting(false);
826
+ }
827
+ };
680
828
  return /* @__PURE__ */ jsxs5("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
681
829
  /* @__PURE__ */ jsx5("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
682
- /* @__PURE__ */ jsxs5("div", { className: "fc:relative fc:w-full fc:max-w-4xl fc:bg-white fc:rounded-3xl fc:shadow-2xl fc:flex fc:flex-col fc:z-10 fc:max-h-[92vh] fc:overflow-hidden fc:animate-in fc:fade-in fc:zoom-in-95 fc:duration-200", children: [
830
+ /* @__PURE__ */ jsxs5("form", { onSubmit: handleSubmit, className: "fc:relative fc:w-full fc:max-w-4xl fc:bg-white fc:rounded-3xl fc:shadow-2xl fc:flex fc:flex-col fc:z-10 fc:max-h-[92vh] fc:overflow-hidden fc:animate-in fc:fade-in fc:zoom-in-95 fc:duration-200", children: [
683
831
  /* @__PURE__ */ jsxs5("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-8 fc:py-6 fc:border-b fc:border-slate-100", children: [
684
832
  /* @__PURE__ */ jsxs5("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
685
833
  /* @__PURE__ */ jsx5("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__ */ jsx5("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx5("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" }) }) }),
686
834
  /* @__PURE__ */ jsxs5("div", { children: [
687
- /* @__PURE__ */ jsx5("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow" }),
688
- /* @__PURE__ */ jsx5("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new workflow and configure its details" })
835
+ /* @__PURE__ */ jsx5("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Workflow" }),
836
+ /* @__PURE__ */ jsx5("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Update the workflow details" })
689
837
  ] })
690
838
  ] }),
691
- /* @__PURE__ */ jsx5("button", { onClick: onClose, className: "fc:text-slate-400 hover:fc:fc:text-slate-600 hover:fc:fc:bg-slate-100 fc:p-2 fc:rounded-full fc:transition-all fc:text-sm fc:font-semibold", children: "\u2715" })
839
+ /* @__PURE__ */ jsx5("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 hover:fc:fc:text-slate-600 hover:fc:fc:bg-slate-100 fc:p-2 fc:rounded-full fc:transition-all fc:text-sm fc:font-semibold", children: "\u2715" })
692
840
  ] }),
693
841
  /* @__PURE__ */ jsxs5("div", { className: "fc:p-8 fc:space-y-8 fc:overflow-y-auto fc:max-h-[calc(92vh-170px)] fc:bg-slate-50/30", children: [
694
842
  /* @__PURE__ */ jsxs5("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
@@ -696,29 +844,34 @@ function AddWorkflowModal({
696
844
  /* @__PURE__ */ jsx5("span", { children: "\u{1F4CB}" }),
697
845
  /* @__PURE__ */ jsx5("span", { children: "Workflow Information" })
698
846
  ] }),
699
- /* @__PURE__ */ jsxs5("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
847
+ /* @__PURE__ */ jsxs5("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
700
848
  /* @__PURE__ */ jsxs5("div", { children: [
701
849
  /* @__PURE__ */ jsxs5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
702
850
  "Workflow Type ",
703
851
  /* @__PURE__ */ jsx5("span", { className: "fc:text-red-500", children: "*" })
704
852
  ] }),
705
- /* @__PURE__ */ jsxs5("select", { 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
853
+ /* @__PURE__ */ jsxs5("select", { name: "workflowTypeId", value: formData.workflowTypeId, onChange: handleChange, className: inputClass2(errors.workflowTypeId), children: [
706
854
  /* @__PURE__ */ jsx5("option", { value: "", children: "Select workflow type" }),
707
- workflowTypes.length > 0 ? workflowTypes.map((type) => /* @__PURE__ */ jsx5("option", { value: type.workflowTypeId || type.WorkflowTypeId, children: type.workflowTypeName || type.WorkflowTypeName }, type.workflowTypeId || type.WorkflowTypeId)) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
855
+ workflowTypes.length > 0 ? workflowTypes.map((type) => {
856
+ var _a, _b;
857
+ const id = (_a = type.workflowTypeId) != null ? _a : type.WorkflowTypeId;
858
+ const label = (_b = type.workflowTypeName) != null ? _b : type.WorkflowTypeName;
859
+ return /* @__PURE__ */ jsx5("option", { value: id, children: label }, id);
860
+ }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
708
861
  /* @__PURE__ */ jsx5("option", { value: "petition", children: "Petition" }),
709
862
  /* @__PURE__ */ jsx5("option", { value: "building", children: "Building Permission" }),
710
863
  /* @__PURE__ */ jsx5("option", { value: "leave", children: "Leave" })
711
864
  ] })
712
865
  ] }),
713
- /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Choose the category this workflow belongs to" })
866
+ errors.workflowTypeId && /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowTypeId })
714
867
  ] }),
715
868
  /* @__PURE__ */ jsxs5("div", { children: [
716
869
  /* @__PURE__ */ jsxs5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
717
870
  "Workflow Code ",
718
871
  /* @__PURE__ */ jsx5("span", { className: "fc:text-red-500", children: "*" })
719
872
  ] }),
720
- /* @__PURE__ */ jsx5("input", { type: "text", placeholder: "Enter workflow code", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
721
- /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Unique code for this workflow (e.g., PET-001)" })
873
+ /* @__PURE__ */ jsx5("input", { name: "workflowCode", value: formData.workflowCode, onChange: handleChange, type: "text", placeholder: "Enter workflow code", className: inputClass2(errors.workflowCode) }),
874
+ errors.workflowCode && /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowCode })
722
875
  ] })
723
876
  ] }),
724
877
  /* @__PURE__ */ jsxs5("div", { children: [
@@ -726,24 +879,24 @@ function AddWorkflowModal({
726
879
  "Workflow Name ",
727
880
  /* @__PURE__ */ jsx5("span", { className: "fc:text-red-500", children: "*" })
728
881
  ] }),
729
- /* @__PURE__ */ jsx5("input", { type: "text", placeholder: "Enter workflow name", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
730
- /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Enter a descriptive name for this workflow" })
882
+ /* @__PURE__ */ jsx5("input", { name: "workflowName", value: formData.workflowName, onChange: handleChange, type: "text", placeholder: "Enter workflow name", className: inputClass2(errors.workflowName) }),
883
+ errors.workflowName && /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowName })
731
884
  ] }),
732
- /* @__PURE__ */ jsxs5("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
885
+ /* @__PURE__ */ jsxs5("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
733
886
  /* @__PURE__ */ jsxs5("div", { children: [
734
887
  /* @__PURE__ */ jsxs5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
735
888
  "Version ",
736
889
  /* @__PURE__ */ jsx5("span", { className: "fc:text-red-500", children: "*" })
737
890
  ] }),
738
- /* @__PURE__ */ jsx5("input", { type: "text", defaultValue: "1", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
739
- /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Workflow version number" })
891
+ /* @__PURE__ */ jsx5("input", { name: "version", type: "text", value: formData.version, onChange: handleChange, className: inputClass2(errors.version) }),
892
+ errors.version && /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.version })
740
893
  ] }),
741
894
  /* @__PURE__ */ jsxs5("div", { children: [
742
895
  /* @__PURE__ */ jsxs5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
743
896
  "Published ",
744
897
  /* @__PURE__ */ jsx5("span", { className: "fc:text-red-500", children: "*" })
745
898
  ] }),
746
- /* @__PURE__ */ jsxs5("select", { 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
899
+ /* @__PURE__ */ jsxs5("select", { name: "published", value: formData.published, onChange: handleChange, className: inputClass2(), children: [
747
900
  /* @__PURE__ */ jsx5("option", { value: "false", children: "No" }),
748
901
  /* @__PURE__ */ jsx5("option", { value: "true", children: "Yes" })
749
902
  ] }),
@@ -754,9 +907,12 @@ function AddWorkflowModal({
754
907
  /* @__PURE__ */ jsxs5("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-3", children: [
755
908
  /* @__PURE__ */ jsxs5("div", { className: "fc:flex fc:justify-between fc:items-center", children: [
756
909
  /* @__PURE__ */ jsx5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: "Description" }),
757
- /* @__PURE__ */ jsx5("span", { className: "fc:text-[10px] fc:text-slate-400", children: "0 / 500" })
910
+ /* @__PURE__ */ jsxs5("span", { className: "fc:text-[10px] fc:text-slate-400", children: [
911
+ formData.description.length,
912
+ " / 500"
913
+ ] })
758
914
  ] }),
759
- /* @__PURE__ */ jsx5("textarea", { rows: 3, placeholder: "Enter workflow description (optional)", className: "fc:w-full fc:p-3 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:resize-none focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
915
+ /* @__PURE__ */ jsx5("textarea", { name: "description", rows: 3, value: formData.description, onChange: handleChange, placeholder: "Enter workflow description (optional)", className: inputClass2() }),
760
916
  /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-400", children: "Provide additional information about this workflow" })
761
917
  ] }),
762
918
  /* @__PURE__ */ jsxs5("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
@@ -764,13 +920,13 @@ function AddWorkflowModal({
764
920
  /* @__PURE__ */ jsx5("span", { children: "\u2699\uFE0F" }),
765
921
  /* @__PURE__ */ jsx5("span", { children: "Status & Settings" })
766
922
  ] }),
767
- /* @__PURE__ */ jsxs5("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
923
+ /* @__PURE__ */ jsxs5("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
768
924
  /* @__PURE__ */ jsxs5("div", { children: [
769
925
  /* @__PURE__ */ jsxs5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
770
926
  "Status ",
771
927
  /* @__PURE__ */ jsx5("span", { className: "fc:text-red-500", children: "*" })
772
928
  ] }),
773
- /* @__PURE__ */ jsxs5("select", { 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
929
+ /* @__PURE__ */ jsxs5("select", { name: "status", value: formData.status, onChange: handleChange, className: inputClass2(), children: [
774
930
  /* @__PURE__ */ jsx5("option", { value: "active", children: "Active" }),
775
931
  /* @__PURE__ */ jsx5("option", { value: "inactive", children: "Inactive" })
776
932
  ] }),
@@ -778,7 +934,7 @@ function AddWorkflowModal({
778
934
  ] }),
779
935
  /* @__PURE__ */ jsxs5("div", { children: [
780
936
  /* @__PURE__ */ jsx5("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: "Default Priority" }),
781
- /* @__PURE__ */ jsxs5("select", { 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
937
+ /* @__PURE__ */ jsxs5("select", { name: "defaultPriority", value: formData.defaultPriority, onChange: handleChange, className: inputClass2(), children: [
782
938
  /* @__PURE__ */ jsx5("option", { value: "medium", children: "Medium" }),
783
939
  /* @__PURE__ */ jsx5("option", { value: "high", children: "High" }),
784
940
  /* @__PURE__ */ jsx5("option", { value: "low", children: "Low" })
@@ -789,12 +945,14 @@ function AddWorkflowModal({
789
945
  ] })
790
946
  ] }),
791
947
  /* @__PURE__ */ jsxs5("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: [
792
- /* @__PURE__ */ jsx5("button", { onClick: onClose, className: "fc:px-6 fc:py-2.5 fc:border fc:border-slate-200 fc:text-red-500 fc:text-xs fc:font-bold fc:rounded-xl hover:fc:fc:bg-slate-50 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u2715 Cancel" }),
793
- /* @__PURE__ */ jsx5("button", { type: "button", className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/10 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u{1F4BE} Save Workflow" })
794
- ] })
948
+ /* @__PURE__ */ jsx5("button", { type: "button", onClick: onClose, disabled: isSubmitting, className: "fc:px-6 fc:py-2.5 fc:border fc:border-slate-200 fc:text-red-500 fc:text-xs fc:font-bold fc:rounded-xl hover:fc:fc:bg-slate-50 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u2715 Cancel" }),
949
+ /* @__PURE__ */ jsx5("button", { type: "submit", disabled: isSubmitting, className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/10 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: isSubmitting ? "Saving..." : "\u{1F4BE} Save Workflow" })
950
+ ] }),
951
+ submitError && /* @__PURE__ */ jsx5("div", { className: "fc:px-8 fc:pb-6", children: /* @__PURE__ */ jsx5("p", { className: "fc:text-sm fc:text-red-600", children: submitError }) })
795
952
  ] })
796
953
  ] });
797
954
  }
955
+ var inputClass2 = (error) => `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:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/10 focus:fc:border-indigo-500 ${error ? "fc:border-red-500" : ""}`;
798
956
 
799
957
  // src/components/Common/commonheader.js
800
958
  import React8 from "react";
@@ -802,10 +960,10 @@ import Link from "next/link";
802
960
  import { FolderKanban, Home, ChevronRight, Plus } from "lucide-react";
803
961
 
804
962
  // src/components/Common/Refresh.js
805
- import React6, { useState as useState3 } from "react";
963
+ import React6, { useState as useState4 } from "react";
806
964
  import { jsx as jsx6 } from "react/jsx-runtime";
807
965
  var Refresh = ({ onRefresh }) => {
808
- const [isSpinning, setIsSpinning] = useState3(false);
966
+ const [isSpinning, setIsSpinning] = useState4(false);
809
967
  const handleClick = () => {
810
968
  setIsSpinning(true);
811
969
  if (onRefresh) {
@@ -846,14 +1004,14 @@ var Refresh = ({ onRefresh }) => {
846
1004
  var Refresh_default = Refresh;
847
1005
 
848
1006
  // src/components/Common/Download.js
849
- import React7, { useState as useState4, useRef, useEffect as useEffect2 } from "react";
1007
+ import React7, { useState as useState5, useRef, useEffect as useEffect4 } from "react";
850
1008
  import html2canvas from "html2canvas";
851
1009
  import { jsPDF } from "jspdf";
852
1010
  import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
853
1011
  var Download = ({ targetRef, fileName = "download" }) => {
854
- const [isOpen, setIsOpen] = useState4(false);
1012
+ const [isOpen, setIsOpen] = useState5(false);
855
1013
  const dropdownRef = useRef(null);
856
- useEffect2(() => {
1014
+ useEffect4(() => {
857
1015
  const handleClickOutside = (event) => {
858
1016
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
859
1017
  setIsOpen(false);
@@ -998,13 +1156,15 @@ function CommonHeader({
998
1156
  // src/components/workflow/WorkflowMain.jsx
999
1157
  import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1000
1158
  function Workflow() {
1001
- const [refreshKey, setRefreshKey] = useState5(0);
1002
- const [modalOpen, setModalOpen] = useState5(false);
1003
- const [pageSize, setPageSize] = useState5(10);
1004
- const [searchQuery, setSearchQuery] = useState5("");
1005
- const [apiData, setApiData] = useState5([]);
1006
- const [workflowTypes, setWorkflowTypes] = useState5([]);
1007
- useEffect3(() => {
1159
+ const [refreshKey, setRefreshKey] = useState6(0);
1160
+ const [modalOpen, setModalOpen] = useState6(false);
1161
+ const [pageSize, setPageSize] = useState6(10);
1162
+ const [searchQuery, setSearchQuery] = useState6("");
1163
+ const [apiData, setApiData] = useState6([]);
1164
+ const [workflowTypes, setWorkflowTypes] = useState6([]);
1165
+ const [editModalOpen, setEditModalOpen] = useState6(false);
1166
+ const [selectedWorkflow, setSelectedWorkflow] = useState6(null);
1167
+ useEffect5(() => {
1008
1168
  (async () => {
1009
1169
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1010
1170
  try {
@@ -1018,11 +1178,11 @@ function Workflow() {
1018
1178
  const typeRows = Array.isArray(typeValue) ? typeValue : (typeValue == null ? void 0 : typeValue.items) || (typeValue == null ? void 0 : typeValue.records) || [];
1019
1179
  setWorkflowTypes(typeRows);
1020
1180
  setApiData(rows.map((item) => {
1021
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
1022
- return __spreadProps(__spreadValues({}, item), { id: (_b2 = (_a2 = item.id) != null ? _a2 : item.workflowId) != null ? _b2 : item.WorkflowId, name: (_d2 = (_c2 = item.name) != null ? _c2 : item.workflowName) != null ? _d2 : item.WorkflowName, code: (_f2 = (_e2 = item.code) != null ? _e2 : item.workflowCode) != null ? _f2 : item.WorkflowCode, type: (_h2 = (_g2 = item.type) != null ? _g2 : item.workflowTypeName) != null ? _h2 : item.WorkflowTypeName, status: (_j2 = (_i2 = item.status) != null ? _i2 : item.isActive) != null ? _j2 : item.IsActive });
1181
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m, _n, _o, _p, _q, _r, _s, _t, _u;
1182
+ return __spreadProps(__spreadValues({}, item), { id: (_b2 = (_a2 = item.id) != null ? _a2 : item.workflowId) != null ? _b2 : item.WorkflowId, workflowId: (_d2 = (_c2 = item.workflowId) != null ? _c2 : item.WorkflowId) != null ? _d2 : item.id, name: (_f2 = (_e2 = item.name) != null ? _e2 : item.workflowName) != null ? _f2 : item.WorkflowName, code: (_h2 = (_g2 = item.code) != null ? _g2 : item.workflowCode) != null ? _h2 : item.WorkflowCode, type: (_j2 = (_i2 = item.type) != null ? _i2 : item.workflowTypeName) != null ? _j2 : item.WorkflowTypeName, workflowTypeId: (_l2 = (_k2 = item.workflowTypeId) != null ? _k2 : item.WorkflowTypeId) != null ? _l2 : item.workflowTypeId, version: (_o = (_n = (_m = item.version) != null ? _m : item.workflowVersion) != null ? _n : item.WorkflowVersion) != null ? _o : item.version, published: (_r = (_q = (_p = item.published) != null ? _p : item.isPublished) != null ? _q : item.IsPublished) != null ? _r : false, status: (_u = (_t = (_s = item.status) != null ? _s : item.isActive) != null ? _t : item.IsActive) != null ? _u : false });
1023
1183
  }));
1024
1184
  } catch (error) {
1025
- await Swal.fire("Error", ((_l = (_k = error == null ? void 0 : error.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (error == null ? void 0 : error.message) || "Unable to load workflows.", "error");
1185
+ await Swal3.fire("Error", ((_l = (_k = error == null ? void 0 : error.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (error == null ? void 0 : error.message) || "Unable to load workflows.", "error");
1026
1186
  }
1027
1187
  })();
1028
1188
  }, [refreshKey]);
@@ -1031,6 +1191,71 @@ function Workflow() {
1031
1191
  console.log("Table data refreshed!");
1032
1192
  setRefreshKey((prev) => prev + 1);
1033
1193
  };
1194
+ const handleCreateApi = async (workflowPayload) => {
1195
+ var _a, _b, _c, _d, _e;
1196
+ try {
1197
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
1198
+ if (!endpoint) throw new Error("Workflow create endpoint is not configured.");
1199
+ await getApiService().post(endpoint, workflowPayload);
1200
+ await Swal3.fire("Success", "Workflow created successfully.", "success");
1201
+ handleRefresh();
1202
+ return true;
1203
+ } catch (error) {
1204
+ await Swal3.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 workflow.", "error");
1205
+ return false;
1206
+ }
1207
+ };
1208
+ const handleUpdateApi = async (workflowPayload) => {
1209
+ var _a, _b, _c, _d, _e;
1210
+ try {
1211
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
1212
+ if (!endpoint) throw new Error("Workflow update endpoint is not configured.");
1213
+ await getApiService().put(endpoint, workflowPayload);
1214
+ await Swal3.fire("Success", "Workflow updated successfully.", "success");
1215
+ handleRefresh();
1216
+ return true;
1217
+ } catch (error) {
1218
+ await Swal3.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 update workflow.", "error");
1219
+ return false;
1220
+ }
1221
+ };
1222
+ const handleDeleteApi = async (workflow) => {
1223
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1224
+ try {
1225
+ const endpoints = getApiEndpoints();
1226
+ const deleteEndpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflow) == null ? void 0 : _b.delete;
1227
+ const updateEndpoint = (_d = (_c = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _c.workflow) == null ? void 0 : _d.update;
1228
+ const workflowId = (_f = (_e = workflow.workflowId) != null ? _e : workflow.WorkflowId) != null ? _f : workflow.id;
1229
+ if (deleteEndpoint) {
1230
+ try {
1231
+ await getApiService().delete(`${deleteEndpoint}/${workflowId}`);
1232
+ } catch (e) {
1233
+ await getApiService().delete(deleteEndpoint, { data: { workflowId } });
1234
+ }
1235
+ } else if (updateEndpoint) {
1236
+ await getApiService().put(updateEndpoint, __spreadProps(__spreadValues({}, workflow), { workflowId, isActive: false, updatedBy: workflow.updatedBy || workflow.createdBy || "System" }));
1237
+ } else {
1238
+ throw new Error("Workflow delete endpoint is not configured.");
1239
+ }
1240
+ await Swal3.fire("Success", "Workflow deleted successfully.", "success");
1241
+ handleRefresh();
1242
+ return true;
1243
+ } catch (error) {
1244
+ await Swal3.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 delete workflow.", "error");
1245
+ return false;
1246
+ }
1247
+ };
1248
+ const handleEdit = (workflow) => {
1249
+ setSelectedWorkflow(workflow);
1250
+ setEditModalOpen(true);
1251
+ };
1252
+ const handleCloseEdit = () => {
1253
+ setEditModalOpen(false);
1254
+ setSelectedWorkflow(null);
1255
+ };
1256
+ const handleCloseAdd = () => {
1257
+ setModalOpen(false);
1258
+ };
1034
1259
  return /* @__PURE__ */ jsxs8("div", { className: "fc:h-screen fc:bg-slate-50 fc:p-6 fc:flex fc:flex-col", children: [
1035
1260
  /* @__PURE__ */ jsxs8("div", { className: "fc:flex fc:flex-col fc:flex-1 fc:gap-5 fc:overflow-hidden", children: [
1036
1261
  /* @__PURE__ */ jsx9(
@@ -1093,7 +1318,9 @@ function Workflow() {
1093
1318
  {
1094
1319
  apiData,
1095
1320
  pageSize,
1096
- searchQuery
1321
+ searchQuery,
1322
+ onEdit: handleEdit,
1323
+ onDeleteApi: handleDeleteApi
1097
1324
  },
1098
1325
  refreshKey
1099
1326
  ) }) })
@@ -1103,16 +1330,27 @@ function Workflow() {
1103
1330
  AddWorkflowModal,
1104
1331
  {
1105
1332
  isOpen: modalOpen,
1106
- onClose: () => setModalOpen(false),
1107
- workflowTypes
1333
+ onClose: handleCloseAdd,
1334
+ workflowTypes,
1335
+ onSave: handleCreateApi
1336
+ }
1337
+ ),
1338
+ /* @__PURE__ */ jsx9(
1339
+ EditWorkflowModal,
1340
+ {
1341
+ isOpen: editModalOpen,
1342
+ onClose: handleCloseEdit,
1343
+ workflowTypes,
1344
+ editData: selectedWorkflow,
1345
+ onSave: handleUpdateApi
1108
1346
  }
1109
1347
  )
1110
1348
  ] });
1111
1349
  }
1112
1350
 
1113
1351
  // src/components/workflow-type/WorkflowTypeMains.js
1114
- import React15, { useState as useState9, useRef as useRef3, useEffect as useEffect6 } from "react";
1115
- import Swal3 from "sweetalert2";
1352
+ import React15, { useState as useState10, useRef as useRef3, useEffect as useEffect8 } from "react";
1353
+ import Swal5 from "sweetalert2";
1116
1354
 
1117
1355
  // src/components/workflow-type/SearchBar.jsx
1118
1356
  import React10 from "react";
@@ -1139,7 +1377,7 @@ function SearchBar2({
1139
1377
  }
1140
1378
 
1141
1379
  // src/components/workflow-type/WorkflowTypeTable.jsx
1142
- import React13, { useState as useState7, useEffect as useEffect5 } from "react";
1380
+ import React13, { useState as useState8, useEffect as useEffect7 } from "react";
1143
1381
 
1144
1382
  // src/components/workflow-type/DeleteWorkflowType.jsx
1145
1383
  import React11 from "react";
@@ -1179,7 +1417,7 @@ var DeleteWorkflowType = ({
1179
1417
  var DeleteWorkflowType_default = DeleteWorkflowType;
1180
1418
 
1181
1419
  // src/components/workflow-type/EditWorkflowType.jsx
1182
- import React12, { useState as useState6, useEffect as useEffect4 } from "react";
1420
+ import React12, { useState as useState7, useEffect as useEffect6 } from "react";
1183
1421
  import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1184
1422
  var EditWorkflowType = ({
1185
1423
  isOpen,
@@ -1187,13 +1425,13 @@ var EditWorkflowType = ({
1187
1425
  onSave,
1188
1426
  selectedData
1189
1427
  }) => {
1190
- const [formData, setFormData] = useState6({
1428
+ const [formData, setFormData] = useState7({
1191
1429
  workflowTypeCode: "",
1192
1430
  workflowTypeName: "",
1193
1431
  description: "",
1194
1432
  isActive: true
1195
1433
  });
1196
- useEffect4(() => {
1434
+ useEffect6(() => {
1197
1435
  var _a, _b;
1198
1436
  if (selectedData) {
1199
1437
  setFormData({
@@ -1516,15 +1754,15 @@ function WorkflowTypeTable({
1516
1754
  updatedOn: "2026-01-29",
1517
1755
  updatedBy: "Officer"
1518
1756
  }];
1519
- const [data, setData] = useState7(apiData || initialData);
1520
- useEffect5(() => {
1757
+ const [data, setData] = useState8(apiData || initialData);
1758
+ useEffect7(() => {
1521
1759
  if (apiData) setData(apiData);
1522
1760
  }, [apiData]);
1523
- const [sortOrder, setSortOrder] = useState7("asc");
1524
- const [sortKey, setSortKey] = useState7("workflowTypeId");
1525
- const [selectedItem, setSelectedItem] = useState7(null);
1526
- const [isEditOpen, setIsEditOpen] = useState7(false);
1527
- const [isDeleteOpen, setIsDeleteOpen] = useState7(false);
1761
+ const [sortOrder, setSortOrder] = useState8("asc");
1762
+ const [sortKey, setSortKey] = useState8("workflowTypeId");
1763
+ const [selectedItem, setSelectedItem] = useState8(null);
1764
+ const [isEditOpen, setIsEditOpen] = useState8(false);
1765
+ const [isDeleteOpen, setIsDeleteOpen] = useState8(false);
1528
1766
  const handleSort = (columnKey) => {
1529
1767
  const isAsc = sortKey === columnKey && sortOrder === "asc";
1530
1768
  setSortOrder(isAsc ? "desc" : "asc");
@@ -1540,7 +1778,7 @@ function WorkflowTypeTable({
1540
1778
  const query = (searchQuery || "").toLowerCase();
1541
1779
  return item.workflowTypeName.toLowerCase().includes(query) || item.workflowTypeCode.toLowerCase().includes(query) || item.description.toLowerCase().includes(query);
1542
1780
  });
1543
- useEffect5(() => {
1781
+ useEffect7(() => {
1544
1782
  if (setTotalEntries) setTotalEntries(filteredData.length);
1545
1783
  }, [filteredData.length, setTotalEntries]);
1546
1784
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -1626,8 +1864,8 @@ function WorkflowTypeTable({
1626
1864
  }
1627
1865
 
1628
1866
  // src/components/workflow-type/AddWorkflowTypeModal.jsx
1629
- import React14, { useState as useState8 } from "react";
1630
- import Swal2 from "sweetalert2";
1867
+ import React14, { useState as useState9 } from "react";
1868
+ import Swal4 from "sweetalert2";
1631
1869
  import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1632
1870
  var initialFormData = {
1633
1871
  workflowTypeCode: "",
@@ -1636,12 +1874,12 @@ var initialFormData = {
1636
1874
  createdBy: ""
1637
1875
  };
1638
1876
  var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1639
- const [formData, setFormData] = useState8(__spreadProps(__spreadValues({}, initialFormData), {
1877
+ const [formData, setFormData] = useState9(__spreadProps(__spreadValues({}, initialFormData), {
1640
1878
  createdBy
1641
1879
  }));
1642
- const [errors, setErrors] = useState8({});
1643
- const [isSubmitting, setIsSubmitting] = useState8(false);
1644
- const [submitError, setSubmitError] = useState8("");
1880
+ const [errors, setErrors] = useState9({});
1881
+ const [isSubmitting, setIsSubmitting] = useState9(false);
1882
+ const [submitError, setSubmitError] = useState9("");
1645
1883
  const handleChange = ({ target: { name, value } }) => {
1646
1884
  if (name === "description" && value.length > 500) return;
1647
1885
  setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [name]: value }));
@@ -1683,7 +1921,7 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1683
1921
  } catch (error) {
1684
1922
  const message = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create workflow type. Please try again.";
1685
1923
  setSubmitError(message);
1686
- await Swal2.fire("Error", message, "error");
1924
+ await Swal4.fire("Error", message, "error");
1687
1925
  } finally {
1688
1926
  setIsSubmitting(false);
1689
1927
  }
@@ -1699,10 +1937,10 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1699
1937
  ] }),
1700
1938
  /* @__PURE__ */ jsxs13("form", { onSubmit: handleSubmit, className: "fc:space-y-4 fc:p-6", children: [
1701
1939
  /* @__PURE__ */ jsxs13("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [
1702
- /* @__PURE__ */ jsx14(FormField, { label: "Workflow Type Code", required: true, error: errors.workflowTypeCode, children: /* @__PURE__ */ jsx14("input", { name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, placeholder: "e.g. PETITION", className: inputClass(errors.workflowTypeCode) }) }),
1703
- /* @__PURE__ */ jsx14(FormField, { label: "Workflow Type Name", required: true, error: errors.workflowTypeName, children: /* @__PURE__ */ jsx14("input", { name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, placeholder: "Enter workflow type name", className: inputClass(errors.workflowTypeName) }) })
1940
+ /* @__PURE__ */ jsx14(FormField, { label: "Workflow Type Code", required: true, error: errors.workflowTypeCode, children: /* @__PURE__ */ jsx14("input", { name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, placeholder: "e.g. PETITION", className: inputClass3(errors.workflowTypeCode) }) }),
1941
+ /* @__PURE__ */ jsx14(FormField, { label: "Workflow Type Name", required: true, error: errors.workflowTypeName, children: /* @__PURE__ */ jsx14("input", { name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, placeholder: "Enter workflow type name", className: inputClass3(errors.workflowTypeName) }) })
1704
1942
  ] }),
1705
- /* @__PURE__ */ jsx14(FormField, { label: "Created By", required: true, error: errors.createdBy, children: /* @__PURE__ */ jsx14("input", { name: "createdBy", value: formData.createdBy, onChange: handleChange, placeholder: "Enter user name or ID", className: inputClass(errors.createdBy) }) }),
1943
+ /* @__PURE__ */ jsx14(FormField, { label: "Created By", required: true, error: errors.createdBy, children: /* @__PURE__ */ jsx14("input", { name: "createdBy", value: formData.createdBy, onChange: handleChange, placeholder: "Enter user name or ID", className: inputClass3(errors.createdBy) }) }),
1706
1944
  /* @__PURE__ */ jsx14(FormField, { label: "Description", children: /* @__PURE__ */ jsxs13("div", { className: "fc:relative", children: [
1707
1945
  /* @__PURE__ */ jsx14("textarea", { name: "description", rows: "3", value: formData.description, onChange: handleChange, placeholder: "Enter description", className: "fc:w-full fc:resize-none fc:rounded-xl fc:border fc:border-slate-200 fc:p-3 fc:text-sm fc:text-slate-700 fc:outline-none focus:fc:border-indigo-500" }),
1708
1946
  /* @__PURE__ */ jsxs13("span", { className: "fc:absolute fc:bottom-2 fc:right-3 fc:text-xs fc:text-gray-400", children: [
@@ -1718,7 +1956,7 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1718
1956
  ] })
1719
1957
  ] }) });
1720
1958
  };
1721
- var inputClass = (hasError) => `fc:w-full fc:rounded-xl fc:border fc:bg-white fc:p-3 fc:text-sm fc:text-slate-700 fc:outline-none focus:fc:border-indigo-500 ${hasError ? "fc:border-red-500" : "fc:border-slate-200"}`;
1959
+ var inputClass3 = (hasError) => `fc:w-full fc:rounded-xl fc:border fc:bg-white fc:p-3 fc:text-sm fc:text-slate-700 fc:outline-none focus:fc:border-indigo-500 ${hasError ? "fc:border-red-500" : "fc:border-slate-200"}`;
1722
1960
  var FormField = ({ label, required, error, children }) => /* @__PURE__ */ jsxs13("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700", children: [
1723
1961
  label,
1724
1962
  " ",
@@ -1731,7 +1969,7 @@ var AddWorkflowTypeModal_default = AddWorkflowTypeModal;
1731
1969
  // src/components/workflow-type/WorkflowTypeMains.js
1732
1970
  import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1733
1971
  function WorkflowTypeMains() {
1734
- const [refreshkey, setRefreshKey] = useState9(0);
1972
+ const [refreshkey, setRefreshKey] = useState10(0);
1735
1973
  const handleRefresh = () => {
1736
1974
  console.log("Table data refreshed!");
1737
1975
  setRefreshKey((prev) => prev + 1);
@@ -1742,11 +1980,11 @@ function WorkflowTypeMains() {
1742
1980
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
1743
1981
  if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
1744
1982
  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" });
1745
- await Swal3.fire("Success", "Workflow type updated successfully.", "success");
1983
+ await Swal5.fire("Success", "Workflow type updated successfully.", "success");
1746
1984
  handleRefresh();
1747
1985
  return true;
1748
1986
  } catch (error) {
1749
- await Swal3.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 update workflow type.", "error");
1987
+ await Swal5.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 update workflow type.", "error");
1750
1988
  return false;
1751
1989
  }
1752
1990
  };
@@ -1754,16 +1992,16 @@ function WorkflowTypeMains() {
1754
1992
  return handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
1755
1993
  };
1756
1994
  const tableRef = useRef3(null);
1757
- const [modalOpen, setModalOpen] = useState9(false);
1758
- const [pageSize, setPageSize] = useState9(10);
1759
- const [searchQuery, setSearchQuery] = useState9("");
1760
- const [currentPage, setCurrentPage] = useState9(1);
1761
- const [totalEntries, setTotalEntries] = useState9(0);
1762
- const [isEditOpen, setIsEditOpen] = useState9(false);
1763
- const [isDeleteOpen, setIsDeleteOpen] = useState9(false);
1764
- const [selectedItem, setSelectedItem] = useState9(null);
1765
- const [apiData, setApiData] = useState9([]);
1766
- useEffect6(() => {
1995
+ const [modalOpen, setModalOpen] = useState10(false);
1996
+ const [pageSize, setPageSize] = useState10(10);
1997
+ const [searchQuery, setSearchQuery] = useState10("");
1998
+ const [currentPage, setCurrentPage] = useState10(1);
1999
+ const [totalEntries, setTotalEntries] = useState10(0);
2000
+ const [isEditOpen, setIsEditOpen] = useState10(false);
2001
+ const [isDeleteOpen, setIsDeleteOpen] = useState10(false);
2002
+ const [selectedItem, setSelectedItem] = useState10(null);
2003
+ const [apiData, setApiData] = useState10([]);
2004
+ useEffect8(() => {
1767
2005
  (async () => {
1768
2006
  var _a, _b, _c, _d, _e, _f, _g;
1769
2007
  try {
@@ -1773,7 +2011,7 @@ function WorkflowTypeMains() {
1773
2011
  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;
1774
2012
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
1775
2013
  } catch (error) {
1776
- await Swal3.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 types.", "error");
2014
+ await Swal5.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 types.", "error");
1777
2015
  }
1778
2016
  })();
1779
2017
  }, [refreshkey]);
@@ -1826,7 +2064,7 @@ function WorkflowTypeMains() {
1826
2064
  ] })
1827
2065
  ] }) }),
1828
2066
  /* @__PURE__ */ jsx15(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: async () => {
1829
- await Swal3.fire("Success", "Workflow type created successfully.", "success");
2067
+ await Swal5.fire("Success", "Workflow type created successfully.", "success");
1830
2068
  handleRefresh();
1831
2069
  } }),
1832
2070
  /* @__PURE__ */ jsx15(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleUpdateApi, selectedData: selectedItem }),
@@ -1835,7 +2073,7 @@ function WorkflowTypeMains() {
1835
2073
  }
1836
2074
 
1837
2075
  // src/components/WorkflowStep/main.js
1838
- import React18, { useState as useState11, useRef as useRef4 } from "react";
2076
+ import React18, { useState as useState12, useRef as useRef4 } from "react";
1839
2077
 
1840
2078
  // src/components/Common/footer.js
1841
2079
  import React16 from "react";
@@ -1858,10 +2096,10 @@ function Footer() {
1858
2096
  import Link2 from "next/link";
1859
2097
 
1860
2098
  // src/components/WorkflowStep/AddWorkflowStepModal.js
1861
- import React17, { useState as useState10 } from "react";
2099
+ import React17, { useState as useState11 } from "react";
1862
2100
  import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
1863
2101
  function AddWorkflowStepModal({ onClose }) {
1864
- const [formData, setFormData] = useState10({
2102
+ const [formData, setFormData] = useState11({
1865
2103
  workflow: "",
1866
2104
  stepCode: "",
1867
2105
  stepName: "",
@@ -1874,7 +2112,7 @@ function AddWorkflowStepModal({ onClose }) {
1874
2112
  excludeHolidays: true,
1875
2113
  status: "active"
1876
2114
  });
1877
- const [errors, setErrors] = useState10({});
2115
+ const [errors, setErrors] = useState11({});
1878
2116
  const handleChange = (field, value) => {
1879
2117
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [field]: value }));
1880
2118
  if (errors[field]) {
@@ -2221,7 +2459,7 @@ function AddWorkflowStepModal({ onClose }) {
2221
2459
  }
2222
2460
 
2223
2461
  // src/components/WorkflowStep/main.js
2224
- import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2462
+ import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2225
2463
  var workflowSteps = [{
2226
2464
  workflowStepId: 1,
2227
2465
  workflowId: 1,
@@ -2351,9 +2589,9 @@ function WorkflowStep() {
2351
2589
  console.log("Download clicked");
2352
2590
  };
2353
2591
  const tableRef = useRef4(null);
2354
- const [showModal, setShowModal] = useState11(false);
2355
- const [pageSize, setPageSize] = useState11(5);
2356
- const [sortConfig, setSortConfig] = useState11({
2592
+ const [showModal, setShowModal] = useState12(false);
2593
+ const [pageSize, setPageSize] = useState12(5);
2594
+ const [sortConfig, setSortConfig] = useState12({
2357
2595
  key: "",
2358
2596
  direction: "asc"
2359
2597
  });
@@ -2367,7 +2605,7 @@ function WorkflowStep() {
2367
2605
  direction
2368
2606
  });
2369
2607
  };
2370
- return /* @__PURE__ */ jsxs17(Fragment3, { children: [
2608
+ return /* @__PURE__ */ jsxs17(Fragment4, { children: [
2371
2609
  /* @__PURE__ */ jsxs17("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
2372
2610
  /* @__PURE__ */ jsx18(CommonHeader, { title: "Workflow Step", breadcrumbs: [{
2373
2611
  label: "Dashboard",
@@ -2455,14 +2693,14 @@ function WorkflowStep() {
2455
2693
  }
2456
2694
 
2457
2695
  // src/components/WorkFlowTransition/Transitiontable.js
2458
- import React20, { useState as useState13, useRef as useRef5 } from "react";
2696
+ import React20, { useState as useState14, useRef as useRef5 } from "react";
2459
2697
  import Link3 from "next/link";
2460
2698
 
2461
2699
  // src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
2462
- import React19, { useState as useState12 } from "react";
2700
+ import React19, { useState as useState13 } from "react";
2463
2701
  import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
2464
2702
  function AddWorkTransitionStepModal({ onClose, onSubmit }) {
2465
- const [formData, setFormData] = useState12({
2703
+ const [formData, setFormData] = useState13({
2466
2704
  workflow: "",
2467
2705
  fromStep: "",
2468
2706
  toStep: "",
@@ -2473,7 +2711,7 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
2473
2711
  requireComment: false,
2474
2712
  status: "active"
2475
2713
  });
2476
- const [errors, setErrors] = useState12({});
2714
+ const [errors, setErrors] = useState13({});
2477
2715
  const validateForm = () => {
2478
2716
  const newErrors = {};
2479
2717
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -2825,7 +3063,7 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
2825
3063
  }
2826
3064
 
2827
3065
  // src/components/WorkFlowTransition/Transitiontable.js
2828
- import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
3066
+ import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
2829
3067
  var WorkflowTransition = [{
2830
3068
  TransitionId: 1,
2831
3069
  workflowId: 1,
@@ -2905,9 +3143,9 @@ function WorkFlowTransition() {
2905
3143
  console.log("Download clicked");
2906
3144
  };
2907
3145
  const tableRef = useRef5(null);
2908
- const [showModal, setShowModal] = useState13(false);
2909
- const [pageSize, setPageSize] = useState13(5);
2910
- const [sortConfig, setSortConfig] = useState13({
3146
+ const [showModal, setShowModal] = useState14(false);
3147
+ const [pageSize, setPageSize] = useState14(5);
3148
+ const [sortConfig, setSortConfig] = useState14({
2911
3149
  key: "",
2912
3150
  direction: "asc"
2913
3151
  });
@@ -2921,7 +3159,7 @@ function WorkFlowTransition() {
2921
3159
  direction
2922
3160
  });
2923
3161
  };
2924
- return /* @__PURE__ */ jsxs19(Fragment4, { children: [
3162
+ return /* @__PURE__ */ jsxs19(Fragment5, { children: [
2925
3163
  /* @__PURE__ */ jsxs19("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: [
2926
3164
  /* @__PURE__ */ jsx20(CommonHeader, { title: "WorkFlow Transition", breadcrumbs: [{
2927
3165
  label: "Dashboard",
@@ -2996,15 +3234,27 @@ function WorkFlowTransition() {
2996
3234
  }
2997
3235
 
2998
3236
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
2999
- import React26, { useState as useState16, useRef as useRef6 } from "react";
3237
+ import React26, { useState as useState18, useRef as useRef6, useEffect as useEffect11 } from "react";
3238
+ import Swal6 from "sweetalert2";
3000
3239
 
3001
3240
  // src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
3002
- import React21 from "react";
3241
+ import React21, { useState as useState15 } from "react";
3003
3242
  import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
3004
3243
  function AddUserHierarchyNodeMappingModal({
3005
3244
  isOpen,
3006
- onClose
3245
+ onClose,
3246
+ onSave
3007
3247
  }) {
3248
+ const [formData, setFormData] = useState15({ mappingId: "", externalUserId: "", hierarchyNodeId: "", roleCode: "", isPrimary: "", effectiveFrom: "", effectiveTo: "" });
3249
+ const [isSubmitting, setIsSubmitting] = useState15(false);
3250
+ const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [event.target.name]: event.target.value }));
3251
+ const handleSave = async () => {
3252
+ if (!onSave) return;
3253
+ setIsSubmitting(true);
3254
+ const success = await onSave({ externalUserId: Number(formData.externalUserId), hierarchyNodeId: Number(formData.hierarchyNodeId), roleCode: formData.roleCode, isPrimary: formData.isPrimary === "true", effectiveFrom: formData.effectiveFrom, effectiveTo: formData.effectiveTo || null, createdBy: "System" });
3255
+ setIsSubmitting(false);
3256
+ if (success) onClose();
3257
+ };
3008
3258
  if (!isOpen) return null;
3009
3259
  return /* @__PURE__ */ jsxs20("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
3010
3260
  /* @__PURE__ */ jsx21("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
@@ -3031,7 +3281,7 @@ function AddUserHierarchyNodeMappingModal({
3031
3281
  "Mapping ID ",
3032
3282
  /* @__PURE__ */ jsx21("span", { className: "fc:text-red-500", children: "*" })
3033
3283
  ] }),
3034
- /* @__PURE__ */ jsx21("input", { type: "text", placeholder: "Enter mapping ID", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3284
+ /* @__PURE__ */ jsx21("input", { name: "mappingId", value: formData.mappingId, onChange: handleChange, type: "text", placeholder: "Enter mapping ID", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3035
3285
  /* @__PURE__ */ jsx21("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the unique mapping ID" })
3036
3286
  ] }),
3037
3287
  /* @__PURE__ */ jsxs20("div", { children: [
@@ -3039,7 +3289,7 @@ function AddUserHierarchyNodeMappingModal({
3039
3289
  "External User ID ",
3040
3290
  /* @__PURE__ */ jsx21("span", { className: "fc:text-red-500", children: "*" })
3041
3291
  ] }),
3042
- /* @__PURE__ */ jsx21("input", { type: "text", placeholder: "Enter external user ID", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3292
+ /* @__PURE__ */ jsx21("input", { name: "externalUserId", value: formData.externalUserId, onChange: handleChange, type: "text", placeholder: "Enter external user ID", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3043
3293
  /* @__PURE__ */ jsx21("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the consumer user ID" })
3044
3294
  ] })
3045
3295
  ] }),
@@ -3048,7 +3298,7 @@ function AddUserHierarchyNodeMappingModal({
3048
3298
  "Hierarchy Node ID ",
3049
3299
  /* @__PURE__ */ jsx21("span", { className: "fc:text-red-500", children: "*" })
3050
3300
  ] }),
3051
- /* @__PURE__ */ jsx21("input", { type: "text", placeholder: "Enter hierarchy node ID", 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3301
+ /* @__PURE__ */ jsx21("input", { name: "hierarchyNodeId", value: formData.hierarchyNodeId, onChange: handleChange, type: "text", placeholder: "Enter hierarchy node ID", 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3052
3302
  /* @__PURE__ */ jsx21("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the hierarchy node assigned to the user" })
3053
3303
  ] }),
3054
3304
  /* @__PURE__ */ jsxs20("div", { className: "fc:grid fc:grid-cols-2 fc:gap-5", children: [
@@ -3057,7 +3307,7 @@ function AddUserHierarchyNodeMappingModal({
3057
3307
  "Role Code ",
3058
3308
  /* @__PURE__ */ jsx21("span", { className: "fc:text-red-500", children: "*" })
3059
3309
  ] }),
3060
- /* @__PURE__ */ jsx21("input", { type: "text", placeholder: "Enter role code", 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3310
+ /* @__PURE__ */ jsx21("input", { name: "roleCode", value: formData.roleCode, onChange: handleChange, type: "text", placeholder: "Enter role code", 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3061
3311
  /* @__PURE__ */ jsx21("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the user role code, for example DEO or RO" })
3062
3312
  ] }),
3063
3313
  /* @__PURE__ */ jsxs20("div", { children: [
@@ -3065,7 +3315,7 @@ function AddUserHierarchyNodeMappingModal({
3065
3315
  "Is Primary ",
3066
3316
  /* @__PURE__ */ jsx21("span", { className: "fc:text-red-500", children: "*" })
3067
3317
  ] }),
3068
- /* @__PURE__ */ jsxs20("select", { 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
3318
+ /* @__PURE__ */ jsxs20("select", { name: "isPrimary", value: formData.isPrimary, onChange: handleChange, 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:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
3069
3319
  /* @__PURE__ */ jsx21("option", { value: "", children: "Select primary status" }),
3070
3320
  /* @__PURE__ */ jsx21("option", { value: "true", children: "Yes" }),
3071
3321
  /* @__PURE__ */ jsx21("option", { value: "false", children: "No" })
@@ -3085,12 +3335,12 @@ function AddUserHierarchyNodeMappingModal({
3085
3335
  "Effective From ",
3086
3336
  /* @__PURE__ */ jsx21("span", { className: "fc:text-red-500", children: "*" })
3087
3337
  ] }),
3088
- /* @__PURE__ */ jsx21("input", { type: "date", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3338
+ /* @__PURE__ */ jsx21("input", { name: "effectiveFrom", value: formData.effectiveFrom, onChange: handleChange, type: "date", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3089
3339
  /* @__PURE__ */ jsx21("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Select the date from which this mapping is effective" })
3090
3340
  ] }),
3091
3341
  /* @__PURE__ */ jsxs20("div", { children: [
3092
3342
  /* @__PURE__ */ jsx21("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: "Effective To" }),
3093
- /* @__PURE__ */ jsx21("input", { type: "date", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3343
+ /* @__PURE__ */ jsx21("input", { name: "effectiveTo", value: formData.effectiveTo, onChange: handleChange, type: "date", className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-slate-700 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500" }),
3094
3344
  /* @__PURE__ */ jsx21("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Select the date until which this mapping is effective" })
3095
3345
  ] })
3096
3346
  ] })
@@ -3098,7 +3348,7 @@ function AddUserHierarchyNodeMappingModal({
3098
3348
  ] }),
3099
3349
  /* @__PURE__ */ jsxs20("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: [
3100
3350
  /* @__PURE__ */ jsx21("button", { onClick: onClose, className: "fc:px-6 fc:py-2.5 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 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u2715 Cancel" }),
3101
- /* @__PURE__ */ jsx21("button", { type: "button", className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/10 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u{1F4BE} Save Mapping" })
3351
+ /* @__PURE__ */ jsx21("button", { type: "button", onClick: handleSave, disabled: isSubmitting, className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/10 fc:transition-all fc:flex fc:items-center fc:gap-1.5", children: "\u{1F4BE} Save Mapping" })
3102
3352
  ] })
3103
3353
  ] })
3104
3354
  ] });
@@ -3129,10 +3379,10 @@ function MappingSearchBar({
3129
3379
  }
3130
3380
 
3131
3381
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
3132
- import React25, { useState as useState15, useEffect as useEffect8 } from "react";
3382
+ import React25, { useState as useState17, useEffect as useEffect10 } from "react";
3133
3383
 
3134
3384
  // src/components/user-hierarchy-node-mapping/edit-mapping.jsx
3135
- import React23, { useEffect as useEffect7, useState as useState14 } from "react";
3385
+ import React23, { useEffect as useEffect9, useState as useState16 } from "react";
3136
3386
  import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
3137
3387
  function EditUserHierarchyNodeMappingModal({
3138
3388
  isOpen,
@@ -3140,14 +3390,14 @@ function EditUserHierarchyNodeMappingModal({
3140
3390
  selectedMapping,
3141
3391
  onSave
3142
3392
  }) {
3143
- const [formData, setFormData] = useState14({
3393
+ const [formData, setFormData] = useState16({
3144
3394
  hierarchyNodeId: "",
3145
3395
  roleCode: "",
3146
3396
  isPrimary: "",
3147
3397
  effectiveFrom: "",
3148
3398
  effectiveTo: ""
3149
3399
  });
3150
- useEffect7(() => {
3400
+ useEffect9(() => {
3151
3401
  if (selectedMapping) {
3152
3402
  setFormData({
3153
3403
  hierarchyNodeId: selectedMapping.hierarchyNodeId || "",
@@ -3165,14 +3415,23 @@ function EditUserHierarchyNodeMappingModal({
3165
3415
  [name]: value
3166
3416
  }));
3167
3417
  };
3168
- const handleSubmit = (event) => {
3418
+ const handleSubmit = async (event) => {
3419
+ var _a, _b, _c;
3169
3420
  event.preventDefault();
3170
3421
  if (onSave) {
3171
- onSave(__spreadProps(__spreadValues(__spreadValues({}, selectedMapping), formData), {
3172
- isPrimary: formData.isPrimary === "true"
3173
- }));
3422
+ const success = await onSave({
3423
+ mappingId: Number((_a = selectedMapping.mappingId) != null ? _a : selectedMapping.id),
3424
+ externalUserId: Number(selectedMapping.externalUserId),
3425
+ hierarchyNodeId: Number(formData.hierarchyNodeId),
3426
+ roleCode: formData.roleCode,
3427
+ isPrimary: formData.isPrimary === "true",
3428
+ effectiveFrom: formData.effectiveFrom,
3429
+ effectiveTo: formData.effectiveTo || null,
3430
+ isActive: (_c = (_b = selectedMapping.isActive) != null ? _b : selectedMapping.status) != null ? _c : true,
3431
+ updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
3432
+ });
3433
+ if (success) onClose();
3174
3434
  }
3175
- onClose();
3176
3435
  };
3177
3436
  return /* @__PURE__ */ jsxs22("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
3178
3437
  /* @__PURE__ */ jsx23(
@@ -3376,266 +3635,21 @@ function DeleteUserHierarchyNodeMappingModal({
3376
3635
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
3377
3636
  import { jsx as jsx25, jsxs as jsxs24 } from "react/jsx-runtime";
3378
3637
  function UserHierarchyNodeMappingTable({
3638
+ apiData,
3379
3639
  pageSize,
3380
3640
  searchQuery = "",
3381
3641
  currentPage,
3382
3642
  setCurrentPage,
3383
- setTotalEntries
3643
+ setTotalEntries,
3644
+ onUpdate,
3645
+ onDelete
3384
3646
  }) {
3385
- const initialData = [{
3386
- id: 1,
3387
- mappingId: 1,
3388
- externalUserId: 101,
3389
- hierarchyNodeId: 2,
3390
- roleCode: "DEO",
3391
- isPrimary: true,
3392
- effectiveFrom: "2026-01-01",
3393
- effectiveTo: "",
3394
- status: true
3395
- }, {
3396
- id: 2,
3397
- mappingId: 2,
3398
- externalUserId: 101,
3399
- hierarchyNodeId: 3,
3400
- roleCode: "RO",
3401
- isPrimary: false,
3402
- effectiveFrom: "2026-01-01",
3403
- effectiveTo: "",
3404
- status: false
3405
- }, {
3406
- id: 3,
3407
- mappingId: 3,
3408
- externalUserId: 102,
3409
- hierarchyNodeId: 4,
3410
- roleCode: "AO",
3411
- isPrimary: true,
3412
- effectiveFrom: "2026-01-03",
3413
- effectiveTo: "",
3414
- status: true
3415
- }, {
3416
- id: 4,
3417
- mappingId: 4,
3418
- externalUserId: 103,
3419
- hierarchyNodeId: 5,
3420
- roleCode: "SO",
3421
- isPrimary: false,
3422
- effectiveFrom: "2026-01-05",
3423
- effectiveTo: "2026-12-31",
3424
- status: false
3425
- }, {
3426
- id: 5,
3427
- mappingId: 5,
3428
- externalUserId: 104,
3429
- hierarchyNodeId: 6,
3430
- roleCode: "DEO",
3431
- isPrimary: true,
3432
- effectiveFrom: "2026-01-07",
3433
- effectiveTo: "",
3434
- status: true
3435
- }, {
3436
- id: 6,
3437
- mappingId: 6,
3438
- externalUserId: 105,
3439
- hierarchyNodeId: 7,
3440
- roleCode: "RO",
3441
- isPrimary: false,
3442
- effectiveFrom: "2026-01-09",
3443
- effectiveTo: "",
3444
- status: false
3445
- }, {
3446
- id: 7,
3447
- mappingId: 7,
3448
- externalUserId: 106,
3449
- hierarchyNodeId: 8,
3450
- roleCode: "AO",
3451
- isPrimary: true,
3452
- effectiveFrom: "2026-01-11",
3453
- effectiveTo: "",
3454
- status: true
3455
- }, {
3456
- id: 8,
3457
- mappingId: 8,
3458
- externalUserId: 107,
3459
- hierarchyNodeId: 9,
3460
- roleCode: "SO",
3461
- isPrimary: false,
3462
- effectiveFrom: "2026-01-13",
3463
- effectiveTo: "2026-09-30",
3464
- status: false
3465
- }, {
3466
- id: 9,
3467
- mappingId: 9,
3468
- externalUserId: 108,
3469
- hierarchyNodeId: 10,
3470
- roleCode: "DEO",
3471
- isPrimary: true,
3472
- effectiveFrom: "2026-01-15",
3473
- effectiveTo: "",
3474
- status: true
3475
- }, {
3476
- id: 10,
3477
- mappingId: 10,
3478
- externalUserId: 109,
3479
- hierarchyNodeId: 11,
3480
- roleCode: "RO",
3481
- isPrimary: false,
3482
- effectiveFrom: "2026-01-17",
3483
- effectiveTo: "",
3484
- status: false
3485
- }, {
3486
- id: 11,
3487
- mappingId: 11,
3488
- externalUserId: 110,
3489
- hierarchyNodeId: 12,
3490
- roleCode: "AO",
3491
- isPrimary: true,
3492
- effectiveFrom: "2026-01-19",
3493
- effectiveTo: "",
3494
- status: true
3495
- }, {
3496
- id: 12,
3497
- mappingId: 12,
3498
- externalUserId: 111,
3499
- hierarchyNodeId: 13,
3500
- roleCode: "SO",
3501
- isPrimary: false,
3502
- effectiveFrom: "2026-01-21",
3503
- effectiveTo: "2026-10-31",
3504
- status: false
3505
- }, {
3506
- id: 13,
3507
- mappingId: 13,
3508
- externalUserId: 112,
3509
- hierarchyNodeId: 14,
3510
- roleCode: "DEO",
3511
- isPrimary: true,
3512
- effectiveFrom: "2026-01-23",
3513
- effectiveTo: "",
3514
- status: true
3515
- }, {
3516
- id: 14,
3517
- mappingId: 14,
3518
- externalUserId: 113,
3519
- hierarchyNodeId: 15,
3520
- roleCode: "RO",
3521
- isPrimary: false,
3522
- effectiveFrom: "2026-01-25",
3523
- effectiveTo: "",
3524
- status: false
3525
- }, {
3526
- id: 15,
3527
- mappingId: 15,
3528
- externalUserId: 114,
3529
- hierarchyNodeId: 16,
3530
- roleCode: "AO",
3531
- isPrimary: true,
3532
- effectiveFrom: "2026-01-27",
3533
- effectiveTo: "",
3534
- status: true
3535
- }, {
3536
- id: 16,
3537
- mappingId: 16,
3538
- externalUserId: 115,
3539
- hierarchyNodeId: 17,
3540
- roleCode: "SO",
3541
- isPrimary: false,
3542
- effectiveFrom: "2026-01-29",
3543
- effectiveTo: "2026-11-30",
3544
- status: false
3545
- }, {
3546
- id: 17,
3547
- mappingId: 17,
3548
- externalUserId: 116,
3549
- hierarchyNodeId: 18,
3550
- roleCode: "DEO",
3551
- isPrimary: true,
3552
- effectiveFrom: "2026-02-01",
3553
- effectiveTo: "",
3554
- status: true
3555
- }, {
3556
- id: 18,
3557
- mappingId: 18,
3558
- externalUserId: 117,
3559
- hierarchyNodeId: 19,
3560
- roleCode: "RO",
3561
- isPrimary: false,
3562
- effectiveFrom: "2026-02-03",
3563
- effectiveTo: "",
3564
- status: false
3565
- }, {
3566
- id: 19,
3567
- mappingId: 19,
3568
- externalUserId: 118,
3569
- hierarchyNodeId: 20,
3570
- roleCode: "AO",
3571
- isPrimary: true,
3572
- effectiveFrom: "2026-02-05",
3573
- effectiveTo: "",
3574
- status: true
3575
- }, {
3576
- id: 20,
3577
- mappingId: 20,
3578
- externalUserId: 119,
3579
- hierarchyNodeId: 21,
3580
- roleCode: "SO",
3581
- isPrimary: false,
3582
- effectiveFrom: "2026-02-07",
3583
- effectiveTo: "2026-12-31",
3584
- status: false
3585
- }, {
3586
- id: 21,
3587
- mappingId: 21,
3588
- externalUserId: 120,
3589
- hierarchyNodeId: 22,
3590
- roleCode: "DEO",
3591
- isPrimary: true,
3592
- effectiveFrom: "2026-02-09",
3593
- effectiveTo: "",
3594
- status: true
3595
- }, {
3596
- id: 22,
3597
- mappingId: 22,
3598
- externalUserId: 121,
3599
- hierarchyNodeId: 23,
3600
- roleCode: "RO",
3601
- isPrimary: false,
3602
- effectiveFrom: "2026-02-11",
3603
- effectiveTo: "",
3604
- status: false
3605
- }, {
3606
- id: 23,
3607
- mappingId: 23,
3608
- externalUserId: 122,
3609
- hierarchyNodeId: 24,
3610
- roleCode: "AO",
3611
- isPrimary: true,
3612
- effectiveFrom: "2026-02-13",
3613
- effectiveTo: "",
3614
- status: true
3615
- }, {
3616
- id: 24,
3617
- mappingId: 24,
3618
- externalUserId: 123,
3619
- hierarchyNodeId: 25,
3620
- roleCode: "SO",
3621
- isPrimary: false,
3622
- effectiveFrom: "2026-02-15",
3623
- effectiveTo: "2026-08-31",
3624
- status: false
3625
- }, {
3626
- id: 25,
3627
- mappingId: 25,
3628
- externalUserId: 124,
3629
- hierarchyNodeId: 26,
3630
- roleCode: "DEO",
3631
- isPrimary: true,
3632
- effectiveFrom: "2026-02-17",
3633
- effectiveTo: "",
3634
- status: true
3635
- }];
3636
- const [data, setData] = useState15(initialData);
3637
- const [sortOrder, setSortOrder] = useState15("asc");
3638
- const [sortKey, setSortKey] = useState15("mappingId");
3647
+ const [data, setData] = useState17(apiData || []);
3648
+ useEffect10(() => {
3649
+ setData(apiData || []);
3650
+ }, [apiData]);
3651
+ const [sortOrder, setSortOrder] = useState17("asc");
3652
+ const [sortKey, setSortKey] = useState17("mappingId");
3639
3653
  const handleSort = (columnKey) => {
3640
3654
  const isAsc = sortKey === columnKey && sortOrder === "asc";
3641
3655
  setSortOrder(isAsc ? "desc" : "asc");
@@ -3651,7 +3665,7 @@ function UserHierarchyNodeMappingTable({
3651
3665
  const query = (searchQuery || "").toLowerCase();
3652
3666
  return String(item.mappingId).toLowerCase().includes(query) || String(item.externalUserId).toLowerCase().includes(query) || String(item.hierarchyNodeId).toLowerCase().includes(query) || item.roleCode.toLowerCase().includes(query);
3653
3667
  });
3654
- useEffect8(() => {
3668
+ useEffect10(() => {
3655
3669
  if (setTotalEntries) setTotalEntries(filteredData.length);
3656
3670
  }, [filteredData.length, setTotalEntries]);
3657
3671
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -3660,9 +3674,9 @@ function UserHierarchyNodeMappingTable({
3660
3674
  const pageNumbers = Array.from({
3661
3675
  length: totalPages
3662
3676
  }, (_, i) => i + 1);
3663
- const [showEditPopup, setShowEditPopup] = useState15(false);
3664
- const [showDeletePopup, setShowDeletePopup] = useState15(false);
3665
- const [selectedItem, setSelectedItem] = useState15(null);
3677
+ const [showEditPopup, setShowEditPopup] = useState17(false);
3678
+ const [showDeletePopup, setShowDeletePopup] = useState17(false);
3679
+ const [selectedItem, setSelectedItem] = useState17(null);
3666
3680
  const openEditPopup = (item) => {
3667
3681
  setSelectedItem(item);
3668
3682
  setShowEditPopup(true);
@@ -3679,16 +3693,16 @@ function UserHierarchyNodeMappingTable({
3679
3693
  setShowDeletePopup(false);
3680
3694
  setSelectedItem(null);
3681
3695
  };
3682
- const handleDelete = () => {
3683
- setData(
3684
- (prev) => prev.filter((item) => item.id !== (selectedItem == null ? void 0 : selectedItem.id))
3685
- );
3686
- closeDeletePopup();
3696
+ const handleDelete = async () => {
3697
+ if (await (onDelete == null ? void 0 : onDelete(selectedItem))) closeDeletePopup();
3687
3698
  };
3688
3699
  const toggleStatus = (id) => {
3689
- setData((prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
3690
- status: !item.status
3691
- }) : item));
3700
+ var _a, _b;
3701
+ const item = data.find((record) => {
3702
+ var _a2;
3703
+ return ((_a2 = record.mappingId) != null ? _a2 : record.id) === id;
3704
+ });
3705
+ if (item) onUpdate == null ? void 0 : onUpdate(__spreadProps(__spreadValues({}, item), { mappingId: (_a = item.mappingId) != null ? _a : item.id, isActive: !((_b = item.isActive) != null ? _b : item.status), updatedBy: item.updatedBy || item.createdBy || "System" }));
3692
3706
  };
3693
3707
  return /* @__PURE__ */ jsxs24("div", { className: "fc:space-y-5", children: [
3694
3708
  /* @__PURE__ */ jsx25("div", { className: "fc:w-full fc:overflow-x-hidden fc:border fc:border-slate-200 fc:rounded-2xl fc:shadow-sm fc:max-h-[420px] fc:overflow-y-auto", children: /* @__PURE__ */ jsxs24("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-fixed", children: [
@@ -3720,29 +3734,35 @@ function UserHierarchyNodeMappingTable({
3720
3734
  /* @__PURE__ */ jsx25("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "STATUS" }),
3721
3735
  /* @__PURE__ */ jsx25("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "ACTION" })
3722
3736
  ] }) }),
3723
- /* @__PURE__ */ jsx25("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-s fc:text-slate-600", children: visibleData.map((item, index) => /* @__PURE__ */ jsxs24("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
3724
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-4 fc:text-center fc:font-medium fc:text-slate-400", children: startIndex + index + 1 }),
3725
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.mappingId }),
3726
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.externalUserId }),
3727
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.hierarchyNodeId }),
3728
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.roleCode }),
3729
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx25("span", { className: `fc:px-2 fc:py-0.5 fc:text-xs fc:font-semibold fc:rounded${item.isPrimary ? "bg-emerald-50 text-emerald-600 border border-emerald-200" : "bg-rose-50 text-rose-600 border border-rose-200"}`, children: item.isPrimary ? "\u2713 Yes" : "\u2715 No" }) }),
3730
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveFrom }),
3731
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveTo }),
3732
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx25("button", { onClick: () => toggleStatus(item.id), 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.status ? "fc:bg-blue-600" : "fc:bg-gray-200"}`, children: /* @__PURE__ */ jsx25("span", { 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.status ? "fc:translate-x-5" : "fc:translate-x-0"}` }) }) }),
3733
- /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-2 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsxs24("div", { className: "fc:flex fc:justify-center fc:items-center fc:gap-2", children: [
3734
- /* @__PURE__ */ jsx25(
3735
- "button",
3736
- {
3737
- type: "button",
3738
- onClick: () => openEditPopup(item),
3739
- className: " fc:px-3 fc:py-1 fc:bg-blue-100/70 hover:fc:bg-blue-200/80 fc:text-blue-600 fc:font-semibold fc:text-xs fc:rounded-lg fc:transition-all fc:duration-150 fc:cursor-pointer",
3740
- children: "Edit"
3741
- }
3742
- ),
3743
- /* @__PURE__ */ jsx25("button", { onClick: () => openDeletePopup(item), className: "fc:px-3 fc:py-1 fc:bg-rose-100/70 hover:fc:bg-rose-200/80 fc:text-rose-600 fc:font-semibold fc:text-xs fc:rounded-lg fc:transition-all fc:duration-150 fc:cursor-pointer", children: "Delete" })
3744
- ] }) })
3745
- ] }, item.id)) })
3737
+ /* @__PURE__ */ jsx25("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-s fc:text-slate-600", children: visibleData.map((item, index) => {
3738
+ var _a, _b;
3739
+ return /* @__PURE__ */ jsxs24("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
3740
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-4 fc:text-center fc:font-medium fc:text-slate-400", children: startIndex + index + 1 }),
3741
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.mappingId }),
3742
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.externalUserId }),
3743
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.hierarchyNodeId }),
3744
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.roleCode }),
3745
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx25("span", { className: `fc:px-2 fc:py-0.5 fc:text-xs fc:font-semibold fc:rounded${item.isPrimary ? "bg-emerald-50 text-emerald-600 border border-emerald-200" : "bg-rose-50 text-rose-600 border border-rose-200"}`, children: item.isPrimary ? "\u2713 Yes" : "\u2715 No" }) }),
3746
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveFrom }),
3747
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveTo }),
3748
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx25("button", { onClick: () => {
3749
+ var _a2;
3750
+ return toggleStatus((_a2 = item.mappingId) != null ? _a2 : item.id);
3751
+ }, 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 ${((_a = item.isActive) != null ? _a : item.status) ? "fc:bg-blue-600" : "fc:bg-gray-200"}`, children: /* @__PURE__ */ jsx25("span", { 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 ${((_b = item.isActive) != null ? _b : item.status) ? "fc:translate-x-5" : "fc:translate-x-0"}` }) }) }),
3752
+ /* @__PURE__ */ jsx25("td", { className: "fc:py-4 fc:px-2 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsxs24("div", { className: "fc:flex fc:justify-center fc:items-center fc:gap-2", children: [
3753
+ /* @__PURE__ */ jsx25(
3754
+ "button",
3755
+ {
3756
+ type: "button",
3757
+ onClick: () => openEditPopup(item),
3758
+ className: " fc:px-3 fc:py-1 fc:bg-blue-100/70 hover:fc:bg-blue-200/80 fc:text-blue-600 fc:font-semibold fc:text-xs fc:rounded-lg fc:transition-all fc:duration-150 fc:cursor-pointer",
3759
+ children: "Edit"
3760
+ }
3761
+ ),
3762
+ /* @__PURE__ */ jsx25("button", { onClick: () => openDeletePopup(item), className: "fc:px-3 fc:py-1 fc:bg-rose-100/70 hover:fc:bg-rose-200/80 fc:text-rose-600 fc:font-semibold fc:text-xs fc:rounded-lg fc:transition-all fc:duration-150 fc:cursor-pointer", children: "Delete" })
3763
+ ] }) })
3764
+ ] }, item.id);
3765
+ }) })
3746
3766
  ] }) }),
3747
3767
  /* @__PURE__ */ jsxs24("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: [
3748
3768
  /* @__PURE__ */ jsx25("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" }),
@@ -3754,7 +3774,8 @@ function UserHierarchyNodeMappingTable({
3754
3774
  {
3755
3775
  isOpen: showEditPopup,
3756
3776
  onClose: closeEditPopup,
3757
- selectedMapping: selectedItem
3777
+ selectedMapping: selectedItem,
3778
+ onSave: (payload) => onUpdate == null ? void 0 : onUpdate(payload)
3758
3779
  }
3759
3780
  ),
3760
3781
  /* @__PURE__ */ jsx25(
@@ -3772,21 +3793,49 @@ function UserHierarchyNodeMappingTable({
3772
3793
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3773
3794
  import { jsx as jsx26, jsxs as jsxs25 } from "react/jsx-runtime";
3774
3795
  function User_hierarchy_mapping_main() {
3775
- const [refreshkey, setRefreshKey] = useState16(0);
3796
+ const [refreshkey, setRefreshKey] = useState18(0);
3797
+ const [apiData, setApiData] = useState18([]);
3798
+ useEffect11(() => {
3799
+ (async () => {
3800
+ var _a, _b, _c, _d, _e, _f, _g;
3801
+ try {
3802
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.userHierarchyNodeMapping) == null ? void 0 : _c.getList;
3803
+ if (!endpoint) throw new Error("User hierarchy node mapping list endpoint is not configured.");
3804
+ const result = await getApiService().post(endpoint, {});
3805
+ const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
3806
+ setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
3807
+ } catch (error) {
3808
+ await Swal6.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load user hierarchy node mappings.", "error");
3809
+ }
3810
+ })();
3811
+ }, [refreshkey]);
3776
3812
  const handleRefresh = () => {
3777
- console.log("Table data refreshed!");
3778
3813
  setRefreshKey((prev) => prev + 1);
3779
3814
  };
3780
3815
  const tableRef = useRef6(null);
3781
- const [modalOpen, setModalOpen] = useState16(false);
3782
- const [pageSize, setPageSize] = useState16(10);
3783
- const [searchQuery, setSearchQuery] = useState16("");
3784
- const [currentPage, setCurrentPage] = useState16(1);
3785
- const [totalEntries, setTotalEntries] = useState16(0);
3816
+ const [modalOpen, setModalOpen] = useState18(false);
3817
+ const [pageSize, setPageSize] = useState18(10);
3818
+ const [searchQuery, setSearchQuery] = useState18("");
3819
+ const [currentPage, setCurrentPage] = useState18(1);
3820
+ const [totalEntries, setTotalEntries] = useState18(0);
3786
3821
  const handlePageSizeChange = (e) => {
3787
3822
  setPageSize(Number(e.target.value));
3788
3823
  setCurrentPage(1);
3789
3824
  };
3825
+ const saveMapping = async (payload, isEdit = false) => {
3826
+ var _a, _b, _c, _d, _e;
3827
+ try {
3828
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.userHierarchyNodeMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
3829
+ if (!endpoint) throw new Error(`User hierarchy node mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
3830
+ await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
3831
+ await Swal6.fire("Success", `User hierarchy node mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
3832
+ handleRefresh();
3833
+ return true;
3834
+ } catch (error) {
3835
+ await Swal6.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} user hierarchy node mapping.`, "error");
3836
+ return false;
3837
+ }
3838
+ };
3790
3839
  return /* @__PURE__ */ jsxs25("div", { className: "fc:min-h-screen fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
3791
3840
  /* @__PURE__ */ jsxs25("div", { className: "fc:w-full fc:space-y-5", children: [
3792
3841
  /* @__PURE__ */ jsx26(CommonHeader, { title: "User Hierarchy Node Mapping", breadcrumbs: [{
@@ -3816,15 +3865,15 @@ function User_hierarchy_mapping_main() {
3816
3865
  ] })
3817
3866
  ] })
3818
3867
  ] }),
3819
- /* @__PURE__ */ jsx26("div", { ref: tableRef, children: /* @__PURE__ */ jsx26(UserHierarchyNodeMappingTable, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries }, refreshkey) })
3868
+ /* @__PURE__ */ jsx26("div", { ref: tableRef, children: /* @__PURE__ */ jsx26(UserHierarchyNodeMappingTable, { apiData, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onUpdate: (payload) => saveMapping(payload, true), onDelete: (item) => saveMapping(__spreadProps(__spreadValues({}, item), { mappingId: item.mappingId, isActive: false, updatedBy: item.updatedBy || item.createdBy || "System" }), true) }) })
3820
3869
  ] })
3821
3870
  ] }),
3822
- /* @__PURE__ */ jsx26(AddUserHierarchyNodeMappingModal, { isOpen: modalOpen, onClose: () => setModalOpen(false) })
3871
+ /* @__PURE__ */ jsx26(AddUserHierarchyNodeMappingModal, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: (payload) => saveMapping(payload) })
3823
3872
  ] });
3824
3873
  }
3825
3874
 
3826
3875
  // src/components/document-configuration/DocumentConfigurationmain.jsx
3827
- import React32, { useState as useState20, useRef as useRef7 } from "react";
3876
+ import React32, { useState as useState22, useRef as useRef7 } from "react";
3828
3877
 
3829
3878
  // src/components/document-configuration/SearchBar.jsx
3830
3879
  import React27 from "react";
@@ -3844,10 +3893,10 @@ function SearchBar3({
3844
3893
  }
3845
3894
 
3846
3895
  // src/components/document-configuration/DocumentConfigurationTable.jsx
3847
- import React30, { useState as useState18, useEffect as useEffect10 } from "react";
3896
+ import React30, { useState as useState20, useEffect as useEffect13 } from "react";
3848
3897
 
3849
3898
  // src/components/document-configuration/Edit.jsx
3850
- import React28, { useState as useState17, useEffect as useEffect9 } from "react";
3899
+ import React28, { useState as useState19, useEffect as useEffect12 } from "react";
3851
3900
  import { jsx as jsx28, jsxs as jsxs27 } from "react/jsx-runtime";
3852
3901
  function EditDocumentConfiguration({
3853
3902
  isOpen,
@@ -3855,7 +3904,7 @@ function EditDocumentConfiguration({
3855
3904
  initialData,
3856
3905
  onSave
3857
3906
  }) {
3858
- const [formData, setFormData] = useState17({
3907
+ const [formData, setFormData] = useState19({
3859
3908
  docName: "",
3860
3909
  stepId: "",
3861
3910
  extensions: "",
@@ -3864,8 +3913,8 @@ function EditDocumentConfiguration({
3864
3913
  isMandatory: false,
3865
3914
  status: "Active"
3866
3915
  });
3867
- const [errors, setErrors] = useState17({});
3868
- useEffect9(() => {
3916
+ const [errors, setErrors] = useState19({});
3917
+ useEffect12(() => {
3869
3918
  if (initialData) {
3870
3919
  const sizeParts = (initialData.maxSize || "10 MB").split(" ");
3871
3920
  setFormData({
@@ -4274,12 +4323,12 @@ function DocumentConfigTable({
4274
4323
  status: "Active"
4275
4324
  }
4276
4325
  ];
4277
- const [data, setData] = useState18(initialData);
4278
- const [sortOrder, setSortOrder] = useState18("asc");
4279
- const [sortKey, setSortKey] = useState18("docName");
4280
- const [isEditOpen, setIsEditOpen] = useState18(false);
4281
- const [isDeleteOpen, setIsDeleteOpen] = useState18(false);
4282
- const [selectedItem, setSelectedItem] = useState18(null);
4326
+ const [data, setData] = useState20(initialData);
4327
+ const [sortOrder, setSortOrder] = useState20("asc");
4328
+ const [sortKey, setSortKey] = useState20("docName");
4329
+ const [isEditOpen, setIsEditOpen] = useState20(false);
4330
+ const [isDeleteOpen, setIsDeleteOpen] = useState20(false);
4331
+ const [selectedItem, setSelectedItem] = useState20(null);
4283
4332
  const handleSort = (columnKey) => {
4284
4333
  const isAsc = sortKey === columnKey && sortOrder === "asc";
4285
4334
  setSortOrder(isAsc ? "desc" : "asc");
@@ -4295,7 +4344,7 @@ function DocumentConfigTable({
4295
4344
  const query = (searchQuery || "").toLowerCase();
4296
4345
  return item.docName.toLowerCase().includes(query) || item.extensions.toLowerCase().includes(query) || item.stepId.toLowerCase().includes(query);
4297
4346
  });
4298
- useEffect10(() => {
4347
+ useEffect13(() => {
4299
4348
  if (setTotalEntries) setTotalEntries(filteredData.length);
4300
4349
  }, [filteredData.length, setTotalEntries]);
4301
4350
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -4501,19 +4550,19 @@ function DocumentConfigTable({
4501
4550
  }
4502
4551
 
4503
4552
  // src/components/document-configuration/AddDocumentConfigurationModal.jsx
4504
- import React31, { useState as useState19 } from "react";
4553
+ import React31, { useState as useState21 } from "react";
4505
4554
  import { jsx as jsx31, jsxs as jsxs30 } from "react/jsx-runtime";
4506
4555
  function AddDocumentConfigModal({
4507
4556
  isOpen,
4508
4557
  onClose
4509
4558
  }) {
4510
- const [isMandatory, setIsMandatory] = useState19(false);
4511
- const [status, setStatus] = useState19("Active");
4512
- const [documentName, setDocumentName] = useState19("");
4513
- const [stepId, setStepId] = useState19("");
4514
- const [maxSize, setMaxSize] = useState19("");
4515
- const [allowedExtensions, setAllowedExtensions] = useState19("");
4516
- const [errors, setErrors] = useState19({});
4559
+ const [isMandatory, setIsMandatory] = useState21(false);
4560
+ const [status, setStatus] = useState21("Active");
4561
+ const [documentName, setDocumentName] = useState21("");
4562
+ const [stepId, setStepId] = useState21("");
4563
+ const [maxSize, setMaxSize] = useState21("");
4564
+ const [allowedExtensions, setAllowedExtensions] = useState21("");
4565
+ const [errors, setErrors] = useState21({});
4517
4566
  const handleSave = () => {
4518
4567
  let newErrors = {};
4519
4568
  if (!documentName.trim()) {
@@ -4646,17 +4695,17 @@ function AddDocumentConfigModal({
4646
4695
  // src/components/document-configuration/DocumentConfigurationmain.jsx
4647
4696
  import { jsx as jsx32, jsxs as jsxs31 } from "react/jsx-runtime";
4648
4697
  function DocumentConfigurationmain() {
4649
- const [refreshkey, setRefreshKey] = useState20(0);
4698
+ const [refreshkey, setRefreshKey] = useState22(0);
4650
4699
  const handleRefresh = () => {
4651
4700
  console.log("Table data refreshed!");
4652
4701
  setRefreshKey((prev) => prev + 1);
4653
4702
  };
4654
4703
  const tableRef = useRef7(null);
4655
- const [modalOpen, setModalOpen] = useState20(false);
4656
- const [pageSize, setPageSize] = useState20(10);
4657
- const [searchQuery, setSearchQuery] = useState20("");
4658
- const [currentPage, setCurrentPage] = useState20(1);
4659
- const [totalEntries, setTotalEntries] = useState20(0);
4704
+ const [modalOpen, setModalOpen] = useState22(false);
4705
+ const [pageSize, setPageSize] = useState22(10);
4706
+ const [searchQuery, setSearchQuery] = useState22("");
4707
+ const [currentPage, setCurrentPage] = useState22(1);
4708
+ const [totalEntries, setTotalEntries] = useState22(0);
4660
4709
  const handlePageSizeChange = (e) => {
4661
4710
  setPageSize(Number(e.target.value));
4662
4711
  setCurrentPage(1);
@@ -4696,7 +4745,7 @@ function DocumentConfigurationmain() {
4696
4745
  }
4697
4746
 
4698
4747
  // src/components/audit-log/AuditLogmain.jsx
4699
- import React36, { useState as useState23, useRef as useRef8 } from "react";
4748
+ import React36, { useState as useState25, useRef as useRef8 } from "react";
4700
4749
 
4701
4750
  // src/components/audit-log/SearchBar.jsx
4702
4751
  import React33 from "react";
@@ -4716,7 +4765,7 @@ function SearchBar4({
4716
4765
  }
4717
4766
 
4718
4767
  // src/components/audit-log/AuditLogTable.jsx
4719
- import React34, { useState as useState21, useEffect as useEffect11 } from "react";
4768
+ import React34, { useState as useState23, useEffect as useEffect14 } from "react";
4720
4769
  import { jsx as jsx34, jsxs as jsxs33 } from "react/jsx-runtime";
4721
4770
  function AuditLogTable({
4722
4771
  pageSize,
@@ -4926,9 +4975,9 @@ function AuditLogTable({
4926
4975
  ip: "192.168.1.45",
4927
4976
  time: "2026-07-17 15:55"
4928
4977
  }];
4929
- const [data, setData] = useState21(initialData);
4930
- const [sortOrder, setSortOrder] = useState21("asc");
4931
- const [sortKey, setSortKey] = useState21("logId");
4978
+ const [data, setData] = useState23(initialData);
4979
+ const [sortOrder, setSortOrder] = useState23("asc");
4980
+ const [sortKey, setSortKey] = useState23("logId");
4932
4981
  const handleSort = (columnKey) => {
4933
4982
  const isAsc = sortKey === columnKey && sortOrder === "asc";
4934
4983
  setSortOrder(isAsc ? "desc" : "asc");
@@ -4944,7 +4993,7 @@ function AuditLogTable({
4944
4993
  const query = (searchQuery || "").toLowerCase();
4945
4994
  return item.logId.toLowerCase().includes(query) || item.user.toLowerCase().includes(query) || item.section.toLowerCase().includes(query) || item.action.toLowerCase().includes(query);
4946
4995
  });
4947
- useEffect11(() => {
4996
+ useEffect14(() => {
4948
4997
  if (setTotalEntries) setTotalEntries(filteredData.length);
4949
4998
  }, [filteredData.length, setTotalEntries]);
4950
4999
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5012,19 +5061,19 @@ function AuditLogTable({
5012
5061
  }
5013
5062
 
5014
5063
  // src/components/audit-log/AddAuditLogModal.jsx
5015
- import React35, { useState as useState22 } from "react";
5064
+ import React35, { useState as useState24 } from "react";
5016
5065
  import { jsx as jsx35, jsxs as jsxs34 } from "react/jsx-runtime";
5017
5066
  function AddAuditLogModal({
5018
5067
  isOpen,
5019
5068
  onClose
5020
5069
  }) {
5021
- const [logId, setLogId] = useState22("");
5022
- const [userName, setUserName] = useState22("");
5023
- const [actionType, setActionType] = useState22("");
5024
- const [ipAddress, setIpAddress] = useState22("");
5025
- const [sectionModule, setSectionModule] = useState22("");
5026
- const [timestamp, setTimestamp] = useState22("");
5027
- const [errors, setErrors] = useState22({});
5070
+ const [logId, setLogId] = useState24("");
5071
+ const [userName, setUserName] = useState24("");
5072
+ const [actionType, setActionType] = useState24("");
5073
+ const [ipAddress, setIpAddress] = useState24("");
5074
+ const [sectionModule, setSectionModule] = useState24("");
5075
+ const [timestamp, setTimestamp] = useState24("");
5076
+ const [errors, setErrors] = useState24({});
5028
5077
  const handleCommit = () => {
5029
5078
  let newErrors = {};
5030
5079
  if (!logId.trim()) newErrors.logId = "Log ID is required";
@@ -5143,17 +5192,17 @@ function AddAuditLogModal({
5143
5192
  // src/components/audit-log/AuditLogmain.jsx
5144
5193
  import { jsx as jsx36, jsxs as jsxs35 } from "react/jsx-runtime";
5145
5194
  function AuditLogmain() {
5146
- const [refreshkey, setRefreshKey] = useState23(0);
5195
+ const [refreshkey, setRefreshKey] = useState25(0);
5147
5196
  const handleRefresh = () => {
5148
5197
  console.log("Table data refreshed!");
5149
5198
  setRefreshKey((prev) => prev + 1);
5150
5199
  };
5151
5200
  const tableRef = useRef8(null);
5152
- const [modalOpen, setModalOpen] = useState23(false);
5153
- const [pageSize, setPageSize] = useState23(10);
5154
- const [searchQuery, setSearchQuery] = useState23("");
5155
- const [currentPage, setCurrentPage] = useState23(1);
5156
- const [totalEntries, setTotalEntries] = useState23(0);
5201
+ const [modalOpen, setModalOpen] = useState25(false);
5202
+ const [pageSize, setPageSize] = useState25(10);
5203
+ const [searchQuery, setSearchQuery] = useState25("");
5204
+ const [currentPage, setCurrentPage] = useState25(1);
5205
+ const [totalEntries, setTotalEntries] = useState25(0);
5157
5206
  const handlePageSizeChange = (e) => {
5158
5207
  setPageSize(Number(e.target.value));
5159
5208
  setCurrentPage(1);
@@ -5212,7 +5261,7 @@ function AuditLogmain() {
5212
5261
  }
5213
5262
 
5214
5263
  // src/components/movement-history/MovementHistorymain.jsx
5215
- import React40, { useState as useState26, useRef as useRef9 } from "react";
5264
+ import React40, { useState as useState28, useRef as useRef9 } from "react";
5216
5265
 
5217
5266
  // src/components/movement-history/SearchBar.jsx
5218
5267
  import React37 from "react";
@@ -5232,7 +5281,7 @@ function SearchBar5({
5232
5281
  }
5233
5282
 
5234
5283
  // src/components/movement-history/MovementHistoryTable.jsx
5235
- import React38, { useState as useState24, useEffect as useEffect12 } from "react";
5284
+ import React38, { useState as useState26, useEffect as useEffect15 } from "react";
5236
5285
  import { jsx as jsx38, jsxs as jsxs37 } from "react/jsx-runtime";
5237
5286
  function MovementHistoryTable({
5238
5287
  pageSize,
@@ -5442,9 +5491,9 @@ function MovementHistoryTable({
5442
5491
  toStepId: "APPROVE",
5443
5492
  movedOn: "2026-02-12"
5444
5493
  }];
5445
- const [data, setData] = useState24(initialData);
5446
- const [sortOrder, setSortOrder] = useState24("asc");
5447
- const [sortKey, setSortKey] = useState24("movementHistoryId");
5494
+ const [data, setData] = useState26(initialData);
5495
+ const [sortOrder, setSortOrder] = useState26("asc");
5496
+ const [sortKey, setSortKey] = useState26("movementHistoryId");
5448
5497
  const handleSort = (columnKey) => {
5449
5498
  const isAsc = sortKey === columnKey && sortOrder === "asc";
5450
5499
  setSortOrder(isAsc ? "desc" : "asc");
@@ -5460,7 +5509,7 @@ function MovementHistoryTable({
5460
5509
  const query = (searchQuery || "").toLowerCase();
5461
5510
  return item.movementHistoryId.toLowerCase().includes(query) || item.name.toLowerCase().includes(query) || item.toStepId.toLowerCase().includes(query);
5462
5511
  });
5463
- useEffect12(() => {
5512
+ useEffect15(() => {
5464
5513
  if (setTotalEntries) setTotalEntries(filteredData.length);
5465
5514
  }, [filteredData.length, setTotalEntries]);
5466
5515
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5531,19 +5580,19 @@ function MovementHistoryTable({
5531
5580
  }
5532
5581
 
5533
5582
  // src/components/movement-history/AddMovementHistoryModal.jsx
5534
- import React39, { useState as useState25 } from "react";
5583
+ import React39, { useState as useState27 } from "react";
5535
5584
  import { jsx as jsx39, jsxs as jsxs38 } from "react/jsx-runtime";
5536
5585
  function AddMovementHistoryModal({
5537
5586
  isOpen,
5538
5587
  onClose
5539
5588
  }) {
5540
- const [movementHistoryId, setMovementHistoryId] = useState25("");
5541
- const [fileInstanceId, setFileInstanceId] = useState25("");
5542
- const [fromStepId, setFromStepId] = useState25("");
5543
- const [toStepId, setToStepId] = useState25("");
5544
- const [actionCode, setActionCode] = useState25("");
5545
- const [movedOn, setMovedOn] = useState25("");
5546
- const [errors, setErrors] = useState25({});
5589
+ const [movementHistoryId, setMovementHistoryId] = useState27("");
5590
+ const [fileInstanceId, setFileInstanceId] = useState27("");
5591
+ const [fromStepId, setFromStepId] = useState27("");
5592
+ const [toStepId, setToStepId] = useState27("");
5593
+ const [actionCode, setActionCode] = useState27("");
5594
+ const [movedOn, setMovedOn] = useState27("");
5595
+ const [errors, setErrors] = useState27({});
5547
5596
  const handleSaveRecord = () => {
5548
5597
  let newErrors = {};
5549
5598
  if (!movementHistoryId.toString().trim()) newErrors.movementHistoryId = "Movement History ID is required";
@@ -5658,17 +5707,17 @@ function AddMovementHistoryModal({
5658
5707
  // src/components/movement-history/MovementHistorymain.jsx
5659
5708
  import { jsx as jsx40, jsxs as jsxs39 } from "react/jsx-runtime";
5660
5709
  function MovementHistorymain() {
5661
- const [refreshkey, setRefreshKey] = useState26(0);
5710
+ const [refreshkey, setRefreshKey] = useState28(0);
5662
5711
  const handleRefresh = () => {
5663
5712
  console.log("Table data refreshed!");
5664
5713
  setRefreshKey((prev) => prev + 1);
5665
5714
  };
5666
5715
  const tableRef = useRef9(null);
5667
- const [modalOpen, setModalOpen] = useState26(false);
5668
- const [pageSize, setPageSize] = useState26(10);
5669
- const [searchQuery, setSearchQuery] = useState26("");
5670
- const [currentPage, setCurrentPage] = useState26(1);
5671
- const [totalEntries, setTotalEntries] = useState26(0);
5716
+ const [modalOpen, setModalOpen] = useState28(false);
5717
+ const [pageSize, setPageSize] = useState28(10);
5718
+ const [searchQuery, setSearchQuery] = useState28("");
5719
+ const [currentPage, setCurrentPage] = useState28(1);
5720
+ const [totalEntries, setTotalEntries] = useState28(0);
5672
5721
  const handlePageSizeChange = (e) => {
5673
5722
  setPageSize(Number(e.target.value));
5674
5723
  setCurrentPage(1);
@@ -5711,7 +5760,7 @@ function MovementHistorymain() {
5711
5760
  }
5712
5761
 
5713
5762
  // src/components/task-permission/TaskPermissionMain.jsx
5714
- import React44, { useState as useState29, useRef as useRef10 } from "react";
5763
+ import React44, { useState as useState31, useRef as useRef10 } from "react";
5715
5764
 
5716
5765
  // src/components/task-permission/SearchBar.js
5717
5766
  import React41 from "react";
@@ -5742,7 +5791,7 @@ function SearchBar6({
5742
5791
  }
5743
5792
 
5744
5793
  // src/components/task-permission/Table.js
5745
- import React42, { useState as useState27, useEffect as useEffect13 } from "react";
5794
+ import React42, { useState as useState29, useEffect as useEffect16 } from "react";
5746
5795
  import { jsx as jsx42, jsxs as jsxs41 } from "react/jsx-runtime";
5747
5796
  function Table({
5748
5797
  pageSize,
@@ -5927,12 +5976,12 @@ function Table({
5927
5976
  permissionType: "Write",
5928
5977
  isStatusEnabled: true
5929
5978
  }];
5930
- const [data, setData] = useState27(initialData);
5931
- const [sortOrder, setSortOrder] = useState27("asc");
5932
- const [sortKey, setSortKey] = useState27("taskId");
5933
- const [selectedItem, setSelectedItem] = useState27(null);
5934
- const [isEditModalOpen, setIsEditModalOpen] = useState27(false);
5935
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState27(false);
5979
+ const [data, setData] = useState29(initialData);
5980
+ const [sortOrder, setSortOrder] = useState29("asc");
5981
+ const [sortKey, setSortKey] = useState29("taskId");
5982
+ const [selectedItem, setSelectedItem] = useState29(null);
5983
+ const [isEditModalOpen, setIsEditModalOpen] = useState29(false);
5984
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState29(false);
5936
5985
  const handleEdit = (item) => {
5937
5986
  setSelectedItem(item);
5938
5987
  setIsEditModalOpen(true);
@@ -5989,7 +6038,7 @@ function Table({
5989
6038
  }
5990
6039
  return item.taskId && item.taskId.toString().toLowerCase().includes(query) || item.role && item.role.toLowerCase().includes(query) || item.taskName && item.taskName.toLowerCase().includes(query) || item.permissionType && item.permissionType.toLowerCase().includes(query);
5991
6040
  });
5992
- useEffect13(() => {
6041
+ useEffect16(() => {
5993
6042
  if (setTotalEntries) setTotalEntries(filteredData.length);
5994
6043
  }, [filteredData.length, setTotalEntries]);
5995
6044
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6112,7 +6161,7 @@ function Table({
6112
6161
  }
6113
6162
 
6114
6163
  // src/components/task-permission/Popup.js
6115
- import React43, { useState as useState28 } from "react";
6164
+ import React43, { useState as useState30 } from "react";
6116
6165
  import { jsx as jsx43, jsxs as jsxs42 } from "react/jsx-runtime";
6117
6166
  function Popup({
6118
6167
  isOpen,
@@ -6120,13 +6169,13 @@ function Popup({
6120
6169
  onSave
6121
6170
  }) {
6122
6171
  if (!isOpen) return null;
6123
- const [stepName, setStepName] = useState28("");
6124
- const [stepCode, setStepCode] = useState28("");
6125
- const [workflow, setWorkflow] = useState28("");
6126
- const [canView, setCanView] = useState28(false);
6127
- const [canEdit, setCanEdit] = useState28(false);
6128
- const [canApprove, setCanApprove] = useState28(false);
6129
- const [canReject, setCanReject] = useState28(false);
6172
+ const [stepName, setStepName] = useState30("");
6173
+ const [stepCode, setStepCode] = useState30("");
6174
+ const [workflow, setWorkflow] = useState30("");
6175
+ const [canView, setCanView] = useState30(false);
6176
+ const [canEdit, setCanEdit] = useState30(false);
6177
+ const [canApprove, setCanApprove] = useState30(false);
6178
+ const [canReject, setCanReject] = useState30(false);
6130
6179
  const handleSubmit = (e) => {
6131
6180
  e.preventDefault();
6132
6181
  if (!stepName || !stepCode || !workflow) {
@@ -6243,17 +6292,17 @@ function Popup({
6243
6292
  // src/components/task-permission/TaskPermissionMain.jsx
6244
6293
  import { jsx as jsx44, jsxs as jsxs43 } from "react/jsx-runtime";
6245
6294
  function TaskPermissionMain() {
6246
- const [refreshkey, setRefreshKey] = useState29(0);
6295
+ const [refreshkey, setRefreshKey] = useState31(0);
6247
6296
  const handleRefresh = () => {
6248
6297
  console.log("Table data refreshed!");
6249
6298
  setRefreshKey((prev) => prev + 1);
6250
6299
  };
6251
6300
  const tableRef = useRef10(null);
6252
- const [showModal, setShowModal] = useState29(false);
6253
- const [pageSize, setPageSize] = useState29(10);
6254
- const [searchQuery, setSearchQuery] = useState29("");
6255
- const [currentPage, setCurrentPage] = useState29(1);
6256
- const [totalEntries, setTotalEntries] = useState29(0);
6301
+ const [showModal, setShowModal] = useState31(false);
6302
+ const [pageSize, setPageSize] = useState31(10);
6303
+ const [searchQuery, setSearchQuery] = useState31("");
6304
+ const [currentPage, setCurrentPage] = useState31(1);
6305
+ const [totalEntries, setTotalEntries] = useState31(0);
6257
6306
  const handlePageSizeChange = (e) => {
6258
6307
  setPageSize(Number(e.target.value));
6259
6308
  setCurrentPage(1);
@@ -6295,7 +6344,7 @@ function TaskPermissionMain() {
6295
6344
  }
6296
6345
 
6297
6346
  // src/components/Workflow-Setting/WorkflowSettingMain.jsx
6298
- import React48, { useState as useState32, useRef as useRef11 } from "react";
6347
+ import React48, { useState as useState34, useRef as useRef11 } from "react";
6299
6348
 
6300
6349
  // src/components/Workflow-Setting/SearchBar.js
6301
6350
  import React45 from "react";
@@ -6326,7 +6375,7 @@ function SearchBar7({
6326
6375
  }
6327
6376
 
6328
6377
  // src/components/Workflow-Setting/Table.js
6329
- import React46, { useState as useState30, useEffect as useEffect14 } from "react";
6378
+ import React46, { useState as useState32, useEffect as useEffect17 } from "react";
6330
6379
  import { jsx as jsx46, jsxs as jsxs45 } from "react/jsx-runtime";
6331
6380
  function Table2({
6332
6381
  pageSize,
@@ -6511,12 +6560,12 @@ function Table2({
6511
6560
  SLA: "2 Hours",
6512
6561
  isActive: true
6513
6562
  }];
6514
- const [data, setData] = useState30(initialData);
6515
- const [sortOrder, setSortOrder] = useState30("asc");
6516
- const [sortKey, setSortKey] = useState30("settingId");
6517
- const [selectedItem, setSelectedItem] = useState30(null);
6518
- const [isEditModalOpen, setIsEditModalOpen] = useState30(false);
6519
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState30(false);
6563
+ const [data, setData] = useState32(initialData);
6564
+ const [sortOrder, setSortOrder] = useState32("asc");
6565
+ const [sortKey, setSortKey] = useState32("settingId");
6566
+ const [selectedItem, setSelectedItem] = useState32(null);
6567
+ const [isEditModalOpen, setIsEditModalOpen] = useState32(false);
6568
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState32(false);
6520
6569
  const handleEdit = (item) => {
6521
6570
  setSelectedItem(item);
6522
6571
  setIsEditModalOpen(true);
@@ -6573,7 +6622,7 @@ function Table2({
6573
6622
  }
6574
6623
  return item.settingId && item.settingId.toString().toLowerCase().includes(query) || item.moduleName && item.moduleName.toLowerCase().includes(query) || item.executionOrder && item.executionOrder.toString().toLowerCase().includes(query) || item.SLA && item.SLA.toLowerCase().includes(query);
6575
6624
  });
6576
- useEffect14(() => {
6625
+ useEffect17(() => {
6577
6626
  if (setTotalEntries) setTotalEntries(filteredData.length);
6578
6627
  }, [filteredData.length, setTotalEntries]);
6579
6628
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6706,7 +6755,7 @@ function Table2({
6706
6755
  }
6707
6756
 
6708
6757
  // src/components/Workflow-Setting/Popup.js
6709
- import React47, { useState as useState31 } from "react";
6758
+ import React47, { useState as useState33 } from "react";
6710
6759
  import { jsx as jsx47, jsxs as jsxs46 } from "react/jsx-runtime";
6711
6760
  function Popup2({
6712
6761
  isOpen,
@@ -6714,8 +6763,8 @@ function Popup2({
6714
6763
  onSave
6715
6764
  }) {
6716
6765
  if (!isOpen) return null;
6717
- const [settingKey, setSettingKey] = useState31("");
6718
- const [settingValue, setSettingValue] = useState31("");
6766
+ const [settingKey, setSettingKey] = useState33("");
6767
+ const [settingValue, setSettingValue] = useState33("");
6719
6768
  const handleSubmit = (e) => {
6720
6769
  e.preventDefault();
6721
6770
  if (!settingKey || !settingValue) {
@@ -6766,17 +6815,17 @@ function Popup2({
6766
6815
  // src/components/Workflow-Setting/WorkflowSettingMain.jsx
6767
6816
  import { jsx as jsx48, jsxs as jsxs47 } from "react/jsx-runtime";
6768
6817
  function WorkflowSettingMain() {
6769
- const [refreshkey, setRefreshKey] = useState32(0);
6818
+ const [refreshkey, setRefreshKey] = useState34(0);
6770
6819
  const handleRefresh = () => {
6771
6820
  console.log("Table data refreshed!");
6772
6821
  setRefreshKey((prev) => prev + 1);
6773
6822
  };
6774
6823
  const tableRef = useRef11(null);
6775
- const [showModal, setShowModal] = useState32(false);
6776
- const [pageSize, setPageSize] = useState32(10);
6777
- const [searchQuery, setSearchQuery] = useState32("");
6778
- const [currentPage, setCurrentPage] = useState32(1);
6779
- const [totalEntries, setTotalEntries] = useState32(0);
6824
+ const [showModal, setShowModal] = useState34(false);
6825
+ const [pageSize, setPageSize] = useState34(10);
6826
+ const [searchQuery, setSearchQuery] = useState34("");
6827
+ const [currentPage, setCurrentPage] = useState34(1);
6828
+ const [totalEntries, setTotalEntries] = useState34(0);
6780
6829
  const handlePageSizeChange = (e) => {
6781
6830
  setPageSize(Number(e.target.value));
6782
6831
  setCurrentPage(1);
@@ -6818,7 +6867,7 @@ function WorkflowSettingMain() {
6818
6867
  }
6819
6868
 
6820
6869
  // src/components/notification/NotificationMain.jsx
6821
- import React52, { useState as useState35, useRef as useRef12 } from "react";
6870
+ import React52, { useState as useState37, useRef as useRef12 } from "react";
6822
6871
 
6823
6872
  // src/components/notification/SearchBar.js
6824
6873
  import React49 from "react";
@@ -6849,7 +6898,7 @@ function SearchBar8({
6849
6898
  }
6850
6899
 
6851
6900
  // src/components/notification/Table.js
6852
- import React50, { useState as useState33, useEffect as useEffect15 } from "react";
6901
+ import React50, { useState as useState35, useEffect as useEffect18 } from "react";
6853
6902
  import { jsx as jsx50, jsxs as jsxs49 } from "react/jsx-runtime";
6854
6903
  function Table3({
6855
6904
  pageSize,
@@ -7034,12 +7083,12 @@ function Table3({
7034
7083
  recipientGroup: "Risk Assessment",
7035
7084
  isMuted: false
7036
7085
  }];
7037
- const [data, setData] = useState33(initialData);
7038
- const [sortOrder, setSortOrder] = useState33("asc");
7039
- const [sortKey, setSortKey] = useState33("notificationId");
7040
- const [selectedItem, setSelectedItem] = useState33(null);
7041
- const [isEditModalOpen, setIsEditModalOpen] = useState33(false);
7042
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState33(false);
7086
+ const [data, setData] = useState35(initialData);
7087
+ const [sortOrder, setSortOrder] = useState35("asc");
7088
+ const [sortKey, setSortKey] = useState35("notificationId");
7089
+ const [selectedItem, setSelectedItem] = useState35(null);
7090
+ const [isEditModalOpen, setIsEditModalOpen] = useState35(false);
7091
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState35(false);
7043
7092
  const handleEdit = (item) => {
7044
7093
  setSelectedItem(item);
7045
7094
  setIsEditModalOpen(true);
@@ -7096,7 +7145,7 @@ function Table3({
7096
7145
  }
7097
7146
  return item.notificationId && item.notificationId.toString().toLowerCase().includes(query) || item.eventTrigger && item.eventTrigger.toLowerCase().includes(query) || item.channelType && item.channelType.toLowerCase().includes(query) || item.recipientGroup && item.recipientGroup.toLowerCase().includes(query);
7098
7147
  });
7099
- useEffect15(() => {
7148
+ useEffect18(() => {
7100
7149
  if (setTotalEntries) setTotalEntries(filteredData.length);
7101
7150
  }, [filteredData.length, setTotalEntries]);
7102
7151
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -7224,7 +7273,7 @@ function Table3({
7224
7273
  }
7225
7274
 
7226
7275
  // src/components/notification/Popup.js
7227
- import React51, { useState as useState34 } from "react";
7276
+ import React51, { useState as useState36 } from "react";
7228
7277
  import { jsx as jsx51, jsxs as jsxs50 } from "react/jsx-runtime";
7229
7278
  function Popup3({
7230
7279
  isOpen,
@@ -7232,10 +7281,10 @@ function Popup3({
7232
7281
  onSave
7233
7282
  }) {
7234
7283
  if (!isOpen) return null;
7235
- const [fileInstanceId, setFileInstanceId] = useState34("");
7236
- const [userId, setUserId] = useState34("");
7237
- const [type, setType] = useState34("");
7238
- const [message, setMessage] = useState34("");
7284
+ const [fileInstanceId, setFileInstanceId] = useState36("");
7285
+ const [userId, setUserId] = useState36("");
7286
+ const [type, setType] = useState36("");
7287
+ const [message, setMessage] = useState36("");
7239
7288
  const handleSubmit = (e) => {
7240
7289
  e.preventDefault();
7241
7290
  if (!fileInstanceId || !userId || !type || !message) {
@@ -7306,17 +7355,17 @@ function Popup3({
7306
7355
  // src/components/notification/NotificationMain.jsx
7307
7356
  import { jsx as jsx52, jsxs as jsxs51 } from "react/jsx-runtime";
7308
7357
  function NotificationMain() {
7309
- const [refreshkey, setRefreshKey] = useState35(0);
7358
+ const [refreshkey, setRefreshKey] = useState37(0);
7310
7359
  const handleRefresh = () => {
7311
7360
  console.log("Table data refreshed!");
7312
7361
  setRefreshKey((prev) => prev + 1);
7313
7362
  };
7314
7363
  const tableRef = useRef12(null);
7315
- const [showModal, setShowModal] = useState35(false);
7316
- const [pageSize, setPageSize] = useState35(10);
7317
- const [searchQuery, setSearchQuery] = useState35("");
7318
- const [currentPage, setCurrentPage] = useState35(1);
7319
- const [totalEntries, setTotalEntries] = useState35(0);
7364
+ const [showModal, setShowModal] = useState37(false);
7365
+ const [pageSize, setPageSize] = useState37(10);
7366
+ const [searchQuery, setSearchQuery] = useState37("");
7367
+ const [currentPage, setCurrentPage] = useState37(1);
7368
+ const [totalEntries, setTotalEntries] = useState37(0);
7320
7369
  const handlePageSizeChange = (e) => {
7321
7370
  setPageSize(Number(e.target.value));
7322
7371
  setCurrentPage(1);
@@ -7355,7 +7404,7 @@ function NotificationMain() {
7355
7404
  }
7356
7405
 
7357
7406
  // src/components/task-instance/task_instance_main.jsx
7358
- import React58, { useState as useState38, useRef as useRef13 } from "react";
7407
+ import React58, { useState as useState40, useRef as useRef13 } from "react";
7359
7408
 
7360
7409
  // src/components/task-instance/searchbartaskinstance.jsx
7361
7410
  import React53 from "react";
@@ -7382,10 +7431,10 @@ function TaskInstanceSearchBar({
7382
7431
  }
7383
7432
 
7384
7433
  // src/components/task-instance/taskinstancetable.jsx
7385
- import React56, { useState as useState37, useEffect as useEffect17 } from "react";
7434
+ import React56, { useState as useState39, useEffect as useEffect20 } from "react";
7386
7435
 
7387
7436
  // src/components/task-instance/edit-instance.jsx
7388
- import React54, { useEffect as useEffect16, useState as useState36 } from "react";
7437
+ import React54, { useEffect as useEffect19, useState as useState38 } from "react";
7389
7438
  import { jsx as jsx54, jsxs as jsxs53 } from "react/jsx-runtime";
7390
7439
  function EditTaskInstanceModal({
7391
7440
  isOpen,
@@ -7393,7 +7442,7 @@ function EditTaskInstanceModal({
7393
7442
  selectedTask,
7394
7443
  onSave
7395
7444
  }) {
7396
- const [formData, setFormData] = useState36({
7445
+ const [formData, setFormData] = useState38({
7397
7446
  assignedUserId: "",
7398
7447
  status: "",
7399
7448
  dueDate: "",
@@ -7401,7 +7450,7 @@ function EditTaskInstanceModal({
7401
7450
  escalatedOn: "",
7402
7451
  slaStatus: ""
7403
7452
  });
7404
- useEffect16(() => {
7453
+ useEffect19(() => {
7405
7454
  if (selectedTask) {
7406
7455
  setFormData({
7407
7456
  assignedUserId: selectedTask.assignedUserId || selectedTask.assigned_user_id || "",
@@ -7904,9 +7953,9 @@ function TaskInstanceTable({
7904
7953
  reminderSentOn: "2026-08-06",
7905
7954
  escalatedOn: ""
7906
7955
  }];
7907
- const [data, setData] = useState37(initialData);
7908
- const [sortOrder, setSortOrder] = useState37("asc");
7909
- const [sortKey, setSortKey] = useState37("taskInstanceId");
7956
+ const [data, setData] = useState39(initialData);
7957
+ const [sortOrder, setSortOrder] = useState39("asc");
7958
+ const [sortKey, setSortKey] = useState39("taskInstanceId");
7910
7959
  const handleSort = (columnKey) => {
7911
7960
  const isAsc = sortKey === columnKey && sortOrder === "asc";
7912
7961
  setSortOrder(isAsc ? "desc" : "asc");
@@ -7922,7 +7971,7 @@ function TaskInstanceTable({
7922
7971
  const query = (searchQuery || "").toLowerCase();
7923
7972
  return String(item.taskInstanceId).includes(query) || String(item.fileInstanceId).includes(query) || String(item.workflowStepId).includes(query) || String(item.assignedUserId).includes(query) || item.status.toLowerCase().includes(query);
7924
7973
  });
7925
- useEffect17(() => {
7974
+ useEffect20(() => {
7926
7975
  if (setTotalEntries) setTotalEntries(filteredData.length);
7927
7976
  }, [filteredData.length, setTotalEntries]);
7928
7977
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -7931,9 +7980,9 @@ function TaskInstanceTable({
7931
7980
  const pageNumbers = Array.from({
7932
7981
  length: totalPages
7933
7982
  }, (_, i) => i + 1);
7934
- const [showEditPopup, setShowEditPopup] = useState37(false);
7935
- const [showDeletePopup, setShowDeletePopup] = useState37(false);
7936
- const [selectedItem, setSelectedItem] = useState37(null);
7983
+ const [showEditPopup, setShowEditPopup] = useState39(false);
7984
+ const [showDeletePopup, setShowDeletePopup] = useState39(false);
7985
+ const [selectedItem, setSelectedItem] = useState39(null);
7937
7986
  const openEditPopup = (item) => {
7938
7987
  setSelectedItem(item);
7939
7988
  setShowEditPopup(true);
@@ -8187,17 +8236,17 @@ function AddTaskInstanceModal({
8187
8236
  // src/components/task-instance/task_instance_main.jsx
8188
8237
  import { jsx as jsx58, jsxs as jsxs57 } from "react/jsx-runtime";
8189
8238
  function Task_instance_main() {
8190
- const [refreshkey, setRefreshKey] = useState38(0);
8239
+ const [refreshkey, setRefreshKey] = useState40(0);
8191
8240
  const handleRefresh = () => {
8192
8241
  console.log("Table data refreshed!");
8193
8242
  setRefreshKey((prev) => prev + 1);
8194
8243
  };
8195
- const [modalOpen, setModalOpen] = useState38(false);
8196
- const [pageSize, setPageSize] = useState38(10);
8197
- const [searchQuery, setSearchQuery] = useState38("");
8244
+ const [modalOpen, setModalOpen] = useState40(false);
8245
+ const [pageSize, setPageSize] = useState40(10);
8246
+ const [searchQuery, setSearchQuery] = useState40("");
8198
8247
  const tableRef = useRef13(null);
8199
- const [currentPage, setCurrentPage] = useState38(1);
8200
- const [totalEntries, setTotalEntries] = useState38(0);
8248
+ const [currentPage, setCurrentPage] = useState40(1);
8249
+ const [totalEntries, setTotalEntries] = useState40(0);
8201
8250
  const handlePageSizeChange = (e) => {
8202
8251
  setPageSize(Number(e.target.value));
8203
8252
  setCurrentPage(1);
@@ -8264,7 +8313,7 @@ function Task_instance_main() {
8264
8313
  }
8265
8314
 
8266
8315
  // src/components/comment/comment_main.jsx
8267
- import React62, { useState as useState41, useRef as useRef14 } from "react";
8316
+ import React62, { useState as useState43, useRef as useRef14 } from "react";
8268
8317
 
8269
8318
  // src/components/comment/searchbarcomment.jsx
8270
8319
  import React59 from "react";
@@ -8291,7 +8340,7 @@ function CommentSearchBar({
8291
8340
  }
8292
8341
 
8293
8342
  // src/components/comment/commenttable.jsx
8294
- import React60, { useState as useState39, useEffect as useEffect18 } from "react";
8343
+ import React60, { useState as useState41, useEffect as useEffect21 } from "react";
8295
8344
  import { jsx as jsx60, jsxs as jsxs59 } from "react/jsx-runtime";
8296
8345
  function CommentTable({
8297
8346
  pageSize,
@@ -8501,9 +8550,9 @@ function CommentTable({
8501
8550
  createdOn: "08 Aug 2026",
8502
8551
  status: true
8503
8552
  }];
8504
- const [data, setData] = useState39(initialData);
8505
- const [sortOrder, setSortOrder] = useState39("asc");
8506
- const [sortKey, setSortKey] = useState39("commentId");
8553
+ const [data, setData] = useState41(initialData);
8554
+ const [sortOrder, setSortOrder] = useState41("asc");
8555
+ const [sortKey, setSortKey] = useState41("commentId");
8507
8556
  const handleSort = (columnKey) => {
8508
8557
  const isAsc = sortKey === columnKey && sortOrder === "asc";
8509
8558
  setSortOrder(isAsc ? "desc" : "asc");
@@ -8519,7 +8568,7 @@ function CommentTable({
8519
8568
  const query = (searchQuery || "").toLowerCase();
8520
8569
  return String(item.commentId).toLowerCase().includes(query) || String(item.taskInstanceId).toLowerCase().includes(query) || item.comment.toLowerCase().includes(query) || String(item.commentedBy).toLowerCase().includes(query);
8521
8570
  });
8522
- useEffect18(() => {
8571
+ useEffect21(() => {
8523
8572
  if (setTotalEntries) setTotalEntries(filteredData.length);
8524
8573
  }, [filteredData.length, setTotalEntries]);
8525
8574
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -8575,15 +8624,15 @@ function CommentTable({
8575
8624
  }
8576
8625
 
8577
8626
  // src/components/comment/addcomment.jsx
8578
- import React61, { useState as useState40 } from "react";
8627
+ import React61, { useState as useState42 } from "react";
8579
8628
  import { jsx as jsx61, jsxs as jsxs60 } from "react/jsx-runtime";
8580
8629
  function AddCommentModal({
8581
8630
  isOpen,
8582
8631
  onClose
8583
8632
  }) {
8584
- const [allowEdit, setAllowEdit] = useState40(true);
8585
- const [pinComment, setPinComment] = useState40(true);
8586
- const [sendNotification, setSendNotification] = useState40(false);
8633
+ const [allowEdit, setAllowEdit] = useState42(true);
8634
+ const [pinComment, setPinComment] = useState42(true);
8635
+ const [sendNotification, setSendNotification] = useState42(false);
8587
8636
  if (!isOpen) return null;
8588
8637
  return /* @__PURE__ */ jsxs60("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
8589
8638
  /* @__PURE__ */ jsx61("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
@@ -8780,11 +8829,11 @@ function AddCommentModal({
8780
8829
  // src/components/comment/comment_main.jsx
8781
8830
  import { jsx as jsx62, jsxs as jsxs61 } from "react/jsx-runtime";
8782
8831
  function Comment_main() {
8783
- const [modalOpen, setModalOpen] = useState41(false);
8784
- const [pageSize, setPageSize] = useState41(10);
8785
- const [searchQuery, setSearchQuery] = useState41("");
8786
- const [currentPage, setCurrentPage] = useState41(1);
8787
- const [totalEntries, setTotalEntries] = useState41(0);
8832
+ const [modalOpen, setModalOpen] = useState43(false);
8833
+ const [pageSize, setPageSize] = useState43(10);
8834
+ const [searchQuery, setSearchQuery] = useState43("");
8835
+ const [currentPage, setCurrentPage] = useState43(1);
8836
+ const [totalEntries, setTotalEntries] = useState43(0);
8788
8837
  const tableRef = useRef14(null);
8789
8838
  const handlePageSizeChange = (e) => {
8790
8839
  setPageSize(Number(e.target.value));
@@ -8854,8 +8903,8 @@ function Comment_main() {
8854
8903
  }
8855
8904
 
8856
8905
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
8857
- import React68, { useState as useState44, useRef as useRef15, useEffect as useEffect21 } from "react";
8858
- import Swal4 from "sweetalert2";
8906
+ import React68, { useState as useState47, useRef as useRef15, useEffect as useEffect24 } from "react";
8907
+ import Swal7 from "sweetalert2";
8859
8908
 
8860
8909
  // src/components/hierarchy-node/SearchBar.jsx
8861
8910
  import React63 from "react";
@@ -8894,18 +8943,18 @@ function SearchBar9({ searchQuery, setSearchQuery }) {
8894
8943
  }
8895
8944
 
8896
8945
  // src/components/hierarchy-node/HierarchyTable.jsx
8897
- import React66, { useState as useState43, useEffect as useEffect20 } from "react";
8946
+ import React66, { useState as useState45, useEffect as useEffect23 } from "react";
8898
8947
 
8899
8948
  // src/components/hierarchy-node/AddEditModal.jsx
8900
- import React64, { useEffect as useEffect19, useState as useState42 } from "react";
8949
+ import React64, { useEffect as useEffect22, useState as useState44 } from "react";
8901
8950
  import { jsx as jsx64, jsxs as jsxs63 } from "react/jsx-runtime";
8902
- function AddEditModal2({
8951
+ function AddEditModal({
8903
8952
  isOpen,
8904
8953
  onClose,
8905
8954
  onSave,
8906
8955
  editData
8907
8956
  }) {
8908
- const [formData, setFormData] = useState42({
8957
+ const [formData, setFormData] = useState44({
8909
8958
  hierarchyNodeId: "",
8910
8959
  parentHierarchyNodeId: "",
8911
8960
  hierarchyLevel: "",
@@ -8915,7 +8964,7 @@ function AddEditModal2({
8915
8964
  externalEntityId: "",
8916
8965
  isActive: true
8917
8966
  });
8918
- useEffect19(() => {
8967
+ useEffect22(() => {
8919
8968
  if (editData) {
8920
8969
  setFormData(editData);
8921
8970
  }
@@ -8927,9 +8976,19 @@ function AddEditModal2({
8927
8976
  [name]: type === "checkbox" ? checked : value
8928
8977
  }));
8929
8978
  };
8930
- const handleSave = () => {
8931
- onSave(formData);
8932
- onClose();
8979
+ const handleSave = async () => {
8980
+ const success = await (onSave == null ? void 0 : onSave({
8981
+ hierarchyNodeId: Number(formData.hierarchyNodeId),
8982
+ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0),
8983
+ hierarchyLevel: Number(formData.hierarchyLevel || 0),
8984
+ nodeType: formData.nodeType,
8985
+ nodeName: formData.nodeName,
8986
+ externalEntityType: formData.externalEntityType,
8987
+ externalEntityId: Number(formData.externalEntityId || 0),
8988
+ isActive: Boolean(formData.isActive),
8989
+ updatedBy: formData.updatedBy || formData.createdBy || "System"
8990
+ }));
8991
+ if (success) onClose();
8933
8992
  };
8934
8993
  return /* @__PURE__ */ jsx64("div", { className: "fc:fixed fc:inset-0 fc:bg-black/40 fc:flex fc:items-center fc:justify-center fc:z-50", children: /* @__PURE__ */ jsxs63("div", { className: "fc:bg-white fc:w-[650px] fc:rounded-2xl fc:shadow-xl fc:p-6", children: [
8935
8994
  /* @__PURE__ */ jsxs63("div", { className: "fc:flex fc:justify-between fc:items-center fc:mb-6", children: [
@@ -9121,120 +9180,31 @@ import { jsx as jsx66, jsxs as jsxs65 } from "react/jsx-runtime";
9121
9180
  function HierarchyTable({
9122
9181
  apiData,
9123
9182
  pageSize,
9124
- searchQuery
9183
+ searchQuery,
9184
+ onUpdate,
9185
+ onDelete
9125
9186
  }) {
9126
- const hierarchyData = [{
9127
- hierarchyNodeId: 1,
9128
- parentHierarchyNodeId: 0,
9129
- hierarchyLevel: 1,
9130
- nodeType: "Department",
9131
- nodeName: "Head Office",
9132
- externalEntityType: "Organization",
9133
- externalEntityId: 1001,
9134
- isActive: true
9135
- }, {
9136
- hierarchyNodeId: 2,
9137
- parentHierarchyNodeId: 1,
9138
- hierarchyLevel: 2,
9139
- nodeType: "District",
9140
- nodeName: "Ludhiana",
9141
- externalEntityType: "District",
9142
- externalEntityId: 1002,
9143
- isActive: true
9144
- }, {
9145
- hierarchyNodeId: 3,
9146
- parentHierarchyNodeId: 2,
9147
- hierarchyLevel: 3,
9148
- nodeType: "Block",
9149
- nodeName: "Samrala",
9150
- externalEntityType: "Block",
9151
- externalEntityId: 1003,
9152
- isActive: false
9153
- }, {
9154
- hierarchyNodeId: 4,
9155
- parentHierarchyNodeId: 2,
9156
- hierarchyLevel: 3,
9157
- nodeType: "Block",
9158
- nodeName: "Khanna",
9159
- externalEntityType: "Block",
9160
- externalEntityId: 1004,
9161
- isActive: true
9162
- }, {
9163
- hierarchyNodeId: 5,
9164
- parentHierarchyNodeId: 4,
9165
- hierarchyLevel: 4,
9166
- nodeType: "Panchayat",
9167
- nodeName: "Village A",
9168
- externalEntityType: "Village",
9169
- externalEntityId: 1005,
9170
- isActive: true
9171
- }, {
9172
- hierarchyNodeId: 6,
9173
- parentHierarchyNodeId: 4,
9174
- hierarchyLevel: 4,
9175
- nodeType: "Panchayat",
9176
- nodeName: "Village B",
9177
- externalEntityType: "Village",
9178
- externalEntityId: 1006,
9179
- isActive: false
9180
- }, {
9181
- hierarchyNodeId: 7,
9182
- parentHierarchyNodeId: 1,
9183
- hierarchyLevel: 2,
9184
- nodeType: "Department",
9185
- nodeName: "Finance",
9186
- externalEntityType: "Department",
9187
- externalEntityId: 1007,
9188
- isActive: true
9189
- }, {
9190
- hierarchyNodeId: 8,
9191
- parentHierarchyNodeId: 1,
9192
- hierarchyLevel: 2,
9193
- nodeType: "Department",
9194
- nodeName: "HR",
9195
- externalEntityType: "Department",
9196
- externalEntityId: 1008,
9197
- isActive: true
9198
- }, {
9199
- hierarchyNodeId: 9,
9200
- parentHierarchyNodeId: 8,
9201
- hierarchyLevel: 3,
9202
- nodeType: "Branch",
9203
- nodeName: "Recruitment",
9204
- externalEntityType: "Branch",
9205
- externalEntityId: 1009,
9206
- isActive: false
9207
- }, {
9208
- hierarchyNodeId: 10,
9209
- parentHierarchyNodeId: 8,
9210
- hierarchyLevel: 3,
9211
- nodeType: "Branch",
9212
- nodeName: "Training",
9213
- externalEntityType: "Branch",
9214
- externalEntityId: 1010,
9215
- isActive: true
9216
- }];
9217
- const [currentPage, setCurrentPage] = useState43(1);
9187
+ const [currentPage, setCurrentPage] = useState45(1);
9218
9188
  ;
9219
- const [data, setData] = useState43(apiData || hierarchyData);
9220
- useEffect20(() => {
9221
- if (apiData) setData(apiData);
9189
+ const [data, setData] = useState45(apiData || []);
9190
+ useEffect23(() => {
9191
+ setData(apiData || []);
9222
9192
  }, [apiData]);
9223
9193
  const filteredData = data.filter(
9224
9194
  (item) => (item.nodeName || "").toLowerCase().includes((searchQuery || "").toLowerCase()) || (item.nodeType || "").toLowerCase().includes((searchQuery || "").toLowerCase()) || String(item.hierarchyNodeId).includes(searchQuery || "")
9225
9195
  );
9226
- const [sortColumn, setSortColumn] = useState43("");
9227
- const [sortDirection, setSortDirection] = useState43("asc");
9196
+ const [sortColumn, setSortColumn] = useState45("");
9197
+ const [sortDirection, setSortDirection] = useState45("asc");
9228
9198
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
9229
9199
  const startIndex = (currentPage - 1) * pageSize;
9230
9200
  const visibleData = filteredData.slice(
9231
9201
  startIndex,
9232
9202
  startIndex + pageSize
9233
9203
  );
9234
- const [editOpen, setEditOpen] = useState43(false);
9235
- const [deleteOpen, setDeleteOpen] = useState43(false);
9236
- const [selectedNode, setSelectedNode] = useState43(null);
9237
- useEffect20(() => {
9204
+ const [editOpen, setEditOpen] = useState45(false);
9205
+ const [deleteOpen, setDeleteOpen] = useState45(false);
9206
+ const [selectedNode, setSelectedNode] = useState45(null);
9207
+ useEffect23(() => {
9238
9208
  setCurrentPage(1);
9239
9209
  }, [searchQuery, pageSize]);
9240
9210
  const handleSort = (column) => {
@@ -9267,21 +9237,11 @@ function HierarchyTable({
9267
9237
  setSelectedNode(item);
9268
9238
  setDeleteOpen(true);
9269
9239
  };
9270
- const handleUpdate = (updatedNode) => {
9271
- setData(
9272
- (prev) => prev.map(
9273
- (item) => item.hierarchyNodeId === updatedNode.hierarchyNodeId ? updatedNode : item
9274
- )
9275
- );
9276
- setEditOpen(false);
9240
+ const handleUpdate = async (updatedNode) => {
9241
+ return onUpdate == null ? void 0 : onUpdate(updatedNode);
9277
9242
  };
9278
- const confirmDelete = () => {
9279
- setData(
9280
- (prev) => prev.filter(
9281
- (item) => item.hierarchyNodeId !== selectedNode.hierarchyNodeId
9282
- )
9283
- );
9284
- setDeleteOpen(false);
9243
+ const confirmDelete = async () => {
9244
+ if (await (onDelete == null ? void 0 : onDelete(selectedNode))) setDeleteOpen(false);
9285
9245
  };
9286
9246
  return /* @__PURE__ */ jsxs65("div", { className: "fc:h-full fc:flex fc:flex-col", children: [
9287
9247
  /* @__PURE__ */ jsx66("div", { className: "fc:rounded-2xl fc:border fc:border-slate-200 fc:overflow-hidden fc:flex fc:flex-col fc:flex-1", children: /* @__PURE__ */ jsx66("div", { className: "fc:flex-1 fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ jsxs65("table", { className: "fc:min-w-full fc:bg-white", children: [
@@ -9385,7 +9345,7 @@ function HierarchyTable({
9385
9345
  )
9386
9346
  ] }),
9387
9347
  /* @__PURE__ */ jsx66(
9388
- AddEditModal2,
9348
+ AddEditModal,
9389
9349
  {
9390
9350
  isOpen: editOpen,
9391
9351
  editData: selectedNode,
@@ -9407,13 +9367,23 @@ function HierarchyTable({
9407
9367
  }
9408
9368
 
9409
9369
  // src/components/hierarchy-node/AddHierarchyNodeModal.jsx
9410
- import React67 from "react";
9370
+ import React67, { useState as useState46 } from "react";
9411
9371
  import { jsx as jsx67, jsxs as jsxs66 } from "react/jsx-runtime";
9412
9372
  function AddHierarchyNodeModal({
9413
9373
  isOpen,
9414
9374
  onClose,
9415
9375
  onSave
9416
9376
  }) {
9377
+ const [formData, setFormData] = useState46({ hierarchyNodeId: "", parentHierarchyNodeId: "", hierarchyLevel: "", nodeType: "", nodeName: "", externalEntityType: "", externalEntityId: "", isActive: "true", remarks: "" });
9378
+ const [isSubmitting, setIsSubmitting] = useState46(false);
9379
+ const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [event.target.name]: event.target.value }));
9380
+ const handleSave = async () => {
9381
+ if (!onSave) return;
9382
+ setIsSubmitting(true);
9383
+ const success = await onSave({ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0), hierarchyLevel: Number(formData.hierarchyLevel || 0), nodeType: formData.nodeType, nodeName: formData.nodeName, externalEntityType: formData.externalEntityType, externalEntityId: Number(formData.externalEntityId || 0), createdBy: "System" });
9384
+ setIsSubmitting(false);
9385
+ if (success) onClose();
9386
+ };
9417
9387
  if (!isOpen) return null;
9418
9388
  return /* @__PURE__ */ jsxs66("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
9419
9389
  /* @__PURE__ */ jsx67("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
@@ -9434,21 +9404,21 @@ function AddHierarchyNodeModal({
9434
9404
  /* @__PURE__ */ jsxs66("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
9435
9405
  /* @__PURE__ */ jsxs66("div", { children: [
9436
9406
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Hierarchy Node Id" }),
9437
- /* @__PURE__ */ jsx67("input", { type: "number", placeholder: "Enter Hierarchy Node Id", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9407
+ /* @__PURE__ */ jsx67("input", { name: "hierarchyNodeId", value: formData.hierarchyNodeId, onChange: handleChange, type: "number", placeholder: "Enter Hierarchy Node Id", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9438
9408
  ] }),
9439
9409
  /* @__PURE__ */ jsxs66("div", { children: [
9440
9410
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Parent Hierarchy Node Id" }),
9441
- /* @__PURE__ */ jsx67("input", { type: "number", placeholder: "Enter Parent Hierarchy Node Id", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9411
+ /* @__PURE__ */ jsx67("input", { name: "parentHierarchyNodeId", value: formData.parentHierarchyNodeId, onChange: handleChange, type: "number", placeholder: "Enter Parent Hierarchy Node Id", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9442
9412
  ] })
9443
9413
  ] }),
9444
9414
  /* @__PURE__ */ jsxs66("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
9445
9415
  /* @__PURE__ */ jsxs66("div", { children: [
9446
9416
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Hierarchy Level" }),
9447
- /* @__PURE__ */ jsx67("input", { type: "number", placeholder: "Enter Hierarchy Level", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9417
+ /* @__PURE__ */ jsx67("input", { name: "hierarchyLevel", value: formData.hierarchyLevel, onChange: handleChange, type: "number", placeholder: "Enter Hierarchy Level", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9448
9418
  ] }),
9449
9419
  /* @__PURE__ */ jsxs66("div", { children: [
9450
9420
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Node Type" }),
9451
- /* @__PURE__ */ jsxs66("select", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500", children: [
9421
+ /* @__PURE__ */ jsxs66("select", { name: "nodeType", value: formData.nodeType, onChange: handleChange, className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500", children: [
9452
9422
  /* @__PURE__ */ jsx67("option", { value: "", children: "Select Node Type" }),
9453
9423
  /* @__PURE__ */ jsx67("option", { children: "District" }),
9454
9424
  /* @__PURE__ */ jsx67("option", { children: "Block" }),
@@ -9460,12 +9430,12 @@ function AddHierarchyNodeModal({
9460
9430
  ] }),
9461
9431
  /* @__PURE__ */ jsxs66("div", { children: [
9462
9432
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Node Name" }),
9463
- /* @__PURE__ */ jsx67("input", { type: "text", placeholder: "Enter Node Name", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9433
+ /* @__PURE__ */ jsx67("input", { name: "nodeName", value: formData.nodeName, onChange: handleChange, type: "text", placeholder: "Enter Node Name", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9464
9434
  ] }),
9465
9435
  /* @__PURE__ */ jsxs66("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
9466
9436
  /* @__PURE__ */ jsxs66("div", { children: [
9467
9437
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "External Entity Type" }),
9468
- /* @__PURE__ */ jsxs66("select", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500", children: [
9438
+ /* @__PURE__ */ jsxs66("select", { name: "externalEntityType", value: formData.externalEntityType, onChange: handleChange, className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500", children: [
9469
9439
  /* @__PURE__ */ jsx67("option", { value: "", children: "Select Entity Type" }),
9470
9440
  /* @__PURE__ */ jsx67("option", { children: "Department" }),
9471
9441
  /* @__PURE__ */ jsx67("option", { children: "Office" }),
@@ -9475,12 +9445,12 @@ function AddHierarchyNodeModal({
9475
9445
  ] }),
9476
9446
  /* @__PURE__ */ jsxs66("div", { children: [
9477
9447
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "External Entity Id" }),
9478
- /* @__PURE__ */ jsx67("input", { type: "number", placeholder: "Enter External Entity Id", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9448
+ /* @__PURE__ */ jsx67("input", { name: "externalEntityId", value: formData.externalEntityId, onChange: handleChange, type: "number", placeholder: "Enter External Entity Id", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9479
9449
  ] })
9480
9450
  ] }),
9481
9451
  /* @__PURE__ */ jsxs66("div", { children: [
9482
9452
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Is Active" }),
9483
- /* @__PURE__ */ jsxs66("select", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500", children: [
9453
+ /* @__PURE__ */ jsxs66("select", { name: "isActive", value: formData.isActive, onChange: handleChange, className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm fc:bg-white focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500", children: [
9484
9454
  /* @__PURE__ */ jsx67("option", { value: "true", children: "Yes" }),
9485
9455
  /* @__PURE__ */ jsx67("option", { value: "false", children: "No" })
9486
9456
  ] })
@@ -9490,7 +9460,7 @@ function AddHierarchyNodeModal({
9490
9460
  /* @__PURE__ */ jsx67("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-blue-600 fc:font-semibold fc:text-sm fc:border-b fc:border-slate-100 fc:pb-3", children: "\u{1F4DD} Additional Information" }),
9491
9461
  /* @__PURE__ */ jsxs66("div", { children: [
9492
9462
  /* @__PURE__ */ jsx67("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Remarks" }),
9493
- /* @__PURE__ */ jsx67("textarea", { rows: 4, placeholder: "Enter remarks (optional)...", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm fc:resize-none focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9463
+ /* @__PURE__ */ jsx67("textarea", { name: "remarks", value: formData.remarks, onChange: handleChange, rows: 4, placeholder: "Enter remarks (optional)...", className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-3 fc:text-sm fc:resize-none focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500" })
9494
9464
  ] })
9495
9465
  ] })
9496
9466
  ] }),
@@ -9500,9 +9470,10 @@ function AddHierarchyNodeModal({
9500
9470
  "button",
9501
9471
  {
9502
9472
  type: "button",
9503
- onClick: onSave,
9473
+ onClick: handleSave,
9474
+ disabled: isSubmitting,
9504
9475
  className: "fc:px-6 fc:py-2.5 fc:rounded-xl fc:bg-blue-600 hover:fc:bg-blue-700 fc:text-white fc:font-semibold fc:text-sm fc:shadow-md fc:shadow-blue-500/20 fc:transition",
9505
- children: "Save Hierarchy Node"
9476
+ children: isSubmitting ? "Saving..." : "Save Hierarchy Node"
9506
9477
  }
9507
9478
  )
9508
9479
  ] })
@@ -9513,12 +9484,13 @@ function AddHierarchyNodeModal({
9513
9484
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
9514
9485
  import { jsx as jsx68, jsxs as jsxs67 } from "react/jsx-runtime";
9515
9486
  function HierarchyNodeMain() {
9516
- const [modalOpen, setModalOpen] = useState44(false);
9517
- const [pageSize, setPageSize] = useState44(5);
9487
+ const [modalOpen, setModalOpen] = useState47(false);
9488
+ const [pageSize, setPageSize] = useState47(5);
9518
9489
  const tableRef = useRef15(null);
9519
- const [searchQuery, setSearchQuery] = useState44("");
9520
- const [apiData, setApiData] = useState44([]);
9521
- useEffect21(() => {
9490
+ const [searchQuery, setSearchQuery] = useState47("");
9491
+ const [apiData, setApiData] = useState47([]);
9492
+ const [refreshKey, setRefreshKey] = useState47(0);
9493
+ useEffect24(() => {
9522
9494
  (async () => {
9523
9495
  var _a, _b, _c, _d, _e, _f, _g;
9524
9496
  try {
@@ -9528,12 +9500,26 @@ function HierarchyNodeMain() {
9528
9500
  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;
9529
9501
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
9530
9502
  } catch (error) {
9531
- await Swal4.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");
9503
+ await Swal7.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9532
9504
  }
9533
9505
  })();
9534
- }, [modalOpen]);
9506
+ }, [refreshKey]);
9535
9507
  const handleRefresh = () => {
9536
- console.log("Refresh clicked");
9508
+ setRefreshKey((previous) => previous + 1);
9509
+ };
9510
+ const saveNode = async (payload, isEdit = false) => {
9511
+ var _a, _b, _c, _d, _e;
9512
+ try {
9513
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
9514
+ if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
9515
+ await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
9516
+ await Swal7.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
9517
+ handleRefresh();
9518
+ return true;
9519
+ } catch (error) {
9520
+ await Swal7.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
9521
+ return false;
9522
+ }
9537
9523
  };
9538
9524
  return /* @__PURE__ */ jsxs67("div", { className: "fc:h-screen fc:bg-slate-50 fc:p-6 fc:flex fc:flex-col fc:overflow-hidden", children: [
9539
9525
  /* @__PURE__ */ jsxs67("div", { className: "fc:w-full fc:flex fc:flex-col fc:flex-1 fc:space-y-5 fc:overflow-hidden", children: [
@@ -9584,17 +9570,19 @@ function HierarchyNodeMain() {
9584
9570
  {
9585
9571
  apiData,
9586
9572
  pageSize,
9587
- searchQuery
9573
+ searchQuery,
9574
+ onUpdate: (payload) => saveNode(payload, true),
9575
+ onDelete: (node) => saveNode(__spreadProps(__spreadValues({}, node), { hierarchyNodeId: node.hierarchyNodeId, isActive: false, updatedBy: node.updatedBy || node.createdBy || "System" }), true)
9588
9576
  }
9589
9577
  ) })
9590
9578
  ] })
9591
9579
  ] }),
9592
- /* @__PURE__ */ jsx68(AddHierarchyNodeModal, { isOpen: modalOpen, onClose: () => setModalOpen(false) })
9580
+ /* @__PURE__ */ jsx68(AddHierarchyNodeModal, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: (payload) => saveNode(payload) })
9593
9581
  ] });
9594
9582
  }
9595
9583
 
9596
9584
  // src/components/file-pool/FilePoolMain.jsx
9597
- import React72, { useState as useState46, useRef as useRef16 } from "react";
9585
+ import React72, { useState as useState49, useRef as useRef16 } from "react";
9598
9586
 
9599
9587
  // src/components/file-pool/SearchBar.jsx
9600
9588
  import React69 from "react";
@@ -9607,7 +9595,7 @@ function SearchBar10() {
9607
9595
  }
9608
9596
 
9609
9597
  // src/components/file-pool/FilePoolTable.jsx
9610
- import React70, { useState as useState45 } from "react";
9598
+ import React70, { useState as useState48 } from "react";
9611
9599
  import { jsx as jsx70, jsxs as jsxs69 } from "react/jsx-runtime";
9612
9600
  function FilePoolTable({
9613
9601
  pageSize
@@ -9683,10 +9671,10 @@ function FilePoolTable({
9683
9671
  addedOn: "10-07-2026",
9684
9672
  pulledOn: "-"
9685
9673
  }];
9686
- const [currentPage, setCurrentPage] = useState45(1);
9687
- const [data, setData] = useState45(filePoolData);
9688
- const [sortColumn, setSortColumn] = useState45("");
9689
- const [sortDirection, setSortDirection] = useState45("asc");
9674
+ const [currentPage, setCurrentPage] = useState48(1);
9675
+ const [data, setData] = useState48(filePoolData);
9676
+ const [sortColumn, setSortColumn] = useState48("");
9677
+ const [sortDirection, setSortDirection] = useState48("asc");
9690
9678
  const totalPages = Math.ceil(data.length / pageSize) || 1;
9691
9679
  const startIndex = (currentPage - 1) * pageSize;
9692
9680
  const currentData = data.slice(startIndex, startIndex + pageSize);
@@ -9842,8 +9830,8 @@ function AddFilePoolModal({
9842
9830
  // src/components/file-pool/FilePoolMain.jsx
9843
9831
  import { jsx as jsx72, jsxs as jsxs71 } from "react/jsx-runtime";
9844
9832
  function FilePoolMain() {
9845
- const [modalOpen, setModalOpen] = useState46(false);
9846
- const [pageSize, setPageSize] = useState46(5);
9833
+ const [modalOpen, setModalOpen] = useState49(false);
9834
+ const [pageSize, setPageSize] = useState49(5);
9847
9835
  const tableRef = useRef16(null);
9848
9836
  const handleRefresh = () => {
9849
9837
  console.log("Refresh clicked");
@@ -9894,7 +9882,7 @@ function FilePoolMain() {
9894
9882
  }
9895
9883
 
9896
9884
  // src/components/uploaded-document/UploadedDocumentMain.jsx
9897
- import React76, { useState as useState48, useRef as useRef17 } from "react";
9885
+ import React76, { useState as useState51, useRef as useRef17 } from "react";
9898
9886
 
9899
9887
  // src/components/uploaded-document/SearchBar.jsx
9900
9888
  import React73 from "react";
@@ -9907,7 +9895,7 @@ function SearchBar11() {
9907
9895
  }
9908
9896
 
9909
9897
  // src/components/uploaded-document/UploadedDocumentTable.jsx
9910
- import React74, { useState as useState47 } from "react";
9898
+ import React74, { useState as useState50 } from "react";
9911
9899
  import { jsx as jsx74, jsxs as jsxs73 } from "react/jsx-runtime";
9912
9900
  function UploadedDocumentTable({
9913
9901
  pageSize
@@ -9983,10 +9971,10 @@ function UploadedDocumentTable({
9983
9971
  storagePath: "/uploads/certificate.pdf",
9984
9972
  uploadedBy: "Admin"
9985
9973
  }];
9986
- const [data, setData] = useState47(uploadedDocuments);
9987
- const [currentPage, setCurrentPage] = useState47(1);
9988
- const [sortColumn, setSortColumn] = useState47("");
9989
- const [sortDirection, setSortDirection] = useState47("asc");
9974
+ const [data, setData] = useState50(uploadedDocuments);
9975
+ const [currentPage, setCurrentPage] = useState50(1);
9976
+ const [sortColumn, setSortColumn] = useState50("");
9977
+ const [sortDirection, setSortDirection] = useState50("asc");
9990
9978
  const totalPages = Math.ceil(data.length / pageSize) || 1;
9991
9979
  const startIndex = (currentPage - 1) * pageSize;
9992
9980
  const currentData = data.slice(startIndex, startIndex + pageSize);
@@ -10186,8 +10174,8 @@ function AddUploadedDocumentModal({
10186
10174
  // src/components/uploaded-document/UploadedDocumentMain.jsx
10187
10175
  import { jsx as jsx76, jsxs as jsxs75 } from "react/jsx-runtime";
10188
10176
  function UploadedDocumentMain() {
10189
- const [modalOpen, setModalOpen] = useState48(false);
10190
- const [pageSize, setPageSize] = useState48(5);
10177
+ const [modalOpen, setModalOpen] = useState51(false);
10178
+ const [pageSize, setPageSize] = useState51(5);
10191
10179
  const tableRef = useRef17(null);
10192
10180
  const handleRefresh = () => {
10193
10181
  console.log("Refresh clicked");
@@ -10238,14 +10226,14 @@ function UploadedDocumentMain() {
10238
10226
  }
10239
10227
 
10240
10228
  // src/components/BuisnessEntity/BusinessEntitymain.js
10241
- import React78, { useState as useState50, useRef as useRef18 } from "react";
10229
+ import React78, { useState as useState53, useRef as useRef18 } from "react";
10242
10230
  import Link4 from "next/link";
10243
10231
 
10244
10232
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
10245
- import React77, { useState as useState49 } from "react";
10233
+ import React77, { useState as useState52 } from "react";
10246
10234
  import { jsx as jsx77, jsxs as jsxs76 } from "react/jsx-runtime";
10247
10235
  function AddBusinessEntityModal({ onClose }) {
10248
- const [formData, setFormData] = useState49({
10236
+ const [formData, setFormData] = useState52({
10249
10237
  entityType: "",
10250
10238
  entityKey: "",
10251
10239
  displayNumber: "",
@@ -10254,7 +10242,7 @@ function AddBusinessEntityModal({ onClose }) {
10254
10242
  isVisible: true,
10255
10243
  status: "Active"
10256
10244
  });
10257
- const [errors, setErrors] = useState49({});
10245
+ const [errors, setErrors] = useState52({});
10258
10246
  const handleChange = (field, value) => {
10259
10247
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
10260
10248
  [field]: value
@@ -10542,7 +10530,7 @@ function AddBusinessEntityModal({ onClose }) {
10542
10530
  }
10543
10531
 
10544
10532
  // src/components/BuisnessEntity/BusinessEntitymain.js
10545
- import { Fragment as Fragment5, jsx as jsx78, jsxs as jsxs77 } from "react/jsx-runtime";
10533
+ import { Fragment as Fragment6, jsx as jsx78, jsxs as jsxs77 } from "react/jsx-runtime";
10546
10534
  var BusinessEntitys = [{
10547
10535
  BusinessEntityId: 1,
10548
10536
  EntityType: "Application",
@@ -10630,9 +10618,9 @@ function BusinessEntity() {
10630
10618
  console.log("Download clicked");
10631
10619
  };
10632
10620
  const tableRef = useRef18(null);
10633
- const [showModal, setShowModal] = useState50(false);
10634
- const [pageSize, setPageSize] = useState50(5);
10635
- const [sortConfig, setSortConfig] = useState50({
10621
+ const [showModal, setShowModal] = useState53(false);
10622
+ const [pageSize, setPageSize] = useState53(5);
10623
+ const [sortConfig, setSortConfig] = useState53({
10636
10624
  key: "",
10637
10625
  direction: "asc"
10638
10626
  });
@@ -10646,7 +10634,7 @@ function BusinessEntity() {
10646
10634
  direction
10647
10635
  });
10648
10636
  };
10649
- return /* @__PURE__ */ jsx78(Fragment5, { children: /* @__PURE__ */ jsxs77("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: [
10637
+ return /* @__PURE__ */ jsx78(Fragment6, { children: /* @__PURE__ */ jsxs77("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: [
10650
10638
  /* @__PURE__ */ jsx78(CommonHeader, { title: "Business Entity", breadcrumbs: [{
10651
10639
  label: "Dashboard",
10652
10640
  href: "/dashboard"
@@ -10710,14 +10698,14 @@ function BusinessEntity() {
10710
10698
  }
10711
10699
 
10712
10700
  // src/components/FileInstance/FileInstancemain.js
10713
- import React80, { useState as useState52, useRef as useRef19 } from "react";
10701
+ import React80, { useState as useState55, useRef as useRef19 } from "react";
10714
10702
  import Link5 from "next/link";
10715
10703
 
10716
10704
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
10717
- import React79, { useState as useState51 } from "react";
10705
+ import React79, { useState as useState54 } from "react";
10718
10706
  import { jsx as jsx79, jsxs as jsxs78 } from "react/jsx-runtime";
10719
10707
  function AddFileInstanceModal({ onClose }) {
10720
- const [formData, setFormData] = useState51({
10708
+ const [formData, setFormData] = useState54({
10721
10709
  workflow: "",
10722
10710
  businessEntityType: "",
10723
10711
  businessEntity: "",
@@ -10727,7 +10715,7 @@ function AddFileInstanceModal({ onClose }) {
10727
10715
  status: "Pending",
10728
10716
  priority: "High"
10729
10717
  });
10730
- const [errors, setErrors] = useState51({});
10718
+ const [errors, setErrors] = useState54({});
10731
10719
  const validateForm = () => {
10732
10720
  const newErrors = {};
10733
10721
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -10999,7 +10987,7 @@ function AddFileInstanceModal({ onClose }) {
10999
10987
  }
11000
10988
 
11001
10989
  // src/components/FileInstance/FileInstancemain.js
11002
- import { Fragment as Fragment6, jsx as jsx80, jsxs as jsxs79 } from "react/jsx-runtime";
10990
+ import { Fragment as Fragment7, jsx as jsx80, jsxs as jsxs79 } from "react/jsx-runtime";
11003
10991
  var FileInstances = [{
11004
10992
  FileInstanceId: 1,
11005
10993
  workflowId: 1,
@@ -11139,9 +11127,9 @@ function FileInstance() {
11139
11127
  console.log("Download clicked");
11140
11128
  };
11141
11129
  const tableRef = useRef19(null);
11142
- const [showModal, setShowModal] = useState52(false);
11143
- const [pageSize, setPageSize] = useState52(5);
11144
- const [sortConfig, setSortConfig] = useState52({
11130
+ const [showModal, setShowModal] = useState55(false);
11131
+ const [pageSize, setPageSize] = useState55(5);
11132
+ const [sortConfig, setSortConfig] = useState55({
11145
11133
  key: "",
11146
11134
  direction: "asc"
11147
11135
  });
@@ -11155,7 +11143,7 @@ function FileInstance() {
11155
11143
  direction
11156
11144
  });
11157
11145
  };
11158
- return /* @__PURE__ */ jsxs79(Fragment6, { children: [
11146
+ return /* @__PURE__ */ jsxs79(Fragment7, { children: [
11159
11147
  /* @__PURE__ */ jsxs79("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
11160
11148
  /* @__PURE__ */ jsx80(CommonHeader, { title: "File Instance ", breadcrumbs: [{
11161
11149
  label: "Dashboard",
@@ -11249,7 +11237,7 @@ function FileInstance() {
11249
11237
  }
11250
11238
 
11251
11239
  // src/components/assignment-rule/AssignmentRuleMain.jsx
11252
- import React84, { useState as useState55, useRef as useRef20 } from "react";
11240
+ import React84, { useState as useState58, useRef as useRef20 } from "react";
11253
11241
 
11254
11242
  // src/components/assignment-rule/SearchBar.js
11255
11243
  import React81 from "react";
@@ -11272,7 +11260,7 @@ function SearchBar12({
11272
11260
  }
11273
11261
 
11274
11262
  // src/components/assignment-rule/Table.js
11275
- import React82, { useState as useState53, useEffect as useEffect22 } from "react";
11263
+ import React82, { useState as useState56, useEffect as useEffect25 } from "react";
11276
11264
  import { jsx as jsx82, jsxs as jsxs81 } from "react/jsx-runtime";
11277
11265
  function Table4({
11278
11266
  pageSize,
@@ -11380,12 +11368,12 @@ function Table4({
11380
11368
  dynamicFunctionId: "4",
11381
11369
  isPoolEnabled: true
11382
11370
  }];
11383
- const [data, setData] = useState53(initialData);
11384
- const [sortOrder, setSortOrder] = useState53("asc");
11385
- const [sortKey, setSortKey] = useState53("workflowStepId");
11386
- const [selectedItem, setSelectedItem] = useState53(null);
11387
- const [isEditModalOpen, setIsEditModalOpen] = useState53(false);
11388
- const [isDeleteModalOpen, setIsDeleteModalOpen] = useState53(false);
11371
+ const [data, setData] = useState56(initialData);
11372
+ const [sortOrder, setSortOrder] = useState56("asc");
11373
+ const [sortKey, setSortKey] = useState56("workflowStepId");
11374
+ const [selectedItem, setSelectedItem] = useState56(null);
11375
+ const [isEditModalOpen, setIsEditModalOpen] = useState56(false);
11376
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = useState56(false);
11389
11377
  const handleEdit = (item) => {
11390
11378
  setSelectedItem(item);
11391
11379
  setIsEditModalOpen(true);
@@ -11438,7 +11426,7 @@ function Table4({
11438
11426
  const query = searchQuery.toLowerCase().trim();
11439
11427
  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);
11440
11428
  });
11441
- useEffect22(() => {
11429
+ useEffect25(() => {
11442
11430
  if (setTotalEntries) setTotalEntries(filteredData.length);
11443
11431
  }, [filteredData.length, setTotalEntries]);
11444
11432
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -11564,7 +11552,7 @@ function Table4({
11564
11552
  }
11565
11553
 
11566
11554
  // src/components/assignment-rule/Popup.js
11567
- import React83, { useState as useState54 } from "react";
11555
+ import React83, { useState as useState57 } from "react";
11568
11556
  import { jsx as jsx83, jsxs as jsxs82 } from "react/jsx-runtime";
11569
11557
  function Popup4({
11570
11558
  isOpen,
@@ -11572,11 +11560,11 @@ function Popup4({
11572
11560
  onSave
11573
11561
  }) {
11574
11562
  if (!isOpen) return null;
11575
- const [workflowStepId, setWorkflowStepId] = useState54("");
11576
- const [assignmentType, setAssignmentType] = useState54("");
11577
- const [hierarchyNodeType, setHierarchyNodeType] = useState54("");
11578
- const [dynamicFunctionId, setDynamicFunctionId] = useState54("");
11579
- const [isPoolEnabled, setIsPoolEnabled] = useState54(false);
11563
+ const [workflowStepId, setWorkflowStepId] = useState57("");
11564
+ const [assignmentType, setAssignmentType] = useState57("");
11565
+ const [hierarchyNodeType, setHierarchyNodeType] = useState57("");
11566
+ const [dynamicFunctionId, setDynamicFunctionId] = useState57("");
11567
+ const [isPoolEnabled, setIsPoolEnabled] = useState57(false);
11580
11568
  const handleSubmit = (e) => {
11581
11569
  e.preventDefault();
11582
11570
  if (!workflowStepId || !assignmentType || !hierarchyNodeType) {
@@ -11653,17 +11641,17 @@ function Popup4({
11653
11641
  // src/components/assignment-rule/AssignmentRuleMain.jsx
11654
11642
  import { jsx as jsx84, jsxs as jsxs83 } from "react/jsx-runtime";
11655
11643
  function AssignmentRuleMain() {
11656
- const [refreshkey, setRefreshKey] = useState55(0);
11644
+ const [refreshkey, setRefreshKey] = useState58(0);
11657
11645
  const handleRefresh = () => {
11658
11646
  console.log("Table data refreshed!");
11659
11647
  setRefreshKey((prev) => prev + 1);
11660
11648
  };
11661
11649
  const tableRef = useRef20(null);
11662
- const [showModal, setShowModal] = useState55(false);
11663
- const [pageSize, setPageSize] = useState55(10);
11664
- const [searchQuery, setSearchQuery] = useState55("");
11665
- const [currentPage, setCurrentPage] = useState55(1);
11666
- const [totalEntries, setTotalEntries] = useState55(0);
11650
+ const [showModal, setShowModal] = useState58(false);
11651
+ const [pageSize, setPageSize] = useState58(10);
11652
+ const [searchQuery, setSearchQuery] = useState58("");
11653
+ const [currentPage, setCurrentPage] = useState58(1);
11654
+ const [totalEntries, setTotalEntries] = useState58(0);
11667
11655
  const handlePageSizeChange = (e) => {
11668
11656
  setPageSize(Number(e.target.value));
11669
11657
  setCurrentPage(1);
@@ -11708,7 +11696,7 @@ function AssignmentRuleMain() {
11708
11696
  }
11709
11697
 
11710
11698
  // src/components/Sidebar.jsx
11711
- import { Fragment as Fragment7, jsx as jsx85, jsxs as jsxs84 } from "react/jsx-runtime";
11699
+ import { Fragment as Fragment8, jsx as jsx85, jsxs as jsxs84 } from "react/jsx-runtime";
11712
11700
  var workflowItems = [
11713
11701
  // Menu Name testing // component or page-Use function name
11714
11702
  {
@@ -11805,15 +11793,15 @@ function Sidebar({
11805
11793
  childrens
11806
11794
  }) {
11807
11795
  const router = useRouter();
11808
- const [workflowOpen, setWorkflowOpen] = useState56(false);
11809
- const [permissionOpen, setPermissionOpen] = useState56(false);
11810
- const [hierarchyOpen, setHierarchyOpen] = useState56(false);
11811
- const [documentOpen, setDocumentOpen] = useState56(false);
11812
- const [filesOpen, setFilesOpen] = useState56(false);
11813
- const [tasksOpen, setTasksOpen] = useState56(false);
11814
- const [trackingOpen, setTrackingOpen] = useState56(false);
11815
- const [communicationOpen, setCommunicationOpen] = useState56(false);
11816
- const [activeComponent, setActiveComponent] = useState56("workflowType");
11796
+ const [workflowOpen, setWorkflowOpen] = useState59(false);
11797
+ const [permissionOpen, setPermissionOpen] = useState59(false);
11798
+ const [hierarchyOpen, setHierarchyOpen] = useState59(false);
11799
+ const [documentOpen, setDocumentOpen] = useState59(false);
11800
+ const [filesOpen, setFilesOpen] = useState59(false);
11801
+ const [tasksOpen, setTasksOpen] = useState59(false);
11802
+ const [trackingOpen, setTrackingOpen] = useState59(false);
11803
+ const [communicationOpen, setCommunicationOpen] = useState59(false);
11804
+ const [activeComponent, setActiveComponent] = useState59("workflowType");
11817
11805
  const renderMenuItemold = (item) => {
11818
11806
  const Icon = item.icon;
11819
11807
  return /* @__PURE__ */ jsxs84("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: [
@@ -11825,7 +11813,7 @@ function Sidebar({
11825
11813
  const Icon = item.icon;
11826
11814
  const handleClick = () => {
11827
11815
  if (item.component) {
11828
- router.push("/flowCore", void 0, {
11816
+ router.push("/", void 0, {
11829
11817
  shallow: true
11830
11818
  });
11831
11819
  setActiveComponent(item.component);
@@ -11895,7 +11883,7 @@ function Sidebar({
11895
11883
  open && /* @__PURE__ */ jsx85("div", { className: "fc:ml-[2px] fc:border-l fc:border-[#E5E9F1] fc:pl-[2px]", children: items.map(renderMenuItem) })
11896
11884
  ] });
11897
11885
  };
11898
- return /* @__PURE__ */ jsxs84(Fragment7, { children: [
11886
+ return /* @__PURE__ */ jsxs84(Fragment8, { children: [
11899
11887
  /* @__PURE__ */ jsxs84("aside", { className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`, children: [
11900
11888
  /* @__PURE__ */ jsxs84("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
11901
11889
  /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
@@ -11939,10 +11927,10 @@ function Sidebar({
11939
11927
  }
11940
11928
 
11941
11929
  // src/components/Layout.jsx
11942
- import { useState as useState57 } from "react";
11930
+ import { useState as useState60 } from "react";
11943
11931
  import { jsx as jsx86 } from "react/jsx-runtime";
11944
11932
  var Layout = ({ children }) => {
11945
- const [isOpen, setIsOpen] = useState57(true);
11933
+ const [isOpen, setIsOpen] = useState60(true);
11946
11934
  return /* @__PURE__ */ jsx86("div", { className: "flowcore fc:flex fc:min-h-screen", children: /* @__PURE__ */ jsx86(
11947
11935
  Sidebar,
11948
11936
  {