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