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
package/dist/pkg-index.js CHANGED
@@ -55,14 +55,13 @@ __export(pkg_index_exports, {
55
55
  module.exports = __toCommonJS(pkg_index_exports);
56
56
 
57
57
  // src/components/Sidebar.jsx
58
- var import_react86 = require("react");
59
- var import_react87 = require("@remixicon/react");
58
+ var import_react85 = require("react");
59
+ var import_react86 = require("@remixicon/react");
60
60
  var import_router = require("next/router");
61
61
 
62
62
  // src/components/workflow/WorkflowMain.jsx
63
63
  var import_react9 = __toESM(require("react"));
64
- var import_react10 = require("react");
65
- var import_sweetalert2 = __toESM(require("sweetalert2"));
64
+ var import_sweetalert23 = __toESM(require("sweetalert2"));
66
65
 
67
66
  // src/components/Service/ApiEndpointsProvider.js
68
67
  var STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
@@ -149,155 +148,11 @@ function SearchBar({ searchQuery, setSearchQuery }) {
149
148
  }
150
149
 
151
150
  // src/components/workflow/WorkflowTable.jsx
152
- var import_react4 = __toESM(require("react"));
151
+ var import_react3 = __toESM(require("react"));
153
152
 
154
- // src/components/workflow/AddEditModal.jsx
153
+ // src/components/workflow/DeleteModal.jsx
155
154
  var import_react2 = __toESM(require("react"));
156
155
  var import_jsx_runtime2 = require("react/jsx-runtime");
157
- function AddEditModal({
158
- isOpen,
159
- onClose,
160
- onSave,
161
- editData
162
- }) {
163
- const [formData, setFormData] = (0, import_react2.useState)({
164
- name: "",
165
- code: "",
166
- type: "",
167
- version: "",
168
- published: true,
169
- status: true
170
- });
171
- (0, import_react2.useEffect)(() => {
172
- if (editData) {
173
- setFormData(editData);
174
- }
175
- }, [editData]);
176
- if (!isOpen) return null;
177
- const handleChange = (e) => {
178
- const { name, value, type, checked } = e.target;
179
- setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
180
- [name]: type === "checkbox" ? checked : value
181
- }));
182
- };
183
- const handleSave = () => {
184
- onSave(formData);
185
- onClose();
186
- };
187
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-black/40 fc:flex fc:items-center fc:justify-center fc:z-50", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:bg-white fc:w-[550px] fc:rounded-xl fc:shadow-xl fc:p-6", children: [
188
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:mb-6", children: [
189
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: "fc:text-xl fc:font-bold fc:text-slate-800", children: "Edit Workflow" }),
190
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
191
- "button",
192
- {
193
- onClick: onClose,
194
- className: "fc:text-slate-500 hover:fc:text-red-500 fc:text-xl",
195
- children: "\u2715"
196
- }
197
- )
198
- ] }),
199
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:mb-4", children: [
200
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Workflow Name" }),
201
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
202
- "input",
203
- {
204
- type: "text",
205
- name: "name",
206
- value: formData.name,
207
- onChange: handleChange,
208
- 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"
209
- }
210
- )
211
- ] }),
212
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:mb-4", children: [
213
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Workflow Code" }),
214
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
215
- "input",
216
- {
217
- type: "text",
218
- name: "code",
219
- value: formData.code,
220
- onChange: handleChange,
221
- 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"
222
- }
223
- )
224
- ] }),
225
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:mb-4", children: [
226
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Workflow Type" }),
227
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
228
- "input",
229
- {
230
- type: "text",
231
- name: "type",
232
- value: formData.type,
233
- onChange: handleChange,
234
- 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"
235
- }
236
- )
237
- ] }),
238
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:mb-4", children: [
239
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "fc:block fc:text-sm fc:font-medium fc:mb-2", children: "Version" }),
240
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
241
- "input",
242
- {
243
- type: "number",
244
- name: "version",
245
- value: formData.version,
246
- onChange: handleChange,
247
- 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"
248
- }
249
- )
250
- ] }),
251
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-3 fc:mb-4", children: [
252
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "fc:text-sm fc:font-medium", children: "Published" }),
253
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
254
- "input",
255
- {
256
- type: "checkbox",
257
- name: "published",
258
- checked: formData.published,
259
- onChange: handleChange
260
- }
261
- ),
262
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: formData.published ? "Yes" : "No" })
263
- ] }),
264
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-3 fc:mb-8", children: [
265
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("label", { className: "fc:text-sm fc:font-medium", children: "Status" }),
266
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
267
- "input",
268
- {
269
- type: "checkbox",
270
- name: "status",
271
- checked: formData.status,
272
- onChange: handleChange
273
- }
274
- ),
275
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: formData.status ? "Active" : "Inactive" })
276
- ] }),
277
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-3", children: [
278
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
279
- "button",
280
- {
281
- onClick: onClose,
282
- className: "fc:px-5 fc:py-2 fc:rounded-lg fc:border fc:border-slate-300 hover:fc:bg-slate-100",
283
- children: "Cancel"
284
- }
285
- ),
286
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
287
- "button",
288
- {
289
- onClick: handleSave,
290
- className: "fc:px-5 fc:py-2 fc:rounded-lg fc:bg-blue-600 hover:fc:bg-blue-700 fc:text-white",
291
- children: "Save"
292
- }
293
- )
294
- ] })
295
- ] }) });
296
- }
297
-
298
- // src/components/workflow/DeleteModal.jsx
299
- var import_react3 = __toESM(require("react"));
300
- var import_jsx_runtime3 = require("react/jsx-runtime");
301
156
  function DeleteModal({
302
157
  isOpen,
303
158
  onClose,
@@ -305,10 +160,10 @@ function DeleteModal({
305
160
  workflowName = "Citizen Petition"
306
161
  }) {
307
162
  if (!isOpen) return null;
308
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center", children: [
309
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fc:absolute fc:inset-0 fc:bg-black/25 fc:backdrop-blur-sm" }),
310
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("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: [
311
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
163
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center", children: [
164
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "fc:absolute fc:inset-0 fc:bg-black/25 fc:backdrop-blur-sm" }),
165
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("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: [
166
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
312
167
  "button",
313
168
  {
314
169
  onClick: onClose,
@@ -316,21 +171,21 @@ function DeleteModal({
316
171
  children: "\xD7"
317
172
  }
318
173
  ),
319
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fc:flex fc:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fc:text-2xl", children: "\u26A0\uFE0F" }) }) }),
320
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { className: "fc:text-[31px] fc:font-semibold fc:text-center fc:mt-5 fc:text-gray-900", children: "Delete Workflow" }),
321
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "fc:text-center fc:text-gray-500 fc:text-sm fc:mt-3", children: [
174
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "fc:flex fc:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("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__ */ (0, import_jsx_runtime2.jsx)("span", { className: "fc:text-2xl", children: "\u26A0\uFE0F" }) }) }),
175
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h2", { className: "fc:text-[31px] fc:font-semibold fc:text-center fc:mt-5 fc:text-gray-900", children: "Delete Workflow" }),
176
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("p", { className: "fc:text-center fc:text-gray-500 fc:text-sm fc:mt-3", children: [
322
177
  "Are you sure you want to delete",
323
178
  " ",
324
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "fc:font-semibold fc:text-gray-700", children: [
179
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "fc:font-semibold fc:text-gray-700", children: [
325
180
  '"',
326
181
  workflowName,
327
182
  '"'
328
183
  ] }),
329
184
  "?"
330
185
  ] }),
331
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "fc:text-center fc:text-gray-400 fc:text-sm fc:mt-1", children: "This action cannot be undone." }),
332
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:gap-3 fc:mt-8", children: [
333
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
186
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "fc:text-center fc:text-gray-400 fc:text-sm fc:mt-1", children: "This action cannot be undone." }),
187
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "fc:flex fc:gap-3 fc:mt-8", children: [
188
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
334
189
  "button",
335
190
  {
336
191
  onClick: onClose,
@@ -338,7 +193,7 @@ function DeleteModal({
338
193
  children: "Cancel"
339
194
  }
340
195
  ),
341
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
196
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
342
197
  "button",
343
198
  {
344
199
  onClick: () => {
@@ -355,8 +210,8 @@ function DeleteModal({
355
210
  }
356
211
 
357
212
  // src/components/workflow/WorkflowTable.jsx
358
- var import_jsx_runtime4 = require("react/jsx-runtime");
359
- function WorkflowTable({ pageSize, searchQuery, apiData }) {
213
+ var import_jsx_runtime3 = require("react/jsx-runtime");
214
+ function WorkflowTable({ pageSize, searchQuery, apiData, onEdit, onDeleteApi }) {
360
215
  const initialData = [
361
216
  {
362
217
  id: "1",
@@ -467,19 +322,18 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
467
322
  status: true
468
323
  }
469
324
  ];
470
- const [data, setData] = (0, import_react4.useState)(apiData || initialData);
471
- import_react4.default.useEffect(() => {
325
+ const [data, setData] = (0, import_react3.useState)(apiData || initialData);
326
+ import_react3.default.useEffect(() => {
472
327
  if (apiData) setData(apiData);
473
328
  }, [apiData]);
474
329
  const filteredData = data.filter(
475
330
  (item) => item.name.toLowerCase().includes((searchQuery || "").toLowerCase()) || item.code.toLowerCase().includes((searchQuery || "").toLowerCase())
476
331
  );
477
- const [sortColumn, setSortColumn] = (0, import_react4.useState)("");
478
- const [sortDirection, setSortDirection] = (0, import_react4.useState)("asc");
479
- const [currentPage, setCurrentPage] = (0, import_react4.useState)(1);
480
- const [editOpen, setEditOpen] = (0, import_react4.useState)(false);
481
- const [deleteOpen, setDeleteOpen] = (0, import_react4.useState)(false);
482
- const [selectedWorkflow, setSelectedWorkflow] = (0, import_react4.useState)(null);
332
+ const [sortColumn, setSortColumn] = (0, import_react3.useState)("");
333
+ const [sortDirection, setSortDirection] = (0, import_react3.useState)("asc");
334
+ const [currentPage, setCurrentPage] = (0, import_react3.useState)(1);
335
+ const [deleteOpen, setDeleteOpen] = (0, import_react3.useState)(false);
336
+ const [selectedWorkflow, setSelectedWorkflow] = (0, import_react3.useState)(null);
483
337
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
484
338
  const startIndex = (currentPage - 1) * pageSize;
485
339
  const visibleData = filteredData.slice(
@@ -505,8 +359,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
505
359
  };
506
360
  const getSortIcon = (column) => {
507
361
  if (sortColumn !== column)
508
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-slate-500 fc:ml-1", children: "\u25B2" });
509
- return sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25B2" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25BC" });
362
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fc:text-slate-500 fc:ml-1", children: "\u25B2" });
363
+ return sortDirection === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25B2" }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "fc:text-blue-600 fc:ml-1", children: "\u25BC" });
510
364
  };
511
365
  const toggleSwitch = (id) => {
512
366
  setData(
@@ -518,22 +372,21 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
518
372
  );
519
373
  };
520
374
  const handleEdit = (workflow) => {
521
- setSelectedWorkflow(workflow);
522
- setEditOpen(true);
375
+ if (onEdit) {
376
+ onEdit(workflow);
377
+ return;
378
+ }
523
379
  };
524
380
  const handleDelete = (workflow) => {
525
381
  setSelectedWorkflow(workflow);
526
382
  setDeleteOpen(true);
527
383
  };
528
- const handleUpdate = (updatedWorkflow) => {
529
- setData(
530
- (prev) => prev.map(
531
- (item) => item.id === updatedWorkflow.id ? updatedWorkflow : item
532
- )
533
- );
534
- setEditOpen(false);
535
- };
536
- const confirmDelete = () => {
384
+ const confirmDelete = async () => {
385
+ if (onDeleteApi) {
386
+ await onDeleteApi(selectedWorkflow);
387
+ setDeleteOpen(false);
388
+ return;
389
+ }
537
390
  setData(
538
391
  (prev) => prev.filter(
539
392
  (item) => item.id !== selectedWorkflow.id
@@ -541,82 +394,82 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
541
394
  );
542
395
  setDeleteOpen(false);
543
396
  };
544
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:space-y-5", children: [
545
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden", children: [
546
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fc:max-h-[420px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("table", { className: "fc:w-full fc:border-collapse fc:bg-white", children: [
547
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("tr", { className: "fc:border-b fc:border-slate-200 fc:text-xs fc:uppercase fc:text-slate-500", children: [
548
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "S.No" }),
549
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
397
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:space-y-5", children: [
398
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden", children: [
399
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "fc:max-h-[420px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("table", { className: "fc:w-full fc:border-collapse fc:bg-white", children: [
400
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { className: "fc:border-b fc:border-slate-200 fc:text-xs fc:uppercase fc:text-slate-500", children: [
401
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "S.No" }),
402
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
550
403
  "th",
551
404
  {
552
405
  onClick: () => handleSort("name"),
553
406
  className: "fc:px-5 fc:py-4 fc:cursor-pointer",
554
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:items-center", children: [
407
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:items-center", children: [
555
408
  "Workflow Name",
556
409
  getSortIcon("name")
557
410
  ] })
558
411
  }
559
412
  ),
560
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
413
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
561
414
  "th",
562
415
  {
563
416
  onClick: () => handleSort("code"),
564
417
  className: "fc:px-5 fc:py-4 fc:cursor-pointer",
565
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:items-center", children: [
418
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:items-center", children: [
566
419
  "Workflow Code",
567
420
  getSortIcon("code")
568
421
  ] })
569
422
  }
570
423
  ),
571
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
424
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
572
425
  "th",
573
426
  {
574
427
  onClick: () => handleSort("type"),
575
428
  className: "fc:px-5 fc:py-4 fc:cursor-pointer",
576
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:items-center", children: [
429
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:items-center", children: [
577
430
  "Workflow Type",
578
431
  getSortIcon("type")
579
432
  ] })
580
433
  }
581
434
  ),
582
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
435
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
583
436
  "th",
584
437
  {
585
438
  onClick: () => handleSort("version"),
586
439
  className: "fc:px-5 fc:py-4 fc:text-center fc:cursor-pointer",
587
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:justify-center fc:items-center", children: [
440
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:justify-center fc:items-center", children: [
588
441
  "Version",
589
442
  getSortIcon("version")
590
443
  ] })
591
444
  }
592
445
  ),
593
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Published" }),
594
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Status" }),
595
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Action" })
446
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Published" }),
447
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Status" }),
448
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { className: "fc:px-5 fc:py-4 fc:text-center", children: "Action" })
596
449
  ] }) }),
597
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100", children: visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
450
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100", children: visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
598
451
  "tr",
599
452
  {
600
453
  className: "hover:fc:bg-slate-50",
601
454
  children: [
602
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: startIndex + index + 1 }),
603
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4 fc:font-semibold", children: item.name }),
604
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4", children: item.code }),
605
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4", children: item.type }),
606
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: item.version }),
607
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
455
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: startIndex + index + 1 }),
456
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4 fc:font-semibold", children: item.name }),
457
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4", children: item.code }),
458
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4", children: item.type }),
459
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: item.version }),
460
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
608
461
  "span",
609
462
  {
610
463
  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"}`,
611
464
  children: item.published ? "Yes" : "No"
612
465
  }
613
466
  ) }),
614
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
467
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
615
468
  "button",
616
469
  {
617
470
  onClick: () => toggleSwitch(item.id),
618
471
  className: `fc:w-11 fc:h-6 fc:rounded-full fc:relative ${item.status ? "fc:bg-blue-600" : "fc:bg-gray-300"}`,
619
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
472
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
620
473
  "span",
621
474
  {
622
475
  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"}`
@@ -624,8 +477,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
624
477
  )
625
478
  }
626
479
  ) }),
627
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("td", { className: "fc:px-5 fc:py-4", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:justify-center fc:gap-2", children: [
628
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
480
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "fc:px-5 fc:py-4", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:justify-center fc:gap-2", children: [
481
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
629
482
  "button",
630
483
  {
631
484
  onClick: () => handleEdit(item),
@@ -633,7 +486,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
633
486
  children: "Edit"
634
487
  }
635
488
  ),
636
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
489
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
637
490
  "button",
638
491
  {
639
492
  onClick: () => handleDelete(item),
@@ -647,8 +500,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
647
500
  item.id
648
501
  )) })
649
502
  ] }) }),
650
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
651
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
503
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
504
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
652
505
  "button",
653
506
  {
654
507
  onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)),
@@ -656,7 +509,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
656
509
  children: "\u2039 Prev"
657
510
  }
658
511
  ),
659
- Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
512
+ Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
660
513
  "button",
661
514
  {
662
515
  onClick: () => setCurrentPage(page),
@@ -665,7 +518,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
665
518
  },
666
519
  page
667
520
  )),
668
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
521
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
669
522
  "button",
670
523
  {
671
524
  onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)),
@@ -673,7 +526,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
673
526
  children: "Next \u203A"
674
527
  }
675
528
  ),
676
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
529
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
677
530
  "button",
678
531
  {
679
532
  onClick: () => setCurrentPage(totalPages),
@@ -683,16 +536,7 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
683
536
  )
684
537
  ] })
685
538
  ] }),
686
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
687
- AddEditModal,
688
- {
689
- isOpen: editOpen,
690
- editData: selectedWorkflow,
691
- onClose: () => setEditOpen(false),
692
- onSave: handleUpdate
693
- }
694
- ),
695
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
539
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
696
540
  DeleteModal,
697
541
  {
698
542
  isOpen: deleteOpen,
@@ -705,26 +549,330 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
705
549
  }
706
550
 
707
551
  // src/components/workflow/AddWorkflowModal.jsx
552
+ var import_react4 = __toESM(require("react"));
553
+ var import_sweetalert2 = __toESM(require("sweetalert2"));
554
+ var import_jsx_runtime4 = require("react/jsx-runtime");
555
+ var INITIAL_FORM = {
556
+ workflowTypeId: "",
557
+ workflowCode: "",
558
+ workflowName: "",
559
+ version: "1",
560
+ published: "false",
561
+ status: "active",
562
+ defaultPriority: "medium",
563
+ description: ""
564
+ };
565
+ function AddWorkflowModal({
566
+ isOpen,
567
+ onClose,
568
+ workflowTypes = [],
569
+ onSave
570
+ }) {
571
+ const [formData, setFormData] = (0, import_react4.useState)(INITIAL_FORM);
572
+ const [errors, setErrors] = (0, import_react4.useState)({});
573
+ const [isSubmitting, setIsSubmitting] = (0, import_react4.useState)(false);
574
+ const [submitError, setSubmitError] = (0, import_react4.useState)("");
575
+ (0, import_react4.useEffect)(() => {
576
+ if (!isOpen) {
577
+ setFormData(INITIAL_FORM);
578
+ setErrors({});
579
+ setSubmitError("");
580
+ setIsSubmitting(false);
581
+ }
582
+ }, [isOpen]);
583
+ if (!isOpen) return null;
584
+ const handleChange = (event) => {
585
+ const { name, value } = event.target;
586
+ if (name === "description" && value.length > 500) return;
587
+ setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [name]: value }));
588
+ setErrors((prev) => __spreadProps(__spreadValues({}, prev), { [name]: "" }));
589
+ setSubmitError("");
590
+ };
591
+ const validate = () => {
592
+ const nextErrors = {};
593
+ if (!formData.workflowTypeId) nextErrors.workflowTypeId = "Workflow type is required";
594
+ if (!formData.workflowCode.trim()) nextErrors.workflowCode = "Workflow code is required";
595
+ if (!formData.workflowName.trim()) nextErrors.workflowName = "Workflow name is required";
596
+ if (!formData.version.trim()) nextErrors.version = "Version is required";
597
+ setErrors(nextErrors);
598
+ return Object.keys(nextErrors).length === 0;
599
+ };
600
+ const handleSubmit = async (event) => {
601
+ var _a, _b;
602
+ event.preventDefault();
603
+ if (!validate()) return;
604
+ if (!onSave) {
605
+ setSubmitError("Save handler not configured.");
606
+ return;
607
+ }
608
+ const payload = {
609
+ workflowTypeId: formData.workflowTypeId,
610
+ workflowCode: formData.workflowCode.trim(),
611
+ workflowName: formData.workflowName.trim(),
612
+ version: formData.version.trim(),
613
+ published: formData.published === "true",
614
+ status: formData.status === "active",
615
+ defaultPriority: formData.defaultPriority,
616
+ description: formData.description.trim(),
617
+ createdBy: "System"
618
+ };
619
+ try {
620
+ setIsSubmitting(true);
621
+ const result = await onSave(payload);
622
+ if (result) {
623
+ onClose();
624
+ }
625
+ } catch (error) {
626
+ 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.";
627
+ setSubmitError(message);
628
+ await import_sweetalert2.default.fire("Error", message, "error");
629
+ } finally {
630
+ setIsSubmitting(false);
631
+ }
632
+ };
633
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
634
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
635
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
636
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-8 fc:py-6 fc:border-b fc:border-slate-100", children: [
637
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
638
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }) }) }),
639
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
640
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow" }),
641
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new workflow and configure its details" })
642
+ ] })
643
+ ] }),
644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" })
645
+ ] }),
646
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
647
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
648
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
649
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u{1F4CB}" }),
650
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Workflow Information" })
651
+ ] }),
652
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
653
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
654
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
655
+ "Workflow Type ",
656
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-red-500", children: "*" })
657
+ ] }),
658
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { name: "workflowTypeId", value: formData.workflowTypeId, onChange: handleChange, className: inputClass(errors.workflowTypeId), children: [
659
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "", children: "Select workflow type" }),
660
+ workflowTypes.length > 0 ? workflowTypes.map((type) => {
661
+ var _a, _b;
662
+ const id = (_a = type.workflowTypeId) != null ? _a : type.WorkflowTypeId;
663
+ const label = (_b = type.workflowTypeName) != null ? _b : type.WorkflowTypeName;
664
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: id, children: label }, id);
665
+ }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
666
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "petition", children: "Petition" }),
667
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "building", children: "Building Permission" }),
668
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "leave", children: "Leave" })
669
+ ] })
670
+ ] }),
671
+ errors.workflowTypeId && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowTypeId })
672
+ ] }),
673
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
674
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
675
+ "Workflow Code ",
676
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-red-500", children: "*" })
677
+ ] }),
678
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { name: "workflowCode", value: formData.workflowCode, onChange: handleChange, type: "text", placeholder: "Enter workflow code", className: inputClass(errors.workflowCode) }),
679
+ errors.workflowCode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowCode })
680
+ ] })
681
+ ] }),
682
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
683
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
684
+ "Workflow Name ",
685
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-red-500", children: "*" })
686
+ ] }),
687
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { name: "workflowName", value: formData.workflowName, onChange: handleChange, type: "text", placeholder: "Enter workflow name", className: inputClass(errors.workflowName) }),
688
+ errors.workflowName && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowName })
689
+ ] }),
690
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
691
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
692
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
693
+ "Version ",
694
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-red-500", children: "*" })
695
+ ] }),
696
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("input", { name: "version", type: "text", value: formData.version, onChange: handleChange, className: inputClass(errors.version) }),
697
+ errors.version && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.version })
698
+ ] }),
699
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
700
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
701
+ "Published ",
702
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-red-500", children: "*" })
703
+ ] }),
704
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { name: "published", value: formData.published, onChange: handleChange, className: inputClass(), children: [
705
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "false", children: "No" }),
706
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "true", children: "Yes" })
707
+ ] }),
708
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Make workflow active for use" })
709
+ ] })
710
+ ] })
711
+ ] }),
712
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-3", children: [
713
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center", children: [
714
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: "Description" }),
715
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "fc:text-[10px] fc:text-slate-400", children: [
716
+ formData.description.length,
717
+ " / 500"
718
+ ] })
719
+ ] }),
720
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("textarea", { name: "description", rows: 3, value: formData.description, onChange: handleChange, placeholder: "Enter workflow description (optional)", className: inputClass() }),
721
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-400", children: "Provide additional information about this workflow" })
722
+ ] }),
723
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
724
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("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: [
725
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u2699\uFE0F" }),
726
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Status & Settings" })
727
+ ] }),
728
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
729
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
730
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
731
+ "Status ",
732
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "fc:text-red-500", children: "*" })
733
+ ] }),
734
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { name: "status", value: formData.status, onChange: handleChange, className: inputClass(), children: [
735
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "active", children: "Active" }),
736
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "inactive", children: "Inactive" })
737
+ ] }),
738
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Set the initial status of this workflow" })
739
+ ] }),
740
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
741
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: "Default Priority" }),
742
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("select", { name: "defaultPriority", value: formData.defaultPriority, onChange: handleChange, className: inputClass(), children: [
743
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "medium", children: "Medium" }),
744
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "high", children: "High" }),
745
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "low", children: "Low" })
746
+ ] }),
747
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Default priority for tasks in this workflow" })
748
+ ] })
749
+ ] })
750
+ ] })
751
+ ] }),
752
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fc:p-5 fc:bg-white fc:border-t fc:border-slate-100 fc:flex fc:items-center fc:justify-end fc:gap-3 fc:px-8", children: [
753
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" }),
754
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("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" })
755
+ ] }),
756
+ submitError && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "fc:px-8 fc:pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "fc:text-sm fc:text-red-600", children: submitError }) })
757
+ ] })
758
+ ] });
759
+ }
760
+ 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" : ""}`;
761
+
762
+ // src/components/workflow/EditWorkflowModal.jsx
708
763
  var import_react5 = __toESM(require("react"));
