flowcore-fn 9.3.4 → 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.
- package/dist/pkg-index.js +181 -431
- package/dist/pkg-index.mjs +440 -690
- package/package.json +1 -1
package/dist/pkg-index.js
CHANGED
|
@@ -3271,14 +3271,26 @@ function WorkFlowTransition() {
|
|
|
3271
3271
|
|
|
3272
3272
|
// src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
|
|
3273
3273
|
var import_react26 = __toESM(require("react"));
|
|
3274
|
+
var import_sweetalert26 = __toESM(require("sweetalert2"));
|
|
3274
3275
|
|
|
3275
3276
|
// src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
|
|
3276
3277
|
var import_react21 = __toESM(require("react"));
|
|
3277
3278
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3278
3279
|
function AddUserHierarchyNodeMappingModal({
|
|
3279
3280
|
isOpen,
|
|
3280
|
-
onClose
|
|
3281
|
+
onClose,
|
|
3282
|
+
onSave
|
|
3281
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
|
+
};
|
|
3282
3294
|
if (!isOpen) return null;
|
|
3283
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: [
|
|
3284
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 }),
|
|
@@ -3305,7 +3317,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3305
3317
|
"Mapping ID ",
|
|
3306
3318
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
3307
3319
|
] }),
|
|
3308
|
-
/* @__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" }),
|
|
3309
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" })
|
|
3310
3322
|
] }),
|
|
3311
3323
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
@@ -3313,7 +3325,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3313
3325
|
"External User ID ",
|
|
3314
3326
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
3315
3327
|
] }),
|
|
3316
|
-
/* @__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" }),
|
|
3317
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" })
|
|
3318
3330
|
] })
|
|
3319
3331
|
] }),
|
|
@@ -3322,7 +3334,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3322
3334
|
"Hierarchy Node ID ",
|
|
3323
3335
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
3324
3336
|
] }),
|
|
3325
|
-
/* @__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" }),
|
|
3326
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" })
|
|
3327
3339
|
] }),
|
|
3328
3340
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-5", children: [
|
|
@@ -3331,7 +3343,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3331
3343
|
"Role Code ",
|
|
3332
3344
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
3333
3345
|
] }),
|
|
3334
|
-
/* @__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" }),
|
|
3335
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" })
|
|
3336
3348
|
] }),
|
|
3337
3349
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
@@ -3339,7 +3351,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3339
3351
|
"Is Primary ",
|
|
3340
3352
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
3341
3353
|
] }),
|
|
3342
|
-
/* @__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: [
|
|
3343
3355
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "", children: "Select primary status" }),
|
|
3344
3356
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "true", children: "Yes" }),
|
|
3345
3357
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: "false", children: "No" })
|
|
@@ -3359,12 +3371,12 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3359
3371
|
"Effective From ",
|
|
3360
3372
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
3361
3373
|
] }),
|
|
3362
|
-
/* @__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" }),
|
|
3363
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" })
|
|
3364
3376
|
] }),
|
|
3365
3377
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3366
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" }),
|
|
3367
|
-
/* @__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" }),
|
|
3368
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" })
|
|
3369
3381
|
] })
|
|
3370
3382
|
] })
|
|
@@ -3372,7 +3384,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3372
3384
|
] }),
|
|
3373
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: [
|
|
3374
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" }),
|
|
3375
|
-
/* @__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" })
|
|
3376
3388
|
] })
|
|
3377
3389
|
] })
|
|
3378
3390
|
] });
|
|
@@ -3439,14 +3451,23 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
3439
3451
|
[name]: value
|
|
3440
3452
|
}));
|
|
3441
3453
|
};
|
|
3442
|
-
const handleSubmit = (event) => {
|
|
3454
|
+
const handleSubmit = async (event) => {
|
|
3455
|
+
var _a, _b, _c;
|
|
3443
3456
|
event.preventDefault();
|
|
3444
3457
|
if (onSave) {
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
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();
|
|
3448
3470
|
}
|
|
3449
|
-
onClose();
|
|
3450
3471
|
};
|
|
3451
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: [
|
|
3452
3473
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -3650,264 +3671,19 @@ function DeleteUserHierarchyNodeMappingModal({
|
|
|
3650
3671
|
// src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
|
|
3651
3672
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3652
3673
|
function UserHierarchyNodeMappingTable({
|
|
3674
|
+
apiData,
|
|
3653
3675
|
pageSize,
|
|
3654
3676
|
searchQuery = "",
|
|
3655
3677
|
currentPage,
|
|
3656
3678
|
setCurrentPage,
|
|
3657
|
-
setTotalEntries
|
|
3679
|
+
setTotalEntries,
|
|
3680
|
+
onUpdate,
|
|
3681
|
+
onDelete
|
|
3658
3682
|
}) {
|
|
3659
|
-
const
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
hierarchyNodeId: 2,
|
|
3664
|
-
roleCode: "DEO",
|
|
3665
|
-
isPrimary: true,
|
|
3666
|
-
effectiveFrom: "2026-01-01",
|
|
3667
|
-
effectiveTo: "",
|
|
3668
|
-
status: true
|
|
3669
|
-
}, {
|
|
3670
|
-
id: 2,
|
|
3671
|
-
mappingId: 2,
|
|
3672
|
-
externalUserId: 101,
|
|
3673
|
-
hierarchyNodeId: 3,
|
|
3674
|
-
roleCode: "RO",
|
|
3675
|
-
isPrimary: false,
|
|
3676
|
-
effectiveFrom: "2026-01-01",
|
|
3677
|
-
effectiveTo: "",
|
|
3678
|
-
status: false
|
|
3679
|
-
}, {
|
|
3680
|
-
id: 3,
|
|
3681
|
-
mappingId: 3,
|
|
3682
|
-
externalUserId: 102,
|
|
3683
|
-
hierarchyNodeId: 4,
|
|
3684
|
-
roleCode: "AO",
|
|
3685
|
-
isPrimary: true,
|
|
3686
|
-
effectiveFrom: "2026-01-03",
|
|
3687
|
-
effectiveTo: "",
|
|
3688
|
-
status: true
|
|
3689
|
-
}, {
|
|
3690
|
-
id: 4,
|
|
3691
|
-
mappingId: 4,
|
|
3692
|
-
externalUserId: 103,
|
|
3693
|
-
hierarchyNodeId: 5,
|
|
3694
|
-
roleCode: "SO",
|
|
3695
|
-
isPrimary: false,
|
|
3696
|
-
effectiveFrom: "2026-01-05",
|
|
3697
|
-
effectiveTo: "2026-12-31",
|
|
3698
|
-
status: false
|
|
3699
|
-
}, {
|
|
3700
|
-
id: 5,
|
|
3701
|
-
mappingId: 5,
|
|
3702
|
-
externalUserId: 104,
|
|
3703
|
-
hierarchyNodeId: 6,
|
|
3704
|
-
roleCode: "DEO",
|
|
3705
|
-
isPrimary: true,
|
|
3706
|
-
effectiveFrom: "2026-01-07",
|
|
3707
|
-
effectiveTo: "",
|
|
3708
|
-
status: true
|
|
3709
|
-
}, {
|
|
3710
|
-
id: 6,
|
|
3711
|
-
mappingId: 6,
|
|
3712
|
-
externalUserId: 105,
|
|
3713
|
-
hierarchyNodeId: 7,
|
|
3714
|
-
roleCode: "RO",
|
|
3715
|
-
isPrimary: false,
|
|
3716
|
-
effectiveFrom: "2026-01-09",
|
|
3717
|
-
effectiveTo: "",
|
|
3718
|
-
status: false
|
|
3719
|
-
}, {
|
|
3720
|
-
id: 7,
|
|
3721
|
-
mappingId: 7,
|
|
3722
|
-
externalUserId: 106,
|
|
3723
|
-
hierarchyNodeId: 8,
|
|
3724
|
-
roleCode: "AO",
|
|
3725
|
-
isPrimary: true,
|
|
3726
|
-
effectiveFrom: "2026-01-11",
|
|
3727
|
-
effectiveTo: "",
|
|
3728
|
-
status: true
|
|
3729
|
-
}, {
|
|
3730
|
-
id: 8,
|
|
3731
|
-
mappingId: 8,
|
|
3732
|
-
externalUserId: 107,
|
|
3733
|
-
hierarchyNodeId: 9,
|
|
3734
|
-
roleCode: "SO",
|
|
3735
|
-
isPrimary: false,
|
|
3736
|
-
effectiveFrom: "2026-01-13",
|
|
3737
|
-
effectiveTo: "2026-09-30",
|
|
3738
|
-
status: false
|
|
3739
|
-
}, {
|
|
3740
|
-
id: 9,
|
|
3741
|
-
mappingId: 9,
|
|
3742
|
-
externalUserId: 108,
|
|
3743
|
-
hierarchyNodeId: 10,
|
|
3744
|
-
roleCode: "DEO",
|
|
3745
|
-
isPrimary: true,
|
|
3746
|
-
effectiveFrom: "2026-01-15",
|
|
3747
|
-
effectiveTo: "",
|
|
3748
|
-
status: true
|
|
3749
|
-
}, {
|
|
3750
|
-
id: 10,
|
|
3751
|
-
mappingId: 10,
|
|
3752
|
-
externalUserId: 109,
|
|
3753
|
-
hierarchyNodeId: 11,
|
|
3754
|
-
roleCode: "RO",
|
|
3755
|
-
isPrimary: false,
|
|
3756
|
-
effectiveFrom: "2026-01-17",
|
|
3757
|
-
effectiveTo: "",
|
|
3758
|
-
status: false
|
|
3759
|
-
}, {
|
|
3760
|
-
id: 11,
|
|
3761
|
-
mappingId: 11,
|
|
3762
|
-
externalUserId: 110,
|
|
3763
|
-
hierarchyNodeId: 12,
|
|
3764
|
-
roleCode: "AO",
|
|
3765
|
-
isPrimary: true,
|
|
3766
|
-
effectiveFrom: "2026-01-19",
|
|
3767
|
-
effectiveTo: "",
|
|
3768
|
-
status: true
|
|
3769
|
-
}, {
|
|
3770
|
-
id: 12,
|
|
3771
|
-
mappingId: 12,
|
|
3772
|
-
externalUserId: 111,
|
|
3773
|
-
hierarchyNodeId: 13,
|
|
3774
|
-
roleCode: "SO",
|
|
3775
|
-
isPrimary: false,
|
|
3776
|
-
effectiveFrom: "2026-01-21",
|
|
3777
|
-
effectiveTo: "2026-10-31",
|
|
3778
|
-
status: false
|
|
3779
|
-
}, {
|
|
3780
|
-
id: 13,
|
|
3781
|
-
mappingId: 13,
|
|
3782
|
-
externalUserId: 112,
|
|
3783
|
-
hierarchyNodeId: 14,
|
|
3784
|
-
roleCode: "DEO",
|
|
3785
|
-
isPrimary: true,
|
|
3786
|
-
effectiveFrom: "2026-01-23",
|
|
3787
|
-
effectiveTo: "",
|
|
3788
|
-
status: true
|
|
3789
|
-
}, {
|
|
3790
|
-
id: 14,
|
|
3791
|
-
mappingId: 14,
|
|
3792
|
-
externalUserId: 113,
|
|
3793
|
-
hierarchyNodeId: 15,
|
|
3794
|
-
roleCode: "RO",
|
|
3795
|
-
isPrimary: false,
|
|
3796
|
-
effectiveFrom: "2026-01-25",
|
|
3797
|
-
effectiveTo: "",
|
|
3798
|
-
status: false
|
|
3799
|
-
}, {
|
|
3800
|
-
id: 15,
|
|
3801
|
-
mappingId: 15,
|
|
3802
|
-
externalUserId: 114,
|
|
3803
|
-
hierarchyNodeId: 16,
|
|
3804
|
-
roleCode: "AO",
|
|
3805
|
-
isPrimary: true,
|
|
3806
|
-
effectiveFrom: "2026-01-27",
|
|
3807
|
-
effectiveTo: "",
|
|
3808
|
-
status: true
|
|
3809
|
-
}, {
|
|
3810
|
-
id: 16,
|
|
3811
|
-
mappingId: 16,
|
|
3812
|
-
externalUserId: 115,
|
|
3813
|
-
hierarchyNodeId: 17,
|
|
3814
|
-
roleCode: "SO",
|
|
3815
|
-
isPrimary: false,
|
|
3816
|
-
effectiveFrom: "2026-01-29",
|
|
3817
|
-
effectiveTo: "2026-11-30",
|
|
3818
|
-
status: false
|
|
3819
|
-
}, {
|
|
3820
|
-
id: 17,
|
|
3821
|
-
mappingId: 17,
|
|
3822
|
-
externalUserId: 116,
|
|
3823
|
-
hierarchyNodeId: 18,
|
|
3824
|
-
roleCode: "DEO",
|
|
3825
|
-
isPrimary: true,
|
|
3826
|
-
effectiveFrom: "2026-02-01",
|
|
3827
|
-
effectiveTo: "",
|
|
3828
|
-
status: true
|
|
3829
|
-
}, {
|
|
3830
|
-
id: 18,
|
|
3831
|
-
mappingId: 18,
|
|
3832
|
-
externalUserId: 117,
|
|
3833
|
-
hierarchyNodeId: 19,
|
|
3834
|
-
roleCode: "RO",
|
|
3835
|
-
isPrimary: false,
|
|
3836
|
-
effectiveFrom: "2026-02-03",
|
|
3837
|
-
effectiveTo: "",
|
|
3838
|
-
status: false
|
|
3839
|
-
}, {
|
|
3840
|
-
id: 19,
|
|
3841
|
-
mappingId: 19,
|
|
3842
|
-
externalUserId: 118,
|
|
3843
|
-
hierarchyNodeId: 20,
|
|
3844
|
-
roleCode: "AO",
|
|
3845
|
-
isPrimary: true,
|
|
3846
|
-
effectiveFrom: "2026-02-05",
|
|
3847
|
-
effectiveTo: "",
|
|
3848
|
-
status: true
|
|
3849
|
-
}, {
|
|
3850
|
-
id: 20,
|
|
3851
|
-
mappingId: 20,
|
|
3852
|
-
externalUserId: 119,
|
|
3853
|
-
hierarchyNodeId: 21,
|
|
3854
|
-
roleCode: "SO",
|
|
3855
|
-
isPrimary: false,
|
|
3856
|
-
effectiveFrom: "2026-02-07",
|
|
3857
|
-
effectiveTo: "2026-12-31",
|
|
3858
|
-
status: false
|
|
3859
|
-
}, {
|
|
3860
|
-
id: 21,
|
|
3861
|
-
mappingId: 21,
|
|
3862
|
-
externalUserId: 120,
|
|
3863
|
-
hierarchyNodeId: 22,
|
|
3864
|
-
roleCode: "DEO",
|
|
3865
|
-
isPrimary: true,
|
|
3866
|
-
effectiveFrom: "2026-02-09",
|
|
3867
|
-
effectiveTo: "",
|
|
3868
|
-
status: true
|
|
3869
|
-
}, {
|
|
3870
|
-
id: 22,
|
|
3871
|
-
mappingId: 22,
|
|
3872
|
-
externalUserId: 121,
|
|
3873
|
-
hierarchyNodeId: 23,
|
|
3874
|
-
roleCode: "RO",
|
|
3875
|
-
isPrimary: false,
|
|
3876
|
-
effectiveFrom: "2026-02-11",
|
|
3877
|
-
effectiveTo: "",
|
|
3878
|
-
status: false
|
|
3879
|
-
}, {
|
|
3880
|
-
id: 23,
|
|
3881
|
-
mappingId: 23,
|
|
3882
|
-
externalUserId: 122,
|
|
3883
|
-
hierarchyNodeId: 24,
|
|
3884
|
-
roleCode: "AO",
|
|
3885
|
-
isPrimary: true,
|
|
3886
|
-
effectiveFrom: "2026-02-13",
|
|
3887
|
-
effectiveTo: "",
|
|
3888
|
-
status: true
|
|
3889
|
-
}, {
|
|
3890
|
-
id: 24,
|
|
3891
|
-
mappingId: 24,
|
|
3892
|
-
externalUserId: 123,
|
|
3893
|
-
hierarchyNodeId: 25,
|
|
3894
|
-
roleCode: "SO",
|
|
3895
|
-
isPrimary: false,
|
|
3896
|
-
effectiveFrom: "2026-02-15",
|
|
3897
|
-
effectiveTo: "2026-08-31",
|
|
3898
|
-
status: false
|
|
3899
|
-
}, {
|
|
3900
|
-
id: 25,
|
|
3901
|
-
mappingId: 25,
|
|
3902
|
-
externalUserId: 124,
|
|
3903
|
-
hierarchyNodeId: 26,
|
|
3904
|
-
roleCode: "DEO",
|
|
3905
|
-
isPrimary: true,
|
|
3906
|
-
effectiveFrom: "2026-02-17",
|
|
3907
|
-
effectiveTo: "",
|
|
3908
|
-
status: true
|
|
3909
|
-
}];
|
|
3910
|
-
const [data, setData] = (0, import_react25.useState)(initialData);
|
|
3683
|
+
const [data, setData] = (0, import_react25.useState)(apiData || []);
|
|
3684
|
+
(0, import_react25.useEffect)(() => {
|
|
3685
|
+
setData(apiData || []);
|
|
3686
|
+
}, [apiData]);
|
|
3911
3687
|
const [sortOrder, setSortOrder] = (0, import_react25.useState)("asc");
|
|
3912
3688
|
const [sortKey, setSortKey] = (0, import_react25.useState)("mappingId");
|
|
3913
3689
|
const handleSort = (columnKey) => {
|
|
@@ -3953,16 +3729,16 @@ function UserHierarchyNodeMappingTable({
|
|
|
3953
3729
|
setShowDeletePopup(false);
|
|
3954
3730
|
setSelectedItem(null);
|
|
3955
3731
|
};
|
|
3956
|
-
const handleDelete = () => {
|
|
3957
|
-
|
|
3958
|
-
(prev) => prev.filter((item) => item.id !== (selectedItem == null ? void 0 : selectedItem.id))
|
|
3959
|
-
);
|
|
3960
|
-
closeDeletePopup();
|
|
3732
|
+
const handleDelete = async () => {
|
|
3733
|
+
if (await (onDelete == null ? void 0 : onDelete(selectedItem))) closeDeletePopup();
|
|
3961
3734
|
};
|
|
3962
3735
|
const toggleStatus = (id) => {
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
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" }));
|
|
3966
3742
|
};
|
|
3967
3743
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fc:space-y-5", children: [
|
|
3968
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: [
|
|
@@ -3994,29 +3770,35 @@ function UserHierarchyNodeMappingTable({
|
|
|
3994
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" }),
|
|
3995
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" })
|
|
3996
3772
|
] }) }),
|
|
3997
|
-
/* @__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) =>
|
|
3998
|
-
|
|
3999
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
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
|
+
}) })
|
|
4020
3802
|
] }) }),
|
|
4021
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: [
|
|
4022
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" }),
|
|
@@ -4028,7 +3810,8 @@ function UserHierarchyNodeMappingTable({
|
|
|
4028
3810
|
{
|
|
4029
3811
|
isOpen: showEditPopup,
|
|
4030
3812
|
onClose: closeEditPopup,
|
|
4031
|
-
selectedMapping: selectedItem
|
|
3813
|
+
selectedMapping: selectedItem,
|
|
3814
|
+
onSave: (payload) => onUpdate == null ? void 0 : onUpdate(payload)
|
|
4032
3815
|
}
|
|
4033
3816
|
),
|
|
4034
3817
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
@@ -4047,8 +3830,22 @@ function UserHierarchyNodeMappingTable({
|
|
|
4047
3830
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4048
3831
|
function User_hierarchy_mapping_main() {
|
|
4049
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]);
|
|
4050
3848
|
const handleRefresh = () => {
|
|
4051
|
-
console.log("Table data refreshed!");
|
|
4052
3849
|
setRefreshKey((prev) => prev + 1);
|
|
4053
3850
|
};
|
|
4054
3851
|
const tableRef = (0, import_react26.useRef)(null);
|
|
@@ -4061,6 +3858,20 @@ function User_hierarchy_mapping_main() {
|
|
|
4061
3858
|
setPageSize(Number(e.target.value));
|
|
4062
3859
|
setCurrentPage(1);
|
|
4063
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
|
+
};
|
|
4064
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: [
|
|
4065
3876
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
4066
3877
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CommonHeader, { title: "User Hierarchy Node Mapping", breadcrumbs: [{
|
|
@@ -4090,10 +3901,10 @@ function User_hierarchy_mapping_main() {
|
|
|
4090
3901
|
] })
|
|
4091
3902
|
] })
|
|
4092
3903
|
] }),
|
|
4093
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UserHierarchyNodeMappingTable, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries },
|
|
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) }) })
|
|
4094
3905
|
] })
|
|
4095
3906
|
] }),
|
|
4096
|
-
/* @__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) })
|
|
4097
3908
|
] });
|
|
4098
3909
|
}
|
|
4099
3910
|
|
|
@@ -9129,7 +8940,7 @@ function Comment_main() {
|
|
|
9129
8940
|
|
|
9130
8941
|
// src/components/hierarchy-node/HierarchyNodeMain.jsx
|
|
9131
8942
|
var import_react68 = __toESM(require("react"));
|
|
9132
|
-
var
|
|
8943
|
+
var import_sweetalert27 = __toESM(require("sweetalert2"));
|
|
9133
8944
|
|
|
9134
8945
|
// src/components/hierarchy-node/SearchBar.jsx
|
|
9135
8946
|
var import_react63 = __toESM(require("react"));
|
|
@@ -9201,9 +9012,19 @@ function AddEditModal({
|
|
|
9201
9012
|
[name]: type === "checkbox" ? checked : value
|
|
9202
9013
|
}));
|
|
9203
9014
|
};
|
|
9204
|
-
const handleSave = () => {
|
|
9205
|
-
onSave(
|
|
9206
|
-
|
|
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();
|
|
9207
9028
|
};
|
|
9208
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: [
|
|
9209
9030
|
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:mb-6", children: [
|
|
@@ -9395,104 +9216,15 @@ var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
|
9395
9216
|
function HierarchyTable({
|
|
9396
9217
|
apiData,
|
|
9397
9218
|
pageSize,
|
|
9398
|
-
searchQuery
|
|
9219
|
+
searchQuery,
|
|
9220
|
+
onUpdate,
|
|
9221
|
+
onDelete
|
|
9399
9222
|
}) {
|
|
9400
|
-
const hierarchyData = [{
|
|
9401
|
-
hierarchyNodeId: 1,
|
|
9402
|
-
parentHierarchyNodeId: 0,
|
|
9403
|
-
hierarchyLevel: 1,
|
|
9404
|
-
nodeType: "Department",
|
|
9405
|
-
nodeName: "Head Office",
|
|
9406
|
-
externalEntityType: "Organization",
|
|
9407
|
-
externalEntityId: 1001,
|
|
9408
|
-
isActive: true
|
|
9409
|
-
}, {
|
|
9410
|
-
hierarchyNodeId: 2,
|
|
9411
|
-
parentHierarchyNodeId: 1,
|
|
9412
|
-
hierarchyLevel: 2,
|
|
9413
|
-
nodeType: "District",
|
|
9414
|
-
nodeName: "Ludhiana",
|
|
9415
|
-
externalEntityType: "District",
|
|
9416
|
-
externalEntityId: 1002,
|
|
9417
|
-
isActive: true
|
|
9418
|
-
}, {
|
|
9419
|
-
hierarchyNodeId: 3,
|
|
9420
|
-
parentHierarchyNodeId: 2,
|
|
9421
|
-
hierarchyLevel: 3,
|
|
9422
|
-
nodeType: "Block",
|
|
9423
|
-
nodeName: "Samrala",
|
|
9424
|
-
externalEntityType: "Block",
|
|
9425
|
-
externalEntityId: 1003,
|
|
9426
|
-
isActive: false
|
|
9427
|
-
}, {
|
|
9428
|
-
hierarchyNodeId: 4,
|
|
9429
|
-
parentHierarchyNodeId: 2,
|
|
9430
|
-
hierarchyLevel: 3,
|
|
9431
|
-
nodeType: "Block",
|
|
9432
|
-
nodeName: "Khanna",
|
|
9433
|
-
externalEntityType: "Block",
|
|
9434
|
-
externalEntityId: 1004,
|
|
9435
|
-
isActive: true
|
|
9436
|
-
}, {
|
|
9437
|
-
hierarchyNodeId: 5,
|
|
9438
|
-
parentHierarchyNodeId: 4,
|
|
9439
|
-
hierarchyLevel: 4,
|
|
9440
|
-
nodeType: "Panchayat",
|
|
9441
|
-
nodeName: "Village A",
|
|
9442
|
-
externalEntityType: "Village",
|
|
9443
|
-
externalEntityId: 1005,
|
|
9444
|
-
isActive: true
|
|
9445
|
-
}, {
|
|
9446
|
-
hierarchyNodeId: 6,
|
|
9447
|
-
parentHierarchyNodeId: 4,
|
|
9448
|
-
hierarchyLevel: 4,
|
|
9449
|
-
nodeType: "Panchayat",
|
|
9450
|
-
nodeName: "Village B",
|
|
9451
|
-
externalEntityType: "Village",
|
|
9452
|
-
externalEntityId: 1006,
|
|
9453
|
-
isActive: false
|
|
9454
|
-
}, {
|
|
9455
|
-
hierarchyNodeId: 7,
|
|
9456
|
-
parentHierarchyNodeId: 1,
|
|
9457
|
-
hierarchyLevel: 2,
|
|
9458
|
-
nodeType: "Department",
|
|
9459
|
-
nodeName: "Finance",
|
|
9460
|
-
externalEntityType: "Department",
|
|
9461
|
-
externalEntityId: 1007,
|
|
9462
|
-
isActive: true
|
|
9463
|
-
}, {
|
|
9464
|
-
hierarchyNodeId: 8,
|
|
9465
|
-
parentHierarchyNodeId: 1,
|
|
9466
|
-
hierarchyLevel: 2,
|
|
9467
|
-
nodeType: "Department",
|
|
9468
|
-
nodeName: "HR",
|
|
9469
|
-
externalEntityType: "Department",
|
|
9470
|
-
externalEntityId: 1008,
|
|
9471
|
-
isActive: true
|
|
9472
|
-
}, {
|
|
9473
|
-
hierarchyNodeId: 9,
|
|
9474
|
-
parentHierarchyNodeId: 8,
|
|
9475
|
-
hierarchyLevel: 3,
|
|
9476
|
-
nodeType: "Branch",
|
|
9477
|
-
nodeName: "Recruitment",
|
|
9478
|
-
externalEntityType: "Branch",
|
|
9479
|
-
externalEntityId: 1009,
|
|
9480
|
-
isActive: false
|
|
9481
|
-
}, {
|
|
9482
|
-
hierarchyNodeId: 10,
|
|
9483
|
-
parentHierarchyNodeId: 8,
|
|
9484
|
-
hierarchyLevel: 3,
|
|
9485
|
-
nodeType: "Branch",
|
|
9486
|
-
nodeName: "Training",
|
|
9487
|
-
externalEntityType: "Branch",
|
|
9488
|
-
externalEntityId: 1010,
|
|
9489
|
-
isActive: true
|
|
9490
|
-
}];
|
|
9491
9223
|
const [currentPage, setCurrentPage] = (0, import_react66.useState)(1);
|
|
9492
9224
|
;
|
|
9493
|
-
const [data, setData] = (0, import_react66.useState)(apiData ||
|
|
9225
|
+
const [data, setData] = (0, import_react66.useState)(apiData || []);
|
|
9494
9226
|
(0, import_react66.useEffect)(() => {
|
|
9495
|
-
|
|
9227
|
+
setData(apiData || []);
|
|
9496
9228
|
}, [apiData]);
|
|
9497
9229
|
const filteredData = data.filter(
|
|
9498
9230
|
(item) => (item.nodeName || "").toLowerCase().includes((searchQuery || "").toLowerCase()) || (item.nodeType || "").toLowerCase().includes((searchQuery || "").toLowerCase()) || String(item.hierarchyNodeId).includes(searchQuery || "")
|
|
@@ -9541,21 +9273,11 @@ function HierarchyTable({
|
|
|
9541
9273
|
setSelectedNode(item);
|
|
9542
9274
|
setDeleteOpen(true);
|
|
9543
9275
|
};
|
|
9544
|
-
const handleUpdate = (updatedNode) => {
|
|
9545
|
-
|
|
9546
|
-
(prev) => prev.map(
|
|
9547
|
-
(item) => item.hierarchyNodeId === updatedNode.hierarchyNodeId ? updatedNode : item
|
|
9548
|
-
)
|
|
9549
|
-
);
|
|
9550
|
-
setEditOpen(false);
|
|
9276
|
+
const handleUpdate = async (updatedNode) => {
|
|
9277
|
+
return onUpdate == null ? void 0 : onUpdate(updatedNode);
|
|
9551
9278
|
};
|
|
9552
|
-
const confirmDelete = () => {
|
|
9553
|
-
|
|
9554
|
-
(prev) => prev.filter(
|
|
9555
|
-
(item) => item.hierarchyNodeId !== selectedNode.hierarchyNodeId
|
|
9556
|
-
)
|
|
9557
|
-
);
|
|
9558
|
-
setDeleteOpen(false);
|
|
9279
|
+
const confirmDelete = async () => {
|
|
9280
|
+
if (await (onDelete == null ? void 0 : onDelete(selectedNode))) setDeleteOpen(false);
|
|
9559
9281
|
};
|
|
9560
9282
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "fc:h-full fc:flex fc:flex-col", children: [
|
|
9561
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: [
|
|
@@ -9688,6 +9410,16 @@ function AddHierarchyNodeModal({
|
|
|
9688
9410
|
onClose,
|
|
9689
9411
|
onSave
|
|
9690
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
|
+
};
|
|
9691
9423
|
if (!isOpen) return null;
|
|
9692
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: [
|
|
9693
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 }),
|
|
@@ -9708,21 +9440,21 @@ function AddHierarchyNodeModal({
|
|
|
9708
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: [
|
|
9709
9441
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9710
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" }),
|
|
9711
|
-
/* @__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" })
|
|
9712
9444
|
] }),
|
|
9713
9445
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9714
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" }),
|
|
9715
|
-
/* @__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" })
|
|
9716
9448
|
] })
|
|
9717
9449
|
] }),
|
|
9718
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: [
|
|
9719
9451
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9720
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" }),
|
|
9721
|
-
/* @__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" })
|
|
9722
9454
|
] }),
|
|
9723
9455
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9724
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" }),
|
|
9725
|
-
/* @__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: [
|
|
9726
9458
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Select Node Type" }),
|
|
9727
9459
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "District" }),
|
|
9728
9460
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "Block" }),
|
|
@@ -9734,12 +9466,12 @@ function AddHierarchyNodeModal({
|
|
|
9734
9466
|
] }),
|
|
9735
9467
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9736
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" }),
|
|
9737
|
-
/* @__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" })
|
|
9738
9470
|
] }),
|
|
9739
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: [
|
|
9740
9472
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9741
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" }),
|
|
9742
|
-
/* @__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: [
|
|
9743
9475
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "", children: "Select Entity Type" }),
|
|
9744
9476
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "Department" }),
|
|
9745
9477
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { children: "Office" }),
|
|
@@ -9749,12 +9481,12 @@ function AddHierarchyNodeModal({
|
|
|
9749
9481
|
] }),
|
|
9750
9482
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9751
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" }),
|
|
9752
|
-
/* @__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" })
|
|
9753
9485
|
] })
|
|
9754
9486
|
] }),
|
|
9755
9487
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9756
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" }),
|
|
9757
|
-
/* @__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: [
|
|
9758
9490
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "true", children: "Yes" }),
|
|
9759
9491
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("option", { value: "false", children: "No" })
|
|
9760
9492
|
] })
|
|
@@ -9764,7 +9496,7 @@ function AddHierarchyNodeModal({
|
|
|
9764
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" }),
|
|
9765
9497
|
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
9766
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" }),
|
|
9767
|
-
/* @__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" })
|
|
9768
9500
|
] })
|
|
9769
9501
|
] })
|
|
9770
9502
|
] }),
|
|
@@ -9774,9 +9506,10 @@ function AddHierarchyNodeModal({
|
|
|
9774
9506
|
"button",
|
|
9775
9507
|
{
|
|
9776
9508
|
type: "button",
|
|
9777
|
-
onClick:
|
|
9509
|
+
onClick: handleSave,
|
|
9510
|
+
disabled: isSubmitting,
|
|
9778
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",
|
|
9779
|
-
children: "Save Hierarchy Node"
|
|
9512
|
+
children: isSubmitting ? "Saving..." : "Save Hierarchy Node"
|
|
9780
9513
|
}
|
|
9781
9514
|
)
|
|
9782
9515
|
] })
|
|
@@ -9792,6 +9525,7 @@ function HierarchyNodeMain() {
|
|
|
9792
9525
|
const tableRef = (0, import_react68.useRef)(null);
|
|
9793
9526
|
const [searchQuery, setSearchQuery] = (0, import_react68.useState)("");
|
|
9794
9527
|
const [apiData, setApiData] = (0, import_react68.useState)([]);
|
|
9528
|
+
const [refreshKey, setRefreshKey] = (0, import_react68.useState)(0);
|
|
9795
9529
|
(0, import_react68.useEffect)(() => {
|
|
9796
9530
|
(async () => {
|
|
9797
9531
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -9802,12 +9536,26 @@ function HierarchyNodeMain() {
|
|
|
9802
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;
|
|
9803
9537
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
9804
9538
|
} catch (error) {
|
|
9805
|
-
await
|
|
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");
|
|
9806
9540
|
}
|
|
9807
9541
|
})();
|
|
9808
|
-
}, [
|
|
9542
|
+
}, [refreshKey]);
|
|
9809
9543
|
const handleRefresh = () => {
|
|
9810
|
-
|
|
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
|
+
}
|
|
9811
9559
|
};
|
|
9812
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: [
|
|
9813
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: [
|
|
@@ -9858,12 +9606,14 @@ function HierarchyNodeMain() {
|
|
|
9858
9606
|
{
|
|
9859
9607
|
apiData,
|
|
9860
9608
|
pageSize,
|
|
9861
|
-
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)
|
|
9862
9612
|
}
|
|
9863
9613
|
) })
|
|
9864
9614
|
] })
|
|
9865
9615
|
] }),
|
|
9866
|
-
/* @__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) })
|
|
9867
9617
|
] });
|
|
9868
9618
|
}
|
|
9869
9619
|
|
|
@@ -12099,7 +11849,7 @@ function Sidebar({
|
|
|
12099
11849
|
const Icon = item.icon;
|
|
12100
11850
|
const handleClick = () => {
|
|
12101
11851
|
if (item.component) {
|
|
12102
|
-
router.push("/
|
|
11852
|
+
router.push("/", void 0, {
|
|
12103
11853
|
shallow: true
|
|
12104
11854
|
});
|
|
12105
11855
|
setActiveComponent(item.component);
|