764
+ var import_sweetalert22 = __toESM(require("sweetalert2"));
709
765
  var import_jsx_runtime5 = require("react/jsx-runtime");
710
- function AddWorkflowModal({
766
+ var INITIAL_FORM2 = {
767
+ workflowTypeId: "",
768
+ workflowCode: "",
769
+ workflowName: "",
770
+ version: "",
771
+ published: "false",
772
+ status: "active",
773
+ defaultPriority: "medium",
774
+ description: ""
775
+ };
776
+ function EditWorkflowModal({
711
777
  isOpen,
712
778
  onClose,
713
- workflowTypes = []
779
+ onSave,
780
+ workflowTypes = [],
781
+ editData = null
714
782
  }) {
783
+ const [formData, setFormData] = (0, import_react5.useState)(INITIAL_FORM2);
784
+ const [errors, setErrors] = (0, import_react5.useState)({});
785
+ const [isSubmitting, setIsSubmitting] = (0, import_react5.useState)(false);
786
+ const [submitError, setSubmitError] = (0, import_react5.useState)("");
787
+ (0, import_react5.useEffect)(() => {
788
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
789
+ if (editData) {
790
+ setFormData({
791
+ workflowTypeId: (_d = (_c = (_a = editData.workflowTypeId) != null ? _a : editData.WorkflowTypeId) != null ? _c : (_b = editData.workflowType) == null ? void 0 : _b.workflowTypeId) != null ? _d : editData.workflowTypeId,
792
+ workflowCode: (_g = (_f = (_e = editData.workflowCode) != null ? _e : editData.WorkflowCode) != null ? _f : editData.code) != null ? _g : "",
793
+ workflowName: (_j = (_i = (_h = editData.workflowName) != null ? _h : editData.WorkflowName) != null ? _i : editData.name) != null ? _j : "",
794
+ version: (_m = (_l = (_k = editData.version) != null ? _k : editData.WorkflowVersion) != null ? _l : editData.workflowVersion) != null ? _m : "1",
795
+ published: ((_o = (_n = editData.published) != null ? _n : editData.isPublished) != null ? _o : editData.IsPublished) ? "true" : "false",
796
+ status: ((_q = (_p = editData.status) != null ? _p : editData.isActive) != null ? _q : editData.IsActive) ? "active" : "inactive",
797
+ defaultPriority: (_s = (_r = editData.defaultPriority) != null ? _r : editData.defaultPriority) != null ? _s : "medium",
798
+ description: (_u = (_t = editData.description) != null ? _t : editData.Description) != null ? _u : ""
799
+ });
800
+ setErrors({});
801
+ setSubmitError("");
802
+ }
803
+ }, [editData]);
804
+ (0, import_react5.useEffect)(() => {
805
+ if (!isOpen) {
806
+ setFormData(INITIAL_FORM2);
807
+ setErrors({});
808
+ setSubmitError("");
809
+ setIsSubmitting(false);
810
+ }
811
+ }, [isOpen]);
715
812
  if (!isOpen) return null;
813
+ const handleChange = (event) => {
814
+ const { name, value } = event.target;
815
+ if (name === "description" && value.length > 500) return;
816
+ setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [name]: value }));
817
+ setErrors((prev) => __spreadProps(__spreadValues({}, prev), { [name]: "" }));
818
+ setSubmitError("");
819
+ };
820
+ const validate = () => {
821
+ const nextErrors = {};
822
+ if (!formData.workflowTypeId) nextErrors.workflowTypeId = "Workflow type is required";
823
+ if (!formData.workflowCode.trim()) nextErrors.workflowCode = "Workflow code is required";
824
+ if (!formData.workflowName.trim()) nextErrors.workflowName = "Workflow name is required";
825
+ if (!formData.version.trim()) nextErrors.version = "Version is required";
826
+ setErrors(nextErrors);
827
+ return Object.keys(nextErrors).length === 0;
828
+ };
829
+ const handleSubmit = async (event) => {
830
+ var _a, _b, _c, _d, _e, _f;
831
+ event.preventDefault();
832
+ if (!validate()) return;
833
+ if (!onSave) {
834
+ setSubmitError("Save handler not configured.");
835
+ return;
836
+ }
837
+ 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;
838
+ const payload = {
839
+ workflowId,
840
+ workflowTypeId: formData.workflowTypeId,
841
+ workflowCode: formData.workflowCode.trim(),
842
+ workflowName: formData.workflowName.trim(),
843
+ version: formData.version.trim(),
844
+ published: formData.published === "true",
845
+ status: formData.status === "active",
846
+ defaultPriority: formData.defaultPriority,
847
+ description: formData.description.trim(),
848
+ updatedBy: (_d = (_c = editData == null ? void 0 : editData.updatedBy) != null ? _c : editData == null ? void 0 : editData.createdBy) != null ? _d : "System"
849
+ };
850
+ try {
851
+ setIsSubmitting(true);
852
+ const result = await onSave(payload);
853
+ if (result) {
854
+ onClose();
855
+ }
856
+ } catch (error) {
857
+ 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.";
858
+ setSubmitError(message);
859
+ await import_sweetalert22.default.fire("Error", message, "error");
860
+ } finally {
861
+ setIsSubmitting(false);
862
+ }
863
+ };
716
864
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
717
865
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
718
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
866
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
719
867
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-8 fc:py-6 fc:border-b fc:border-slate-100", children: [
720
868
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
721
869
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }) }) }),
722
870
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
723
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow" }),
724
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new workflow and configure its details" })
871
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Workflow" }),
872
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Update the workflow details" })
725
873
  ] })
726
874
  ] }),
727
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" })
875
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" })
728
876
  ] }),
729
877
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
730
878
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
@@ -732,29 +880,34 @@ function AddWorkflowModal({
732
880
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u{1F4CB}" }),
733
881
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Workflow Information" })
734
882
  ] }),
735
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
883
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
736
884
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
737
885
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
738
886
  "Workflow Type ",
739
887
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-red-500", children: "*" })
740
888
  ] }),
741
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
889
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { name: "workflowTypeId", value: formData.workflowTypeId, onChange: handleChange, className: inputClass2(errors.workflowTypeId), children: [
742
890
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "Select workflow type" }),
743
- workflowTypes.length > 0 ? workflowTypes.map((type) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: type.workflowTypeId || type.WorkflowTypeId, children: type.workflowTypeName || type.WorkflowTypeName }, type.workflowTypeId || type.WorkflowTypeId)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
891
+ workflowTypes.length > 0 ? workflowTypes.map((type) => {
892
+ var _a, _b;
893
+ const id = (_a = type.workflowTypeId) != null ? _a : type.WorkflowTypeId;
894
+ const label = (_b = type.workflowTypeName) != null ? _b : type.WorkflowTypeName;
895
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: id, children: label }, id);
896
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
744
897
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "petition", children: "Petition" }),
745
898
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "building", children: "Building Permission" }),
746
899
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "leave", children: "Leave" })
747
900
  ] })
748
901
  ] }),
749
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Choose the category this workflow belongs to" })
902
+ errors.workflowTypeId && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowTypeId })
750
903
  ] }),
751
904
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
752
905
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
753
906
  "Workflow Code ",
754
907
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-red-500", children: "*" })
755
908
  ] }),
756
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
757
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Unique code for this workflow (e.g., PET-001)" })
909
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { name: "workflowCode", value: formData.workflowCode, onChange: handleChange, type: "text", placeholder: "Enter workflow code", className: inputClass2(errors.workflowCode) }),
910
+ errors.workflowCode && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowCode })
758
911
  ] })
759
912
  ] }),
760
913
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
@@ -762,24 +915,24 @@ function AddWorkflowModal({
762
915
  "Workflow Name ",
763
916
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-red-500", children: "*" })
764
917
  ] }),
765
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
766
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Enter a descriptive name for this workflow" })
918
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { name: "workflowName", value: formData.workflowName, onChange: handleChange, type: "text", placeholder: "Enter workflow name", className: inputClass2(errors.workflowName) }),
919
+ errors.workflowName && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.workflowName })
767
920
  ] }),
768
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
921
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
769
922
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
770
923
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
771
924
  "Version ",
772
925
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-red-500", children: "*" })
773
926
  ] }),
774
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
775
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Workflow version number" })
927
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { name: "version", type: "text", value: formData.version, onChange: handleChange, className: inputClass2(errors.version) }),
928
+ errors.version && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-500 fc:mt-1", children: errors.version })
776
929
  ] }),
777
930
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
778
931
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
779
932
  "Published ",
780
933
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-red-500", children: "*" })
781
934
  ] }),
782
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
935
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { name: "published", value: formData.published, onChange: handleChange, className: inputClass2(), children: [
783
936
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "false", children: "No" }),
784
937
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "true", children: "Yes" })
785
938
  ] }),
@@ -790,9 +943,12 @@ function AddWorkflowModal({
790
943
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-3", children: [
791
944
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center", children: [
792
945
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: "Description" }),
793
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-[10px] fc:text-slate-400", children: "0 / 500" })
946
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "fc:text-[10px] fc:text-slate-400", children: [
947
+ formData.description.length,
948
+ " / 500"
949
+ ] })
794
950
  ] }),
795
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
951
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("textarea", { name: "description", rows: 3, value: formData.description, onChange: handleChange, placeholder: "Enter workflow description (optional)", className: inputClass2() }),
796
952
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-400", children: "Provide additional information about this workflow" })
797
953
  ] }),
798
954
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-5", children: [
@@ -800,13 +956,13 @@ function AddWorkflowModal({
800
956
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u2699\uFE0F" }),
801
957
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Status & Settings" })
802
958
  ] }),
803
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
959
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:grid-cols-2 fc:gap-5", children: [
804
960
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
805
961
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
806
962
  "Status ",
807
963
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "fc:text-red-500", children: "*" })
808
964
  ] }),
809
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
965
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { name: "status", value: formData.status, onChange: handleChange, className: inputClass2(), children: [
810
966
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "active", children: "Active" }),
811
967
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "inactive", children: "Inactive" })
812
968
  ] }),
@@ -814,7 +970,7 @@ function AddWorkflowModal({
814
970
  ] }),
815
971
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
816
972
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: "Default Priority" }),
817
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("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: [
973
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { name: "defaultPriority", value: formData.defaultPriority, onChange: handleChange, className: inputClass2(), children: [
818
974
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "medium", children: "Medium" }),
819
975
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "high", children: "High" }),
820
976
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "low", children: "Low" })
@@ -825,12 +981,14 @@ function AddWorkflowModal({
825
981
  ] })
826
982
  ] }),
827
983
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:p-5 fc:bg-white fc:border-t fc:border-slate-100 fc:flex fc:items-center fc:justify-end fc:gap-3 fc:px-8", children: [
828
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
829
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" })
830
- ] })
984
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" }),
985
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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" })
986
+ ] }),
987
+ submitError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "fc:px-8 fc:pb-6", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-sm fc:text-red-600", children: submitError }) })
831
988
  ] })
832
989
  ] });
833
990
  }
991
+ 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" : ""}`;
834
992
 
835
993
  // src/components/Common/commonheader.js
836
994
  var import_react8 = __toESM(require("react"));
@@ -1040,7 +1198,9 @@ function Workflow() {
1040
1198
  const [searchQuery, setSearchQuery] = (0, import_react9.useState)("");
1041
1199
  const [apiData, setApiData] = (0, import_react9.useState)([]);
1042
1200
  const [workflowTypes, setWorkflowTypes] = (0, import_react9.useState)([]);
1043
- (0, import_react10.useEffect)(() => {
1201
+ const [editModalOpen, setEditModalOpen] = (0, import_react9.useState)(false);
1202
+ const [selectedWorkflow, setSelectedWorkflow] = (0, import_react9.useState)(null);
1203
+ (0, import_react9.useEffect)(() => {
1044
1204
  (async () => {
1045
1205
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1046
1206
  try {
@@ -1054,11 +1214,11 @@ function Workflow() {
1054
1214
  const typeRows = Array.isArray(typeValue) ? typeValue : (typeValue == null ? void 0 : typeValue.items) || (typeValue == null ? void 0 : typeValue.records) || [];
1055
1215
  setWorkflowTypes(typeRows);
1056
1216
  setApiData(rows.map((item) => {
1057
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
1058
- 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 });
1217
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m, _n, _o, _p, _q, _r, _s, _t, _u;
1218
+ 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 });
1059
1219
  }));
1060
1220
  } catch (error) {
1061
- await import_sweetalert2.default.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");
1221
+ await import_sweetalert23.default.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");
1062
1222
  }
1063
1223
  })();
1064
1224
  }, [refreshKey]);
@@ -1067,6 +1227,71 @@ function Workflow() {
1067
1227
  console.log("Table data refreshed!");
1068
1228
  setRefreshKey((prev) => prev + 1);
1069
1229
  };
1230
+ const handleCreateApi = async (workflowPayload) => {
1231
+ var _a, _b, _c, _d, _e;
1232
+ try {
1233
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
1234
+ if (!endpoint) throw new Error("Workflow create endpoint is not configured.");
1235
+ await getApiService().post(endpoint, workflowPayload);
1236
+ await import_sweetalert23.default.fire("Success", "Workflow created successfully.", "success");
1237
+ handleRefresh();
1238
+ return true;
1239
+ } catch (error) {
1240
+ await import_sweetalert23.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create workflow.", "error");
1241
+ return false;
1242
+ }
1243
+ };
1244
+ const handleUpdateApi = async (workflowPayload) => {
1245
+ var _a, _b, _c, _d, _e;
1246
+ try {
1247
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
1248
+ if (!endpoint) throw new Error("Workflow update endpoint is not configured.");
1249
+ await getApiService().put(endpoint, workflowPayload);
1250
+ await import_sweetalert23.default.fire("Success", "Workflow updated successfully.", "success");
1251
+ handleRefresh();
1252
+ return true;
1253
+ } catch (error) {
1254
+ await import_sweetalert23.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to update workflow.", "error");
1255
+ return false;
1256
+ }
1257
+ };
1258
+ const handleDeleteApi = async (workflow) => {
1259
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1260
+ try {
1261
+ const endpoints = getApiEndpoints();
1262
+ const deleteEndpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflow) == null ? void 0 : _b.delete;
1263
+ const updateEndpoint = (_d = (_c = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _c.workflow) == null ? void 0 : _d.update;
1264
+ const workflowId = (_f = (_e = workflow.workflowId) != null ? _e : workflow.WorkflowId) != null ? _f : workflow.id;
1265
+ if (deleteEndpoint) {
1266
+ try {
1267
+ await getApiService().delete(`${deleteEndpoint}/${workflowId}`);
1268
+ } catch (e) {
1269
+ await getApiService().delete(deleteEndpoint, { data: { workflowId } });
1270
+ }
1271
+ } else if (updateEndpoint) {
1272
+ await getApiService().put(updateEndpoint, __spreadProps(__spreadValues({}, workflow), { workflowId, isActive: false, updatedBy: workflow.updatedBy || workflow.createdBy || "System" }));
1273
+ } else {
1274
+ throw new Error("Workflow delete endpoint is not configured.");
1275
+ }
1276
+ await import_sweetalert23.default.fire("Success", "Workflow deleted successfully.", "success");
1277
+ handleRefresh();
1278
+ return true;
1279
+ } catch (error) {
1280
+ await import_sweetalert23.default.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to delete workflow.", "error");
1281
+ return false;
1282
+ }
1283
+ };
1284
+ const handleEdit = (workflow) => {
1285
+ setSelectedWorkflow(workflow);
1286
+ setEditModalOpen(true);
1287
+ };
1288
+ const handleCloseEdit = () => {
1289
+ setEditModalOpen(false);
1290
+ setSelectedWorkflow(null);
1291
+ };
1292
+ const handleCloseAdd = () => {
1293
+ setModalOpen(false);
1294
+ };
1070
1295
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fc:h-screen fc:bg-slate-50 fc:p-6 fc:flex fc:flex-col", children: [
1071
1296
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "fc:flex fc:flex-col fc:flex-1 fc:gap-5 fc:overflow-hidden", children: [
1072
1297
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
@@ -1129,7 +1354,9 @@ function Workflow() {
1129
1354
  {
1130
1355
  apiData,
1131
1356
  pageSize,
1132
- searchQuery
1357
+ searchQuery,
1358
+ onEdit: handleEdit,
1359
+ onDeleteApi: handleDeleteApi
1133
1360
  },
1134
1361
  refreshKey
1135
1362
  ) }) })
@@ -1139,19 +1366,30 @@ function Workflow() {
1139
1366
  AddWorkflowModal,
1140
1367
  {
1141
1368
  isOpen: modalOpen,
1142
- onClose: () => setModalOpen(false),
1143
- workflowTypes
1369
+ onClose: handleCloseAdd,
1370
+ workflowTypes,
1371
+ onSave: handleCreateApi
1372
+ }
1373
+ ),
1374
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1375
+ EditWorkflowModal,
1376
+ {
1377
+ isOpen: editModalOpen,
1378
+ onClose: handleCloseEdit,
1379
+ workflowTypes,
1380
+ editData: selectedWorkflow,
1381
+ onSave: handleUpdateApi
1144
1382
  }
1145
1383
  )
1146
1384
  ] });
1147
1385
  }
1148
1386
 
1149
1387
  // src/components/workflow-type/WorkflowTypeMains.js
1150
- var import_react16 = __toESM(require("react"));
1151
- var import_sweetalert23 = __toESM(require("sweetalert2"));
1388
+ var import_react15 = __toESM(require("react"));
1389
+ var import_sweetalert25 = __toESM(require("sweetalert2"));
1152
1390
 
1153
1391
  // src/components/workflow-type/SearchBar.jsx
1154
- var import_react11 = __toESM(require("react"));
1392
+ var import_react10 = __toESM(require("react"));
1155
1393
  var import_jsx_runtime10 = require("react/jsx-runtime");
1156
1394
  function SearchBar2({
1157
1395
  searchQuery,
@@ -1175,10 +1413,10 @@ function SearchBar2({
1175
1413
  }
1176
1414
 
1177
1415
  // src/components/workflow-type/WorkflowTypeTable.jsx
1178
- var import_react14 = __toESM(require("react"));
1416
+ var import_react13 = __toESM(require("react"));
1179
1417
 
1180
1418
  // src/components/workflow-type/DeleteWorkflowType.jsx
1181
- var import_react12 = __toESM(require("react"));
1419
+ var import_react11 = __toESM(require("react"));
1182
1420
  var import_jsx_runtime11 = require("react/jsx-runtime");
1183
1421
  var DeleteWorkflowType = ({
1184
1422
  isOpen,
@@ -1215,7 +1453,7 @@ var DeleteWorkflowType = ({
1215
1453
  var DeleteWorkflowType_default = DeleteWorkflowType;
1216
1454
 
1217
1455
  // src/components/workflow-type/EditWorkflowType.jsx
1218
- var import_react13 = __toESM(require("react"));
1456
+ var import_react12 = __toESM(require("react"));
1219
1457
  var import_jsx_runtime12 = require("react/jsx-runtime");
1220
1458
  var EditWorkflowType = ({
1221
1459
  isOpen,
@@ -1223,13 +1461,13 @@ var EditWorkflowType = ({
1223
1461
  onSave,
1224
1462
  selectedData
1225
1463
  }) => {
1226
- const [formData, setFormData] = (0, import_react13.useState)({
1464
+ const [formData, setFormData] = (0, import_react12.useState)({
1227
1465
  workflowTypeCode: "",
1228
1466
  workflowTypeName: "",
1229
1467
  description: "",
1230
1468
  isActive: true
1231
1469
  });
1232
- (0, import_react13.useEffect)(() => {
1470
+ (0, import_react12.useEffect)(() => {
1233
1471
  var _a, _b;
1234
1472
  if (selectedData) {
1235
1473
  setFormData({
@@ -1552,15 +1790,15 @@ function WorkflowTypeTable({
1552
1790
  updatedOn: "2026-01-29",
1553
1791
  updatedBy: "Officer"
1554
1792
  }];
1555
- const [data, setData] = (0, import_react14.useState)(apiData || initialData);
1556
- (0, import_react14.useEffect)(() => {
1793
+ const [data, setData] = (0, import_react13.useState)(apiData || initialData);
1794
+ (0, import_react13.useEffect)(() => {
1557
1795
  if (apiData) setData(apiData);
1558
1796
  }, [apiData]);
1559
- const [sortOrder, setSortOrder] = (0, import_react14.useState)("asc");
1560
- const [sortKey, setSortKey] = (0, import_react14.useState)("workflowTypeId");
1561
- const [selectedItem, setSelectedItem] = (0, import_react14.useState)(null);
1562
- const [isEditOpen, setIsEditOpen] = (0, import_react14.useState)(false);
1563
- const [isDeleteOpen, setIsDeleteOpen] = (0, import_react14.useState)(false);
1797
+ const [sortOrder, setSortOrder] = (0, import_react13.useState)("asc");
1798
+ const [sortKey, setSortKey] = (0, import_react13.useState)("workflowTypeId");
1799
+ const [selectedItem, setSelectedItem] = (0, import_react13.useState)(null);
1800
+ const [isEditOpen, setIsEditOpen] = (0, import_react13.useState)(false);
1801
+ const [isDeleteOpen, setIsDeleteOpen] = (0, import_react13.useState)(false);
1564
1802
  const handleSort = (columnKey) => {
1565
1803
  const isAsc = sortKey === columnKey && sortOrder === "asc";
1566
1804
  setSortOrder(isAsc ? "desc" : "asc");
@@ -1576,7 +1814,7 @@ function WorkflowTypeTable({
1576
1814
  const query = (searchQuery || "").toLowerCase();
1577
1815
  return item.workflowTypeName.toLowerCase().includes(query) || item.workflowTypeCode.toLowerCase().includes(query) || item.description.toLowerCase().includes(query);
1578
1816
  });
1579
- (0, import_react14.useEffect)(() => {
1817
+ (0, import_react13.useEffect)(() => {
1580
1818
  if (setTotalEntries) setTotalEntries(filteredData.length);
1581
1819
  }, [filteredData.length, setTotalEntries]);
1582
1820
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -1662,8 +1900,8 @@ function WorkflowTypeTable({
1662
1900
  }
1663
1901
 
1664
1902
  // src/components/workflow-type/AddWorkflowTypeModal.jsx
1665
- var import_react15 = __toESM(require("react"));
1666
- var import_sweetalert22 = __toESM(require("sweetalert2"));
1903
+ var import_react14 = __toESM(require("react"));
1904
+ var import_sweetalert24 = __toESM(require("sweetalert2"));
1667
1905
  var import_jsx_runtime14 = require("react/jsx-runtime");
1668
1906
  var initialFormData = {
1669
1907
  workflowTypeCode: "",
@@ -1672,12 +1910,12 @@ var initialFormData = {
1672
1910
  createdBy: ""
1673
1911
  };
1674
1912
  var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1675
- const [formData, setFormData] = (0, import_react15.useState)(__spreadProps(__spreadValues({}, initialFormData), {
1913
+ const [formData, setFormData] = (0, import_react14.useState)(__spreadProps(__spreadValues({}, initialFormData), {
1676
1914
  createdBy
1677
1915
  }));
1678
- const [errors, setErrors] = (0, import_react15.useState)({});
1679
- const [isSubmitting, setIsSubmitting] = (0, import_react15.useState)(false);
1680
- const [submitError, setSubmitError] = (0, import_react15.useState)("");
1916
+ const [errors, setErrors] = (0, import_react14.useState)({});
1917
+ const [isSubmitting, setIsSubmitting] = (0, import_react14.useState)(false);
1918
+ const [submitError, setSubmitError] = (0, import_react14.useState)("");
1681
1919
  const handleChange = ({ target: { name, value } }) => {
1682
1920
  if (name === "description" && value.length > 500) return;
1683
1921
  setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [name]: value }));
@@ -1719,7 +1957,7 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1719
1957
  } catch (error) {
1720
1958
  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.";
1721
1959
  setSubmitError(message);
1722
- await import_sweetalert22.default.fire("Error", message, "error");
1960
+ await import_sweetalert24.default.fire("Error", message, "error");
1723
1961
  } finally {
1724
1962
  setIsSubmitting(false);
1725
1963
  }
@@ -1735,10 +1973,10 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1735
1973
  ] }),
1736
1974
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("form", { onSubmit: handleSubmit, className: "fc:space-y-4 fc:p-6", children: [
1737
1975
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [
1738
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Workflow Type Code", required: true, error: errors.workflowTypeCode, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, placeholder: "e.g. PETITION", className: inputClass(errors.workflowTypeCode) }) }),
1739
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Workflow Type Name", required: true, error: errors.workflowTypeName, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, placeholder: "Enter workflow type name", className: inputClass(errors.workflowTypeName) }) })
1976
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Workflow Type Code", required: true, error: errors.workflowTypeCode, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, placeholder: "e.g. PETITION", className: inputClass3(errors.workflowTypeCode) }) }),
1977
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Workflow Type Name", required: true, error: errors.workflowTypeName, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, placeholder: "Enter workflow type name", className: inputClass3(errors.workflowTypeName) }) })
1740
1978
  ] }),
1741
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Created By", required: true, error: errors.createdBy, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "createdBy", value: formData.createdBy, onChange: handleChange, placeholder: "Enter user name or ID", className: inputClass(errors.createdBy) }) }),
1979
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Created By", required: true, error: errors.createdBy, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "createdBy", value: formData.createdBy, onChange: handleChange, placeholder: "Enter user name or ID", className: inputClass3(errors.createdBy) }) }),
1742
1980
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Description", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:relative", children: [
1743
1981
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("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" }),
1744
1982
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fc:absolute fc:bottom-2 fc:right-3 fc:text-xs fc:text-gray-400", children: [
@@ -1754,7 +1992,7 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1754
1992
  ] })
1755
1993
  ] }) });
1756
1994
  };
1757
- 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"}`;
1995
+ 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"}`;
1758
1996
  var FormField = ({ label, required, error, children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700", children: [
1759
1997
  label,
1760
1998
  " ",
@@ -1767,7 +2005,7 @@ var AddWorkflowTypeModal_default = AddWorkflowTypeModal;
1767
2005
  // src/components/workflow-type/WorkflowTypeMains.js
1768
2006
  var import_jsx_runtime15 = require("react/jsx-runtime");
1769
2007
  function WorkflowTypeMains() {
1770
- const [refreshkey, setRefreshKey] = (0, import_react16.useState)(0);
2008
+ const [refreshkey, setRefreshKey] = (0, import_react15.useState)(0);
1771
2009
  const handleRefresh = () => {
1772
2010
  console.log("Table data refreshed!");
1773
2011
  setRefreshKey((prev) => prev + 1);
@@ -1778,28 +2016,28 @@ function WorkflowTypeMains() {
1778
2016
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
1779
2017
  if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
1780
2018
  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" });
1781
- await import_sweetalert23.default.fire("Success", "Workflow type updated successfully.", "success");
2019
+ await import_sweetalert25.default.fire("Success", "Workflow type updated successfully.", "success");
1782
2020
  handleRefresh();
1783
2021
  return true;
1784
2022
  } catch (error) {
1785
- await import_sweetalert23.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to update workflow type.", "error");
2023
+ await import_sweetalert25.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to update workflow type.", "error");
1786
2024
  return false;
1787
2025
  }
1788
2026
  };
1789
2027
  const handleDeleteApi = async (item) => {
1790
2028
  return handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
1791
2029
  };
1792
- const tableRef = (0, import_react16.useRef)(null);
1793
- const [modalOpen, setModalOpen] = (0, import_react16.useState)(false);
1794
- const [pageSize, setPageSize] = (0, import_react16.useState)(10);
1795
- const [searchQuery, setSearchQuery] = (0, import_react16.useState)("");
1796
- const [currentPage, setCurrentPage] = (0, import_react16.useState)(1);
1797
- const [totalEntries, setTotalEntries] = (0, import_react16.useState)(0);
1798
- const [isEditOpen, setIsEditOpen] = (0, import_react16.useState)(false);
1799
- const [isDeleteOpen, setIsDeleteOpen] = (0, import_react16.useState)(false);
1800
- const [selectedItem, setSelectedItem] = (0, import_react16.useState)(null);
1801
- const [apiData, setApiData] = (0, import_react16.useState)([]);
1802
- (0, import_react16.useEffect)(() => {
2030
+ const tableRef = (0, import_react15.useRef)(null);
2031
+ const [modalOpen, setModalOpen] = (0, import_react15.useState)(false);
2032
+ const [pageSize, setPageSize] = (0, import_react15.useState)(10);
2033
+ const [searchQuery, setSearchQuery] = (0, import_react15.useState)("");
2034
+ const [currentPage, setCurrentPage] = (0, import_react15.useState)(1);
2035
+ const [totalEntries, setTotalEntries] = (0, import_react15.useState)(0);
2036
+ const [isEditOpen, setIsEditOpen] = (0, import_react15.useState)(false);
2037
+ const [isDeleteOpen, setIsDeleteOpen] = (0, import_react15.useState)(false);
2038
+ const [selectedItem, setSelectedItem] = (0, import_react15.useState)(null);
2039
+ const [apiData, setApiData] = (0, import_react15.useState)([]);
2040
+ (0, import_react15.useEffect)(() => {
1803
2041
  (async () => {
1804
2042
  var _a, _b, _c, _d, _e, _f, _g;
1805
2043
  try {
@@ -1809,7 +2047,7 @@ function WorkflowTypeMains() {
1809
2047
  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;
1810
2048
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
1811
2049
  } catch (error) {
1812
- await import_sweetalert23.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load workflow types.", "error");
2050
+ await import_sweetalert25.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load workflow types.", "error");
1813
2051
  }
1814
2052
  })();
1815
2053
  }, [refreshkey]);
@@ -1862,7 +2100,7 @@ function WorkflowTypeMains() {
1862
2100
  ] })
1863
2101
  ] }) }),
1864
2102
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: async () => {
1865
- await import_sweetalert23.default.fire("Success", "Workflow type created successfully.", "success");
2103
+ await import_sweetalert25.default.fire("Success", "Workflow type created successfully.", "success");
1866
2104
  handleRefresh();
1867
2105
  } }),
1868
2106
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleUpdateApi, selectedData: selectedItem }),
@@ -1871,10 +2109,10 @@ function WorkflowTypeMains() {
1871
2109
  }
1872
2110
 
1873
2111
  // src/components/WorkflowStep/main.js
1874
- var import_react19 = __toESM(require("react"));
2112
+ var import_react18 = __toESM(require("react"));
1875
2113
 
1876
2114
  // src/components/Common/footer.js
1877
- var import_react17 = __toESM(require("react"));
2115
+ var import_react16 = __toESM(require("react"));
1878
2116
  var import_jsx_runtime16 = require("react/jsx-runtime");
1879
2117
  function Footer() {
1880
2118
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:px-6 fc:py-4 fc:sticky fc:bottom-0 fc:z-10 fc:border-t fc:border-gray-200 fc:rounded-xl fc:bg-slate-50/50 fc:shadow-md", children: [
@@ -1894,10 +2132,10 @@ function Footer() {
1894
2132
  var import_link2 = __toESM(require("next/link"));
1895
2133
 
1896
2134
  // src/components/WorkflowStep/AddWorkflowStepModal.js
1897
- var import_react18 = __toESM(require("react"));
2135
+ var import_react17 = __toESM(require("react"));
1898
2136
  var import_jsx_runtime17 = require("react/jsx-runtime");
1899
2137
  function AddWorkflowStepModal({ onClose }) {
1900
- const [formData, setFormData] = (0, import_react18.useState)({
2138
+ const [formData, setFormData] = (0, import_react17.useState)({
1901
2139
  workflow: "",
1902
2140
  stepCode: "",
1903
2141
  stepName: "",
@@ -1910,7 +2148,7 @@ function AddWorkflowStepModal({ onClose }) {
1910
2148
  excludeHolidays: true,
1911
2149
  status: "active"
1912
2150
  });
1913
- const [errors, setErrors] = (0, import_react18.useState)({});
2151
+ const [errors, setErrors] = (0, import_react17.useState)({});
1914
2152
  const handleChange = (field, value) => {
1915
2153
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), { [field]: value }));
1916
2154
  if (errors[field]) {
@@ -2386,10 +2624,10 @@ function WorkflowStep() {
2386
2624
  const handleDownload = () => {
2387
2625
  console.log("Download clicked");
2388
2626
  };
2389
- const tableRef = (0, import_react19.useRef)(null);
2390
- const [showModal, setShowModal] = (0, import_react19.useState)(false);
2391
- const [pageSize, setPageSize] = (0, import_react19.useState)(5);
2392
- const [sortConfig, setSortConfig] = (0, import_react19.useState)({
2627
+ const tableRef = (0, import_react18.useRef)(null);
2628
+ const [showModal, setShowModal] = (0, import_react18.useState)(false);
2629
+ const [pageSize, setPageSize] = (0, import_react18.useState)(5);
2630
+ const [sortConfig, setSortConfig] = (0, import_react18.useState)({
2393
2631
  key: "",
2394
2632
  direction: "asc"
2395
2633
  });
@@ -2491,14 +2729,14 @@ function WorkflowStep() {
2491
2729
  }
2492
2730
 
2493
2731
  // src/components/WorkFlowTransition/Transitiontable.js
2494
- var import_react21 = __toESM(require("react"));
2732
+ var import_react20 = __toESM(require("react"));
2495
2733
  var import_link3 = __toESM(require("next/link"));
2496
2734
 
2497
2735
  // src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
2498
- var import_react20 = __toESM(require("react"));
2736
+ var import_react19 = __toESM(require("react"));
2499
2737
  var import_jsx_runtime19 = require("react/jsx-runtime");
2500
2738
  function AddWorkTransitionStepModal({ onClose, onSubmit }) {
2501
- const [formData, setFormData] = (0, import_react20.useState)({
2739
+ const [formData, setFormData] = (0, import_react19.useState)({
2502
2740
  workflow: "",
2503
2741
  fromStep: "",
2504
2742
  toStep: "",
@@ -2509,7 +2747,7 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
2509
2747
  requireComment: false,
2510
2748
  status: "active"
2511
2749
  });
2512
- const [errors, setErrors] = (0, import_react20.useState)({});
2750
+ const [errors, setErrors] = (0, import_react19.useState)({});
2513
2751
  const validateForm = () => {
2514
2752
  const newErrors = {};
2515
2753
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -2940,10 +3178,10 @@ function WorkFlowTransition() {
2940
3178
  const handleDownload = () => {
2941
3179
  console.log("Download clicked");
2942
3180
  };
2943
- const tableRef = (0, import_react21.useRef)(null);
2944
- const [showModal, setShowModal] = (0, import_react21.useState)(false);
2945
- const [pageSize, setPageSize] = (0, import_react21.useState)(5);
2946
- const [sortConfig, setSortConfig] = (0, import_react21.useState)({
3181
+ const tableRef = (0, import_react20.useRef)(null);
3182
+ const [showModal, setShowModal] = (0, import_react20.useState)(false);
3183
+ const [pageSize, setPageSize] = (0, import_react20.useState)(5);
3184
+ const [sortConfig, setSortConfig] = (0, import_react20.useState)({
2947
3185
  key: "",
2948
3186
  direction: "asc"
2949
3187
  });
@@ -3032,15 +3270,27 @@ function WorkFlowTransition() {
3032
3270
  }
3033
3271
 
3034
3272
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3035
- var import_react27 = __toESM(require("react"));
3273
+ var import_react26 = __toESM(require("react"));
3274
+ var import_sweetalert26 = __toESM(require("sweetalert2"));
3036
3275
 
3037
3276
  // src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
3038
- var import_react22 = __toESM(require("react"));
3277
+ var import_react21 = __toESM(require("react"));
3039
3278
  var import_jsx_runtime21 = require("react/jsx-runtime");
3040
3279
  function AddUserHierarchyNodeMappingModal({
3041
3280
  isOpen,
3042
- onClose
3281
+ onClose,
3282
+ onSave
3043
3283
  }) {
3284
+ const [formData, setFormData] = (0, import_react21.useState)({ mappingId: "", externalUserId: "", hierarchyNodeId: "", roleCode: "", isPrimary: "", effectiveFrom: "", effectiveTo: "" });
3285
+ const [isSubmitting, setIsSubmitting] = (0, import_react21.useState)(false);
3286
+ const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [event.target.name]: event.target.value }));
3287
+ const handleSave = async () => {
3288
+ if (!onSave) return;
3289
+ setIsSubmitting(true);
3290
+ 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" });
3291
+ setIsSubmitting(false);
3292
+ if (success) onClose();
3293
+ };
3044
3294
  if (!isOpen) return null;
3045
3295
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
3046
3296
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
@@ -3067,7 +3317,7 @@ function AddUserHierarchyNodeMappingModal({
3067
3317
  "Mapping ID ",
3068
3318
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
3069
3319
  ] }),
3070
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3320
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3071
3321
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the unique mapping ID" })
3072
3322
  ] }),
3073
3323
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
@@ -3075,7 +3325,7 @@ function AddUserHierarchyNodeMappingModal({
3075
3325
  "External User ID ",
3076
3326
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
3077
3327
  ] }),
3078
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3328
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3079
3329
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the consumer user ID" })
3080
3330
  ] })
3081
3331
  ] }),
@@ -3084,7 +3334,7 @@ function AddUserHierarchyNodeMappingModal({
3084
3334
  "Hierarchy Node ID ",
3085
3335
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
3086
3336
  ] }),
3087
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3337
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3088
3338
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the hierarchy node assigned to the user" })
3089
3339
  ] }),
3090
3340
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-5", children: [
@@ -3093,7 +3343,7 @@ function AddUserHierarchyNodeMappingModal({
3093
3343
  "Role Code ",
3094
3344
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
3095
3345
  ] }),
3096
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3346
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3097
3347
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Enter the user role code, for example DEO or RO" })
3098
3348
  ] }),
3099
3349
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
@@ -3101,7 +3351,7 @@ function AddUserHierarchyNodeMappingModal({
3101
3351
  "Is Primary ",
3102
3352
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
3103
3353
  ] }),
3104
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("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: [
3354
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("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: [
3105
3355
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "Select primary status" }),
3106
3356
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "true", children: "Yes" }),
3107
3357
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "false", children: "No" })
@@ -3121,12 +3371,12 @@ function AddUserHierarchyNodeMappingModal({
3121
3371
  "Effective From ",
3122
3372
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
3123
3373
  ] }),
3124
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3374
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3125
3375
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Select the date from which this mapping is effective" })
3126
3376
  ] }),
3127
3377
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3128
3378
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: "Effective To" }),
3129
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3379
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3130
3380
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400 fc:mt-1", children: "Select the date until which this mapping is effective" })
3131
3381
  ] })
3132
3382
  ] })
@@ -3134,14 +3384,14 @@ function AddUserHierarchyNodeMappingModal({
3134
3384
  ] }),
3135
3385
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:p-5 fc:bg-white fc:border-t fc:border-slate-100 fc:flex fc:items-center fc:justify-end fc:gap-3 fc:px-8", children: [
3136
3386
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" }),
3137
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" })
3387
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("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" })
3138
3388
  ] })
3139
3389
  ] })
3140
3390
  ] });
3141
3391
  }
3142
3392
 
3143
3393
  // src/components/user-hierarchy-node-mapping/searchbar.jsx
3144
- var import_react23 = __toESM(require("react"));
3394
+ var import_react22 = __toESM(require("react"));
3145
3395
  var import_jsx_runtime22 = require("react/jsx-runtime");
3146
3396
  function MappingSearchBar({
3147
3397
  searchQuery,
@@ -3165,10 +3415,10 @@ function MappingSearchBar({
3165
3415
  }
3166
3416
 
3167
3417
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
3168
- var import_react26 = __toESM(require("react"));
3418
+ var import_react25 = __toESM(require("react"));
3169
3419
 
3170
3420
  // src/components/user-hierarchy-node-mapping/edit-mapping.jsx
3171
- var import_react24 = __toESM(require("react"));
3421
+ var import_react23 = __toESM(require("react"));
3172
3422
  var import_jsx_runtime23 = require("react/jsx-runtime");
3173
3423
  function EditUserHierarchyNodeMappingModal({
3174
3424
  isOpen,
@@ -3176,14 +3426,14 @@ function EditUserHierarchyNodeMappingModal({
3176
3426
  selectedMapping,
3177
3427
  onSave
3178
3428
  }) {
3179
- const [formData, setFormData] = (0, import_react24.useState)({
3429
+ const [formData, setFormData] = (0, import_react23.useState)({
3180
3430
  hierarchyNodeId: "",
3181
3431
  roleCode: "",
3182
3432
  isPrimary: "",
3183
3433
  effectiveFrom: "",
3184
3434
  effectiveTo: ""
3185
3435
  });
3186
- (0, import_react24.useEffect)(() => {
3436
+ (0, import_react23.useEffect)(() => {
3187
3437
  if (selectedMapping) {
3188
3438
  setFormData({
3189
3439
  hierarchyNodeId: selectedMapping.hierarchyNodeId || "",
@@ -3201,14 +3451,23 @@ function EditUserHierarchyNodeMappingModal({
3201
3451
  [name]: value
3202
3452
  }));
3203
3453
  };
3204
- const handleSubmit = (event) => {
3454
+ const handleSubmit = async (event) => {
3455
+ var _a, _b, _c;
3205
3456
  event.preventDefault();
3206
3457
  if (onSave) {
3207
- onSave(__spreadProps(__spreadValues(__spreadValues({}, selectedMapping), formData), {
3208
- isPrimary: formData.isPrimary === "true"
3209
- }));
3458
+ const success = await onSave({
3459
+ mappingId: Number((_a = selectedMapping.mappingId) != null ? _a : selectedMapping.id),
3460
+ externalUserId: Number(selectedMapping.externalUserId),
3461
+ hierarchyNodeId: Number(formData.hierarchyNodeId),
3462
+ roleCode: formData.roleCode,
3463
+ isPrimary: formData.isPrimary === "true",
3464
+ effectiveFrom: formData.effectiveFrom,
3465
+ effectiveTo: formData.effectiveTo || null,
3466
+ isActive: (_c = (_b = selectedMapping.isActive) != null ? _b : selectedMapping.status) != null ? _c : true,
3467
+ updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
3468
+ });
3469
+ if (success) onClose();
3210
3470
  }
3211
- onClose();
3212
3471
  };
3213
3472
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
3214
3473
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
@@ -3364,7 +3623,7 @@ function EditUserHierarchyNodeMappingModal({
3364
3623
  }
3365
3624
 
3366
3625
  // src/components/user-hierarchy-node-mapping/delete-mapping.jsx
3367
- var import_react25 = __toESM(require("react"));
3626
+ var import_react24 = __toESM(require("react"));
3368
3627
  var import_jsx_runtime24 = require("react/jsx-runtime");
3369
3628
  function DeleteUserHierarchyNodeMappingModal({
3370
3629
  isOpen,
@@ -3378,300 +3637,55 @@ function DeleteUserHierarchyNodeMappingModal({
3378
3637
  "div",
3379
3638
  {
3380
3639
  className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm",
3381
- onClick: onClose
3382
- }
3383
- ),
3384
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:relative fc:z-10 fc:w-full fc:max-w-md fc:rounded-3xl fc:bg-white fc:shadow-2xl fc:overflow-hidden", children: [
3385
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:flex fc:flex-col fc:items-center fc:px-8 fc:pt-8 fc:pb-4", children: [
3386
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fc:flex fc:h-16 fc:w-16 fc:items-center fc:justify-center fc:rounded-full fc:bg-red-100", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fc:text-3xl fc:text-red-600", children: "\u26A0\uFE0F" }) }),
3387
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "fc:mt-5 fc:text-2xl fc:font-bold fc:text-slate-800", children: "Are you sure?" }),
3388
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "fc:mt-2 fc:text-center fc:text-sm fc:text-slate-500", children: "You are about to delete this User Hierarchy Node Mapping. This action cannot be undone." })
3389
- ] }),
3390
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:flex fc:justify-center fc:gap-4 fc:px-8 fc:pb-8 fc:pt-4", children: [
3391
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3392
- "button",
3393
- {
3394
- onClick: onClose,
3395
- className: "fcp:x-6 fc:py-2.5 fc:rounded-xl fc:border fc:border-slate-200 fc:text-slate-600 fc:font-semibold fc:hover:bg-slate-50",
3396
- children: "Cancel"
3397
- }
3398
- ),
3399
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3400
- "button",
3401
- {
3402
- onClick: onDelete,
3403
- className: "fc:px-6 fc:py-2.5 fc:rounded-xl fc:bg-red-600 fc:text-white fc:font-semibold fc:hover:bg-red-700",
3404
- children: "Yes, Delete"
3405
- }
3406
- )
3407
- ] })
3408
- ] })
3409
- ] });
3410
- }
3411
-
3412
- // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
3413
- var import_jsx_runtime25 = require("react/jsx-runtime");
3414
- function UserHierarchyNodeMappingTable({
3415
- pageSize,
3416
- searchQuery = "",
3417
- currentPage,
3418
- setCurrentPage,
3419
- setTotalEntries
3420
- }) {
3421
- const initialData = [{
3422
- id: 1,
3423
- mappingId: 1,
3424
- externalUserId: 101,
3425
- hierarchyNodeId: 2,
3426
- roleCode: "DEO",
3427
- isPrimary: true,
3428
- effectiveFrom: "2026-01-01",
3429
- effectiveTo: "",
3430
- status: true
3431
- }, {
3432
- id: 2,
3433
- mappingId: 2,
3434
- externalUserId: 101,
3435
- hierarchyNodeId: 3,
3436
- roleCode: "RO",
3437
- isPrimary: false,
3438
- effectiveFrom: "2026-01-01",
3439
- effectiveTo: "",
3440
- status: false
3441
- }, {
3442
- id: 3,
3443
- mappingId: 3,
3444
- externalUserId: 102,
3445
- hierarchyNodeId: 4,
3446
- roleCode: "AO",
3447
- isPrimary: true,
3448
- effectiveFrom: "2026-01-03",
3449
- effectiveTo: "",
3450
- status: true
3451
- }, {
3452
- id: 4,
3453
- mappingId: 4,
3454
- externalUserId: 103,
3455
- hierarchyNodeId: 5,
3456
- roleCode: "SO",
3457
- isPrimary: false,
3458
- effectiveFrom: "2026-01-05",
3459
- effectiveTo: "2026-12-31",
3460
- status: false
3461
- }, {
3462
- id: 5,
3463
- mappingId: 5,
3464
- externalUserId: 104,
3465
- hierarchyNodeId: 6,
3466
- roleCode: "DEO",
3467
- isPrimary: true,
3468
- effectiveFrom: "2026-01-07",
3469
- effectiveTo: "",
3470
- status: true
3471
- }, {
3472
- id: 6,
3473
- mappingId: 6,
3474
- externalUserId: 105,
3475
- hierarchyNodeId: 7,
3476
- roleCode: "RO",
3477
- isPrimary: false,
3478
- effectiveFrom: "2026-01-09",
3479
- effectiveTo: "",
3480
- status: false
3481
- }, {
3482
- id: 7,
3483
- mappingId: 7,
3484
- externalUserId: 106,
3485
- hierarchyNodeId: 8,
3486
- roleCode: "AO",
3487
- isPrimary: true,
3488
- effectiveFrom: "2026-01-11",
3489
- effectiveTo: "",
3490
- status: true
3491
- }, {
3492
- id: 8,
3493
- mappingId: 8,
3494
- externalUserId: 107,
3495
- hierarchyNodeId: 9,
3496
- roleCode: "SO",
3497
- isPrimary: false,
3498
- effectiveFrom: "2026-01-13",
3499
- effectiveTo: "2026-09-30",
3500
- status: false
3501
- }, {
3502
- id: 9,
3503
- mappingId: 9,
3504
- externalUserId: 108,
3505
- hierarchyNodeId: 10,
3506
- roleCode: "DEO",
3507
- isPrimary: true,
3508
- effectiveFrom: "2026-01-15",
3509
- effectiveTo: "",
3510
- status: true
3511
- }, {
3512
- id: 10,
3513
- mappingId: 10,
3514
- externalUserId: 109,
3515
- hierarchyNodeId: 11,
3516
- roleCode: "RO",
3517
- isPrimary: false,
3518
- effectiveFrom: "2026-01-17",
3519
- effectiveTo: "",
3520
- status: false
3521
- }, {
3522
- id: 11,
3523
- mappingId: 11,
3524
- externalUserId: 110,
3525
- hierarchyNodeId: 12,
3526
- roleCode: "AO",
3527
- isPrimary: true,
3528
- effectiveFrom: "2026-01-19",
3529
- effectiveTo: "",
3530
- status: true
3531
- }, {
3532
- id: 12,
3533
- mappingId: 12,
3534
- externalUserId: 111,
3535
- hierarchyNodeId: 13,
3536
- roleCode: "SO",
3537
- isPrimary: false,
3538
- effectiveFrom: "2026-01-21",
3539
- effectiveTo: "2026-10-31",
3540
- status: false
3541
- }, {
3542
- id: 13,
3543
- mappingId: 13,
3544
- externalUserId: 112,
3545
- hierarchyNodeId: 14,
3546
- roleCode: "DEO",
3547
- isPrimary: true,
3548
- effectiveFrom: "2026-01-23",
3549
- effectiveTo: "",
3550
- status: true
3551
- }, {
3552
- id: 14,
3553
- mappingId: 14,
3554
- externalUserId: 113,
3555
- hierarchyNodeId: 15,
3556
- roleCode: "RO",
3557
- isPrimary: false,
3558
- effectiveFrom: "2026-01-25",
3559
- effectiveTo: "",
3560
- status: false
3561
- }, {
3562
- id: 15,
3563
- mappingId: 15,
3564
- externalUserId: 114,
3565
- hierarchyNodeId: 16,
3566
- roleCode: "AO",
3567
- isPrimary: true,
3568
- effectiveFrom: "2026-01-27",
3569
- effectiveTo: "",
3570
- status: true
3571
- }, {
3572
- id: 16,
3573
- mappingId: 16,
3574
- externalUserId: 115,
3575
- hierarchyNodeId: 17,
3576
- roleCode: "SO",
3577
- isPrimary: false,
3578
- effectiveFrom: "2026-01-29",
3579
- effectiveTo: "2026-11-30",
3580
- status: false
3581
- }, {
3582
- id: 17,
3583
- mappingId: 17,
3584
- externalUserId: 116,
3585
- hierarchyNodeId: 18,
3586
- roleCode: "DEO",
3587
- isPrimary: true,
3588
- effectiveFrom: "2026-02-01",
3589
- effectiveTo: "",
3590
- status: true
3591
- }, {
3592
- id: 18,
3593
- mappingId: 18,
3594
- externalUserId: 117,
3595
- hierarchyNodeId: 19,
3596
- roleCode: "RO",
3597
- isPrimary: false,
3598
- effectiveFrom: "2026-02-03",
3599
- effectiveTo: "",
3600
- status: false
3601
- }, {
3602
- id: 19,
3603
- mappingId: 19,
3604
- externalUserId: 118,
3605
- hierarchyNodeId: 20,
3606
- roleCode: "AO",
3607
- isPrimary: true,
3608
- effectiveFrom: "2026-02-05",
3609
- effectiveTo: "",
3610
- status: true
3611
- }, {
3612
- id: 20,
3613
- mappingId: 20,
3614
- externalUserId: 119,
3615
- hierarchyNodeId: 21,
3616
- roleCode: "SO",
3617
- isPrimary: false,
3618
- effectiveFrom: "2026-02-07",
3619
- effectiveTo: "2026-12-31",
3620
- status: false
3621
- }, {
3622
- id: 21,
3623
- mappingId: 21,
3624
- externalUserId: 120,
3625
- hierarchyNodeId: 22,
3626
- roleCode: "DEO",
3627
- isPrimary: true,
3628
- effectiveFrom: "2026-02-09",
3629
- effectiveTo: "",
3630
- status: true
3631
- }, {
3632
- id: 22,
3633
- mappingId: 22,
3634
- externalUserId: 121,
3635
- hierarchyNodeId: 23,
3636
- roleCode: "RO",
3637
- isPrimary: false,
3638
- effectiveFrom: "2026-02-11",
3639
- effectiveTo: "",
3640
- status: false
3641
- }, {
3642
- id: 23,
3643
- mappingId: 23,
3644
- externalUserId: 122,
3645
- hierarchyNodeId: 24,
3646
- roleCode: "AO",
3647
- isPrimary: true,
3648
- effectiveFrom: "2026-02-13",
3649
- effectiveTo: "",
3650
- status: true
3651
- }, {
3652
- id: 24,
3653
- mappingId: 24,
3654
- externalUserId: 123,
3655
- hierarchyNodeId: 25,
3656
- roleCode: "SO",
3657
- isPrimary: false,
3658
- effectiveFrom: "2026-02-15",
3659
- effectiveTo: "2026-08-31",
3660
- status: false
3661
- }, {
3662
- id: 25,
3663
- mappingId: 25,
3664
- externalUserId: 124,
3665
- hierarchyNodeId: 26,
3666
- roleCode: "DEO",
3667
- isPrimary: true,
3668
- effectiveFrom: "2026-02-17",
3669
- effectiveTo: "",
3670
- status: true
3671
- }];
3672
- const [data, setData] = (0, import_react26.useState)(initialData);
3673
- const [sortOrder, setSortOrder] = (0, import_react26.useState)("asc");
3674
- const [sortKey, setSortKey] = (0, import_react26.useState)("mappingId");
3640
+ onClick: onClose
3641
+ }
3642
+ ),
3643
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:relative fc:z-10 fc:w-full fc:max-w-md fc:rounded-3xl fc:bg-white fc:shadow-2xl fc:overflow-hidden", children: [
3644
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:flex fc:flex-col fc:items-center fc:px-8 fc:pt-8 fc:pb-4", children: [
3645
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fc:flex fc:h-16 fc:w-16 fc:items-center fc:justify-center fc:rounded-full fc:bg-red-100", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fc:text-3xl fc:text-red-600", children: "\u26A0\uFE0F" }) }),
3646
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "fc:mt-5 fc:text-2xl fc:font-bold fc:text-slate-800", children: "Are you sure?" }),
3647
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "fc:mt-2 fc:text-center fc:text-sm fc:text-slate-500", children: "You are about to delete this User Hierarchy Node Mapping. This action cannot be undone." })
3648
+ ] }),
3649
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:flex fc:justify-center fc:gap-4 fc:px-8 fc:pb-8 fc:pt-4", children: [
3650
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3651
+ "button",
3652
+ {
3653
+ onClick: onClose,
3654
+ className: "fcp:x-6 fc:py-2.5 fc:rounded-xl fc:border fc:border-slate-200 fc:text-slate-600 fc:font-semibold fc:hover:bg-slate-50",
3655
+ children: "Cancel"
3656
+ }
3657
+ ),
3658
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3659
+ "button",
3660
+ {
3661
+ onClick: onDelete,
3662
+ className: "fc:px-6 fc:py-2.5 fc:rounded-xl fc:bg-red-600 fc:text-white fc:font-semibold fc:hover:bg-red-700",
3663
+ children: "Yes, Delete"
3664
+ }
3665
+ )
3666
+ ] })
3667
+ ] })
3668
+ ] });
3669
+ }
3670
+
3671
+ // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
3672
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3673
+ function UserHierarchyNodeMappingTable({
3674
+ apiData,
3675
+ pageSize,
3676
+ searchQuery = "",
3677
+ currentPage,
3678
+ setCurrentPage,
3679
+ setTotalEntries,
3680
+ onUpdate,
3681
+ onDelete
3682
+ }) {
3683
+ const [data, setData] = (0, import_react25.useState)(apiData || []);
3684
+ (0, import_react25.useEffect)(() => {
3685
+ setData(apiData || []);
3686
+ }, [apiData]);
3687
+ const [sortOrder, setSortOrder] = (0, import_react25.useState)("asc");
3688
+ const [sortKey, setSortKey] = (0, import_react25.useState)("mappingId");
3675
3689
  const handleSort = (columnKey) => {
3676
3690
  const isAsc = sortKey === columnKey && sortOrder === "asc";
3677
3691
  setSortOrder(isAsc ? "desc" : "asc");
@@ -3687,7 +3701,7 @@ function UserHierarchyNodeMappingTable({
3687
3701
  const query = (searchQuery || "").toLowerCase();
3688
3702
  return String(item.mappingId).toLowerCase().includes(query) || String(item.externalUserId).toLowerCase().includes(query) || String(item.hierarchyNodeId).toLowerCase().includes(query) || item.roleCode.toLowerCase().includes(query);
3689
3703
  });
3690
- (0, import_react26.useEffect)(() => {
3704
+ (0, import_react25.useEffect)(() => {
3691
3705
  if (setTotalEntries) setTotalEntries(filteredData.length);
3692
3706
  }, [filteredData.length, setTotalEntries]);
3693
3707
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -3696,9 +3710,9 @@ function UserHierarchyNodeMappingTable({
3696
3710
  const pageNumbers = Array.from({
3697
3711
  length: totalPages
3698
3712
  }, (_, i) => i + 1);
3699
- const [showEditPopup, setShowEditPopup] = (0, import_react26.useState)(false);
3700
- const [showDeletePopup, setShowDeletePopup] = (0, import_react26.useState)(false);
3701
- const [selectedItem, setSelectedItem] = (0, import_react26.useState)(null);
3713
+ const [showEditPopup, setShowEditPopup] = (0, import_react25.useState)(false);
3714
+ const [showDeletePopup, setShowDeletePopup] = (0, import_react25.useState)(false);
3715
+ const [selectedItem, setSelectedItem] = (0, import_react25.useState)(null);
3702
3716
  const openEditPopup = (item) => {
3703
3717
  setSelectedItem(item);
3704
3718
  setShowEditPopup(true);
@@ -3715,16 +3729,16 @@ function UserHierarchyNodeMappingTable({
3715
3729
  setShowDeletePopup(false);
3716
3730
  setSelectedItem(null);
3717
3731
  };
3718
- const handleDelete = () => {
3719
- setData(
3720
- (prev) => prev.filter((item) => item.id !== (selectedItem == null ? void 0 : selectedItem.id))
3721
- );
3722
- closeDeletePopup();
3732
+ const handleDelete = async () => {
3733
+ if (await (onDelete == null ? void 0 : onDelete(selectedItem))) closeDeletePopup();
3723
3734
  };
3724
3735
  const toggleStatus = (id) => {
3725
- setData((prev) => prev.map((item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
3726
- status: !item.status
3727
- }) : item));
3736
+ var _a, _b;
3737
+ const item = data.find((record) => {
3738
+ var _a2;
3739
+ return ((_a2 = record.mappingId) != null ? _a2 : record.id) === id;
3740
+ });
3741
+ 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" }));
3728
3742
  };
3729
3743
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fc:space-y-5", children: [
3730
3744
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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__ */ (0, import_jsx_runtime25.jsxs)("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-fixed", children: [
@@ -3756,29 +3770,35 @@ function UserHierarchyNodeMappingTable({
3756
3770
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "STATUS" }),
3757
3771
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "ACTION" })
3758
3772
  ] }) }),
3759
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-s fc:text-slate-600", children: visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
3760
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-4 fc:text-center fc:font-medium fc:text-slate-400", children: startIndex + index + 1 }),
3761
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.mappingId }),
3762
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.externalUserId }),
3763
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.hierarchyNodeId }),
3764
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.roleCode }),
3765
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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" }) }),
3766
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveFrom }),
3767
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveTo }),
3768
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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__ */ (0, import_jsx_runtime25.jsx)("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"}` }) }) }),
3769
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-2 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fc:flex fc:justify-center fc:items-center fc:gap-2", children: [
3770
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3771
- "button",
3772
- {
3773
- type: "button",
3774
- onClick: () => openEditPopup(item),
3775
- 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",
3776
- children: "Edit"
3777
- }
3778
- ),
3779
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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" })
3780
- ] }) })
3781
- ] }, item.id)) })
3773
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-s fc:text-slate-600", children: visibleData.map((item, index) => {
3774
+ var _a, _b;
3775
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
3776
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-4 fc:text-center fc:font-medium fc:text-slate-400", children: startIndex + index + 1 }),
3777
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.mappingId }),
3778
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.externalUserId }),
3779
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.hierarchyNodeId }),
3780
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.roleCode }),
3781
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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" }) }),
3782
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveFrom }),
3783
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveTo }),
3784
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { onClick: () => {
3785
+ var _a2;
3786
+ return toggleStatus((_a2 = item.mappingId) != null ? _a2 : item.id);
3787
+ }, 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__ */ (0, import_jsx_runtime25.jsx)("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"}` }) }) }),
3788
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("td", { className: "fc:py-4 fc:px-2 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fc:flex fc:justify-center fc:items-center fc:gap-2", children: [
3789
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3790
+ "button",
3791
+ {
3792
+ type: "button",
3793
+ onClick: () => openEditPopup(item),
3794
+ 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",
3795
+ children: "Edit"
3796
+ }
3797
+ ),
3798
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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" })
3799
+ ] }) })
3800
+ ] }, item.id);
3801
+ }) })
3782
3802
  ] }) }),
3783
3803
  /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
3784
3804
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)), disabled: currentPage === 1, className: "fc:px-2.5 fc:py-1 fc:text-slate-500 hover:fc:fc:text-slate-900 fc:mr-2 disabled:fc:fc:opacity-40", children: "\u2039 Prev" }),
@@ -3790,7 +3810,8 @@ function UserHierarchyNodeMappingTable({
3790
3810
  {
3791
3811
  isOpen: showEditPopup,
3792
3812
  onClose: closeEditPopup,
3793
- selectedMapping: selectedItem
3813
+ selectedMapping: selectedItem,
3814
+ onSave: (payload) => onUpdate == null ? void 0 : onUpdate(payload)
3794
3815
  }
3795
3816
  ),
3796
3817
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -3808,21 +3829,49 @@ function UserHierarchyNodeMappingTable({
3808
3829
  // src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
3809
3830
  var import_jsx_runtime26 = require("react/jsx-runtime");
3810
3831
  function User_hierarchy_mapping_main() {
3811
- const [refreshkey, setRefreshKey] = (0, import_react27.useState)(0);
3832
+ const [refreshkey, setRefreshKey] = (0, import_react26.useState)(0);
3833
+ const [apiData, setApiData] = (0, import_react26.useState)([]);
3834
+ (0, import_react26.useEffect)(() => {
3835
+ (async () => {
3836
+ var _a, _b, _c, _d, _e, _f, _g;
3837
+ try {
3838
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.userHierarchyNodeMapping) == null ? void 0 : _c.getList;
3839
+ if (!endpoint) throw new Error("User hierarchy node mapping list endpoint is not configured.");
3840
+ const result = await getApiService().post(endpoint, {});
3841
+ const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
3842
+ setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
3843
+ } catch (error) {
3844
+ await import_sweetalert26.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load user hierarchy node mappings.", "error");
3845
+ }
3846
+ })();
3847
+ }, [refreshkey]);
3812
3848
  const handleRefresh = () => {
3813
- console.log("Table data refreshed!");
3814
3849
  setRefreshKey((prev) => prev + 1);
3815
3850
  };
3816
- const tableRef = (0, import_react27.useRef)(null);
3817
- const [modalOpen, setModalOpen] = (0, import_react27.useState)(false);
3818
- const [pageSize, setPageSize] = (0, import_react27.useState)(10);
3819
- const [searchQuery, setSearchQuery] = (0, import_react27.useState)("");
3820
- const [currentPage, setCurrentPage] = (0, import_react27.useState)(1);
3821
- const [totalEntries, setTotalEntries] = (0, import_react27.useState)(0);
3851
+ const tableRef = (0, import_react26.useRef)(null);
3852
+ const [modalOpen, setModalOpen] = (0, import_react26.useState)(false);
3853
+ const [pageSize, setPageSize] = (0, import_react26.useState)(10);
3854
+ const [searchQuery, setSearchQuery] = (0, import_react26.useState)("");
3855
+ const [currentPage, setCurrentPage] = (0, import_react26.useState)(1);
3856
+ const [totalEntries, setTotalEntries] = (0, import_react26.useState)(0);
3822
3857
  const handlePageSizeChange = (e) => {
3823
3858
  setPageSize(Number(e.target.value));
3824
3859
  setCurrentPage(1);
3825
3860
  };
3861
+ const saveMapping = async (payload, isEdit = false) => {
3862
+ var _a, _b, _c, _d, _e;
3863
+ try {
3864
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.userHierarchyNodeMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
3865
+ if (!endpoint) throw new Error(`User hierarchy node mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
3866
+ await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
3867
+ await import_sweetalert26.default.fire("Success", `User hierarchy node mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
3868
+ handleRefresh();
3869
+ return true;
3870
+ } catch (error) {
3871
+ await import_sweetalert26.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} user hierarchy node mapping.`, "error");
3872
+ return false;
3873
+ }
3874
+ };
3826
3875
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "fc:min-h-screen fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
3827
3876
  /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
3828
3877
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CommonHeader, { title: "User Hierarchy Node Mapping", breadcrumbs: [{
@@ -3852,18 +3901,18 @@ function User_hierarchy_mapping_main() {
3852
3901
  ] })
3853
3902
  ] })
3854
3903
  ] }),
3855
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UserHierarchyNodeMappingTable, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries }, refreshkey) })
3904
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(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) }) })
3856
3905
  ] })
3857
3906
  ] }),
3858
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AddUserHierarchyNodeMappingModal, { isOpen: modalOpen, onClose: () => setModalOpen(false) })
3907
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AddUserHierarchyNodeMappingModal, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: (payload) => saveMapping(payload) })
3859
3908
  ] });
3860
3909
  }
3861
3910
 
3862
3911
  // src/components/document-configuration/DocumentConfigurationmain.jsx
3863
- var import_react33 = __toESM(require("react"));
3912
+ var import_react32 = __toESM(require("react"));
3864
3913
 
3865
3914
  // src/components/document-configuration/SearchBar.jsx
3866
- var import_react28 = __toESM(require("react"));
3915
+ var import_react27 = __toESM(require("react"));
3867
3916
  var import_jsx_runtime27 = require("react/jsx-runtime");
3868
3917
  function SearchBar3({
3869
3918
  searchQuery,
@@ -3880,10 +3929,10 @@ function SearchBar3({
3880
3929
  }
3881
3930
 
3882
3931
  // src/components/document-configuration/DocumentConfigurationTable.jsx
3883
- var import_react31 = __toESM(require("react"));
3932
+ var import_react30 = __toESM(require("react"));
3884
3933
 
3885
3934
  // src/components/document-configuration/Edit.jsx
3886
- var import_react29 = __toESM(require("react"));
3935
+ var import_react28 = __toESM(require("react"));
3887
3936
  var import_jsx_runtime28 = require("react/jsx-runtime");
3888
3937
  function EditDocumentConfiguration({
3889
3938
  isOpen,
@@ -3891,7 +3940,7 @@ function EditDocumentConfiguration({
3891
3940
  initialData,
3892
3941
  onSave
3893
3942
  }) {
3894
- const [formData, setFormData] = (0, import_react29.useState)({
3943
+ const [formData, setFormData] = (0, import_react28.useState)({
3895
3944
  docName: "",
3896
3945
  stepId: "",
3897
3946
  extensions: "",
@@ -3900,8 +3949,8 @@ function EditDocumentConfiguration({
3900
3949
  isMandatory: false,
3901
3950
  status: "Active"
3902
3951
  });
3903
- const [errors, setErrors] = (0, import_react29.useState)({});
3904
- (0, import_react29.useEffect)(() => {
3952
+ const [errors, setErrors] = (0, import_react28.useState)({});
3953
+ (0, import_react28.useEffect)(() => {
3905
3954
  if (initialData) {
3906
3955
  const sizeParts = (initialData.maxSize || "10 MB").split(" ");
3907
3956
  setFormData({
@@ -4033,7 +4082,7 @@ function EditDocumentConfiguration({
4033
4082
  }
4034
4083
 
4035
4084
  // src/components/document-configuration/Delete.jsx
4036
- var import_react30 = __toESM(require("react"));
4085
+ var import_react29 = __toESM(require("react"));
4037
4086
  var import_jsx_runtime29 = require("react/jsx-runtime");
4038
4087
  function DeleteDocumentConfiguration({
4039
4088
  isOpen,
@@ -4310,12 +4359,12 @@ function DocumentConfigTable({
4310
4359
  status: "Active"
4311
4360
  }
4312
4361
  ];
4313
- const [data, setData] = (0, import_react31.useState)(initialData);
4314
- const [sortOrder, setSortOrder] = (0, import_react31.useState)("asc");
4315
- const [sortKey, setSortKey] = (0, import_react31.useState)("docName");
4316
- const [isEditOpen, setIsEditOpen] = (0, import_react31.useState)(false);
4317
- const [isDeleteOpen, setIsDeleteOpen] = (0, import_react31.useState)(false);
4318
- const [selectedItem, setSelectedItem] = (0, import_react31.useState)(null);
4362
+ const [data, setData] = (0, import_react30.useState)(initialData);
4363
+ const [sortOrder, setSortOrder] = (0, import_react30.useState)("asc");
4364
+ const [sortKey, setSortKey] = (0, import_react30.useState)("docName");
4365
+ const [isEditOpen, setIsEditOpen] = (0, import_react30.useState)(false);
4366
+ const [isDeleteOpen, setIsDeleteOpen] = (0, import_react30.useState)(false);
4367
+ const [selectedItem, setSelectedItem] = (0, import_react30.useState)(null);
4319
4368
  const handleSort = (columnKey) => {
4320
4369
  const isAsc = sortKey === columnKey && sortOrder === "asc";
4321
4370
  setSortOrder(isAsc ? "desc" : "asc");
@@ -4331,7 +4380,7 @@ function DocumentConfigTable({
4331
4380
  const query = (searchQuery || "").toLowerCase();
4332
4381
  return item.docName.toLowerCase().includes(query) || item.extensions.toLowerCase().includes(query) || item.stepId.toLowerCase().includes(query);
4333
4382
  });
4334
- (0, import_react31.useEffect)(() => {
4383
+ (0, import_react30.useEffect)(() => {
4335
4384
  if (setTotalEntries) setTotalEntries(filteredData.length);
4336
4385
  }, [filteredData.length, setTotalEntries]);
4337
4386
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -4537,19 +4586,19 @@ function DocumentConfigTable({
4537
4586
  }
4538
4587
 
4539
4588
  // src/components/document-configuration/AddDocumentConfigurationModal.jsx
4540
- var import_react32 = __toESM(require("react"));
4589
+ var import_react31 = __toESM(require("react"));
4541
4590
  var import_jsx_runtime31 = require("react/jsx-runtime");
4542
4591
  function AddDocumentConfigModal({
4543
4592
  isOpen,
4544
4593
  onClose
4545
4594
  }) {
4546
- const [isMandatory, setIsMandatory] = (0, import_react32.useState)(false);
4547
- const [status, setStatus] = (0, import_react32.useState)("Active");
4548
- const [documentName, setDocumentName] = (0, import_react32.useState)("");
4549
- const [stepId, setStepId] = (0, import_react32.useState)("");
4550
- const [maxSize, setMaxSize] = (0, import_react32.useState)("");
4551
- const [allowedExtensions, setAllowedExtensions] = (0, import_react32.useState)("");
4552
- const [errors, setErrors] = (0, import_react32.useState)({});
4595
+ const [isMandatory, setIsMandatory] = (0, import_react31.useState)(false);
4596
+ const [status, setStatus] = (0, import_react31.useState)("Active");
4597
+ const [documentName, setDocumentName] = (0, import_react31.useState)("");
4598
+ const [stepId, setStepId] = (0, import_react31.useState)("");
4599
+ const [maxSize, setMaxSize] = (0, import_react31.useState)("");
4600
+ const [allowedExtensions, setAllowedExtensions] = (0, import_react31.useState)("");
4601
+ const [errors, setErrors] = (0, import_react31.useState)({});
4553
4602
  const handleSave = () => {
4554
4603
  let newErrors = {};
4555
4604
  if (!documentName.trim()) {
@@ -4682,17 +4731,17 @@ function AddDocumentConfigModal({
4682
4731
  // src/components/document-configuration/DocumentConfigurationmain.jsx
4683
4732
  var import_jsx_runtime32 = require("react/jsx-runtime");
4684
4733
  function DocumentConfigurationmain() {
4685
- const [refreshkey, setRefreshKey] = (0, import_react33.useState)(0);
4734
+ const [refreshkey, setRefreshKey] = (0, import_react32.useState)(0);
4686
4735
  const handleRefresh = () => {
4687
4736
  console.log("Table data refreshed!");
4688
4737
  setRefreshKey((prev) => prev + 1);
4689
4738
  };
4690
- const tableRef = (0, import_react33.useRef)(null);
4691
- const [modalOpen, setModalOpen] = (0, import_react33.useState)(false);
4692
- const [pageSize, setPageSize] = (0, import_react33.useState)(10);
4693
- const [searchQuery, setSearchQuery] = (0, import_react33.useState)("");
4694
- const [currentPage, setCurrentPage] = (0, import_react33.useState)(1);
4695
- const [totalEntries, setTotalEntries] = (0, import_react33.useState)(0);
4739
+ const tableRef = (0, import_react32.useRef)(null);
4740
+ const [modalOpen, setModalOpen] = (0, import_react32.useState)(false);
4741
+ const [pageSize, setPageSize] = (0, import_react32.useState)(10);
4742
+ const [searchQuery, setSearchQuery] = (0, import_react32.useState)("");
4743
+ const [currentPage, setCurrentPage] = (0, import_react32.useState)(1);
4744
+ const [totalEntries, setTotalEntries] = (0, import_react32.useState)(0);
4696
4745
  const handlePageSizeChange = (e) => {
4697
4746
  setPageSize(Number(e.target.value));
4698
4747
  setCurrentPage(1);
@@ -4732,10 +4781,10 @@ function DocumentConfigurationmain() {
4732
4781
  }
4733
4782
 
4734
4783
  // src/components/audit-log/AuditLogmain.jsx
4735
- var import_react37 = __toESM(require("react"));
4784
+ var import_react36 = __toESM(require("react"));
4736
4785
 
4737
4786
  // src/components/audit-log/SearchBar.jsx
4738
- var import_react34 = __toESM(require("react"));
4787
+ var import_react33 = __toESM(require("react"));
4739
4788
  var import_jsx_runtime33 = require("react/jsx-runtime");
4740
4789
  function SearchBar4({
4741
4790
  searchQuery,
@@ -4752,7 +4801,7 @@ function SearchBar4({
4752
4801
  }
4753
4802
 
4754
4803
  // src/components/audit-log/AuditLogTable.jsx
4755
- var import_react35 = __toESM(require("react"));
4804
+ var import_react34 = __toESM(require("react"));
4756
4805
  var import_jsx_runtime34 = require("react/jsx-runtime");
4757
4806
  function AuditLogTable({
4758
4807
  pageSize,
@@ -4962,9 +5011,9 @@ function AuditLogTable({
4962
5011
  ip: "192.168.1.45",
4963
5012
  time: "2026-07-17 15:55"
4964
5013
  }];
4965
- const [data, setData] = (0, import_react35.useState)(initialData);
4966
- const [sortOrder, setSortOrder] = (0, import_react35.useState)("asc");
4967
- const [sortKey, setSortKey] = (0, import_react35.useState)("logId");
5014
+ const [data, setData] = (0, import_react34.useState)(initialData);
5015
+ const [sortOrder, setSortOrder] = (0, import_react34.useState)("asc");
5016
+ const [sortKey, setSortKey] = (0, import_react34.useState)("logId");
4968
5017
  const handleSort = (columnKey) => {
4969
5018
  const isAsc = sortKey === columnKey && sortOrder === "asc";
4970
5019
  setSortOrder(isAsc ? "desc" : "asc");
@@ -4980,7 +5029,7 @@ function AuditLogTable({
4980
5029
  const query = (searchQuery || "").toLowerCase();
4981
5030
  return item.logId.toLowerCase().includes(query) || item.user.toLowerCase().includes(query) || item.section.toLowerCase().includes(query) || item.action.toLowerCase().includes(query);
4982
5031
  });
4983
- (0, import_react35.useEffect)(() => {
5032
+ (0, import_react34.useEffect)(() => {
4984
5033
  if (setTotalEntries) setTotalEntries(filteredData.length);
4985
5034
  }, [filteredData.length, setTotalEntries]);
4986
5035
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5048,19 +5097,19 @@ function AuditLogTable({
5048
5097
  }
5049
5098
 
5050
5099
  // src/components/audit-log/AddAuditLogModal.jsx
5051
- var import_react36 = __toESM(require("react"));
5100
+ var import_react35 = __toESM(require("react"));
5052
5101
  var import_jsx_runtime35 = require("react/jsx-runtime");
5053
5102
  function AddAuditLogModal({
5054
5103
  isOpen,
5055
5104
  onClose
5056
5105
  }) {
5057
- const [logId, setLogId] = (0, import_react36.useState)("");
5058
- const [userName, setUserName] = (0, import_react36.useState)("");
5059
- const [actionType, setActionType] = (0, import_react36.useState)("");
5060
- const [ipAddress, setIpAddress] = (0, import_react36.useState)("");
5061
- const [sectionModule, setSectionModule] = (0, import_react36.useState)("");
5062
- const [timestamp, setTimestamp] = (0, import_react36.useState)("");
5063
- const [errors, setErrors] = (0, import_react36.useState)({});
5106
+ const [logId, setLogId] = (0, import_react35.useState)("");
5107
+ const [userName, setUserName] = (0, import_react35.useState)("");
5108
+ const [actionType, setActionType] = (0, import_react35.useState)("");
5109
+ const [ipAddress, setIpAddress] = (0, import_react35.useState)("");
5110
+ const [sectionModule, setSectionModule] = (0, import_react35.useState)("");
5111
+ const [timestamp, setTimestamp] = (0, import_react35.useState)("");
5112
+ const [errors, setErrors] = (0, import_react35.useState)({});
5064
5113
  const handleCommit = () => {
5065
5114
  let newErrors = {};
5066
5115
  if (!logId.trim()) newErrors.logId = "Log ID is required";
@@ -5179,17 +5228,17 @@ function AddAuditLogModal({
5179
5228
  // src/components/audit-log/AuditLogmain.jsx
5180
5229
  var import_jsx_runtime36 = require("react/jsx-runtime");
5181
5230
  function AuditLogmain() {
5182
- const [refreshkey, setRefreshKey] = (0, import_react37.useState)(0);
5231
+ const [refreshkey, setRefreshKey] = (0, import_react36.useState)(0);
5183
5232
  const handleRefresh = () => {
5184
5233
  console.log("Table data refreshed!");
5185
5234
  setRefreshKey((prev) => prev + 1);
5186
5235
  };
5187
- const tableRef = (0, import_react37.useRef)(null);
5188
- const [modalOpen, setModalOpen] = (0, import_react37.useState)(false);
5189
- const [pageSize, setPageSize] = (0, import_react37.useState)(10);
5190
- const [searchQuery, setSearchQuery] = (0, import_react37.useState)("");
5191
- const [currentPage, setCurrentPage] = (0, import_react37.useState)(1);
5192
- const [totalEntries, setTotalEntries] = (0, import_react37.useState)(0);
5236
+ const tableRef = (0, import_react36.useRef)(null);
5237
+ const [modalOpen, setModalOpen] = (0, import_react36.useState)(false);
5238
+ const [pageSize, setPageSize] = (0, import_react36.useState)(10);
5239
+ const [searchQuery, setSearchQuery] = (0, import_react36.useState)("");
5240
+ const [currentPage, setCurrentPage] = (0, import_react36.useState)(1);
5241
+ const [totalEntries, setTotalEntries] = (0, import_react36.useState)(0);
5193
5242
  const handlePageSizeChange = (e) => {
5194
5243
  setPageSize(Number(e.target.value));
5195
5244
  setCurrentPage(1);
@@ -5248,10 +5297,10 @@ function AuditLogmain() {
5248
5297
  }
5249
5298
 
5250
5299
  // src/components/movement-history/MovementHistorymain.jsx
5251
- var import_react41 = __toESM(require("react"));
5300
+ var import_react40 = __toESM(require("react"));
5252
5301
 
5253
5302
  // src/components/movement-history/SearchBar.jsx
5254
- var import_react38 = __toESM(require("react"));
5303
+ var import_react37 = __toESM(require("react"));
5255
5304
  var import_jsx_runtime37 = require("react/jsx-runtime");
5256
5305
  function SearchBar5({
5257
5306
  searchQuery,
@@ -5268,7 +5317,7 @@ function SearchBar5({
5268
5317
  }
5269
5318
 
5270
5319
  // src/components/movement-history/MovementHistoryTable.jsx
5271
- var import_react39 = __toESM(require("react"));
5320
+ var import_react38 = __toESM(require("react"));
5272
5321
  var import_jsx_runtime38 = require("react/jsx-runtime");
5273
5322
  function MovementHistoryTable({
5274
5323
  pageSize,
@@ -5478,9 +5527,9 @@ function MovementHistoryTable({
5478
5527
  toStepId: "APPROVE",
5479
5528
  movedOn: "2026-02-12"
5480
5529
  }];
5481
- const [data, setData] = (0, import_react39.useState)(initialData);
5482
- const [sortOrder, setSortOrder] = (0, import_react39.useState)("asc");
5483
- const [sortKey, setSortKey] = (0, import_react39.useState)("movementHistoryId");
5530
+ const [data, setData] = (0, import_react38.useState)(initialData);
5531
+ const [sortOrder, setSortOrder] = (0, import_react38.useState)("asc");
5532
+ const [sortKey, setSortKey] = (0, import_react38.useState)("movementHistoryId");
5484
5533
  const handleSort = (columnKey) => {
5485
5534
  const isAsc = sortKey === columnKey && sortOrder === "asc";
5486
5535
  setSortOrder(isAsc ? "desc" : "asc");
@@ -5496,7 +5545,7 @@ function MovementHistoryTable({
5496
5545
  const query = (searchQuery || "").toLowerCase();
5497
5546
  return item.movementHistoryId.toLowerCase().includes(query) || item.name.toLowerCase().includes(query) || item.toStepId.toLowerCase().includes(query);
5498
5547
  });
5499
- (0, import_react39.useEffect)(() => {
5548
+ (0, import_react38.useEffect)(() => {
5500
5549
  if (setTotalEntries) setTotalEntries(filteredData.length);
5501
5550
  }, [filteredData.length, setTotalEntries]);
5502
5551
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -5567,19 +5616,19 @@ function MovementHistoryTable({
5567
5616
  }
5568
5617
 
5569
5618
  // src/components/movement-history/AddMovementHistoryModal.jsx
5570
- var import_react40 = __toESM(require("react"));
5619
+ var import_react39 = __toESM(require("react"));
5571
5620
  var import_jsx_runtime39 = require("react/jsx-runtime");
5572
5621
  function AddMovementHistoryModal({
5573
5622
  isOpen,
5574
5623
  onClose
5575
5624
  }) {
5576
- const [movementHistoryId, setMovementHistoryId] = (0, import_react40.useState)("");
5577
- const [fileInstanceId, setFileInstanceId] = (0, import_react40.useState)("");
5578
- const [fromStepId, setFromStepId] = (0, import_react40.useState)("");
5579
- const [toStepId, setToStepId] = (0, import_react40.useState)("");
5580
- const [actionCode, setActionCode] = (0, import_react40.useState)("");
5581
- const [movedOn, setMovedOn] = (0, import_react40.useState)("");
5582
- const [errors, setErrors] = (0, import_react40.useState)({});
5625
+ const [movementHistoryId, setMovementHistoryId] = (0, import_react39.useState)("");
5626
+ const [fileInstanceId, setFileInstanceId] = (0, import_react39.useState)("");
5627
+ const [fromStepId, setFromStepId] = (0, import_react39.useState)("");
5628
+ const [toStepId, setToStepId] = (0, import_react39.useState)("");
5629
+ const [actionCode, setActionCode] = (0, import_react39.useState)("");
5630
+ const [movedOn, setMovedOn] = (0, import_react39.useState)("");
5631
+ const [errors, setErrors] = (0, import_react39.useState)({});
5583
5632
  const handleSaveRecord = () => {
5584
5633
  let newErrors = {};
5585
5634
  if (!movementHistoryId.toString().trim()) newErrors.movementHistoryId = "Movement History ID is required";
@@ -5694,17 +5743,17 @@ function AddMovementHistoryModal({
5694
5743
  // src/components/movement-history/MovementHistorymain.jsx
5695
5744
  var import_jsx_runtime40 = require("react/jsx-runtime");
5696
5745
  function MovementHistorymain() {
5697
- const [refreshkey, setRefreshKey] = (0, import_react41.useState)(0);
5746
+ const [refreshkey, setRefreshKey] = (0, import_react40.useState)(0);
5698
5747
  const handleRefresh = () => {
5699
5748
  console.log("Table data refreshed!");
5700
5749
  setRefreshKey((prev) => prev + 1);
5701
5750
  };
5702
- const tableRef = (0, import_react41.useRef)(null);
5703
- const [modalOpen, setModalOpen] = (0, import_react41.useState)(false);
5704
- const [pageSize, setPageSize] = (0, import_react41.useState)(10);
5705
- const [searchQuery, setSearchQuery] = (0, import_react41.useState)("");
5706
- const [currentPage, setCurrentPage] = (0, import_react41.useState)(1);
5707
- const [totalEntries, setTotalEntries] = (0, import_react41.useState)(0);
5751
+ const tableRef = (0, import_react40.useRef)(null);
5752
+ const [modalOpen, setModalOpen] = (0, import_react40.useState)(false);
5753
+ const [pageSize, setPageSize] = (0, import_react40.useState)(10);
5754
+ const [searchQuery, setSearchQuery] = (0, import_react40.useState)("");
5755
+ const [currentPage, setCurrentPage] = (0, import_react40.useState)(1);
5756
+ const [totalEntries, setTotalEntries] = (0, import_react40.useState)(0);
5708
5757
  const handlePageSizeChange = (e) => {
5709
5758
  setPageSize(Number(e.target.value));
5710
5759
  setCurrentPage(1);
@@ -5747,10 +5796,10 @@ function MovementHistorymain() {
5747
5796
  }
5748
5797
 
5749
5798
  // src/components/task-permission/TaskPermissionMain.jsx
5750
- var import_react45 = __toESM(require("react"));
5799
+ var import_react44 = __toESM(require("react"));
5751
5800
 
5752
5801
  // src/components/task-permission/SearchBar.js
5753
- var import_react42 = __toESM(require("react"));
5802
+ var import_react41 = __toESM(require("react"));
5754
5803
  var import_jsx_runtime41 = require("react/jsx-runtime");
5755
5804
  function SearchBar6({
5756
5805
  searchTerm,
@@ -5778,7 +5827,7 @@ function SearchBar6({
5778
5827
  }
5779
5828
 
5780
5829
  // src/components/task-permission/Table.js
5781
- var import_react43 = __toESM(require("react"));
5830
+ var import_react42 = __toESM(require("react"));
5782
5831
  var import_jsx_runtime42 = require("react/jsx-runtime");
5783
5832
  function Table({
5784
5833
  pageSize,
@@ -5963,12 +6012,12 @@ function Table({
5963
6012
  permissionType: "Write",
5964
6013
  isStatusEnabled: true
5965
6014
  }];
5966
- const [data, setData] = (0, import_react43.useState)(initialData);
5967
- const [sortOrder, setSortOrder] = (0, import_react43.useState)("asc");
5968
- const [sortKey, setSortKey] = (0, import_react43.useState)("taskId");
5969
- const [selectedItem, setSelectedItem] = (0, import_react43.useState)(null);
5970
- const [isEditModalOpen, setIsEditModalOpen] = (0, import_react43.useState)(false);
5971
- const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react43.useState)(false);
6015
+ const [data, setData] = (0, import_react42.useState)(initialData);
6016
+ const [sortOrder, setSortOrder] = (0, import_react42.useState)("asc");
6017
+ const [sortKey, setSortKey] = (0, import_react42.useState)("taskId");
6018
+ const [selectedItem, setSelectedItem] = (0, import_react42.useState)(null);
6019
+ const [isEditModalOpen, setIsEditModalOpen] = (0, import_react42.useState)(false);
6020
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react42.useState)(false);
5972
6021
  const handleEdit = (item) => {
5973
6022
  setSelectedItem(item);
5974
6023
  setIsEditModalOpen(true);
@@ -6025,7 +6074,7 @@ function Table({
6025
6074
  }
6026
6075
  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);
6027
6076
  });
6028
- (0, import_react43.useEffect)(() => {
6077
+ (0, import_react42.useEffect)(() => {
6029
6078
  if (setTotalEntries) setTotalEntries(filteredData.length);
6030
6079
  }, [filteredData.length, setTotalEntries]);
6031
6080
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6148,7 +6197,7 @@ function Table({
6148
6197
  }
6149
6198
 
6150
6199
  // src/components/task-permission/Popup.js
6151
- var import_react44 = __toESM(require("react"));
6200
+ var import_react43 = __toESM(require("react"));
6152
6201
  var import_jsx_runtime43 = require("react/jsx-runtime");
6153
6202
  function Popup({
6154
6203
  isOpen,
@@ -6156,13 +6205,13 @@ function Popup({
6156
6205
  onSave
6157
6206
  }) {
6158
6207
  if (!isOpen) return null;
6159
- const [stepName, setStepName] = (0, import_react44.useState)("");
6160
- const [stepCode, setStepCode] = (0, import_react44.useState)("");
6161
- const [workflow, setWorkflow] = (0, import_react44.useState)("");
6162
- const [canView, setCanView] = (0, import_react44.useState)(false);
6163
- const [canEdit, setCanEdit] = (0, import_react44.useState)(false);
6164
- const [canApprove, setCanApprove] = (0, import_react44.useState)(false);
6165
- const [canReject, setCanReject] = (0, import_react44.useState)(false);
6208
+ const [stepName, setStepName] = (0, import_react43.useState)("");
6209
+ const [stepCode, setStepCode] = (0, import_react43.useState)("");
6210
+ const [workflow, setWorkflow] = (0, import_react43.useState)("");
6211
+ const [canView, setCanView] = (0, import_react43.useState)(false);
6212
+ const [canEdit, setCanEdit] = (0, import_react43.useState)(false);
6213
+ const [canApprove, setCanApprove] = (0, import_react43.useState)(false);
6214
+ const [canReject, setCanReject] = (0, import_react43.useState)(false);
6166
6215
  const handleSubmit = (e) => {
6167
6216
  e.preventDefault();
6168
6217
  if (!stepName || !stepCode || !workflow) {
@@ -6279,17 +6328,17 @@ function Popup({
6279
6328
  // src/components/task-permission/TaskPermissionMain.jsx
6280
6329
  var import_jsx_runtime44 = require("react/jsx-runtime");
6281
6330
  function TaskPermissionMain() {
6282
- const [refreshkey, setRefreshKey] = (0, import_react45.useState)(0);
6331
+ const [refreshkey, setRefreshKey] = (0, import_react44.useState)(0);
6283
6332
  const handleRefresh = () => {
6284
6333
  console.log("Table data refreshed!");
6285
6334
  setRefreshKey((prev) => prev + 1);
6286
6335
  };
6287
- const tableRef = (0, import_react45.useRef)(null);
6288
- const [showModal, setShowModal] = (0, import_react45.useState)(false);
6289
- const [pageSize, setPageSize] = (0, import_react45.useState)(10);
6290
- const [searchQuery, setSearchQuery] = (0, import_react45.useState)("");
6291
- const [currentPage, setCurrentPage] = (0, import_react45.useState)(1);
6292
- const [totalEntries, setTotalEntries] = (0, import_react45.useState)(0);
6336
+ const tableRef = (0, import_react44.useRef)(null);
6337
+ const [showModal, setShowModal] = (0, import_react44.useState)(false);
6338
+ const [pageSize, setPageSize] = (0, import_react44.useState)(10);
6339
+ const [searchQuery, setSearchQuery] = (0, import_react44.useState)("");
6340
+ const [currentPage, setCurrentPage] = (0, import_react44.useState)(1);
6341
+ const [totalEntries, setTotalEntries] = (0, import_react44.useState)(0);
6293
6342
  const handlePageSizeChange = (e) => {
6294
6343
  setPageSize(Number(e.target.value));
6295
6344
  setCurrentPage(1);
@@ -6331,10 +6380,10 @@ function TaskPermissionMain() {
6331
6380
  }
6332
6381
 
6333
6382
  // src/components/Workflow-Setting/WorkflowSettingMain.jsx
6334
- var import_react49 = __toESM(require("react"));
6383
+ var import_react48 = __toESM(require("react"));
6335
6384
 
6336
6385
  // src/components/Workflow-Setting/SearchBar.js
6337
- var import_react46 = __toESM(require("react"));
6386
+ var import_react45 = __toESM(require("react"));
6338
6387
  var import_jsx_runtime45 = require("react/jsx-runtime");
6339
6388
  function SearchBar7({
6340
6389
  searchTerm,
@@ -6362,7 +6411,7 @@ function SearchBar7({
6362
6411
  }
6363
6412
 
6364
6413
  // src/components/Workflow-Setting/Table.js
6365
- var import_react47 = __toESM(require("react"));
6414
+ var import_react46 = __toESM(require("react"));
6366
6415
  var import_jsx_runtime46 = require("react/jsx-runtime");
6367
6416
  function Table2({
6368
6417
  pageSize,
@@ -6547,12 +6596,12 @@ function Table2({
6547
6596
  SLA: "2 Hours",
6548
6597
  isActive: true
6549
6598
  }];
6550
- const [data, setData] = (0, import_react47.useState)(initialData);
6551
- const [sortOrder, setSortOrder] = (0, import_react47.useState)("asc");
6552
- const [sortKey, setSortKey] = (0, import_react47.useState)("settingId");
6553
- const [selectedItem, setSelectedItem] = (0, import_react47.useState)(null);
6554
- const [isEditModalOpen, setIsEditModalOpen] = (0, import_react47.useState)(false);
6555
- const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react47.useState)(false);
6599
+ const [data, setData] = (0, import_react46.useState)(initialData);
6600
+ const [sortOrder, setSortOrder] = (0, import_react46.useState)("asc");
6601
+ const [sortKey, setSortKey] = (0, import_react46.useState)("settingId");
6602
+ const [selectedItem, setSelectedItem] = (0, import_react46.useState)(null);
6603
+ const [isEditModalOpen, setIsEditModalOpen] = (0, import_react46.useState)(false);
6604
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react46.useState)(false);
6556
6605
  const handleEdit = (item) => {
6557
6606
  setSelectedItem(item);
6558
6607
  setIsEditModalOpen(true);
@@ -6609,7 +6658,7 @@ function Table2({
6609
6658
  }
6610
6659
  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);
6611
6660
  });
6612
- (0, import_react47.useEffect)(() => {
6661
+ (0, import_react46.useEffect)(() => {
6613
6662
  if (setTotalEntries) setTotalEntries(filteredData.length);
6614
6663
  }, [filteredData.length, setTotalEntries]);
6615
6664
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -6742,7 +6791,7 @@ function Table2({
6742
6791
  }
6743
6792
 
6744
6793
  // src/components/Workflow-Setting/Popup.js
6745
- var import_react48 = __toESM(require("react"));
6794
+ var import_react47 = __toESM(require("react"));
6746
6795
  var import_jsx_runtime47 = require("react/jsx-runtime");
6747
6796
  function Popup2({
6748
6797
  isOpen,
@@ -6750,8 +6799,8 @@ function Popup2({
6750
6799
  onSave
6751
6800
  }) {
6752
6801
  if (!isOpen) return null;
6753
- const [settingKey, setSettingKey] = (0, import_react48.useState)("");
6754
- const [settingValue, setSettingValue] = (0, import_react48.useState)("");
6802
+ const [settingKey, setSettingKey] = (0, import_react47.useState)("");
6803
+ const [settingValue, setSettingValue] = (0, import_react47.useState)("");
6755
6804
  const handleSubmit = (e) => {
6756
6805
  e.preventDefault();
6757
6806
  if (!settingKey || !settingValue) {
@@ -6802,17 +6851,17 @@ function Popup2({
6802
6851
  // src/components/Workflow-Setting/WorkflowSettingMain.jsx
6803
6852
  var import_jsx_runtime48 = require("react/jsx-runtime");
6804
6853
  function WorkflowSettingMain() {
6805
- const [refreshkey, setRefreshKey] = (0, import_react49.useState)(0);
6854
+ const [refreshkey, setRefreshKey] = (0, import_react48.useState)(0);
6806
6855
  const handleRefresh = () => {
6807
6856
  console.log("Table data refreshed!");
6808
6857
  setRefreshKey((prev) => prev + 1);
6809
6858
  };
6810
- const tableRef = (0, import_react49.useRef)(null);
6811
- const [showModal, setShowModal] = (0, import_react49.useState)(false);
6812
- const [pageSize, setPageSize] = (0, import_react49.useState)(10);
6813
- const [searchQuery, setSearchQuery] = (0, import_react49.useState)("");
6814
- const [currentPage, setCurrentPage] = (0, import_react49.useState)(1);
6815
- const [totalEntries, setTotalEntries] = (0, import_react49.useState)(0);
6859
+ const tableRef = (0, import_react48.useRef)(null);
6860
+ const [showModal, setShowModal] = (0, import_react48.useState)(false);
6861
+ const [pageSize, setPageSize] = (0, import_react48.useState)(10);
6862
+ const [searchQuery, setSearchQuery] = (0, import_react48.useState)("");
6863
+ const [currentPage, setCurrentPage] = (0, import_react48.useState)(1);
6864
+ const [totalEntries, setTotalEntries] = (0, import_react48.useState)(0);
6816
6865
  const handlePageSizeChange = (e) => {
6817
6866
  setPageSize(Number(e.target.value));
6818
6867
  setCurrentPage(1);
@@ -6854,10 +6903,10 @@ function WorkflowSettingMain() {
6854
6903
  }
6855
6904
 
6856
6905
  // src/components/notification/NotificationMain.jsx
6857
- var import_react53 = __toESM(require("react"));
6906
+ var import_react52 = __toESM(require("react"));
6858
6907
 
6859
6908
  // src/components/notification/SearchBar.js
6860
- var import_react50 = __toESM(require("react"));
6909
+ var import_react49 = __toESM(require("react"));
6861
6910
  var import_jsx_runtime49 = require("react/jsx-runtime");
6862
6911
  function SearchBar8({
6863
6912
  searchTerm,
@@ -6885,7 +6934,7 @@ function SearchBar8({
6885
6934
  }
6886
6935
 
6887
6936
  // src/components/notification/Table.js
6888
- var import_react51 = __toESM(require("react"));
6937
+ var import_react50 = __toESM(require("react"));
6889
6938
  var import_jsx_runtime50 = require("react/jsx-runtime");
6890
6939
  function Table3({
6891
6940
  pageSize,
@@ -7070,12 +7119,12 @@ function Table3({
7070
7119
  recipientGroup: "Risk Assessment",
7071
7120
  isMuted: false
7072
7121
  }];
7073
- const [data, setData] = (0, import_react51.useState)(initialData);
7074
- const [sortOrder, setSortOrder] = (0, import_react51.useState)("asc");
7075
- const [sortKey, setSortKey] = (0, import_react51.useState)("notificationId");
7076
- const [selectedItem, setSelectedItem] = (0, import_react51.useState)(null);
7077
- const [isEditModalOpen, setIsEditModalOpen] = (0, import_react51.useState)(false);
7078
- const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react51.useState)(false);
7122
+ const [data, setData] = (0, import_react50.useState)(initialData);
7123
+ const [sortOrder, setSortOrder] = (0, import_react50.useState)("asc");
7124
+ const [sortKey, setSortKey] = (0, import_react50.useState)("notificationId");
7125
+ const [selectedItem, setSelectedItem] = (0, import_react50.useState)(null);
7126
+ const [isEditModalOpen, setIsEditModalOpen] = (0, import_react50.useState)(false);
7127
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react50.useState)(false);
7079
7128
  const handleEdit = (item) => {
7080
7129
  setSelectedItem(item);
7081
7130
  setIsEditModalOpen(true);
@@ -7132,7 +7181,7 @@ function Table3({
7132
7181
  }
7133
7182
  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);
7134
7183
  });
7135
- (0, import_react51.useEffect)(() => {
7184
+ (0, import_react50.useEffect)(() => {
7136
7185
  if (setTotalEntries) setTotalEntries(filteredData.length);
7137
7186
  }, [filteredData.length, setTotalEntries]);
7138
7187
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -7260,7 +7309,7 @@ function Table3({
7260
7309
  }
7261
7310
 
7262
7311
  // src/components/notification/Popup.js
7263
- var import_react52 = __toESM(require("react"));
7312
+ var import_react51 = __toESM(require("react"));
7264
7313
  var import_jsx_runtime51 = require("react/jsx-runtime");
7265
7314
  function Popup3({
7266
7315
  isOpen,
@@ -7268,10 +7317,10 @@ function Popup3({
7268
7317
  onSave
7269
7318
  }) {
7270
7319
  if (!isOpen) return null;
7271
- const [fileInstanceId, setFileInstanceId] = (0, import_react52.useState)("");
7272
- const [userId, setUserId] = (0, import_react52.useState)("");
7273
- const [type, setType] = (0, import_react52.useState)("");
7274
- const [message, setMessage] = (0, import_react52.useState)("");
7320
+ const [fileInstanceId, setFileInstanceId] = (0, import_react51.useState)("");
7321
+ const [userId, setUserId] = (0, import_react51.useState)("");
7322
+ const [type, setType] = (0, import_react51.useState)("");
7323
+ const [message, setMessage] = (0, import_react51.useState)("");
7275
7324
  const handleSubmit = (e) => {
7276
7325
  e.preventDefault();
7277
7326
  if (!fileInstanceId || !userId || !type || !message) {
@@ -7342,17 +7391,17 @@ function Popup3({
7342
7391
  // src/components/notification/NotificationMain.jsx
7343
7392
  var import_jsx_runtime52 = require("react/jsx-runtime");
7344
7393
  function NotificationMain() {
7345
- const [refreshkey, setRefreshKey] = (0, import_react53.useState)(0);
7394
+ const [refreshkey, setRefreshKey] = (0, import_react52.useState)(0);
7346
7395
  const handleRefresh = () => {
7347
7396
  console.log("Table data refreshed!");
7348
7397
  setRefreshKey((prev) => prev + 1);
7349
7398
  };
7350
- const tableRef = (0, import_react53.useRef)(null);
7351
- const [showModal, setShowModal] = (0, import_react53.useState)(false);
7352
- const [pageSize, setPageSize] = (0, import_react53.useState)(10);
7353
- const [searchQuery, setSearchQuery] = (0, import_react53.useState)("");
7354
- const [currentPage, setCurrentPage] = (0, import_react53.useState)(1);
7355
- const [totalEntries, setTotalEntries] = (0, import_react53.useState)(0);
7399
+ const tableRef = (0, import_react52.useRef)(null);
7400
+ const [showModal, setShowModal] = (0, import_react52.useState)(false);
7401
+ const [pageSize, setPageSize] = (0, import_react52.useState)(10);
7402
+ const [searchQuery, setSearchQuery] = (0, import_react52.useState)("");
7403
+ const [currentPage, setCurrentPage] = (0, import_react52.useState)(1);
7404
+ const [totalEntries, setTotalEntries] = (0, import_react52.useState)(0);
7356
7405
  const handlePageSizeChange = (e) => {
7357
7406
  setPageSize(Number(e.target.value));
7358
7407
  setCurrentPage(1);
@@ -7391,10 +7440,10 @@ function NotificationMain() {
7391
7440
  }
7392
7441
 
7393
7442
  // src/components/task-instance/task_instance_main.jsx
7394
- var import_react59 = __toESM(require("react"));
7443
+ var import_react58 = __toESM(require("react"));
7395
7444
 
7396
7445
  // src/components/task-instance/searchbartaskinstance.jsx
7397
- var import_react54 = __toESM(require("react"));
7446
+ var import_react53 = __toESM(require("react"));
7398
7447
  var import_jsx_runtime53 = require("react/jsx-runtime");
7399
7448
  function TaskInstanceSearchBar({
7400
7449
  searchQuery,
@@ -7418,10 +7467,10 @@ function TaskInstanceSearchBar({
7418
7467
  }
7419
7468
 
7420
7469
  // src/components/task-instance/taskinstancetable.jsx
7421
- var import_react57 = __toESM(require("react"));
7470
+ var import_react56 = __toESM(require("react"));
7422
7471
 
7423
7472
  // src/components/task-instance/edit-instance.jsx
7424
- var import_react55 = __toESM(require("react"));
7473
+ var import_react54 = __toESM(require("react"));
7425
7474
  var import_jsx_runtime54 = require("react/jsx-runtime");
7426
7475
  function EditTaskInstanceModal({
7427
7476
  isOpen,
@@ -7429,7 +7478,7 @@ function EditTaskInstanceModal({
7429
7478
  selectedTask,
7430
7479
  onSave
7431
7480
  }) {
7432
- const [formData, setFormData] = (0, import_react55.useState)({
7481
+ const [formData, setFormData] = (0, import_react54.useState)({
7433
7482
  assignedUserId: "",
7434
7483
  status: "",
7435
7484
  dueDate: "",
@@ -7437,7 +7486,7 @@ function EditTaskInstanceModal({
7437
7486
  escalatedOn: "",
7438
7487
  slaStatus: ""
7439
7488
  });
7440
- (0, import_react55.useEffect)(() => {
7489
+ (0, import_react54.useEffect)(() => {
7441
7490
  if (selectedTask) {
7442
7491
  setFormData({
7443
7492
  assignedUserId: selectedTask.assignedUserId || selectedTask.assigned_user_id || "",
@@ -7635,7 +7684,7 @@ function EditTaskInstanceModal({
7635
7684
  }
7636
7685
 
7637
7686
  // src/components/task-instance/delete-instance.jsx
7638
- var import_react56 = __toESM(require("react"));
7687
+ var import_react55 = __toESM(require("react"));
7639
7688
  var import_jsx_runtime55 = require("react/jsx-runtime");
7640
7689
  function DeleteInstanceModal({
7641
7690
  isOpen,
@@ -7940,9 +7989,9 @@ function TaskInstanceTable({
7940
7989
  reminderSentOn: "2026-08-06",
7941
7990
  escalatedOn: ""
7942
7991
  }];
7943
- const [data, setData] = (0, import_react57.useState)(initialData);
7944
- const [sortOrder, setSortOrder] = (0, import_react57.useState)("asc");
7945
- const [sortKey, setSortKey] = (0, import_react57.useState)("taskInstanceId");
7992
+ const [data, setData] = (0, import_react56.useState)(initialData);
7993
+ const [sortOrder, setSortOrder] = (0, import_react56.useState)("asc");
7994
+ const [sortKey, setSortKey] = (0, import_react56.useState)("taskInstanceId");
7946
7995
  const handleSort = (columnKey) => {
7947
7996
  const isAsc = sortKey === columnKey && sortOrder === "asc";
7948
7997
  setSortOrder(isAsc ? "desc" : "asc");
@@ -7958,7 +8007,7 @@ function TaskInstanceTable({
7958
8007
  const query = (searchQuery || "").toLowerCase();
7959
8008
  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);
7960
8009
  });
7961
- (0, import_react57.useEffect)(() => {
8010
+ (0, import_react56.useEffect)(() => {
7962
8011
  if (setTotalEntries) setTotalEntries(filteredData.length);
7963
8012
  }, [filteredData.length, setTotalEntries]);
7964
8013
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -7967,9 +8016,9 @@ function TaskInstanceTable({
7967
8016
  const pageNumbers = Array.from({
7968
8017
  length: totalPages
7969
8018
  }, (_, i) => i + 1);
7970
- const [showEditPopup, setShowEditPopup] = (0, import_react57.useState)(false);
7971
- const [showDeletePopup, setShowDeletePopup] = (0, import_react57.useState)(false);
7972
- const [selectedItem, setSelectedItem] = (0, import_react57.useState)(null);
8019
+ const [showEditPopup, setShowEditPopup] = (0, import_react56.useState)(false);
8020
+ const [showDeletePopup, setShowDeletePopup] = (0, import_react56.useState)(false);
8021
+ const [selectedItem, setSelectedItem] = (0, import_react56.useState)(null);
7973
8022
  const openEditPopup = (item) => {
7974
8023
  setSelectedItem(item);
7975
8024
  setShowEditPopup(true);
@@ -8090,7 +8139,7 @@ function TaskInstanceTable({
8090
8139
  }
8091
8140
 
8092
8141
  // src/components/task-instance/addtaskinstance.jsx
8093
- var import_react58 = __toESM(require("react"));
8142
+ var import_react57 = __toESM(require("react"));
8094
8143
  var import_jsx_runtime57 = require("react/jsx-runtime");
8095
8144
  function AddTaskInstanceModal({
8096
8145
  isOpen,
@@ -8223,17 +8272,17 @@ function AddTaskInstanceModal({
8223
8272
  // src/components/task-instance/task_instance_main.jsx
8224
8273
  var import_jsx_runtime58 = require("react/jsx-runtime");
8225
8274
  function Task_instance_main() {
8226
- const [refreshkey, setRefreshKey] = (0, import_react59.useState)(0);
8275
+ const [refreshkey, setRefreshKey] = (0, import_react58.useState)(0);
8227
8276
  const handleRefresh = () => {
8228
8277
  console.log("Table data refreshed!");
8229
8278
  setRefreshKey((prev) => prev + 1);
8230
8279
  };
8231
- const [modalOpen, setModalOpen] = (0, import_react59.useState)(false);
8232
- const [pageSize, setPageSize] = (0, import_react59.useState)(10);
8233
- const [searchQuery, setSearchQuery] = (0, import_react59.useState)("");
8234
- const tableRef = (0, import_react59.useRef)(null);
8235
- const [currentPage, setCurrentPage] = (0, import_react59.useState)(1);
8236
- const [totalEntries, setTotalEntries] = (0, import_react59.useState)(0);
8280
+ const [modalOpen, setModalOpen] = (0, import_react58.useState)(false);
8281
+ const [pageSize, setPageSize] = (0, import_react58.useState)(10);
8282
+ const [searchQuery, setSearchQuery] = (0, import_react58.useState)("");
8283
+ const tableRef = (0, import_react58.useRef)(null);
8284
+ const [currentPage, setCurrentPage] = (0, import_react58.useState)(1);
8285
+ const [totalEntries, setTotalEntries] = (0, import_react58.useState)(0);
8237
8286
  const handlePageSizeChange = (e) => {
8238
8287
  setPageSize(Number(e.target.value));
8239
8288
  setCurrentPage(1);
@@ -8300,10 +8349,10 @@ function Task_instance_main() {
8300
8349
  }
8301
8350
 
8302
8351
  // src/components/comment/comment_main.jsx
8303
- var import_react63 = __toESM(require("react"));
8352
+ var import_react62 = __toESM(require("react"));
8304
8353
 
8305
8354
  // src/components/comment/searchbarcomment.jsx
8306
- var import_react60 = __toESM(require("react"));
8355
+ var import_react59 = __toESM(require("react"));
8307
8356
  var import_jsx_runtime59 = require("react/jsx-runtime");
8308
8357
  function CommentSearchBar({
8309
8358
  searchQuery,
@@ -8327,7 +8376,7 @@ function CommentSearchBar({
8327
8376
  }
8328
8377
 
8329
8378
  // src/components/comment/commenttable.jsx
8330
- var import_react61 = __toESM(require("react"));
8379
+ var import_react60 = __toESM(require("react"));
8331
8380
  var import_jsx_runtime60 = require("react/jsx-runtime");
8332
8381
  function CommentTable({
8333
8382
  pageSize,
@@ -8537,9 +8586,9 @@ function CommentTable({
8537
8586
  createdOn: "08 Aug 2026",
8538
8587
  status: true
8539
8588
  }];
8540
- const [data, setData] = (0, import_react61.useState)(initialData);
8541
- const [sortOrder, setSortOrder] = (0, import_react61.useState)("asc");
8542
- const [sortKey, setSortKey] = (0, import_react61.useState)("commentId");
8589
+ const [data, setData] = (0, import_react60.useState)(initialData);
8590
+ const [sortOrder, setSortOrder] = (0, import_react60.useState)("asc");
8591
+ const [sortKey, setSortKey] = (0, import_react60.useState)("commentId");
8543
8592
  const handleSort = (columnKey) => {
8544
8593
  const isAsc = sortKey === columnKey && sortOrder === "asc";
8545
8594
  setSortOrder(isAsc ? "desc" : "asc");
@@ -8555,7 +8604,7 @@ function CommentTable({
8555
8604
  const query = (searchQuery || "").toLowerCase();
8556
8605
  return String(item.commentId).toLowerCase().includes(query) || String(item.taskInstanceId).toLowerCase().includes(query) || item.comment.toLowerCase().includes(query) || String(item.commentedBy).toLowerCase().includes(query);
8557
8606
  });
8558
- (0, import_react61.useEffect)(() => {
8607
+ (0, import_react60.useEffect)(() => {
8559
8608
  if (setTotalEntries) setTotalEntries(filteredData.length);
8560
8609
  }, [filteredData.length, setTotalEntries]);
8561
8610
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -8611,15 +8660,15 @@ function CommentTable({
8611
8660
  }
8612
8661
 
8613
8662
  // src/components/comment/addcomment.jsx
8614
- var import_react62 = __toESM(require("react"));
8663
+ var import_react61 = __toESM(require("react"));
8615
8664
  var import_jsx_runtime61 = require("react/jsx-runtime");
8616
8665
  function AddCommentModal({
8617
8666
  isOpen,
8618
8667
  onClose
8619
8668
  }) {
8620
- const [allowEdit, setAllowEdit] = (0, import_react62.useState)(true);
8621
- const [pinComment, setPinComment] = (0, import_react62.useState)(true);
8622
- const [sendNotification, setSendNotification] = (0, import_react62.useState)(false);
8669
+ const [allowEdit, setAllowEdit] = (0, import_react61.useState)(true);
8670
+ const [pinComment, setPinComment] = (0, import_react61.useState)(true);
8671
+ const [sendNotification, setSendNotification] = (0, import_react61.useState)(false);
8623
8672
  if (!isOpen) return null;
8624
8673
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
8625
8674
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
@@ -8816,12 +8865,12 @@ function AddCommentModal({
8816
8865
  // src/components/comment/comment_main.jsx
8817
8866
  var import_jsx_runtime62 = require("react/jsx-runtime");
8818
8867
  function Comment_main() {
8819
- const [modalOpen, setModalOpen] = (0, import_react63.useState)(false);
8820
- const [pageSize, setPageSize] = (0, import_react63.useState)(10);
8821
- const [searchQuery, setSearchQuery] = (0, import_react63.useState)("");
8822
- const [currentPage, setCurrentPage] = (0, import_react63.useState)(1);
8823
- const [totalEntries, setTotalEntries] = (0, import_react63.useState)(0);
8824
- const tableRef = (0, import_react63.useRef)(null);
8868
+ const [modalOpen, setModalOpen] = (0, import_react62.useState)(false);
8869
+ const [pageSize, setPageSize] = (0, import_react62.useState)(10);
8870
+ const [searchQuery, setSearchQuery] = (0, import_react62.useState)("");
8871
+ const [currentPage, setCurrentPage] = (0, import_react62.useState)(1);
8872
+ const [totalEntries, setTotalEntries] = (0, import_react62.useState)(0);
8873
+ const tableRef = (0, import_react62.useRef)(null);
8825
8874
  const handlePageSizeChange = (e) => {
8826
8875
  setPageSize(Number(e.target.value));
8827
8876
  setCurrentPage(1);
@@ -8890,11 +8939,11 @@ function Comment_main() {
8890
8939
  }
8891
8940
 
8892
8941
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
8893
- var import_react69 = __toESM(require("react"));
8894
- var import_sweetalert24 = __toESM(require("sweetalert2"));
8942
+ var import_react68 = __toESM(require("react"));
8943
+ var import_sweetalert27 = __toESM(require("sweetalert2"));
8895
8944
 
8896
8945
  // src/components/hierarchy-node/SearchBar.jsx
8897
- var import_react64 = __toESM(require("react"));
8946
+ var import_react63 = __toESM(require("react"));
8898
8947
  var import_jsx_runtime63 = require("react/jsx-runtime");
8899
8948
  function SearchBar9({ searchQuery, setSearchQuery }) {
8900
8949
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "fc:relative fc:max-w-sm fc:w-full", children: [
@@ -8930,18 +8979,18 @@ function SearchBar9({ searchQuery, setSearchQuery }) {
8930
8979
  }
8931
8980
 
8932
8981
  // src/components/hierarchy-node/HierarchyTable.jsx
8933
- var import_react67 = __toESM(require("react"));
8982
+ var import_react66 = __toESM(require("react"));
8934
8983
 
8935
8984
  // src/components/hierarchy-node/AddEditModal.jsx
8936
- var import_react65 = __toESM(require("react"));
8985
+ var import_react64 = __toESM(require("react"));
8937
8986
  var import_jsx_runtime64 = require("react/jsx-runtime");
8938
- function AddEditModal2({
8987
+ function AddEditModal({
8939
8988
  isOpen,
8940
8989
  onClose,
8941
8990
  onSave,
8942
8991
  editData
8943
8992
  }) {
8944
- const [formData, setFormData] = (0, import_react65.useState)({
8993
+ const [formData, setFormData] = (0, import_react64.useState)({
8945
8994
  hierarchyNodeId: "",
8946
8995
  parentHierarchyNodeId: "",
8947
8996
  hierarchyLevel: "",
@@ -8951,7 +9000,7 @@ function AddEditModal2({
8951
9000
  externalEntityId: "",
8952
9001
  isActive: true
8953
9002
  });
8954
- (0, import_react65.useEffect)(() => {
9003
+ (0, import_react64.useEffect)(() => {
8955
9004
  if (editData) {
8956
9005
  setFormData(editData);
8957
9006
  }
@@ -8963,9 +9012,19 @@ function AddEditModal2({
8963
9012
  [name]: type === "checkbox" ? checked : value
8964
9013
  }));
8965
9014
  };
8966
- const handleSave = () => {
8967
- onSave(formData);
8968
- onClose();
9015
+ const handleSave = async () => {
9016
+ const success = await (onSave == null ? void 0 : onSave({
9017
+ hierarchyNodeId: Number(formData.hierarchyNodeId),
9018
+ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0),
9019
+ hierarchyLevel: Number(formData.hierarchyLevel || 0),
9020
+ nodeType: formData.nodeType,
9021
+ nodeName: formData.nodeName,
9022
+ externalEntityType: formData.externalEntityType,
9023
+ externalEntityId: Number(formData.externalEntityId || 0),
9024
+ isActive: Boolean(formData.isActive),
9025
+ updatedBy: formData.updatedBy || formData.createdBy || "System"
9026
+ }));
9027
+ if (success) onClose();
8969
9028
  };
8970
9029
  return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-black/40 fc:flex fc:items-center fc:justify-center fc:z-50", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "fc:bg-white fc:w-[650px] fc:rounded-2xl fc:shadow-xl fc:p-6", children: [
8971
9030
  /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:mb-6", children: [
@@ -9094,7 +9153,7 @@ function AddEditModal2({
9094
9153
  }
9095
9154
 
9096
9155
  // src/components/hierarchy-node/DeleteModal.jsx
9097
- var import_react66 = __toESM(require("react"));
9156
+ var import_react65 = __toESM(require("react"));
9098
9157
  var import_jsx_runtime65 = require("react/jsx-runtime");
9099
9158
  function DeleteModal2({
9100
9159
  isOpen,
@@ -9157,120 +9216,31 @@ var import_jsx_runtime66 = require("react/jsx-runtime");
9157
9216
  function HierarchyTable({
9158
9217
  apiData,
9159
9218
  pageSize,
9160
- searchQuery
9219
+ searchQuery,
9220
+ onUpdate,
9221
+ onDelete
9161
9222
  }) {
9162
- const hierarchyData = [{
9163
- hierarchyNodeId: 1,
9164
- parentHierarchyNodeId: 0,
9165
- hierarchyLevel: 1,
9166
- nodeType: "Department",
9167
- nodeName: "Head Office",
9168
- externalEntityType: "Organization",
9169
- externalEntityId: 1001,
9170
- isActive: true
9171
- }, {
9172
- hierarchyNodeId: 2,
9173
- parentHierarchyNodeId: 1,
9174
- hierarchyLevel: 2,
9175
- nodeType: "District",
9176
- nodeName: "Ludhiana",
9177
- externalEntityType: "District",
9178
- externalEntityId: 1002,
9179
- isActive: true
9180
- }, {
9181
- hierarchyNodeId: 3,
9182
- parentHierarchyNodeId: 2,
9183
- hierarchyLevel: 3,
9184
- nodeType: "Block",
9185
- nodeName: "Samrala",
9186
- externalEntityType: "Block",
9187
- externalEntityId: 1003,
9188
- isActive: false
9189
- }, {
9190
- hierarchyNodeId: 4,
9191
- parentHierarchyNodeId: 2,
9192
- hierarchyLevel: 3,
9193
- nodeType: "Block",
9194
- nodeName: "Khanna",
9195
- externalEntityType: "Block",
9196
- externalEntityId: 1004,
9197
- isActive: true
9198
- }, {
9199
- hierarchyNodeId: 5,
9200
- parentHierarchyNodeId: 4,
9201
- hierarchyLevel: 4,
9202
- nodeType: "Panchayat",
9203
- nodeName: "Village A",
9204
- externalEntityType: "Village",
9205
- externalEntityId: 1005,
9206
- isActive: true
9207
- }, {
9208
- hierarchyNodeId: 6,
9209
- parentHierarchyNodeId: 4,
9210
- hierarchyLevel: 4,
9211
- nodeType: "Panchayat",
9212
- nodeName: "Village B",
9213
- externalEntityType: "Village",
9214
- externalEntityId: 1006,
9215
- isActive: false
9216
- }, {
9217
- hierarchyNodeId: 7,
9218
- parentHierarchyNodeId: 1,
9219
- hierarchyLevel: 2,
9220
- nodeType: "Department",
9221
- nodeName: "Finance",
9222
- externalEntityType: "Department",
9223
- externalEntityId: 1007,
9224
- isActive: true
9225
- }, {
9226
- hierarchyNodeId: 8,
9227
- parentHierarchyNodeId: 1,
9228
- hierarchyLevel: 2,
9229
- nodeType: "Department",
9230
- nodeName: "HR",
9231
- externalEntityType: "Department",
9232
- externalEntityId: 1008,
9233
- isActive: true
9234
- }, {
9235
- hierarchyNodeId: 9,
9236
- parentHierarchyNodeId: 8,
9237
- hierarchyLevel: 3,
9238
- nodeType: "Branch",
9239
- nodeName: "Recruitment",
9240
- externalEntityType: "Branch",
9241
- externalEntityId: 1009,
9242
- isActive: false
9243
- }, {
9244
- hierarchyNodeId: 10,
9245
- parentHierarchyNodeId: 8,
9246
- hierarchyLevel: 3,
9247
- nodeType: "Branch",
9248
- nodeName: "Training",
9249
- externalEntityType: "Branch",
9250
- externalEntityId: 1010,
9251
- isActive: true
9252
- }];
9253
- const [currentPage, setCurrentPage] = (0, import_react67.useState)(1);
9223
+ const [currentPage, setCurrentPage] = (0, import_react66.useState)(1);
9254
9224
  ;
9255
- const [data, setData] = (0, import_react67.useState)(apiData || hierarchyData);
9256
- (0, import_react67.useEffect)(() => {
9257
- if (apiData) setData(apiData);
9225
+ const [data, setData] = (0, import_react66.useState)(apiData || []);
9226
+ (0, import_react66.useEffect)(() => {
9227
+ setData(apiData || []);
9258
9228
  }, [apiData]);
9259
9229
  const filteredData = data.filter(
9260
9230
  (item) => (item.nodeName || "").toLowerCase().includes((searchQuery || "").toLowerCase()) || (item.nodeType || "").toLowerCase().includes((searchQuery || "").toLowerCase()) || String(item.hierarchyNodeId).includes(searchQuery || "")
9261
9231
  );
9262
- const [sortColumn, setSortColumn] = (0, import_react67.useState)("");
9263
- const [sortDirection, setSortDirection] = (0, import_react67.useState)("asc");
9232
+ const [sortColumn, setSortColumn] = (0, import_react66.useState)("");
9233
+ const [sortDirection, setSortDirection] = (0, import_react66.useState)("asc");
9264
9234
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
9265
9235
  const startIndex = (currentPage - 1) * pageSize;
9266
9236
  const visibleData = filteredData.slice(
9267
9237
  startIndex,
9268
9238
  startIndex + pageSize
9269
9239
  );
9270
- const [editOpen, setEditOpen] = (0, import_react67.useState)(false);
9271
- const [deleteOpen, setDeleteOpen] = (0, import_react67.useState)(false);
9272
- const [selectedNode, setSelectedNode] = (0, import_react67.useState)(null);
9273
- (0, import_react67.useEffect)(() => {
9240
+ const [editOpen, setEditOpen] = (0, import_react66.useState)(false);
9241
+ const [deleteOpen, setDeleteOpen] = (0, import_react66.useState)(false);
9242
+ const [selectedNode, setSelectedNode] = (0, import_react66.useState)(null);
9243
+ (0, import_react66.useEffect)(() => {
9274
9244
  setCurrentPage(1);
9275
9245
  }, [searchQuery, pageSize]);
9276
9246
  const handleSort = (column) => {
@@ -9303,21 +9273,11 @@ function HierarchyTable({
9303
9273
  setSelectedNode(item);
9304
9274
  setDeleteOpen(true);
9305
9275
  };
9306
- const handleUpdate = (updatedNode) => {
9307
- setData(
9308
- (prev) => prev.map(
9309
- (item) => item.hierarchyNodeId === updatedNode.hierarchyNodeId ? updatedNode : item
9310
- )
9311
- );
9312
- setEditOpen(false);
9276
+ const handleUpdate = async (updatedNode) => {
9277
+ return onUpdate == null ? void 0 : onUpdate(updatedNode);
9313
9278
  };
9314
- const confirmDelete = () => {
9315
- setData(
9316
- (prev) => prev.filter(
9317
- (item) => item.hierarchyNodeId !== selectedNode.hierarchyNodeId
9318
- )
9319
- );
9320
- setDeleteOpen(false);
9279
+ const confirmDelete = async () => {
9280
+ if (await (onDelete == null ? void 0 : onDelete(selectedNode))) setDeleteOpen(false);
9321
9281
  };
9322
9282
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "fc:h-full fc:flex fc:flex-col", children: [
9323
9283
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "fc:rounded-2xl fc:border fc:border-slate-200 fc:overflow-hidden fc:flex fc:flex-col fc:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "fc:flex-1 fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("table", { className: "fc:min-w-full fc:bg-white", children: [
@@ -9421,7 +9381,7 @@ function HierarchyTable({
9421
9381
  )
9422
9382
  ] }),
9423
9383
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
9424
- AddEditModal2,
9384
+ AddEditModal,
9425
9385
  {
9426
9386
  isOpen: editOpen,
9427
9387
  editData: selectedNode,
@@ -9443,13 +9403,23 @@ function HierarchyTable({
9443
9403
  }
9444
9404
 
9445
9405
  // src/components/hierarchy-node/AddHierarchyNodeModal.jsx
9446
- var import_react68 = __toESM(require("react"));
9406
+ var import_react67 = __toESM(require("react"));
9447
9407
  var import_jsx_runtime67 = require("react/jsx-runtime");
9448
9408
  function AddHierarchyNodeModal({
9449
9409
  isOpen,
9450
9410
  onClose,
9451
9411
  onSave
9452
9412
  }) {
9413
+ const [formData, setFormData] = (0, import_react67.useState)({ hierarchyNodeId: "", parentHierarchyNodeId: "", hierarchyLevel: "", nodeType: "", nodeName: "", externalEntityType: "", externalEntityId: "", isActive: "true", remarks: "" });
9414
+ const [isSubmitting, setIsSubmitting] = (0, import_react67.useState)(false);
9415
+ const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [event.target.name]: event.target.value }));
9416
+ const handleSave = async () => {
9417
+ if (!onSave) return;
9418
+ setIsSubmitting(true);
9419
+ const success = await onSave({ parentHierarchyNodeId: Number(formData.parentHierarchyNodeId || 0), hierarchyLevel: Number(formData.hierarchyLevel || 0), nodeType: formData.nodeType, nodeName: formData.nodeName, externalEntityType: formData.externalEntityType, externalEntityId: Number(formData.externalEntityId || 0), createdBy: "System" });
9420
+ setIsSubmitting(false);
9421
+ if (success) onClose();
9422
+ };
9453
9423
  if (!isOpen) return null;
9454
9424
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
9455
9425
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
@@ -9470,21 +9440,21 @@ function AddHierarchyNodeModal({
9470
9440
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
9471
9441
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9472
9442
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Hierarchy Node Id" }),
9473
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9443
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9474
9444
  ] }),
9475
9445
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9476
9446
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Parent Hierarchy Node Id" }),
9477
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9447
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9478
9448
  ] })
9479
9449
  ] }),
9480
9450
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
9481
9451
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9482
9452
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Hierarchy Level" }),
9483
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9453
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9484
9454
  ] }),
9485
9455
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9486
9456
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Node Type" }),
9487
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("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: [
9457
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("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: [
9488
9458
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Select Node Type" }),
9489
9459
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "District" }),
9490
9460
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "Block" }),
@@ -9496,12 +9466,12 @@ function AddHierarchyNodeModal({
9496
9466
  ] }),
9497
9467
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9498
9468
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Node Name" }),
9499
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9469
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9500
9470
  ] }),
9501
9471
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "fc:grid fc:grid-cols-1 md:fc:fc:grid-cols-2 fc:gap-5", children: [
9502
9472
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9503
9473
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "External Entity Type" }),
9504
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("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: [
9474
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("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: [
9505
9475
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Select Entity Type" }),
9506
9476
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "Department" }),
9507
9477
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "Office" }),
@@ -9511,12 +9481,12 @@ function AddHierarchyNodeModal({
9511
9481
  ] }),
9512
9482
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9513
9483
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "External Entity Id" }),
9514
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9484
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9515
9485
  ] })
9516
9486
  ] }),
9517
9487
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9518
9488
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Is Active" }),
9519
- /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("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: [
9489
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("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: [
9520
9490
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "true", children: "Yes" }),
9521
9491
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "false", children: "No" })
9522
9492
  ] })
@@ -9526,7 +9496,7 @@ function AddHierarchyNodeModal({
9526
9496
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" }),
9527
9497
  /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
9528
9498
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-slate-700 fc:mb-2", children: "Remarks" }),
9529
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9499
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("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" })
9530
9500
  ] })
9531
9501
  ] })
9532
9502
  ] }),
@@ -9536,9 +9506,10 @@ function AddHierarchyNodeModal({
9536
9506
  "button",
9537
9507
  {
9538
9508
  type: "button",
9539
- onClick: onSave,
9509
+ onClick: handleSave,
9510
+ disabled: isSubmitting,
9540
9511
  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",
9541
- children: "Save Hierarchy Node"
9512
+ children: isSubmitting ? "Saving..." : "Save Hierarchy Node"
9542
9513
  }
9543
9514
  )
9544
9515
  ] })
@@ -9549,12 +9520,13 @@ function AddHierarchyNodeModal({
9549
9520
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
9550
9521
  var import_jsx_runtime68 = require("react/jsx-runtime");
9551
9522
  function HierarchyNodeMain() {
9552
- const [modalOpen, setModalOpen] = (0, import_react69.useState)(false);
9553
- const [pageSize, setPageSize] = (0, import_react69.useState)(5);
9554
- const tableRef = (0, import_react69.useRef)(null);
9555
- const [searchQuery, setSearchQuery] = (0, import_react69.useState)("");
9556
- const [apiData, setApiData] = (0, import_react69.useState)([]);
9557
- (0, import_react69.useEffect)(() => {
9523
+ const [modalOpen, setModalOpen] = (0, import_react68.useState)(false);
9524
+ const [pageSize, setPageSize] = (0, import_react68.useState)(5);
9525
+ const tableRef = (0, import_react68.useRef)(null);
9526
+ const [searchQuery, setSearchQuery] = (0, import_react68.useState)("");
9527
+ const [apiData, setApiData] = (0, import_react68.useState)([]);
9528
+ const [refreshKey, setRefreshKey] = (0, import_react68.useState)(0);
9529
+ (0, import_react68.useEffect)(() => {
9558
9530
  (async () => {
9559
9531
  var _a, _b, _c, _d, _e, _f, _g;
9560
9532
  try {
@@ -9564,12 +9536,26 @@ function HierarchyNodeMain() {
9564
9536
  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;
9565
9537
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
9566
9538
  } catch (error) {
9567
- await import_sweetalert24.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9539
+ await import_sweetalert27.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
9568
9540
  }
9569
9541
  })();
9570
- }, [modalOpen]);
9542
+ }, [refreshKey]);
9571
9543
  const handleRefresh = () => {
9572
- console.log("Refresh clicked");
9544
+ setRefreshKey((previous) => previous + 1);
9545
+ };
9546
+ const saveNode = async (payload, isEdit = false) => {
9547
+ var _a, _b, _c, _d, _e;
9548
+ try {
9549
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
9550
+ if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
9551
+ await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
9552
+ await import_sweetalert27.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
9553
+ handleRefresh();
9554
+ return true;
9555
+ } catch (error) {
9556
+ await import_sweetalert27.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
9557
+ return false;
9558
+ }
9573
9559
  };
9574
9560
  return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "fc:h-screen fc:bg-slate-50 fc:p-6 fc:flex fc:flex-col fc:overflow-hidden", children: [
9575
9561
  /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "fc:w-full fc:flex fc:flex-col fc:flex-1 fc:space-y-5 fc:overflow-hidden", children: [
@@ -9620,20 +9606,22 @@ function HierarchyNodeMain() {
9620
9606
  {
9621
9607
  apiData,
9622
9608
  pageSize,
9623
- searchQuery
9609
+ searchQuery,
9610
+ onUpdate: (payload) => saveNode(payload, true),
9611
+ onDelete: (node) => saveNode(__spreadProps(__spreadValues({}, node), { hierarchyNodeId: node.hierarchyNodeId, isActive: false, updatedBy: node.updatedBy || node.createdBy || "System" }), true)
9624
9612
  }
9625
9613
  ) })
9626
9614
  ] })
9627
9615
  ] }),
9628
- /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AddHierarchyNodeModal, { isOpen: modalOpen, onClose: () => setModalOpen(false) })
9616
+ /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(AddHierarchyNodeModal, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: (payload) => saveNode(payload) })
9629
9617
  ] });
9630
9618
  }
9631
9619
 
9632
9620
  // src/components/file-pool/FilePoolMain.jsx
9633
- var import_react73 = __toESM(require("react"));
9621
+ var import_react72 = __toESM(require("react"));
9634
9622
 
9635
9623
  // src/components/file-pool/SearchBar.jsx
9636
- var import_react70 = __toESM(require("react"));
9624
+ var import_react69 = __toESM(require("react"));
9637
9625
  var import_jsx_runtime69 = require("react/jsx-runtime");
9638
9626
  function SearchBar10() {
9639
9627
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "fc:relative fc:w-full fc:max-w-sm", children: [
@@ -9643,7 +9631,7 @@ function SearchBar10() {
9643
9631
  }
9644
9632
 
9645
9633
  // src/components/file-pool/FilePoolTable.jsx
9646
- var import_react71 = __toESM(require("react"));
9634
+ var import_react70 = __toESM(require("react"));
9647
9635
  var import_jsx_runtime70 = require("react/jsx-runtime");
9648
9636
  function FilePoolTable({
9649
9637
  pageSize
@@ -9719,10 +9707,10 @@ function FilePoolTable({
9719
9707
  addedOn: "10-07-2026",
9720
9708
  pulledOn: "-"
9721
9709
  }];
9722
- const [currentPage, setCurrentPage] = (0, import_react71.useState)(1);
9723
- const [data, setData] = (0, import_react71.useState)(filePoolData);
9724
- const [sortColumn, setSortColumn] = (0, import_react71.useState)("");
9725
- const [sortDirection, setSortDirection] = (0, import_react71.useState)("asc");
9710
+ const [currentPage, setCurrentPage] = (0, import_react70.useState)(1);
9711
+ const [data, setData] = (0, import_react70.useState)(filePoolData);
9712
+ const [sortColumn, setSortColumn] = (0, import_react70.useState)("");
9713
+ const [sortDirection, setSortDirection] = (0, import_react70.useState)("asc");
9726
9714
  const totalPages = Math.ceil(data.length / pageSize) || 1;
9727
9715
  const startIndex = (currentPage - 1) * pageSize;
9728
9716
  const currentData = data.slice(startIndex, startIndex + pageSize);
@@ -9805,7 +9793,7 @@ function FilePoolTable({
9805
9793
  }
9806
9794
 
9807
9795
  // src/components/file-pool/AddFilePoolModal.jsx
9808
- var import_react72 = __toESM(require("react"));
9796
+ var import_react71 = __toESM(require("react"));
9809
9797
  var import_jsx_runtime71 = require("react/jsx-runtime");
9810
9798
  function AddFilePoolModal({
9811
9799
  isOpen,
@@ -9878,9 +9866,9 @@ function AddFilePoolModal({
9878
9866
  // src/components/file-pool/FilePoolMain.jsx
9879
9867
  var import_jsx_runtime72 = require("react/jsx-runtime");
9880
9868
  function FilePoolMain() {
9881
- const [modalOpen, setModalOpen] = (0, import_react73.useState)(false);
9882
- const [pageSize, setPageSize] = (0, import_react73.useState)(5);
9883
- const tableRef = (0, import_react73.useRef)(null);
9869
+ const [modalOpen, setModalOpen] = (0, import_react72.useState)(false);
9870
+ const [pageSize, setPageSize] = (0, import_react72.useState)(5);
9871
+ const tableRef = (0, import_react72.useRef)(null);
9884
9872
  const handleRefresh = () => {
9885
9873
  console.log("Refresh clicked");
9886
9874
  };
@@ -9930,10 +9918,10 @@ function FilePoolMain() {
9930
9918
  }
9931
9919
 
9932
9920
  // src/components/uploaded-document/UploadedDocumentMain.jsx
9933
- var import_react77 = __toESM(require("react"));
9921
+ var import_react76 = __toESM(require("react"));
9934
9922
 
9935
9923
  // src/components/uploaded-document/SearchBar.jsx
9936
- var import_react74 = __toESM(require("react"));
9924
+ var import_react73 = __toESM(require("react"));
9937
9925
  var import_jsx_runtime73 = require("react/jsx-runtime");
9938
9926
  function SearchBar11() {
9939
9927
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "fc:relative fc:w-full fc:max-w-sm", children: [
@@ -9943,7 +9931,7 @@ function SearchBar11() {
9943
9931
  }
9944
9932
 
9945
9933
  // src/components/uploaded-document/UploadedDocumentTable.jsx
9946
- var import_react75 = __toESM(require("react"));
9934
+ var import_react74 = __toESM(require("react"));
9947
9935
  var import_jsx_runtime74 = require("react/jsx-runtime");
9948
9936
  function UploadedDocumentTable({
9949
9937
  pageSize
@@ -10019,10 +10007,10 @@ function UploadedDocumentTable({
10019
10007
  storagePath: "/uploads/certificate.pdf",
10020
10008
  uploadedBy: "Admin"
10021
10009
  }];
10022
- const [data, setData] = (0, import_react75.useState)(uploadedDocuments);
10023
- const [currentPage, setCurrentPage] = (0, import_react75.useState)(1);
10024
- const [sortColumn, setSortColumn] = (0, import_react75.useState)("");
10025
- const [sortDirection, setSortDirection] = (0, import_react75.useState)("asc");
10010
+ const [data, setData] = (0, import_react74.useState)(uploadedDocuments);
10011
+ const [currentPage, setCurrentPage] = (0, import_react74.useState)(1);
10012
+ const [sortColumn, setSortColumn] = (0, import_react74.useState)("");
10013
+ const [sortDirection, setSortDirection] = (0, import_react74.useState)("asc");
10026
10014
  const totalPages = Math.ceil(data.length / pageSize) || 1;
10027
10015
  const startIndex = (currentPage - 1) * pageSize;
10028
10016
  const currentData = data.slice(startIndex, startIndex + pageSize);
@@ -10106,7 +10094,7 @@ function UploadedDocumentTable({
10106
10094
  }
10107
10095
 
10108
10096
  // src/components/uploaded-document/AddUploadedDocumentModal.jsx
10109
- var import_react76 = __toESM(require("react"));
10097
+ var import_react75 = __toESM(require("react"));
10110
10098
  var import_jsx_runtime75 = require("react/jsx-runtime");
10111
10099
  function AddUploadedDocumentModal({
10112
10100
  isOpen,
@@ -10222,9 +10210,9 @@ function AddUploadedDocumentModal({
10222
10210
  // src/components/uploaded-document/UploadedDocumentMain.jsx
10223
10211
  var import_jsx_runtime76 = require("react/jsx-runtime");
10224
10212
  function UploadedDocumentMain() {
10225
- const [modalOpen, setModalOpen] = (0, import_react77.useState)(false);
10226
- const [pageSize, setPageSize] = (0, import_react77.useState)(5);
10227
- const tableRef = (0, import_react77.useRef)(null);
10213
+ const [modalOpen, setModalOpen] = (0, import_react76.useState)(false);
10214
+ const [pageSize, setPageSize] = (0, import_react76.useState)(5);
10215
+ const tableRef = (0, import_react76.useRef)(null);
10228
10216
  const handleRefresh = () => {
10229
10217
  console.log("Refresh clicked");
10230
10218
  };
@@ -10274,14 +10262,14 @@ function UploadedDocumentMain() {
10274
10262
  }
10275
10263
 
10276
10264
  // src/components/BuisnessEntity/BusinessEntitymain.js
10277
- var import_react79 = __toESM(require("react"));
10265
+ var import_react78 = __toESM(require("react"));
10278
10266
  var import_link4 = __toESM(require("next/link"));
10279
10267
 
10280
10268
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
10281
- var import_react78 = __toESM(require("react"));
10269
+ var import_react77 = __toESM(require("react"));
10282
10270
  var import_jsx_runtime77 = require("react/jsx-runtime");
10283
10271
  function AddBusinessEntityModal({ onClose }) {
10284
- const [formData, setFormData] = (0, import_react78.useState)({
10272
+ const [formData, setFormData] = (0, import_react77.useState)({
10285
10273
  entityType: "",
10286
10274
  entityKey: "",
10287
10275
  displayNumber: "",
@@ -10290,7 +10278,7 @@ function AddBusinessEntityModal({ onClose }) {
10290
10278
  isVisible: true,
10291
10279
  status: "Active"
10292
10280
  });
10293
- const [errors, setErrors] = (0, import_react78.useState)({});
10281
+ const [errors, setErrors] = (0, import_react77.useState)({});
10294
10282
  const handleChange = (field, value) => {
10295
10283
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
10296
10284
  [field]: value
@@ -10665,10 +10653,10 @@ function BusinessEntity() {
10665
10653
  const handleDownload = () => {
10666
10654
  console.log("Download clicked");
10667
10655
  };
10668
- const tableRef = (0, import_react79.useRef)(null);
10669
- const [showModal, setShowModal] = (0, import_react79.useState)(false);
10670
- const [pageSize, setPageSize] = (0, import_react79.useState)(5);
10671
- const [sortConfig, setSortConfig] = (0, import_react79.useState)({
10656
+ const tableRef = (0, import_react78.useRef)(null);
10657
+ const [showModal, setShowModal] = (0, import_react78.useState)(false);
10658
+ const [pageSize, setPageSize] = (0, import_react78.useState)(5);
10659
+ const [sortConfig, setSortConfig] = (0, import_react78.useState)({
10672
10660
  key: "",
10673
10661
  direction: "asc"
10674
10662
  });
@@ -10746,14 +10734,14 @@ function BusinessEntity() {
10746
10734
  }
10747
10735
 
10748
10736
  // src/components/FileInstance/FileInstancemain.js
10749
- var import_react81 = __toESM(require("react"));
10737
+ var import_react80 = __toESM(require("react"));
10750
10738
  var import_link5 = __toESM(require("next/link"));
10751
10739
 
10752
10740
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
10753
- var import_react80 = __toESM(require("react"));
10741
+ var import_react79 = __toESM(require("react"));
10754
10742
  var import_jsx_runtime79 = require("react/jsx-runtime");
10755
10743
  function AddFileInstanceModal({ onClose }) {
10756
- const [formData, setFormData] = (0, import_react80.useState)({
10744
+ const [formData, setFormData] = (0, import_react79.useState)({
10757
10745
  workflow: "",
10758
10746
  businessEntityType: "",
10759
10747
  businessEntity: "",
@@ -10763,7 +10751,7 @@ function AddFileInstanceModal({ onClose }) {
10763
10751
  status: "Pending",
10764
10752
  priority: "High"
10765
10753
  });
10766
- const [errors, setErrors] = (0, import_react80.useState)({});
10754
+ const [errors, setErrors] = (0, import_react79.useState)({});
10767
10755
  const validateForm = () => {
10768
10756
  const newErrors = {};
10769
10757
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -11174,10 +11162,10 @@ function FileInstance() {
11174
11162
  const handleDownload = () => {
11175
11163
  console.log("Download clicked");
11176
11164
  };
11177
- const tableRef = (0, import_react81.useRef)(null);
11178
- const [showModal, setShowModal] = (0, import_react81.useState)(false);
11179
- const [pageSize, setPageSize] = (0, import_react81.useState)(5);
11180
- const [sortConfig, setSortConfig] = (0, import_react81.useState)({
11165
+ const tableRef = (0, import_react80.useRef)(null);
11166
+ const [showModal, setShowModal] = (0, import_react80.useState)(false);
11167
+ const [pageSize, setPageSize] = (0, import_react80.useState)(5);
11168
+ const [sortConfig, setSortConfig] = (0, import_react80.useState)({
11181
11169
  key: "",
11182
11170
  direction: "asc"
11183
11171
  });
@@ -11285,10 +11273,10 @@ function FileInstance() {
11285
11273
  }
11286
11274
 
11287
11275
  // src/components/assignment-rule/AssignmentRuleMain.jsx
11288
- var import_react85 = __toESM(require("react"));
11276
+ var import_react84 = __toESM(require("react"));
11289
11277
 
11290
11278
  // src/components/assignment-rule/SearchBar.js
11291
- var import_react82 = __toESM(require("react"));
11279
+ var import_react81 = __toESM(require("react"));
11292
11280
  var import_jsx_runtime81 = require("react/jsx-runtime");
11293
11281
  function SearchBar12({
11294
11282
  searchQuery,
@@ -11308,7 +11296,7 @@ function SearchBar12({
11308
11296
  }
11309
11297
 
11310
11298
  // src/components/assignment-rule/Table.js
11311
- var import_react83 = __toESM(require("react"));
11299
+ var import_react82 = __toESM(require("react"));
11312
11300
  var import_jsx_runtime82 = require("react/jsx-runtime");
11313
11301
  function Table4({
11314
11302
  pageSize,
@@ -11416,12 +11404,12 @@ function Table4({
11416
11404
  dynamicFunctionId: "4",
11417
11405
  isPoolEnabled: true
11418
11406
  }];
11419
- const [data, setData] = (0, import_react83.useState)(initialData);
11420
- const [sortOrder, setSortOrder] = (0, import_react83.useState)("asc");
11421
- const [sortKey, setSortKey] = (0, import_react83.useState)("workflowStepId");
11422
- const [selectedItem, setSelectedItem] = (0, import_react83.useState)(null);
11423
- const [isEditModalOpen, setIsEditModalOpen] = (0, import_react83.useState)(false);
11424
- const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react83.useState)(false);
11407
+ const [data, setData] = (0, import_react82.useState)(initialData);
11408
+ const [sortOrder, setSortOrder] = (0, import_react82.useState)("asc");
11409
+ const [sortKey, setSortKey] = (0, import_react82.useState)("workflowStepId");
11410
+ const [selectedItem, setSelectedItem] = (0, import_react82.useState)(null);
11411
+ const [isEditModalOpen, setIsEditModalOpen] = (0, import_react82.useState)(false);
11412
+ const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react82.useState)(false);
11425
11413
  const handleEdit = (item) => {
11426
11414
  setSelectedItem(item);
11427
11415
  setIsEditModalOpen(true);
@@ -11474,7 +11462,7 @@ function Table4({
11474
11462
  const query = searchQuery.toLowerCase().trim();
11475
11463
  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);
11476
11464
  });
11477
- (0, import_react83.useEffect)(() => {
11465
+ (0, import_react82.useEffect)(() => {
11478
11466
  if (setTotalEntries) setTotalEntries(filteredData.length);
11479
11467
  }, [filteredData.length, setTotalEntries]);
11480
11468
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -11600,7 +11588,7 @@ function Table4({
11600
11588
  }
11601
11589
 
11602
11590
  // src/components/assignment-rule/Popup.js
11603
- var import_react84 = __toESM(require("react"));
11591
+ var import_react83 = __toESM(require("react"));
11604
11592
  var import_jsx_runtime83 = require("react/jsx-runtime");
11605
11593
  function Popup4({
11606
11594
  isOpen,
@@ -11608,11 +11596,11 @@ function Popup4({
11608
11596
  onSave
11609
11597
  }) {
11610
11598
  if (!isOpen) return null;
11611
- const [workflowStepId, setWorkflowStepId] = (0, import_react84.useState)("");
11612
- const [assignmentType, setAssignmentType] = (0, import_react84.useState)("");
11613
- const [hierarchyNodeType, setHierarchyNodeType] = (0, import_react84.useState)("");
11614
- const [dynamicFunctionId, setDynamicFunctionId] = (0, import_react84.useState)("");
11615
- const [isPoolEnabled, setIsPoolEnabled] = (0, import_react84.useState)(false);
11599
+ const [workflowStepId, setWorkflowStepId] = (0, import_react83.useState)("");
11600
+ const [assignmentType, setAssignmentType] = (0, import_react83.useState)("");
11601
+ const [hierarchyNodeType, setHierarchyNodeType] = (0, import_react83.useState)("");
11602
+ const [dynamicFunctionId, setDynamicFunctionId] = (0, import_react83.useState)("");
11603
+ const [isPoolEnabled, setIsPoolEnabled] = (0, import_react83.useState)(false);
11616
11604
  const handleSubmit = (e) => {
11617
11605
  e.preventDefault();
11618
11606
  if (!workflowStepId || !assignmentType || !hierarchyNodeType) {
@@ -11689,17 +11677,17 @@ function Popup4({
11689
11677
  // src/components/assignment-rule/AssignmentRuleMain.jsx
11690
11678
  var import_jsx_runtime84 = require("react/jsx-runtime");
11691
11679
  function AssignmentRuleMain() {
11692
- const [refreshkey, setRefreshKey] = (0, import_react85.useState)(0);
11680
+ const [refreshkey, setRefreshKey] = (0, import_react84.useState)(0);
11693
11681
  const handleRefresh = () => {
11694
11682
  console.log("Table data refreshed!");
11695
11683
  setRefreshKey((prev) => prev + 1);
11696
11684
  };
11697
- const tableRef = (0, import_react85.useRef)(null);
11698
- const [showModal, setShowModal] = (0, import_react85.useState)(false);
11699
- const [pageSize, setPageSize] = (0, import_react85.useState)(10);
11700
- const [searchQuery, setSearchQuery] = (0, import_react85.useState)("");
11701
- const [currentPage, setCurrentPage] = (0, import_react85.useState)(1);
11702
- const [totalEntries, setTotalEntries] = (0, import_react85.useState)(0);
11685
+ const tableRef = (0, import_react84.useRef)(null);
11686
+ const [showModal, setShowModal] = (0, import_react84.useState)(false);
11687
+ const [pageSize, setPageSize] = (0, import_react84.useState)(10);
11688
+ const [searchQuery, setSearchQuery] = (0, import_react84.useState)("");
11689
+ const [currentPage, setCurrentPage] = (0, import_react84.useState)(1);
11690
+ const [totalEntries, setTotalEntries] = (0, import_react84.useState)(0);
11703
11691
  const handlePageSizeChange = (e) => {
11704
11692
  setPageSize(Number(e.target.value));
11705
11693
  setCurrentPage(1);
@@ -11750,90 +11738,90 @@ var workflowItems = [
11750
11738
  {
11751
11739
  name: "Workflow Type",
11752
11740
  component: "workflowType",
11753
- icon: import_react87.RiGitMergeLine
11741
+ icon: import_react86.RiGitMergeLine
11754
11742
  },
11755
11743
  {
11756
11744
  name: "Workflow",
11757
11745
  component: "workflow",
11758
- icon: import_react87.RiNodeTree
11746
+ icon: import_react86.RiNodeTree
11759
11747
  },
11760
11748
  {
11761
11749
  name: "Workflow Step",
11762
11750
  component: "workflowStep",
11763
- icon: import_react87.RiGitBranchLine
11751
+ icon: import_react86.RiGitBranchLine
11764
11752
  },
11765
11753
  {
11766
11754
  name: "Workflow Transition",
11767
11755
  component: "workflowTransition",
11768
- icon: import_react87.RiCornerDownRightLine
11756
+ icon: import_react86.RiCornerDownRightLine
11769
11757
  }
11770
11758
  ];
11771
11759
  var permissionItems = [{
11772
11760
  name: "Task Permission",
11773
11761
  component: "Task_permission_main",
11774
- icon: import_react87.RiUserSettingsLine
11762
+ icon: import_react86.RiUserSettingsLine
11775
11763
  }, {
11776
11764
  name: "Assignment Rule",
11777
11765
  component: "AssignmentRuleMain",
11778
- icon: import_react87.RiFileShieldLine
11766
+ icon: import_react86.RiFileShieldLine
11779
11767
  }];
11780
11768
  var hierarchyItems = [{
11781
11769
  name: "Hierarchy Node",
11782
11770
  component: "HierarchyNodeMain",
11783
- icon: import_react87.RiNodeTree
11771
+ icon: import_react86.RiNodeTree
11784
11772
  }, {
11785
11773
  name: "User Hierarchy Mapping",
11786
11774
  component: "User_hierarchy_mapping_main",
11787
- icon: import_react87.RiUserSharedLine
11775
+ icon: import_react86.RiUserSharedLine
11788
11776
  }, {
11789
11777
  name: "Workflow Settings",
11790
11778
  component: "WorkflowSettingMain",
11791
- icon: import_react87.RiSettings4Line
11779
+ icon: import_react86.RiSettings4Line
11792
11780
  }];
11793
11781
  var documentItems = [{
11794
11782
  name: "Document Configuration",
11795
11783
  component: "DocumentConfigurationmain",
11796
- icon: import_react87.RiFileSettingsLine
11784
+ icon: import_react86.RiFileSettingsLine
11797
11785
  }];
11798
11786
  var fileItems = [{
11799
11787
  name: "File Instance",
11800
11788
  component: "FileInstanceMain",
11801
- icon: import_react87.RiFileList3Line
11789
+ icon: import_react86.RiFileList3Line
11802
11790
  }, {
11803
11791
  name: "Business Entity",
11804
11792
  component: "BusinessEntitymain",
11805
- icon: import_react87.RiFileList3Line
11793
+ icon: import_react86.RiFileList3Line
11806
11794
  }, {
11807
11795
  name: "File Pool",
11808
11796
  component: "FilePoolMain",
11809
- icon: import_react87.RiDatabase2Line
11797
+ icon: import_react86.RiDatabase2Line
11810
11798
  }, {
11811
11799
  name: "Uploaded Document",
11812
11800
  component: "UploadedDocumentMain",
11813
- icon: import_react87.RiFileUploadLine
11801
+ icon: import_react86.RiFileUploadLine
11814
11802
  }];
11815
11803
  var communicationItems = [{
11816
11804
  name: "Notification",
11817
11805
  component: "Notification_main",
11818
- icon: import_react87.RiNotification4Line
11806
+ icon: import_react86.RiNotification4Line
11819
11807
  }, {
11820
11808
  name: "Comment",
11821
11809
  component: "Comment_main",
11822
- icon: import_react87.RiChat3Line
11810
+ icon: import_react86.RiChat3Line
11823
11811
  }];
11824
11812
  var taskItems = [{
11825
11813
  name: "Task Instance",
11826
11814
  component: "TaskInstanceMain",
11827
- icon: import_react87.RiCheckboxMultipleLine
11815
+ icon: import_react86.RiCheckboxMultipleLine
11828
11816
  }];
11829
11817
  var trackingItems = [{
11830
11818
  name: "Audit Log",
11831
11819
  component: "AuditLogmain",
11832
- icon: import_react87.RiShieldCheckLine
11820
+ icon: import_react86.RiShieldCheckLine
11833
11821
  }, {
11834
11822
  name: "Movement History",
11835
11823
  component: "MovementHistorymain",
11836
- icon: import_react87.RiHistoryLine
11824
+ icon: import_react86.RiHistoryLine
11837
11825
  }];
11838
11826
  function Sidebar({
11839
11827
  isOpen,
@@ -11841,15 +11829,15 @@ function Sidebar({
11841
11829
  childrens
11842
11830
  }) {
11843
11831
  const router = (0, import_router.useRouter)();
11844
- const [workflowOpen, setWorkflowOpen] = (0, import_react86.useState)(false);
11845
- const [permissionOpen, setPermissionOpen] = (0, import_react86.useState)(false);
11846
- const [hierarchyOpen, setHierarchyOpen] = (0, import_react86.useState)(false);
11847
- const [documentOpen, setDocumentOpen] = (0, import_react86.useState)(false);
11848
- const [filesOpen, setFilesOpen] = (0, import_react86.useState)(false);
11849
- const [tasksOpen, setTasksOpen] = (0, import_react86.useState)(false);
11850
- const [trackingOpen, setTrackingOpen] = (0, import_react86.useState)(false);
11851
- const [communicationOpen, setCommunicationOpen] = (0, import_react86.useState)(false);
11852
- const [activeComponent, setActiveComponent] = (0, import_react86.useState)("workflowType");
11832
+ const [workflowOpen, setWorkflowOpen] = (0, import_react85.useState)(false);
11833
+ const [permissionOpen, setPermissionOpen] = (0, import_react85.useState)(false);
11834
+ const [hierarchyOpen, setHierarchyOpen] = (0, import_react85.useState)(false);
11835
+ const [documentOpen, setDocumentOpen] = (0, import_react85.useState)(false);
11836
+ const [filesOpen, setFilesOpen] = (0, import_react85.useState)(false);
11837
+ const [tasksOpen, setTasksOpen] = (0, import_react85.useState)(false);
11838
+ const [trackingOpen, setTrackingOpen] = (0, import_react85.useState)(false);
11839
+ const [communicationOpen, setCommunicationOpen] = (0, import_react85.useState)(false);
11840
+ const [activeComponent, setActiveComponent] = (0, import_react85.useState)("workflowType");
11853
11841
  const renderMenuItemold = (item) => {
11854
11842
  const Icon = item.icon;
11855
11843
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("button", { type: "button", className: `fc:flex fc:h-[48px] fc:w-full fc:items-center fc:gap-[8px] fc:rounded-[9px] fc:px-[8px] fc:text-left fc:transition-colors fc:duration-150${router.pathname === item.path ? "bg-blue-50 text-blue-600" : "text-[#344261] hover:bg-[#F6F8FC]"}`, onClick: () => router.push(item.path), children: [
@@ -11861,7 +11849,7 @@ function Sidebar({
11861
11849
  const Icon = item.icon;
11862
11850
  const handleClick = () => {
11863
11851
  if (item.component) {
11864
- router.push("/flowCore", void 0, {
11852
+ router.push("/", void 0, {
11865
11853
  shallow: true
11866
11854
  });
11867
11855
  setActiveComponent(item.component);
@@ -11926,7 +11914,7 @@ function Sidebar({
11926
11914
  HeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(HeadingIcon, { size: 18, className: "fc:text-[#405170] fc:shrink-0" }),
11927
11915
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "fc:text-[16px] fc:font-semibold", children: title })
11928
11916
  ] }),
11929
- open ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react87.RiArrowDownSLine, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react87.RiArrowRightSLine, { size: 18 })
11917
+ open ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react86.RiArrowDownSLine, { size: 18 }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react86.RiArrowRightSLine, { size: 18 })
11930
11918
  ] }),
11931
11919
  open && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:ml-[2px] fc:border-l fc:border-[#E5E9F1] fc:pl-[2px]", children: items.map(renderMenuItem) })
11932
11920
  ] });
@@ -11946,39 +11934,39 @@ function Sidebar({
11946
11934
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
11947
11935
  ] })
11948
11936
  ] }),
11949
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onToggle, className: "fc:flex fc:h-8 fc:w-8 fc:items-center fc:justify-center fc:rounded-lg hover:fc:fc:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react87.RiMenuLine, { size: 18 }) })
11937
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onToggle, className: "fc:flex fc:h-8 fc:w-8 fc:items-center fc:justify-center fc:rounded-lg hover:fc:fc:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react86.RiMenuLine, { size: 18 }) })
11950
11938
  ] }),
11951
11939
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:min-h-0 fc:flex-1 fc:overflow-y-auto fc:overflow-x-hidden fc:px-[27px] fc:pb-[30px] fc:pt-[31px]", children: [
11952
11940
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:mb-[19px] fc:ml-[15px] fc:text-[14px] fc:font-bold fc:uppercase fc:leading-[20px] fc:tracking-[0.2px] fc:text-[#3C4D74]", children: "Configuration Masters" }),
11953
11941
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:flex-col fc:gap-[3px]", children: [
11954
- renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, import_react87.RiNodeTree),
11955
- renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, import_react87.RiShieldUserLine),
11956
- renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, import_react87.RiFileSettingsLine),
11957
- renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, import_react87.RiNodeTree)
11942
+ renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, import_react86.RiNodeTree),
11943
+ renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, import_react86.RiShieldUserLine),
11944
+ renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, import_react86.RiFileSettingsLine),
11945
+ renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, import_react86.RiNodeTree)
11958
11946
  ] }),
11959
11947
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:mb-[19px] fc:ml-[15px] fc:mt-[39px] fc:text-[14px] fc:font-bold fc:uppercase fc:leading-[20px] fc:tracking-[0.2px] fc:text-[#3C4D74]", children: "Runtime" }),
11960
11948
  /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:flex-col fc:gap-[3px]", children: [
11961
- renderDropdown("Files", filesOpen, setFilesOpen, fileItems, import_react87.RiFolder3Line),
11962
- renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, import_react87.RiCheckboxCircleLine),
11963
- renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, import_react87.RiRouteLine),
11964
- renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, import_react87.RiMessage2Line)
11949
+ renderDropdown("Files", filesOpen, setFilesOpen, fileItems, import_react86.RiFolder3Line),
11950
+ renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, import_react86.RiCheckboxCircleLine),
11951
+ renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, import_react86.RiRouteLine),
11952
+ renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, import_react86.RiMessage2Line)
11965
11953
  ] })
11966
11954
  ] }),
11967
11955
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:shrink-0 fc:bg-white fc:px-[27px] fc:pb-[34px] fc:pt-[18px]", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("button", { type: "button", className: "fc:flex fc:h-[66px] fc:w-full fc:items-center fc:gap-[18px] fc:rounded-[10px] fc:border fc:border-[#E1E5ED] fc:bg-white fc:px-[23px] fc:text-left fc:text-[16px] fc:font-semibold fc:text-[#2D3A58] fc:shadow-sm hover:fc:fc:bg-[#F7F8FC] fc:transition", children: [
11968
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react87.RiSettings4Line, { size: 20 }),
11956
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react86.RiSettings4Line, { size: 20 }),
11969
11957
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { children: "Settings" })
11970
11958
  ] }) })
11971
11959
  ] }),
11972
11960
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:flex-1 fc:overflow-auto fc:bg-[#F5F7FB]", children: renderContent() }),
11973
- !isOpen && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fc:left-[px] fc:top-[30px] fc:z-[100] fc:flex fc:h-[46px] fc:w-[46px] fc:items-center fc:justify-center fc:rounded-[9px] fc:border fc:border-[#E1E5ED] fc:bg-white fc:text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors hover:fc:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react87.RiMenuLine, { size: 18 }) })
11961
+ !isOpen && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fc:left-[px] fc:top-[30px] fc:z-[100] fc:flex fc:h-[46px] fc:w-[46px] fc:items-center fc:justify-center fc:rounded-[9px] fc:border fc:border-[#E1E5ED] fc:bg-white fc:text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors hover:fc:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react86.RiMenuLine, { size: 18 }) })
11974
11962
  ] });
11975
11963
  }
11976
11964
 
11977
11965
  // src/components/Layout.jsx
11978
- var import_react88 = require("react");
11966
+ var import_react87 = require("react");
11979
11967
  var import_jsx_runtime86 = require("react/jsx-runtime");
11980
11968
  var Layout = ({ children }) => {
11981
- const [isOpen, setIsOpen] = (0, import_react88.useState)(true);
11969
+ const [isOpen, setIsOpen] = (0, import_react87.useState)(true);
11982
11970
  return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "flowcore fc:flex fc:min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
11983
11971
  Sidebar,
11984
11972
  {