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.js
CHANGED
|
@@ -1235,10 +1235,10 @@ function Workflow() {
|
|
|
1235
1235
|
(async () => {
|
|
1236
1236
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1237
1237
|
try {
|
|
1238
|
-
const
|
|
1238
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
|
|
1239
1239
|
const typeEndpoint = (_f = (_e = (_d = getApiEndpoints()) == null ? void 0 : _d.flowCore) == null ? void 0 : _e.workflowType) == null ? void 0 : _f.getList;
|
|
1240
|
-
if (!
|
|
1241
|
-
const [result, types] = await Promise.all([getApiService().get(
|
|
1240
|
+
if (!endpoint2) throw Error("Workflow list endpoint is not configured.");
|
|
1241
|
+
const [result, types] = await Promise.all([getApiService().get(endpoint2), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
|
|
1242
1242
|
const value = ((_g = result == null ? void 0 : result.data) == null ? void 0 : _g.data) || ((_h = result == null ? void 0 : result.data) == null ? void 0 : _h.result) || (result == null ? void 0 : result.data) || result;
|
|
1243
1243
|
const rows = Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || [];
|
|
1244
1244
|
const typeValue = ((_i = types == null ? void 0 : types.data) == null ? void 0 : _i.data) || ((_j = types == null ? void 0 : types.data) == null ? void 0 : _j.result) || (types == null ? void 0 : types.data) || types;
|
|
@@ -1261,9 +1261,9 @@ function Workflow() {
|
|
|
1261
1261
|
const handleCreateApi = async (workflowPayload) => {
|
|
1262
1262
|
var _a, _b, _c, _d, _e;
|
|
1263
1263
|
try {
|
|
1264
|
-
const
|
|
1265
|
-
if (!
|
|
1266
|
-
await getApiService().post(
|
|
1264
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.create;
|
|
1265
|
+
if (!endpoint2) throw new Error("Workflow create endpoint is not configured.");
|
|
1266
|
+
await getApiService().post(endpoint2, workflowPayload);
|
|
1267
1267
|
await import_sweetalert23.default.fire("Success", "Workflow created successfully.", "success");
|
|
1268
1268
|
handleRefresh();
|
|
1269
1269
|
return true;
|
|
@@ -1275,9 +1275,9 @@ function Workflow() {
|
|
|
1275
1275
|
const handleUpdateApi = async (workflowPayload) => {
|
|
1276
1276
|
var _a, _b, _c, _d, _e;
|
|
1277
1277
|
try {
|
|
1278
|
-
const
|
|
1279
|
-
if (!
|
|
1280
|
-
await getApiService().put(
|
|
1278
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.update;
|
|
1279
|
+
if (!endpoint2) throw new Error("Workflow update endpoint is not configured.");
|
|
1280
|
+
await getApiService().put(endpoint2, workflowPayload);
|
|
1281
1281
|
await import_sweetalert23.default.fire("Success", "Workflow updated successfully.", "success");
|
|
1282
1282
|
handleRefresh();
|
|
1283
1283
|
return true;
|
|
@@ -1982,9 +1982,9 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
|
|
|
1982
1982
|
setIsSubmitting(true);
|
|
1983
1983
|
setSubmitError("");
|
|
1984
1984
|
const endpoints = getApiEndpoints();
|
|
1985
|
-
const
|
|
1986
|
-
if (!
|
|
1987
|
-
const response = await getApiService().post(
|
|
1985
|
+
const endpoint2 = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
|
|
1986
|
+
if (!endpoint2) throw new Error("Create workflow type endpoint is not configured.");
|
|
1987
|
+
const response = await getApiService().post(endpoint2, payload);
|
|
1988
1988
|
const resData = (_c = response == null ? void 0 : response.data) != null ? _c : response;
|
|
1989
1989
|
if ((resData == null ? void 0 : resData.success) === false) {
|
|
1990
1990
|
const apiErrors = Array.isArray(resData == null ? void 0 : resData.errors) && resData.errors.length > 0 ? resData.errors : null;
|
|
@@ -2068,9 +2068,9 @@ function WorkflowTypeMains() {
|
|
|
2068
2068
|
const handleUpdateApi = async (item) => {
|
|
2069
2069
|
var _a, _b, _c, _d;
|
|
2070
2070
|
try {
|
|
2071
|
-
const
|
|
2072
|
-
if (!
|
|
2073
|
-
await getApiService().put(
|
|
2071
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
|
|
2072
|
+
if (!endpoint2) throw new Error("Workflow type update endpoint is not configured.");
|
|
2073
|
+
await getApiService().put(endpoint2, { workflowTypeId: item.workflowTypeId, workflowTypeCode: item.workflowTypeCode.trim().toUpperCase(), workflowTypeName: item.workflowTypeName.trim(), description: (item.description || "").trim(), isActive: Boolean(item.isActive), updatedBy: item.updatedBy || item.createdBy || "System" });
|
|
2074
2074
|
await import_sweetalert25.default.fire("Success", "Workflow type updated successfully.", "success");
|
|
2075
2075
|
handleRefresh();
|
|
2076
2076
|
return true;
|
|
@@ -2102,9 +2102,9 @@ function WorkflowTypeMains() {
|
|
|
2102
2102
|
(async () => {
|
|
2103
2103
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2104
2104
|
try {
|
|
2105
|
-
const
|
|
2106
|
-
if (!
|
|
2107
|
-
const result = await getApiService().get(
|
|
2105
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.getList;
|
|
2106
|
+
if (!endpoint2) throw new Error("Workflow type list endpoint is not configured.");
|
|
2107
|
+
const result = await getApiService().get(endpoint2);
|
|
2108
2108
|
const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
|
|
2109
2109
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
2110
2110
|
} catch (error) {
|
|
@@ -2219,9 +2219,9 @@ function AddWorkflowStepModal({ onClose, onSave }) {
|
|
|
2219
2219
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2220
2220
|
try {
|
|
2221
2221
|
setLoadingWorkflows(true);
|
|
2222
|
-
const
|
|
2223
|
-
if (!
|
|
2224
|
-
const result = await getApiService().get(
|
|
2222
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
|
|
2223
|
+
if (!endpoint2) return;
|
|
2224
|
+
const result = await getApiService().get(endpoint2);
|
|
2225
2225
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
2226
2226
|
const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
|
|
2227
2227
|
setWorkflows(rows);
|
|
@@ -2571,8 +2571,8 @@ function AddWorkflowStepModal({ onClose, onSave }) {
|
|
|
2571
2571
|
if (!validateForm()) return;
|
|
2572
2572
|
try {
|
|
2573
2573
|
setIsSubmitting(true);
|
|
2574
|
-
const
|
|
2575
|
-
if (!
|
|
2574
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.create;
|
|
2575
|
+
if (!endpoint2) throw new Error("Workflow step create endpoint is not configured.");
|
|
2576
2576
|
const payload = {
|
|
2577
2577
|
workflowId: Number(formData.workflow) || 0,
|
|
2578
2578
|
stepCode: formData.stepCode.trim().toUpperCase(),
|
|
@@ -2586,7 +2586,7 @@ function AddWorkflowStepModal({ onClose, onSave }) {
|
|
|
2586
2586
|
excludeHolidays: Boolean(formData.excludeHolidays),
|
|
2587
2587
|
createdBy: "System"
|
|
2588
2588
|
};
|
|
2589
|
-
await getApiService().post(
|
|
2589
|
+
await getApiService().post(endpoint2, payload);
|
|
2590
2590
|
onClose();
|
|
2591
2591
|
await (onSave == null ? void 0 : onSave());
|
|
2592
2592
|
} catch (error) {
|
|
@@ -2639,9 +2639,9 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
|
|
|
2639
2639
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2640
2640
|
try {
|
|
2641
2641
|
setLoadingWorkflows(true);
|
|
2642
|
-
const
|
|
2643
|
-
if (!
|
|
2644
|
-
const result = await getApiService().get(
|
|
2642
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
|
|
2643
|
+
if (!endpoint2) return;
|
|
2644
|
+
const result = await getApiService().get(endpoint2);
|
|
2645
2645
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
2646
2646
|
const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
|
|
2647
2647
|
setWorkflows(rows);
|
|
@@ -2695,8 +2695,8 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
|
|
|
2695
2695
|
if (!validate()) return;
|
|
2696
2696
|
try {
|
|
2697
2697
|
setIsSubmitting(true);
|
|
2698
|
-
const
|
|
2699
|
-
if (!
|
|
2698
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
|
|
2699
|
+
if (!endpoint2) throw new Error("Workflow step update endpoint is not configured.");
|
|
2700
2700
|
const payload = {
|
|
2701
2701
|
workflowStepId: (_e = (_d = selectedData == null ? void 0 : selectedData.workflowStepId) != null ? _d : selectedData == null ? void 0 : selectedData.WorkflowStepId) != null ? _e : 0,
|
|
2702
2702
|
workflowId: Number(formData.workflowId) || 0,
|
|
@@ -2712,7 +2712,7 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
|
|
|
2712
2712
|
isActive: Boolean(formData.isActive),
|
|
2713
2713
|
updatedBy: String(formData.updatedBy).trim() || "System"
|
|
2714
2714
|
};
|
|
2715
|
-
await getApiService().put(
|
|
2715
|
+
await getApiService().put(endpoint2, payload);
|
|
2716
2716
|
onClose();
|
|
2717
2717
|
await (onSave == null ? void 0 : onSave());
|
|
2718
2718
|
} catch (error) {
|
|
@@ -3093,9 +3093,9 @@ function WorkflowStep() {
|
|
|
3093
3093
|
const handleUpdateApi = async (item) => {
|
|
3094
3094
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
3095
3095
|
try {
|
|
3096
|
-
const
|
|
3097
|
-
if (!
|
|
3098
|
-
await getApiService().put(
|
|
3096
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.update;
|
|
3097
|
+
if (!endpoint2) throw new Error("Workflow step update endpoint is not configured.");
|
|
3098
|
+
await getApiService().put(endpoint2, {
|
|
3099
3099
|
workflowStepId: (_e = (_d = item.workflowStepId) != null ? _d : item.WorkflowStepId) != null ? _e : 0,
|
|
3100
3100
|
workflowId: Number(item.workflowId) || 0,
|
|
3101
3101
|
stepCode: String(item.stepCode).trim().toUpperCase(),
|
|
@@ -3360,24 +3360,58 @@ function WorkflowStep() {
|
|
|
3360
3360
|
|
|
3361
3361
|
// src/components/WorkFlowTransition/Transitiontable.js
|
|
3362
3362
|
var import_react21 = __toESM(require("react"));
|
|
3363
|
-
var
|
|
3363
|
+
var import_sweetalert29 = __toESM(require("sweetalert2"));
|
|
3364
3364
|
|
|
3365
3365
|
// src/components/WorkFlowTransition/AddWorkFlowTransitionModal.js
|
|
3366
3366
|
var import_react20 = __toESM(require("react"));
|
|
3367
|
+
init_ApiEndpointsProvider();
|
|
3368
|
+
init_ApiServicepackage();
|
|
3367
3369
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3368
|
-
|
|
3370
|
+
var rowsFrom = (response) => {
|
|
3371
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3372
|
+
const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
|
|
3373
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
3374
|
+
};
|
|
3375
|
+
var lookupEndpoint = (name, fallback) => {
|
|
3376
|
+
var _a, _b, _c, _d;
|
|
3377
|
+
try {
|
|
3378
|
+
return (_d = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b[name]) == null ? void 0 : _c.getList) != null ? _d : fallback;
|
|
3379
|
+
} catch (e) {
|
|
3380
|
+
return fallback;
|
|
3381
|
+
}
|
|
3382
|
+
};
|
|
3383
|
+
function AddWorkTransitionStepModal({ onClose, onSave, editData }) {
|
|
3384
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
3369
3385
|
const [formData, setFormData] = (0, import_react20.useState)({
|
|
3370
|
-
workflow: "",
|
|
3371
|
-
fromStep: "",
|
|
3372
|
-
toStep: "",
|
|
3373
|
-
actionCode: "",
|
|
3374
|
-
actionName: "",
|
|
3386
|
+
workflow: String((_b = (_a = editData == null ? void 0 : editData.workflowId) != null ? _a : editData == null ? void 0 : editData.WorkflowId) != null ? _b : ""),
|
|
3387
|
+
fromStep: String((_f = (_e = (_d = (_c = editData == null ? void 0 : editData.fromWorkflowStepId) != null ? _c : editData == null ? void 0 : editData.FromWorkflowStepId) != null ? _d : editData == null ? void 0 : editData.fromStepId) != null ? _e : editData == null ? void 0 : editData.FromStepId) != null ? _f : ""),
|
|
3388
|
+
toStep: String((_j = (_i = (_h = (_g = editData == null ? void 0 : editData.toWorkflowStepId) != null ? _g : editData == null ? void 0 : editData.ToWorkflowStepId) != null ? _h : editData == null ? void 0 : editData.toStepId) != null ? _i : editData == null ? void 0 : editData.ToStepId) != null ? _j : ""),
|
|
3389
|
+
actionCode: (_l = (_k = editData == null ? void 0 : editData.actionCode) != null ? _k : editData == null ? void 0 : editData.ActionCode) != null ? _l : "",
|
|
3390
|
+
actionName: (_n = (_m = editData == null ? void 0 : editData.actionName) != null ? _m : editData == null ? void 0 : editData.ActionName) != null ? _n : "",
|
|
3375
3391
|
sequenceNo: "",
|
|
3376
3392
|
isDefault: false,
|
|
3377
3393
|
requireComment: false,
|
|
3378
|
-
status: "active"
|
|
3394
|
+
status: ((_p = (_o = editData == null ? void 0 : editData.isActive) != null ? _o : editData == null ? void 0 : editData.IsActive) != null ? _p : true) ? "active" : "inactive"
|
|
3379
3395
|
});
|
|
3380
3396
|
const [errors, setErrors] = (0, import_react20.useState)({});
|
|
3397
|
+
const [workflows, setWorkflows] = (0, import_react20.useState)([]);
|
|
3398
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react20.useState)(false);
|
|
3399
|
+
(0, import_react20.useEffect)(() => {
|
|
3400
|
+
let active = true;
|
|
3401
|
+
(async () => {
|
|
3402
|
+
try {
|
|
3403
|
+
const service = getApiService();
|
|
3404
|
+
const workflowResult = await service.get(lookupEndpoint("workflow", "/api/flowcore/WorkFlow/GetList"));
|
|
3405
|
+
if (!active) return;
|
|
3406
|
+
setWorkflows(rowsFrom(workflowResult));
|
|
3407
|
+
} catch (error) {
|
|
3408
|
+
if (active) setErrors((current) => __spreadProps(__spreadValues({}, current), { lookup: (error == null ? void 0 : error.message) || "Unable to load workflows." }));
|
|
3409
|
+
}
|
|
3410
|
+
})();
|
|
3411
|
+
return () => {
|
|
3412
|
+
active = false;
|
|
3413
|
+
};
|
|
3414
|
+
}, []);
|
|
3381
3415
|
const validateForm = () => {
|
|
3382
3416
|
const newErrors = {};
|
|
3383
3417
|
if (!formData.workflow) newErrors.workflow = "Workflow is required.";
|
|
@@ -3385,18 +3419,20 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
|
|
|
3385
3419
|
if (!formData.toStep) newErrors.toStep = "To Step is required.";
|
|
3386
3420
|
if (!formData.actionCode.trim()) newErrors.actionCode = "Action Code is required.";
|
|
3387
3421
|
if (!formData.actionName.trim()) newErrors.actionName = "Action Name is required.";
|
|
3388
|
-
if (!formData.sequenceNo) newErrors.sequenceNo = "Sequence No is required.";
|
|
3389
3422
|
setErrors(newErrors);
|
|
3390
3423
|
return Object.keys(newErrors).length === 0;
|
|
3391
3424
|
};
|
|
3392
|
-
const handleSubmit = (e) => {
|
|
3425
|
+
const handleSubmit = async (e) => {
|
|
3426
|
+
var _a2, _b2, _c2;
|
|
3393
3427
|
e.preventDefault();
|
|
3394
|
-
if (validateForm())
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3428
|
+
if (!validateForm() || !onSave) return;
|
|
3429
|
+
const isEdit = Boolean(editData);
|
|
3430
|
+
const payload = isEdit ? { transitionId: (_a2 = editData.transitionId) != null ? _a2 : editData.TransitionId, workflowId: Number(formData.workflow), fromWorkflowStepId: Number(formData.fromStep), toWorkflowStepId: Number(formData.toStep), actionCode: formData.actionCode.trim(), actionName: formData.actionName.trim(), isActive: formData.status === "active", updatedBy: (_c2 = (_b2 = editData.updatedBy) != null ? _b2 : editData.createdBy) != null ? _c2 : "System" } : { workflowId: Number(formData.workflow), fromWorkflowStepId: Number(formData.fromStep), toWorkflowStepId: Number(formData.toStep), actionCode: formData.actionCode.trim(), actionName: formData.actionName.trim(), createdBy: "System" };
|
|
3431
|
+
setIsSubmitting(true);
|
|
3432
|
+
try {
|
|
3433
|
+
if (await onSave(payload, isEdit)) onClose();
|
|
3434
|
+
} finally {
|
|
3435
|
+
setIsSubmitting(false);
|
|
3400
3436
|
}
|
|
3401
3437
|
};
|
|
3402
3438
|
const handleChange = (field, value) => {
|
|
@@ -3455,8 +3491,12 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
|
|
|
3455
3491
|
className: `fc:w-full fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:border fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${errors.workflow ? "fc:border-red-500 fc:text-slate-800" : "fc:border-slate-200 fc:text-slate-700 hover:fc:border-slate-300"}`,
|
|
3456
3492
|
children: [
|
|
3457
3493
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select Workflow" }),
|
|
3458
|
-
|
|
3459
|
-
|
|
3494
|
+
workflows.map((workflow) => {
|
|
3495
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
3496
|
+
const id = (_b2 = (_a2 = workflow.workflowId) != null ? _a2 : workflow.WorkflowId) != null ? _b2 : workflow.id;
|
|
3497
|
+
const name = (_h2 = (_g2 = (_f2 = (_e2 = (_d2 = (_c2 = workflow.workflowName) != null ? _c2 : workflow.WorkflowName) != null ? _d2 : workflow.name) != null ? _e2 : workflow.Name) != null ? _f2 : workflow.workflowCode) != null ? _g2 : workflow.WorkflowCode) != null ? _h2 : `Workflow ${id}`;
|
|
3498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: String(id), children: name }, id);
|
|
3499
|
+
})
|
|
3460
3500
|
]
|
|
3461
3501
|
}
|
|
3462
3502
|
),
|
|
@@ -3478,8 +3518,8 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
|
|
|
3478
3518
|
className: `fc:w-full fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:border fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${errors.fromStep ? "fc:border-red-500 fc:text-slate-800" : "fc:border-slate-200 fc:text-slate-700 hover:fc:border-slate-300"}`,
|
|
3479
3519
|
children: [
|
|
3480
3520
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select From Step" }),
|
|
3481
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "
|
|
3482
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "1", children: "Scrutiny" }),
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "2", children: "Inspection" })
|
|
3483
3523
|
]
|
|
3484
3524
|
}
|
|
3485
3525
|
),
|
|
@@ -3503,8 +3543,8 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
|
|
|
3503
3543
|
className: `fc:w-full fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:border fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${errors.toStep ? "fc:border-red-500 fc:text-slate-800" : "fc:border-slate-200 fc:text-slate-700 hover:fc:border-slate-300"}`,
|
|
3504
3544
|
children: [
|
|
3505
3545
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "", children: "Select To Step" }),
|
|
3506
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "
|
|
3507
|
-
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "
|
|
3546
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "3", children: "Approval" }),
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("option", { value: "4", children: "Completed" })
|
|
3508
3548
|
]
|
|
3509
3549
|
}
|
|
3510
3550
|
),
|
|
@@ -3729,185 +3769,134 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
|
|
|
3729
3769
|
}
|
|
3730
3770
|
|
|
3731
3771
|
// src/components/WorkFlowTransition/Transitiontable.js
|
|
3772
|
+
init_ApiEndpointsProvider();
|
|
3773
|
+
init_ApiServicepackage();
|
|
3732
3774
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3733
|
-
var
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
TransitionId:
|
|
3756
|
-
|
|
3757
|
-
FromStepId: 2,
|
|
3758
|
-
ToStepId: 1,
|
|
3759
|
-
ActionCode: "APPROVE",
|
|
3760
|
-
ActionName: "APPROVE"
|
|
3761
|
-
}, {
|
|
3762
|
-
TransitionId: 1,
|
|
3763
|
-
workflowId: 1,
|
|
3764
|
-
FromStepId: 2,
|
|
3765
|
-
ToStepId: 1,
|
|
3766
|
-
ActionCode: "APPROVE",
|
|
3767
|
-
ActionName: "APPROVE"
|
|
3768
|
-
}, {
|
|
3769
|
-
TransitionId: 1,
|
|
3770
|
-
workflowId: 1,
|
|
3771
|
-
FromStepId: 2,
|
|
3772
|
-
ToStepId: 1,
|
|
3773
|
-
ActionCode: "APPROVE",
|
|
3774
|
-
ActionName: "APPROVE"
|
|
3775
|
-
}, {
|
|
3776
|
-
TransitionId: 1,
|
|
3777
|
-
workflowId: 1,
|
|
3778
|
-
FromStepId: 2,
|
|
3779
|
-
ToStepId: 1,
|
|
3780
|
-
ActionCode: "APPROVE",
|
|
3781
|
-
ActionName: "APPROVE"
|
|
3782
|
-
}, {
|
|
3783
|
-
TransitionId: 1,
|
|
3784
|
-
workflowId: 1,
|
|
3785
|
-
FromStepId: 2,
|
|
3786
|
-
ToStepId: 1,
|
|
3787
|
-
ActionCode: "APPROVE",
|
|
3788
|
-
ActionName: "APPROVE"
|
|
3789
|
-
}, {
|
|
3790
|
-
TransitionId: 1,
|
|
3791
|
-
workflowId: 1,
|
|
3792
|
-
FromStepId: 2,
|
|
3793
|
-
ToStepId: 1,
|
|
3794
|
-
ActionCode: "RETURN",
|
|
3795
|
-
ActionName: "APPROVE"
|
|
3796
|
-
}, {
|
|
3797
|
-
TransitionId: 1,
|
|
3798
|
-
workflowId: 1,
|
|
3799
|
-
FromStepId: 2,
|
|
3800
|
-
ToStepId: 1,
|
|
3801
|
-
ActionCode: "APPROVE",
|
|
3802
|
-
ActionName: "RETURN"
|
|
3803
|
-
}];
|
|
3775
|
+
var PATHS = { create: "/api/flowcore/WorkflowTransition/Create", update: "/api/flowcore/WorkflowTransition/Update", getById: "/api/flowcore/WorkflowTransition/GetById", getList: "/api/flowcore/WorkflowTransition/GetList" };
|
|
3776
|
+
var getRows = (response) => {
|
|
3777
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
3778
|
+
const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
|
|
3779
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
3780
|
+
};
|
|
3781
|
+
var getEndpoint = (action) => {
|
|
3782
|
+
var _a, _b, _c, _d;
|
|
3783
|
+
try {
|
|
3784
|
+
const endpoints = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
|
|
3785
|
+
const configured = (_d = (_b = endpoints == null ? void 0 : endpoints.WorkflowTransition) == null ? void 0 : _b[action]) != null ? _d : (_c = endpoints == null ? void 0 : endpoints.workflowTransition) == null ? void 0 : _c[action];
|
|
3786
|
+
if (configured) return configured;
|
|
3787
|
+
} catch (e) {
|
|
3788
|
+
}
|
|
3789
|
+
return PATHS[action];
|
|
3790
|
+
};
|
|
3791
|
+
var getByIdUrl = (id) => {
|
|
3792
|
+
const endpoint2 = getEndpoint("getById");
|
|
3793
|
+
return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
|
|
3794
|
+
};
|
|
3795
|
+
var normalise = (item) => {
|
|
3796
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
3797
|
+
return __spreadProps(__spreadValues({}, item), { transitionId: (_b = (_a = item.transitionId) != null ? _a : item.TransitionId) != null ? _b : item.id, workflowId: (_d = (_c = item.workflowId) != null ? _c : item.WorkflowId) != null ? _d : "", fromWorkflowStepId: (_h = (_g = (_f = (_e = item.fromWorkflowStepId) != null ? _e : item.FromWorkflowStepId) != null ? _f : item.fromStepId) != null ? _g : item.FromStepId) != null ? _h : "", toWorkflowStepId: (_l = (_k = (_j = (_i = item.toWorkflowStepId) != null ? _i : item.ToWorkflowStepId) != null ? _j : item.toStepId) != null ? _k : item.ToStepId) != null ? _l : "", actionCode: (_n = (_m = item.actionCode) != null ? _m : item.ActionCode) != null ? _n : "", actionName: (_p = (_o = item.actionName) != null ? _o : item.ActionName) != null ? _p : "", isActive: (_r = (_q = item.isActive) != null ? _q : item.IsActive) != null ? _r : true });
|
|
3798
|
+
};
|
|
3804
3799
|
function WorkFlowTransition() {
|
|
3805
|
-
const handleRefresh = () => {
|
|
3806
|
-
console.log("Refresh clicked");
|
|
3807
|
-
};
|
|
3808
|
-
const handleDownload = () => {
|
|
3809
|
-
console.log("Download clicked");
|
|
3810
|
-
};
|
|
3811
3800
|
const tableRef = (0, import_react21.useRef)(null);
|
|
3801
|
+
const [rows, setRows] = (0, import_react21.useState)([]);
|
|
3812
3802
|
const [showModal, setShowModal] = (0, import_react21.useState)(false);
|
|
3803
|
+
const [editingTransition, setEditingTransition] = (0, import_react21.useState)(null);
|
|
3813
3804
|
const [pageSize, setPageSize] = (0, import_react21.useState)(5);
|
|
3814
|
-
const [
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3805
|
+
const [search, setSearch] = (0, import_react21.useState)("");
|
|
3806
|
+
const [sortConfig, setSortConfig] = (0, import_react21.useState)({ key: "", direction: "asc" });
|
|
3807
|
+
const [refreshKey, setRefreshKey] = (0, import_react21.useState)(0);
|
|
3808
|
+
const refresh = () => setRefreshKey((value) => value + 1);
|
|
3809
|
+
(0, import_react21.useEffect)(() => {
|
|
3810
|
+
(async () => {
|
|
3811
|
+
var _a, _b;
|
|
3812
|
+
try {
|
|
3813
|
+
setRows(getRows(await getApiService().get(getEndpoint("getList"))).map(normalise));
|
|
3814
|
+
} catch (error) {
|
|
3815
|
+
await import_sweetalert29.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load workflow transitions.", "error");
|
|
3816
|
+
}
|
|
3817
|
+
})();
|
|
3818
|
+
}, [refreshKey]);
|
|
3819
|
+
const saveTransition = async (payload, isEdit) => {
|
|
3820
|
+
var _a, _b;
|
|
3821
|
+
try {
|
|
3822
|
+
await getApiService()[isEdit ? "put" : "post"](getEndpoint(isEdit ? "update" : "create"), payload);
|
|
3823
|
+
await import_sweetalert29.default.fire("Success", `Workflow transition ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
3824
|
+
refresh();
|
|
3825
|
+
return true;
|
|
3826
|
+
} catch (error) {
|
|
3827
|
+
await import_sweetalert29.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} workflow transition.`, "error");
|
|
3828
|
+
return false;
|
|
3822
3829
|
}
|
|
3823
|
-
setSortConfig({
|
|
3824
|
-
key,
|
|
3825
|
-
direction
|
|
3826
|
-
});
|
|
3827
3830
|
};
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3831
|
+
const editTransition = async (transition) => {
|
|
3832
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3833
|
+
try {
|
|
3834
|
+
const result = await getApiService().get(getByIdUrl(transition.transitionId));
|
|
3835
|
+
const data = (_f = (_e = (_d = (_b = getRows(result)[0]) != null ? _b : (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data) != null ? _d : (_c = result == null ? void 0 : result.data) == null ? void 0 : _c.result) != null ? _e : result == null ? void 0 : result.data) != null ? _f : result;
|
|
3836
|
+
setEditingTransition(normalise(data));
|
|
3837
|
+
setShowModal(true);
|
|
3838
|
+
} catch (error) {
|
|
3839
|
+
await import_sweetalert29.default.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load workflow transition details.", "error");
|
|
3840
|
+
}
|
|
3841
|
+
};
|
|
3842
|
+
const columns = [["Transition ID", "transitionId"], ["Workflow ID", "workflowId"], ["From Step ID", "fromWorkflowStepId"], ["To Step ID", "toWorkflowStepId"], ["Action Code", "actionCode"], ["Action Name", "actionName"]];
|
|
3843
|
+
const visibleRows = rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
|
|
3844
|
+
var _a, _b;
|
|
3845
|
+
if (!sortConfig.key) return 0;
|
|
3846
|
+
const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
|
|
3847
|
+
return sortConfig.direction === "asc" ? result : -result;
|
|
3848
|
+
});
|
|
3849
|
+
const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
|
|
3850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
|
|
3851
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CommonHeader, { title: "Workflow Transition", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Masters", href: "/masters" }, { label: "Workflow Transition", href: "/workflowTransition" }], buttonText: "Add Workflow Transition", onButtonClick: () => {
|
|
3852
|
+
setEditingTransition(null);
|
|
3853
|
+
setShowModal(true);
|
|
3854
|
+
} }),
|
|
3855
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
|
|
3856
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
|
|
3857
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { value: search, onChange: (event) => setSearch(event.target.value), placeholder: "Search workflow transitions...", className: "fc:max-w-xs fc:w-full fc:px-4 fc:py-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-sm" }),
|
|
3858
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
|
|
3859
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Refresh_default, { onRefresh: refresh }),
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Download_default, { targetRef: tableRef, fileName: "workflow-transition" }),
|
|
3861
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("select", { value: pageSize, onChange: (event) => setPageSize(Number(event.target.value)), className: "fc:px-4 fc:py-2 fc:rounded-xl fc:border fc:border-slate-200", children: [
|
|
3862
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 5, children: "5 Rows" }),
|
|
3863
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 10, children: "10 Rows" }),
|
|
3864
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("option", { value: 25, children: "25 Rows" })
|
|
3854
3865
|
] })
|
|
3855
|
-
] }),
|
|
3856
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden fc:bg-white fc:shadow-md", children: [
|
|
3857
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "fc:max-h-[350px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("table", { className: "fc:min-w-max fc:w-full fc:border-collapse", children: [
|
|
3858
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { className: "fc:bg-slate-50 fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "fc:text-[11px] fc:font-bold fc:uppercase fc:tracking-wider fc:text-slate-400", children: [{
|
|
3859
|
-
label: "TransitionId",
|
|
3860
|
-
key: "TransitionId"
|
|
3861
|
-
}, {
|
|
3862
|
-
label: "WorkflowId",
|
|
3863
|
-
key: "workflowId"
|
|
3864
|
-
}, {
|
|
3865
|
-
label: "FromStepId",
|
|
3866
|
-
key: "FromStepId"
|
|
3867
|
-
}, {
|
|
3868
|
-
label: "ToStepId",
|
|
3869
|
-
key: "ToStepId"
|
|
3870
|
-
}, {
|
|
3871
|
-
label: "ActionCode",
|
|
3872
|
-
key: "ActionCode"
|
|
3873
|
-
}, {
|
|
3874
|
-
label: "ActionName",
|
|
3875
|
-
key: "ActionName"
|
|
3876
|
-
}].map((column) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("th", { onClick: () => handleSort(column.key), className: "fc:px-6 fc:py-4 fc:text-left fc:text-xs fc:font-bold fc:text-slate-500 fc:uppercase fc:tracking-wider fc:cursor-pointer fc:select-none hover:fc:fc:bg-slate-100 fc:transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
3877
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: column.label }),
|
|
3878
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "fc:text-gray-400 fc:text-xs", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
|
|
3879
|
-
] }) }, column.key)) }) }),
|
|
3880
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: WorkflowTransition.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
|
|
3881
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:p-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.TransitionId }),
|
|
3882
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
|
|
3883
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.FromStepId }),
|
|
3884
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.ToStepId }),
|
|
3885
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `fc:inline-flex fc:items-center fc:text-[14px] fc:text-slate-500 fc:font-semibold fc:rounded-full fc:px-3 fc:py-1 ${item.ActionCode === "APPROVE" ? "bg-green-100 text-green-700" : "bg-red-100 text-red-700"}`, children: item.ActionCode }) }),
|
|
3886
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: `fc:inline-flex fc:items-center fc:rounded-full fc:px-3 fc:py-1 fc:text-[14px] fc:text-slate-500 fc:font-semibold ${item.ActionName === "APPROVE" ? "bg-green-100 text-green-700" : "bg-red-100 text-red-700"}`, children: item.ActionName }) })
|
|
3887
|
-
] }, item.TransitionId)) })
|
|
3888
|
-
] }) }),
|
|
3889
|
-
" "
|
|
3890
|
-
] }),
|
|
3891
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: [
|
|
3892
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Footer, {}),
|
|
3893
|
-
" "
|
|
3894
3866
|
] })
|
|
3895
|
-
] })
|
|
3867
|
+
] }),
|
|
3868
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("table", { className: "fc:min-w-max fc:w-full", children: [
|
|
3869
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("tr", { children: [
|
|
3870
|
+
columns.map(([label, key]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
|
|
3871
|
+
label,
|
|
3872
|
+
" ",
|
|
3873
|
+
sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
|
|
3874
|
+
] }, key)),
|
|
3875
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
|
|
3876
|
+
] }) }),
|
|
3877
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("tr", { className: "fc:border-t fc:border-slate-100", children: [
|
|
3878
|
+
columns.map(([, key]) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item[key] }, key)),
|
|
3879
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { onClick: () => editTransition(item), className: "fc:bg-blue-50 hover:fc:bg-blue-100 fc:text-blue-600 fc:px-3 fc:py-1 fc:rounded-lg fc:text-xs fc:font-semibold", children: "Edit" }) })
|
|
3880
|
+
] }, item.transitionId)) })
|
|
3881
|
+
] }) }),
|
|
3882
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Footer, {})
|
|
3896
3883
|
] }),
|
|
3897
|
-
showModal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AddWorkTransitionStepModal, { onClose: () =>
|
|
3898
|
-
|
|
3884
|
+
showModal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AddWorkTransitionStepModal, { editData: editingTransition, onClose: () => {
|
|
3885
|
+
setShowModal(false);
|
|
3886
|
+
setEditingTransition(null);
|
|
3887
|
+
}, onSave: saveTransition })
|
|
3899
3888
|
] });
|
|
3900
3889
|
}
|
|
3901
3890
|
|
|
3902
3891
|
// src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
|
|
3903
3892
|
var import_react27 = __toESM(require("react"));
|
|
3904
|
-
var
|
|
3893
|
+
var import_sweetalert211 = __toESM(require("sweetalert2"));
|
|
3905
3894
|
init_ApiEndpointsProvider();
|
|
3906
3895
|
init_ApiServicepackage();
|
|
3907
3896
|
|
|
3908
3897
|
// src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
|
|
3909
3898
|
var import_react22 = __toESM(require("react"));
|
|
3910
|
-
var
|
|
3899
|
+
var import_sweetalert210 = __toESM(require("sweetalert2"));
|
|
3911
3900
|
init_ApiEndpointsProvider();
|
|
3912
3901
|
init_ApiServicepackage();
|
|
3913
3902
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
@@ -3970,7 +3959,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3970
3959
|
const handleSave = async () => {
|
|
3971
3960
|
if (!onSave) return;
|
|
3972
3961
|
if (!formData.workflowStepId) {
|
|
3973
|
-
await
|
|
3962
|
+
await import_sweetalert210.default.fire("Required field", "Please select a workflow step.", "warning");
|
|
3974
3963
|
return;
|
|
3975
3964
|
}
|
|
3976
3965
|
setIsSubmitting(true);
|
|
@@ -3995,7 +3984,7 @@ function AddUserHierarchyNodeMappingModal({
|
|
|
3995
3984
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
|
|
3996
3985
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" }) }) }),
|
|
3997
3986
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
3998
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow
|
|
3987
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Workflow Hierarchy Mapping " }),
|
|
3999
3988
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Map a consumer user to a hierarchy node" })
|
|
4000
3989
|
] })
|
|
4001
3990
|
] }),
|
|
@@ -4642,13 +4631,13 @@ function User_hierarchy_mapping_main() {
|
|
|
4642
4631
|
(async () => {
|
|
4643
4632
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4644
4633
|
try {
|
|
4645
|
-
const
|
|
4646
|
-
if (!
|
|
4647
|
-
const result = await getApiService().post(
|
|
4634
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c.getList;
|
|
4635
|
+
if (!endpoint2) throw new Error("Workflow Step Hierarchy Mapping list endpoint is not configured.");
|
|
4636
|
+
const result = await getApiService().post(endpoint2, {});
|
|
4648
4637
|
const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
|
|
4649
4638
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
4650
4639
|
} catch (error) {
|
|
4651
|
-
await
|
|
4640
|
+
await import_sweetalert211.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load Workflow Step Hierarchy Mappings.", "error");
|
|
4652
4641
|
}
|
|
4653
4642
|
})();
|
|
4654
4643
|
}, [refreshkey]);
|
|
@@ -4668,8 +4657,8 @@ function User_hierarchy_mapping_main() {
|
|
|
4668
4657
|
const saveMapping = async (payload, isEdit = false) => {
|
|
4669
4658
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4670
4659
|
try {
|
|
4671
|
-
const
|
|
4672
|
-
if (!
|
|
4660
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
|
|
4661
|
+
if (!endpoint2) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
|
|
4673
4662
|
const requestPayload = isEdit ? {
|
|
4674
4663
|
workflowStepUserMappingId: Number(
|
|
4675
4664
|
(_f = (_e = (_d = payload.workflowStepUserMappingId) != null ? _d : payload.WorkFlowStepUserMappingId) != null ? _e : payload.mappingId) != null ? _f : payload.id
|
|
@@ -4682,18 +4671,18 @@ function User_hierarchy_mapping_main() {
|
|
|
4682
4671
|
isActive: (_g = payload.isActive) != null ? _g : true,
|
|
4683
4672
|
updatedBy: payload.updatedBy || "System"
|
|
4684
4673
|
} : payload;
|
|
4685
|
-
await getApiService()[isEdit ? "put" : "post"](
|
|
4686
|
-
await
|
|
4674
|
+
await getApiService()[isEdit ? "put" : "post"](endpoint2, requestPayload);
|
|
4675
|
+
await import_sweetalert211.default.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
4687
4676
|
handleRefresh();
|
|
4688
4677
|
return true;
|
|
4689
4678
|
} catch (error) {
|
|
4690
|
-
await
|
|
4679
|
+
await import_sweetalert211.default.fire("Error", ((_i = (_h = error == null ? void 0 : error.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
|
|
4691
4680
|
return false;
|
|
4692
4681
|
}
|
|
4693
4682
|
};
|
|
4694
4683
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:min-h-screen fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
|
|
4695
4684
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
4696
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CommonHeader, { title: "Workflow
|
|
4685
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CommonHeader, { title: "Workflow Hierarchy Mapping", breadcrumbs: [{
|
|
4697
4686
|
label: "Dashboard",
|
|
4698
4687
|
href: "/dashboard"
|
|
4699
4688
|
}, {
|
|
@@ -4703,8 +4692,8 @@ function User_hierarchy_mapping_main() {
|
|
|
4703
4692
|
label: "Hierarchy",
|
|
4704
4693
|
href: "/hierarchy"
|
|
4705
4694
|
}, {
|
|
4706
|
-
label: "
|
|
4707
|
-
href: "/
|
|
4695
|
+
label: "Workflow Hierarchy Mapping",
|
|
4696
|
+
href: "/Workflow-Hierarchy-Mapping"
|
|
4708
4697
|
}], buttonText: "Add Mapping", onButtonClick: () => setModalOpen(true) }),
|
|
4709
4698
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:shadow-sm fc:space-y-5", children: [
|
|
4710
4699
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
|
|
@@ -4729,7 +4718,7 @@ function User_hierarchy_mapping_main() {
|
|
|
4729
4718
|
|
|
4730
4719
|
// src/components/document-configuration/DocumentConfigurationmain.jsx
|
|
4731
4720
|
var import_react33 = __toESM(require("react"));
|
|
4732
|
-
var
|
|
4721
|
+
var import_sweetalert213 = __toESM(require("sweetalert2"));
|
|
4733
4722
|
init_ApiEndpointsProvider();
|
|
4734
4723
|
init_ApiServicepackage();
|
|
4735
4724
|
|
|
@@ -4752,7 +4741,7 @@ function SearchBar3({
|
|
|
4752
4741
|
|
|
4753
4742
|
// src/components/document-configuration/DocumentConfigurationTable.jsx
|
|
4754
4743
|
var import_react31 = __toESM(require("react"));
|
|
4755
|
-
var
|
|
4744
|
+
var import_sweetalert212 = __toESM(require("sweetalert2"));
|
|
4756
4745
|
|
|
4757
4746
|
// src/components/document-configuration/Edit.jsx
|
|
4758
4747
|
var import_react29 = __toESM(require("react"));
|
|
@@ -4784,9 +4773,9 @@ function EditDocumentConfiguration({
|
|
|
4784
4773
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4785
4774
|
try {
|
|
4786
4775
|
setLoadingSteps(true);
|
|
4787
|
-
const
|
|
4788
|
-
if (!
|
|
4789
|
-
const result = await getApiService().get(
|
|
4776
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
4777
|
+
if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
|
|
4778
|
+
const result = await getApiService().get(endpoint2);
|
|
4790
4779
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
4791
4780
|
setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
|
|
4792
4781
|
} catch (_) {
|
|
@@ -5248,13 +5237,13 @@ function DocumentConfigTable({
|
|
|
5248
5237
|
var _a, _b, _c, _d, _e;
|
|
5249
5238
|
try {
|
|
5250
5239
|
setIsLoading(true);
|
|
5251
|
-
const
|
|
5252
|
-
if (!
|
|
5253
|
-
const result = await getApiService().post(
|
|
5240
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
|
|
5241
|
+
if (!endpoint2) throw new Error("Document Configuration list endpoint is not configured.");
|
|
5242
|
+
const result = await getApiService().post(endpoint2, {});
|
|
5254
5243
|
setData(unwrapRows(result).map(toUiItem));
|
|
5255
5244
|
} catch (error) {
|
|
5256
5245
|
setData([]);
|
|
5257
|
-
await
|
|
5246
|
+
await import_sweetalert212.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to load document configurations.", "error");
|
|
5258
5247
|
} finally {
|
|
5259
5248
|
setIsLoading(false);
|
|
5260
5249
|
}
|
|
@@ -5289,22 +5278,22 @@ function DocumentConfigTable({
|
|
|
5289
5278
|
},
|
|
5290
5279
|
(_, i) => i + 1
|
|
5291
5280
|
);
|
|
5292
|
-
const buildGetByIdUrl = (
|
|
5293
|
-
if (
|
|
5294
|
-
return `${
|
|
5281
|
+
const buildGetByIdUrl = (endpoint2, id) => {
|
|
5282
|
+
if (endpoint2.includes("{id}")) return endpoint2.replace("{id}", encodeURIComponent(id));
|
|
5283
|
+
return `${endpoint2.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
|
|
5295
5284
|
};
|
|
5296
5285
|
const handleEdit = async (item) => {
|
|
5297
5286
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5298
5287
|
try {
|
|
5299
|
-
const
|
|
5300
|
-
if (!
|
|
5301
|
-
const url = typeof
|
|
5288
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
|
|
5289
|
+
if (!endpoint2) throw new Error("Document Configuration get-by-id endpoint is not configured.");
|
|
5290
|
+
const url = typeof endpoint2 === "function" ? endpoint2(item.id) : buildGetByIdUrl(endpoint2, item.id);
|
|
5302
5291
|
const result = await getApiService().get(url);
|
|
5303
5292
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
5304
5293
|
setSelectedItem(toUiItem(value != null ? value : item));
|
|
5305
5294
|
setIsEditOpen(true);
|
|
5306
5295
|
} catch (error) {
|
|
5307
|
-
await
|
|
5296
|
+
await import_sweetalert212.default.fire("Error", ((_j = (_i = error == null ? void 0 : error.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (error == null ? void 0 : error.message) || "Unable to load document configuration.", "error");
|
|
5308
5297
|
}
|
|
5309
5298
|
};
|
|
5310
5299
|
const handleDelete = (item) => {
|
|
@@ -5314,13 +5303,13 @@ function DocumentConfigTable({
|
|
|
5314
5303
|
const handleSaveEdit = async (updatedData) => {
|
|
5315
5304
|
var _a, _b, _c, _d, _e, _f;
|
|
5316
5305
|
try {
|
|
5317
|
-
const
|
|
5318
|
-
if (!
|
|
5306
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
|
|
5307
|
+
if (!endpoint2) throw new Error("Document Configuration update endpoint is not configured.");
|
|
5319
5308
|
const maxSizeMB = Number.parseFloat((_d = updatedData.maxSizeNum) != null ? _d : updatedData.maxSize);
|
|
5320
5309
|
if (!Number.isFinite(maxSizeMB) || maxSizeMB <= 0) {
|
|
5321
5310
|
throw new Error("Please enter a valid maximum size in MB.");
|
|
5322
5311
|
}
|
|
5323
|
-
await getApiService().put(
|
|
5312
|
+
await getApiService().put(endpoint2, {
|
|
5324
5313
|
documentConfigurationId: updatedData.id,
|
|
5325
5314
|
documentName: updatedData.docName.trim(),
|
|
5326
5315
|
allowedExtensions: updatedData.extensions.trim(),
|
|
@@ -5329,12 +5318,12 @@ function DocumentConfigTable({
|
|
|
5329
5318
|
isActive: updatedData.status === "Active",
|
|
5330
5319
|
updatedBy: "System"
|
|
5331
5320
|
});
|
|
5332
|
-
await
|
|
5321
|
+
await import_sweetalert212.default.fire("Success", "Document configuration updated successfully.", "success");
|
|
5333
5322
|
setIsEditOpen(false);
|
|
5334
5323
|
await loadData();
|
|
5335
5324
|
return true;
|
|
5336
5325
|
} catch (error) {
|
|
5337
|
-
await
|
|
5326
|
+
await import_sweetalert212.default.fire("Error", ((_f = (_e = error == null ? void 0 : error.response) == null ? void 0 : _e.data) == null ? void 0 : _f.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
|
|
5338
5327
|
return false;
|
|
5339
5328
|
}
|
|
5340
5329
|
};
|
|
@@ -5540,9 +5529,9 @@ function AddDocumentConfigModal({
|
|
|
5540
5529
|
setLoadingSteps(true);
|
|
5541
5530
|
const { getApiEndpoints: getApiEndpoints2 } = await Promise.resolve().then(() => (init_ApiEndpointsProvider(), ApiEndpointsProvider_exports));
|
|
5542
5531
|
const { getApiService: getApiService2 } = await Promise.resolve().then(() => (init_ApiServicepackage(), ApiServicepackage_exports));
|
|
5543
|
-
const
|
|
5544
|
-
if (!
|
|
5545
|
-
const result = await getApiService2().get(
|
|
5532
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints2()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
5533
|
+
if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
|
|
5534
|
+
const result = await getApiService2().get(endpoint2);
|
|
5546
5535
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
5547
5536
|
setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
|
|
5548
5537
|
} catch (_) {
|
|
@@ -5729,15 +5718,15 @@ function DocumentConfigurationmain() {
|
|
|
5729
5718
|
const handleCreate = async (payload) => {
|
|
5730
5719
|
var _a, _b, _c, _d, _e;
|
|
5731
5720
|
try {
|
|
5732
|
-
const
|
|
5733
|
-
if (!
|
|
5734
|
-
await getApiService().post(
|
|
5735
|
-
await
|
|
5721
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
|
|
5722
|
+
if (!endpoint2) throw new Error("Document Configuration create endpoint is not configured.");
|
|
5723
|
+
await getApiService().post(endpoint2, payload);
|
|
5724
|
+
await import_sweetalert213.default.fire("Success", "Document configuration created successfully.", "success");
|
|
5736
5725
|
setModalOpen(false);
|
|
5737
5726
|
handleRefresh();
|
|
5738
5727
|
return true;
|
|
5739
5728
|
} catch (error) {
|
|
5740
|
-
await
|
|
5729
|
+
await import_sweetalert213.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create document configuration.", "error");
|
|
5741
5730
|
return false;
|
|
5742
5731
|
}
|
|
5743
5732
|
};
|
|
@@ -6796,7 +6785,7 @@ function MovementHistorymain() {
|
|
|
6796
6785
|
|
|
6797
6786
|
// src/components/task-permission/TaskPermissionMain.jsx
|
|
6798
6787
|
var import_react46 = __toESM(require("react"));
|
|
6799
|
-
var
|
|
6788
|
+
var import_sweetalert215 = __toESM(require("sweetalert2"));
|
|
6800
6789
|
|
|
6801
6790
|
// src/components/task-permission/SearchBar.js
|
|
6802
6791
|
var import_react42 = __toESM(require("react"));
|
|
@@ -6926,6 +6915,12 @@ function Table({
|
|
|
6926
6915
|
{ label: "Can Edit", key: "canEdit" },
|
|
6927
6916
|
{ label: "Can Approve", key: "canApprove" },
|
|
6928
6917
|
{ label: "Can Reject", key: "canReject" },
|
|
6918
|
+
{ label: "Can Forward", key: "canForward" },
|
|
6919
|
+
{ label: "Can Free Forward", key: "canFreeForward" },
|
|
6920
|
+
{ label: "Can Return", key: "canReturn" },
|
|
6921
|
+
{ label: "Can Return To Applicant", key: "canReturnToApplicant" },
|
|
6922
|
+
{ label: "Can Delegate", key: "canDelegate" },
|
|
6923
|
+
{ label: "Can Hold", key: "canHold" },
|
|
6929
6924
|
{ label: "Active", key: "isActive" }
|
|
6930
6925
|
];
|
|
6931
6926
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "fc:space-y-5", children: [
|
|
@@ -6950,7 +6945,7 @@ function Table({
|
|
|
6950
6945
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
6951
6946
|
"td",
|
|
6952
6947
|
{
|
|
6953
|
-
colSpan:
|
|
6948
|
+
colSpan: columns.length + 2,
|
|
6954
6949
|
className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm",
|
|
6955
6950
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
6956
6951
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
@@ -6982,15 +6977,15 @@ function Table({
|
|
|
6982
6977
|
]
|
|
6983
6978
|
}
|
|
6984
6979
|
),
|
|
6985
|
-
"Loading
|
|
6980
|
+
"Loading step permissions..."
|
|
6986
6981
|
] })
|
|
6987
6982
|
}
|
|
6988
6983
|
) }) : visibleData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
6989
6984
|
"td",
|
|
6990
6985
|
{
|
|
6991
|
-
colSpan:
|
|
6986
|
+
colSpan: columns.length + 2,
|
|
6992
6987
|
className: "fc:py-10 fc:text-center fc:text-slate-400 fc:text-sm",
|
|
6993
|
-
children: "No
|
|
6988
|
+
children: "No step permissions found."
|
|
6994
6989
|
}
|
|
6995
6990
|
) }) : visibleData.map((item, index) => {
|
|
6996
6991
|
var _a, _b, _c, _d;
|
|
@@ -7006,6 +7001,12 @@ function Table({
|
|
|
7006
7001
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canEdit }) }),
|
|
7007
7002
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canApprove }) }),
|
|
7008
7003
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canReject }) }),
|
|
7004
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canForward }) }),
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canFreeForward }) }),
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canReturn }) }),
|
|
7007
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canReturnToApplicant }) }),
|
|
7008
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canDelegate }) }),
|
|
7009
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.canHold }) }),
|
|
7009
7010
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(BoolBadge, { val: item.isActive }) }),
|
|
7010
7011
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("td", { className: "fc:sticky fc:right-0 fc:bg-white fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
7011
7012
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
@@ -7067,7 +7068,7 @@ function Table({
|
|
|
7067
7068
|
|
|
7068
7069
|
// src/components/task-permission/Popup.js
|
|
7069
7070
|
var import_react44 = __toESM(require("react"));
|
|
7070
|
-
var
|
|
7071
|
+
var import_sweetalert214 = __toESM(require("sweetalert2"));
|
|
7071
7072
|
init_ApiEndpointsProvider();
|
|
7072
7073
|
init_ApiServicepackage();
|
|
7073
7074
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
@@ -7077,7 +7078,14 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7077
7078
|
canView: false,
|
|
7078
7079
|
canEdit: false,
|
|
7079
7080
|
canApprove: false,
|
|
7080
|
-
canReject: false
|
|
7081
|
+
canReject: false,
|
|
7082
|
+
canForward: false,
|
|
7083
|
+
canFreeForward: false,
|
|
7084
|
+
canReturn: false,
|
|
7085
|
+
canReturnToApplicant: false,
|
|
7086
|
+
canDelegate: false,
|
|
7087
|
+
canHold: false,
|
|
7088
|
+
isActive: true
|
|
7081
7089
|
});
|
|
7082
7090
|
const [errors, setErrors] = (0, import_react44.useState)({});
|
|
7083
7091
|
const [isSubmitting, setIsSubmitting] = (0, import_react44.useState)(false);
|
|
@@ -7089,9 +7097,9 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7089
7097
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7090
7098
|
try {
|
|
7091
7099
|
setLoadingSteps(true);
|
|
7092
|
-
const
|
|
7093
|
-
if (!
|
|
7094
|
-
const result = await getApiService().get(
|
|
7100
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
7101
|
+
if (!endpoint2) return;
|
|
7102
|
+
const result = await getApiService().get(endpoint2);
|
|
7095
7103
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
7096
7104
|
const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
|
|
7097
7105
|
setWorkflowSteps(rows);
|
|
@@ -7103,7 +7111,20 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7103
7111
|
}, [isOpen]);
|
|
7104
7112
|
(0, import_react44.useEffect)(() => {
|
|
7105
7113
|
if (!isOpen) {
|
|
7106
|
-
setFormData({
|
|
7114
|
+
setFormData({
|
|
7115
|
+
workflowStepId: "",
|
|
7116
|
+
canView: false,
|
|
7117
|
+
canEdit: false,
|
|
7118
|
+
canApprove: false,
|
|
7119
|
+
canReject: false,
|
|
7120
|
+
canForward: false,
|
|
7121
|
+
canFreeForward: false,
|
|
7122
|
+
canReturn: false,
|
|
7123
|
+
canReturnToApplicant: false,
|
|
7124
|
+
canDelegate: false,
|
|
7125
|
+
canHold: false,
|
|
7126
|
+
isActive: true
|
|
7127
|
+
});
|
|
7107
7128
|
setErrors({});
|
|
7108
7129
|
}
|
|
7109
7130
|
}, [isOpen]);
|
|
@@ -7124,31 +7145,44 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7124
7145
|
if (!validate()) return;
|
|
7125
7146
|
try {
|
|
7126
7147
|
setIsSubmitting(true);
|
|
7127
|
-
const
|
|
7128
|
-
if (!
|
|
7148
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.create;
|
|
7149
|
+
if (!endpoint2) throw new Error("Step Permission create endpoint is not configured.");
|
|
7129
7150
|
const payload = {
|
|
7130
7151
|
workflowStepId: Number(formData.workflowStepId) || 0,
|
|
7131
7152
|
canView: Boolean(formData.canView),
|
|
7132
7153
|
canEdit: Boolean(formData.canEdit),
|
|
7133
7154
|
canApprove: Boolean(formData.canApprove),
|
|
7134
7155
|
canReject: Boolean(formData.canReject),
|
|
7156
|
+
canForward: Boolean(formData.canForward),
|
|
7157
|
+
canFreeForward: Boolean(formData.canFreeForward),
|
|
7158
|
+
canReturn: Boolean(formData.canReturn),
|
|
7159
|
+
canReturnToApplicant: Boolean(formData.canReturnToApplicant),
|
|
7160
|
+
canDelegate: Boolean(formData.canDelegate),
|
|
7161
|
+
canHold: Boolean(formData.canHold),
|
|
7162
|
+
isActive: Boolean(formData.isActive),
|
|
7135
7163
|
createdBy: "System"
|
|
7136
7164
|
};
|
|
7137
|
-
await getApiService().post(
|
|
7165
|
+
await getApiService().post(endpoint2, payload);
|
|
7138
7166
|
onClose();
|
|
7139
7167
|
await (onSave == null ? void 0 : onSave());
|
|
7140
7168
|
} catch (error) {
|
|
7141
|
-
const msg = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create
|
|
7142
|
-
await
|
|
7169
|
+
const msg = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create step permission.";
|
|
7170
|
+
await import_sweetalert214.default.fire("Error", msg, "error");
|
|
7143
7171
|
} finally {
|
|
7144
7172
|
setIsSubmitting(false);
|
|
7145
7173
|
}
|
|
7146
7174
|
};
|
|
7147
7175
|
const permissionCards = [
|
|
7148
|
-
{ icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs", field: "canView" },
|
|
7149
|
-
{ icon: "\u2713", title: "Can Approve", desc: "Pass states", field: "canApprove" },
|
|
7150
|
-
{ icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify
|
|
7151
|
-
{ icon: "\u2715", title: "Can Reject", desc: "Cancel tasks", field: "canReject" }
|
|
7176
|
+
{ icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs & details", field: "canView" },
|
|
7177
|
+
{ icon: "\u2713", title: "Can Approve", desc: "Pass states & approve", field: "canApprove" },
|
|
7178
|
+
{ icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify properties", field: "canEdit" },
|
|
7179
|
+
{ icon: "\u2715", title: "Can Reject", desc: "Cancel / reject tasks", field: "canReject" },
|
|
7180
|
+
{ icon: "\u27A1\uFE0F", title: "Can Forward", desc: "Forward to next step", field: "canForward" },
|
|
7181
|
+
{ icon: "\u23E9", title: "Can Free Forward", desc: "Forward freely to any step", field: "canFreeForward" },
|
|
7182
|
+
{ icon: "\u21A9\uFE0F", title: "Can Return", desc: "Return to previous step", field: "canReturn" },
|
|
7183
|
+
{ icon: "\u{1F464}", title: "Can Return To Applicant", desc: "Send back to applicant", field: "canReturnToApplicant" },
|
|
7184
|
+
{ icon: "\u{1F465}", title: "Can Delegate", desc: "Reassign or delegate task", field: "canDelegate" },
|
|
7185
|
+
{ icon: "\u23F8\uFE0F", title: "Can Hold", desc: "Put execution on hold", field: "canHold" }
|
|
7152
7186
|
];
|
|
7153
7187
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
|
|
7154
7188
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm fc:transition-opacity fc:duration-200", onClick: onClose }),
|
|
@@ -7157,7 +7191,7 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7157
7191
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
|
|
7158
7192
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-blue-50 fc:text-blue-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm fc:text-xl", children: "\u{1F511}" }),
|
|
7159
7193
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { children: [
|
|
7160
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add
|
|
7194
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Step Permission" }),
|
|
7161
7195
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Configure step details and initial user control access rules" })
|
|
7162
7196
|
] })
|
|
7163
7197
|
] }),
|
|
@@ -7227,6 +7261,30 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7227
7261
|
}
|
|
7228
7262
|
)
|
|
7229
7263
|
] }, field)) })
|
|
7264
|
+
] }),
|
|
7265
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-100/80 fc:shadow-sm fc:space-y-4", children: [
|
|
7266
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-blue-600 fc:text-sm fc:font-bold fc:border-b fc:border-slate-50 fc:pb-3", children: [
|
|
7267
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "\u{1F518}" }),
|
|
7268
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: "Status" })
|
|
7269
|
+
] }),
|
|
7270
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [{ label: "Active", val: true }, { label: "Inactive", val: false }].map(({ label, val }) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
7271
|
+
"div",
|
|
7272
|
+
{
|
|
7273
|
+
onClick: () => handleChange("isActive", val),
|
|
7274
|
+
className: `fc:flex fc:items-center fc:gap-3 fc:p-3.5 fc:rounded-xl fc:border fc:cursor-pointer fc:transition-all ${formData.isActive === val ? val ? "fc:border-emerald-500 fc:bg-emerald-50/40 fc:ring-1 fc:ring-emerald-500/20" : "fc:border-slate-400 fc:bg-slate-100/60 fc:ring-1 fc:ring-slate-400/20" : "fc:border-slate-200 fc:bg-white hover:fc:bg-slate-50/60"}`,
|
|
7275
|
+
children: [
|
|
7276
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
7277
|
+
"div",
|
|
7278
|
+
{
|
|
7279
|
+
className: `fc:w-3.5 fc:h-3.5 fc:rounded-full fc:border fc:flex fc:items-center fc:justify-center ${formData.isActive === val ? val ? "fc:border-emerald-500 fc:bg-emerald-500" : "fc:border-slate-600 fc:bg-slate-600" : "fc:border-slate-300"}`,
|
|
7280
|
+
children: formData.isActive === val && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "fc:w-1.5 fc:h-1.5 fc:bg-white fc:rounded-full" })
|
|
7281
|
+
}
|
|
7282
|
+
),
|
|
7283
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "fc:text-xs fc:font-bold fc:text-slate-800", children: label })
|
|
7284
|
+
]
|
|
7285
|
+
},
|
|
7286
|
+
label
|
|
7287
|
+
)) })
|
|
7230
7288
|
] })
|
|
7231
7289
|
] }),
|
|
7232
7290
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "fc:p-5 fc:bg-white fc:border-t fc:border-slate-100 fc:flex fc:items-center fc:justify-end fc:gap-3 fc:px-8", children: [
|
|
@@ -7273,6 +7331,12 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7273
7331
|
canEdit: false,
|
|
7274
7332
|
canApprove: false,
|
|
7275
7333
|
canReject: false,
|
|
7334
|
+
canForward: false,
|
|
7335
|
+
canFreeForward: false,
|
|
7336
|
+
canReturn: false,
|
|
7337
|
+
canReturnToApplicant: false,
|
|
7338
|
+
canDelegate: false,
|
|
7339
|
+
canHold: false,
|
|
7276
7340
|
isActive: true,
|
|
7277
7341
|
updatedBy: "System"
|
|
7278
7342
|
});
|
|
@@ -7286,9 +7350,9 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7286
7350
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
7287
7351
|
try {
|
|
7288
7352
|
setLoadingSteps(true);
|
|
7289
|
-
const
|
|
7290
|
-
if (!
|
|
7291
|
-
const result = await getApiService().get(
|
|
7353
|
+
const endpoint2 = (_c = (_b = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
7354
|
+
if (!endpoint2) return;
|
|
7355
|
+
const result = await getApiService().get(endpoint2);
|
|
7292
7356
|
const value = (_h = (_g = (_f = (_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) != null ? _f : (_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) != null ? _g : result == null ? void 0 : result.data) != null ? _h : result;
|
|
7293
7357
|
const rows = Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : [];
|
|
7294
7358
|
setWorkflowSteps(rows);
|
|
@@ -7299,7 +7363,7 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7299
7363
|
})();
|
|
7300
7364
|
}, [isOpen]);
|
|
7301
7365
|
(0, import_react45.useEffect)(() => {
|
|
7302
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
7366
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
7303
7367
|
if (selectedData) {
|
|
7304
7368
|
setFormData({
|
|
7305
7369
|
workflowStepId: (_b = (_a2 = selectedData.workflowStepId) != null ? _a2 : selectedData.WorkflowStepId) != null ? _b : "",
|
|
@@ -7307,8 +7371,14 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7307
7371
|
canEdit: (_f = (_e = selectedData.canEdit) != null ? _e : selectedData.CanEdit) != null ? _f : false,
|
|
7308
7372
|
canApprove: (_h = (_g = selectedData.canApprove) != null ? _g : selectedData.CanApprove) != null ? _h : false,
|
|
7309
7373
|
canReject: (_j = (_i = selectedData.canReject) != null ? _i : selectedData.CanReject) != null ? _j : false,
|
|
7310
|
-
|
|
7311
|
-
|
|
7374
|
+
canForward: (_l = (_k = selectedData.canForward) != null ? _k : selectedData.CanForward) != null ? _l : false,
|
|
7375
|
+
canFreeForward: (_n = (_m = selectedData.canFreeForward) != null ? _m : selectedData.CanFreeForward) != null ? _n : false,
|
|
7376
|
+
canReturn: (_p = (_o = selectedData.canReturn) != null ? _o : selectedData.CanReturn) != null ? _p : false,
|
|
7377
|
+
canReturnToApplicant: (_r = (_q = selectedData.canReturnToApplicant) != null ? _q : selectedData.CanReturnToApplicant) != null ? _r : false,
|
|
7378
|
+
canDelegate: (_t = (_s = selectedData.canDelegate) != null ? _s : selectedData.CanDelegate) != null ? _t : false,
|
|
7379
|
+
canHold: (_v = (_u = selectedData.canHold) != null ? _u : selectedData.CanHold) != null ? _v : false,
|
|
7380
|
+
isActive: (_x = (_w = selectedData.isActive) != null ? _w : selectedData.IsActive) != null ? _x : true,
|
|
7381
|
+
updatedBy: (_z = (_y = selectedData.updatedBy) != null ? _y : selectedData.UpdatedBy) != null ? _z : "System"
|
|
7312
7382
|
});
|
|
7313
7383
|
setErrors({});
|
|
7314
7384
|
}
|
|
@@ -7336,6 +7406,12 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7336
7406
|
canEdit: Boolean(formData.canEdit),
|
|
7337
7407
|
canApprove: Boolean(formData.canApprove),
|
|
7338
7408
|
canReject: Boolean(formData.canReject),
|
|
7409
|
+
canForward: Boolean(formData.canForward),
|
|
7410
|
+
canFreeForward: Boolean(formData.canFreeForward),
|
|
7411
|
+
canReturn: Boolean(formData.canReturn),
|
|
7412
|
+
canReturnToApplicant: Boolean(formData.canReturnToApplicant),
|
|
7413
|
+
canDelegate: Boolean(formData.canDelegate),
|
|
7414
|
+
canHold: Boolean(formData.canHold),
|
|
7339
7415
|
isActive: Boolean(formData.isActive),
|
|
7340
7416
|
updatedBy: String(formData.updatedBy).trim() || "System"
|
|
7341
7417
|
});
|
|
@@ -7347,10 +7423,16 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7347
7423
|
}
|
|
7348
7424
|
};
|
|
7349
7425
|
const permissionCards = [
|
|
7350
|
-
{ icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs", field: "canView" },
|
|
7351
|
-
{ icon: "\u2713", title: "Can Approve", desc: "Pass states", field: "canApprove" },
|
|
7352
|
-
{ icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify
|
|
7353
|
-
{ icon: "\u2715", title: "Can Reject", desc: "Cancel tasks", field: "canReject" }
|
|
7426
|
+
{ icon: "\u{1F441}\uFE0F", title: "Can View", desc: "Read logs & details", field: "canView" },
|
|
7427
|
+
{ icon: "\u2713", title: "Can Approve", desc: "Pass states & approve", field: "canApprove" },
|
|
7428
|
+
{ icon: "\u{1F4DD}", title: "Can Edit", desc: "Modify properties", field: "canEdit" },
|
|
7429
|
+
{ icon: "\u2715", title: "Can Reject", desc: "Cancel / reject tasks", field: "canReject" },
|
|
7430
|
+
{ icon: "\u27A1\uFE0F", title: "Can Forward", desc: "Forward to next step", field: "canForward" },
|
|
7431
|
+
{ icon: "\u23E9", title: "Can Free Forward", desc: "Forward freely to any step", field: "canFreeForward" },
|
|
7432
|
+
{ icon: "\u21A9\uFE0F", title: "Can Return", desc: "Return to previous step", field: "canReturn" },
|
|
7433
|
+
{ icon: "\u{1F464}", title: "Can Return To Applicant", desc: "Send back to applicant", field: "canReturnToApplicant" },
|
|
7434
|
+
{ icon: "\u{1F465}", title: "Can Delegate", desc: "Reassign or delegate task", field: "canDelegate" },
|
|
7435
|
+
{ icon: "\u23F8\uFE0F", title: "Can Hold", desc: "Put execution on hold", field: "canHold" }
|
|
7354
7436
|
];
|
|
7355
7437
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
|
|
7356
7438
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
|
|
@@ -7359,7 +7441,7 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7359
7441
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
|
|
7360
7442
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm fc:text-xl", children: "\u{1F511}" }),
|
|
7361
7443
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { children: [
|
|
7362
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit
|
|
7444
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Edit Step Permission" }),
|
|
7363
7445
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: [
|
|
7364
7446
|
"Update step access rules \u2014 ID: ",
|
|
7365
7447
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "fc:font-bold fc:text-slate-600", children: [
|
|
@@ -7527,29 +7609,35 @@ function TaskPermissionMain() {
|
|
|
7527
7609
|
const handleUpdateApi = async (item) => {
|
|
7528
7610
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
7529
7611
|
try {
|
|
7530
|
-
const
|
|
7531
|
-
if (!
|
|
7532
|
-
await getApiService().put(
|
|
7612
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.taskPermission) == null ? void 0 : _c.update;
|
|
7613
|
+
if (!endpoint2) throw new Error("Step Permission update endpoint is not configured.");
|
|
7614
|
+
await getApiService().put(endpoint2, {
|
|
7533
7615
|
taskPermissionId: (_e = (_d = item.taskPermissionId) != null ? _d : item.TaskPermissionId) != null ? _e : 0,
|
|
7534
7616
|
workflowStepId: Number(item.workflowStepId) || 0,
|
|
7535
7617
|
canView: Boolean(item.canView),
|
|
7536
7618
|
canEdit: Boolean(item.canEdit),
|
|
7537
7619
|
canApprove: Boolean(item.canApprove),
|
|
7538
7620
|
canReject: Boolean(item.canReject),
|
|
7621
|
+
canForward: Boolean(item.canForward),
|
|
7622
|
+
canFreeForward: Boolean(item.canFreeForward),
|
|
7623
|
+
canReturn: Boolean(item.canReturn),
|
|
7624
|
+
canReturnToApplicant: Boolean(item.canReturnToApplicant),
|
|
7625
|
+
canDelegate: Boolean(item.canDelegate),
|
|
7626
|
+
canHold: Boolean(item.canHold),
|
|
7539
7627
|
isActive: Boolean(item.isActive),
|
|
7540
7628
|
updatedBy: item.updatedBy || "System"
|
|
7541
7629
|
});
|
|
7542
7630
|
handleRefresh();
|
|
7543
7631
|
return true;
|
|
7544
7632
|
} catch (error) {
|
|
7545
|
-
await
|
|
7633
|
+
await import_sweetalert215.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to update step permission.", "error");
|
|
7546
7634
|
return false;
|
|
7547
7635
|
}
|
|
7548
7636
|
};
|
|
7549
7637
|
const handleDeleteApi = async (item) => {
|
|
7550
7638
|
var _a;
|
|
7551
|
-
const confirm = await
|
|
7552
|
-
title: "Delete
|
|
7639
|
+
const confirm = await import_sweetalert215.default.fire({
|
|
7640
|
+
title: "Delete Step Permission?",
|
|
7553
7641
|
text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
|
|
7554
7642
|
icon: "warning",
|
|
7555
7643
|
showCancelButton: true,
|
|
@@ -7558,11 +7646,11 @@ function TaskPermissionMain() {
|
|
|
7558
7646
|
});
|
|
7559
7647
|
if (!confirm.isConfirmed) return;
|
|
7560
7648
|
const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
|
|
7561
|
-
if (ok) await
|
|
7649
|
+
if (ok) await import_sweetalert215.default.fire("Deleted", "Step permission has been deactivated.", "success");
|
|
7562
7650
|
};
|
|
7563
7651
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
|
|
7564
7652
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
7565
|
-
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CommonHeader, { title: "
|
|
7653
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CommonHeader, { title: "Step Permission", breadcrumbs: [{
|
|
7566
7654
|
label: "Dashboard",
|
|
7567
7655
|
href: "/dashboard"
|
|
7568
7656
|
}, {
|
|
@@ -7572,9 +7660,9 @@ function TaskPermissionMain() {
|
|
|
7572
7660
|
label: "Permissions",
|
|
7573
7661
|
href: "/permissions"
|
|
7574
7662
|
}, {
|
|
7575
|
-
label: "
|
|
7576
|
-
href: "/
|
|
7577
|
-
}], buttonText: "Add
|
|
7663
|
+
label: "StepPermission",
|
|
7664
|
+
href: "/step-permission"
|
|
7665
|
+
}], buttonText: "Add Step Permission", onButtonClick: () => setShowModal(true) }),
|
|
7578
7666
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:shadow-sm fc:space-y-5", children: [
|
|
7579
7667
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
|
|
7580
7668
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(SearchBar6, { searchQuery, setSearchQuery, setCurrentPage }) }),
|
|
@@ -7611,7 +7699,7 @@ function TaskPermissionMain() {
|
|
|
7611
7699
|
isOpen: showModal,
|
|
7612
7700
|
onClose: () => setShowModal(false),
|
|
7613
7701
|
onSave: async () => {
|
|
7614
|
-
await
|
|
7702
|
+
await import_sweetalert215.default.fire("Success", "Step permission created successfully.", "success");
|
|
7615
7703
|
handleRefresh();
|
|
7616
7704
|
}
|
|
7617
7705
|
}
|
|
@@ -7623,7 +7711,7 @@ function TaskPermissionMain() {
|
|
|
7623
7711
|
onClose: () => setIsEditOpen(false),
|
|
7624
7712
|
selectedData: selectedItem,
|
|
7625
7713
|
onSave: async () => {
|
|
7626
|
-
await
|
|
7714
|
+
await import_sweetalert215.default.fire("Success", "Step permission updated successfully.", "success");
|
|
7627
7715
|
handleRefresh();
|
|
7628
7716
|
},
|
|
7629
7717
|
onUpdate: handleUpdateApi
|
|
@@ -10193,7 +10281,7 @@ function Comment_main() {
|
|
|
10193
10281
|
|
|
10194
10282
|
// src/components/hierarchy-node/HierarchyNodeMain.jsx
|
|
10195
10283
|
var import_react70 = __toESM(require("react"));
|
|
10196
|
-
var
|
|
10284
|
+
var import_sweetalert216 = __toESM(require("sweetalert2"));
|
|
10197
10285
|
init_ApiEndpointsProvider();
|
|
10198
10286
|
init_ApiServicepackage();
|
|
10199
10287
|
|
|
@@ -10793,13 +10881,13 @@ function HierarchyNodeMain() {
|
|
|
10793
10881
|
(async () => {
|
|
10794
10882
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
10795
10883
|
try {
|
|
10796
|
-
const
|
|
10797
|
-
if (!
|
|
10798
|
-
const result = await getApiService().get(
|
|
10884
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c.getList;
|
|
10885
|
+
if (!endpoint2) throw Error("Hierarchy node list endpoint is not configured.");
|
|
10886
|
+
const result = await getApiService().get(endpoint2);
|
|
10799
10887
|
const value = ((_d = result == null ? void 0 : result.data) == null ? void 0 : _d.data) || ((_e = result == null ? void 0 : result.data) == null ? void 0 : _e.result) || (result == null ? void 0 : result.data) || result;
|
|
10800
10888
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
10801
10889
|
} catch (error) {
|
|
10802
|
-
await
|
|
10890
|
+
await import_sweetalert216.default.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
|
|
10803
10891
|
}
|
|
10804
10892
|
})();
|
|
10805
10893
|
}, [refreshKey]);
|
|
@@ -10809,14 +10897,14 @@ function HierarchyNodeMain() {
|
|
|
10809
10897
|
const saveNode = async (payload, isEdit = false) => {
|
|
10810
10898
|
var _a, _b, _c, _d, _e;
|
|
10811
10899
|
try {
|
|
10812
|
-
const
|
|
10813
|
-
if (!
|
|
10814
|
-
await getApiService()[isEdit ? "put" : "post"](
|
|
10815
|
-
await
|
|
10900
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
|
|
10901
|
+
if (!endpoint2) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
|
|
10902
|
+
await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
|
|
10903
|
+
await import_sweetalert216.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
10816
10904
|
handleRefresh();
|
|
10817
10905
|
return true;
|
|
10818
10906
|
} catch (error) {
|
|
10819
|
-
await
|
|
10907
|
+
await import_sweetalert216.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} hierarchy node.`, "error");
|
|
10820
10908
|
return false;
|
|
10821
10909
|
}
|
|
10822
10910
|
};
|
|
@@ -11526,22 +11614,26 @@ function UploadedDocumentMain() {
|
|
|
11526
11614
|
|
|
11527
11615
|
// src/components/BuisnessEntity/BusinessEntitymain.js
|
|
11528
11616
|
var import_react80 = __toESM(require("react"));
|
|
11529
|
-
var
|
|
11617
|
+
var import_sweetalert217 = __toESM(require("sweetalert2"));
|
|
11530
11618
|
|
|
11531
11619
|
// src/components/BuisnessEntity/AddBusinessEntityModal.js
|
|
11532
11620
|
var import_react79 = __toESM(require("react"));
|
|
11533
11621
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
11534
|
-
function AddBusinessEntityModal({ onClose }) {
|
|
11535
|
-
const [formData, setFormData] = (0, import_react79.useState)({
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11622
|
+
function AddBusinessEntityModal({ onClose, onSave, editData }) {
|
|
11623
|
+
const [formData, setFormData] = (0, import_react79.useState)(() => {
|
|
11624
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
11625
|
+
return {
|
|
11626
|
+
entityType: (_b = (_a = editData == null ? void 0 : editData.entityType) != null ? _a : editData == null ? void 0 : editData.EntityType) != null ? _b : "",
|
|
11627
|
+
entityKey: String((_d = (_c = editData == null ? void 0 : editData.entityKey) != null ? _c : editData == null ? void 0 : editData.EntityKey) != null ? _d : ""),
|
|
11628
|
+
displayNumber: (_f = (_e = editData == null ? void 0 : editData.displayNumber) != null ? _e : editData == null ? void 0 : editData.DisplayNumber) != null ? _f : "",
|
|
11629
|
+
displayTitle: (_h = (_g = editData == null ? void 0 : editData.displayTitle) != null ? _g : editData == null ? void 0 : editData.DisplayTitle) != null ? _h : "",
|
|
11630
|
+
isDefault: (_i = editData == null ? void 0 : editData.isDefault) != null ? _i : false,
|
|
11631
|
+
isVisible: (_j = editData == null ? void 0 : editData.isVisible) != null ? _j : true,
|
|
11632
|
+
status: ((_l = (_k = editData == null ? void 0 : editData.isActive) != null ? _k : editData == null ? void 0 : editData.IsActive) != null ? _l : true) ? "Active" : "Inactive"
|
|
11633
|
+
};
|
|
11543
11634
|
});
|
|
11544
11635
|
const [errors, setErrors] = (0, import_react79.useState)({});
|
|
11636
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react79.useState)(false);
|
|
11545
11637
|
const handleChange = (field, value) => {
|
|
11546
11638
|
setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
11547
11639
|
[field]: value
|
|
@@ -11561,10 +11653,17 @@ function AddBusinessEntityModal({ onClose }) {
|
|
|
11561
11653
|
setErrors(newErrors);
|
|
11562
11654
|
return Object.keys(newErrors).length === 0;
|
|
11563
11655
|
};
|
|
11564
|
-
const handleSubmit = (e) => {
|
|
11656
|
+
const handleSubmit = async (e) => {
|
|
11657
|
+
var _a, _b, _c;
|
|
11565
11658
|
e.preventDefault();
|
|
11566
|
-
if (validate())
|
|
11567
|
-
|
|
11659
|
+
if (!validate() || !onSave) return;
|
|
11660
|
+
const isEdit = Boolean(editData);
|
|
11661
|
+
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" };
|
|
11662
|
+
setIsSubmitting(true);
|
|
11663
|
+
try {
|
|
11664
|
+
if (await onSave(payload, isEdit)) onClose();
|
|
11665
|
+
} finally {
|
|
11666
|
+
setIsSubmitting(false);
|
|
11568
11667
|
}
|
|
11569
11668
|
};
|
|
11570
11669
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
|
|
@@ -11580,7 +11679,7 @@ function AddBusinessEntityModal({ onClose }) {
|
|
|
11580
11679
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
|
|
11581
11680
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm fc:transition-transform hover:fc:scale-105", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("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" }) }) }),
|
|
11582
11681
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { children: [
|
|
11583
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Business Entity" }),
|
|
11682
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: editData ? "Edit Business Entity" : "Add Business Entity" }),
|
|
11584
11683
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new business entity for the workflow engine" })
|
|
11585
11684
|
] })
|
|
11586
11685
|
] }),
|
|
@@ -11816,10 +11915,11 @@ function AddBusinessEntityModal({ onClose }) {
|
|
|
11816
11915
|
{
|
|
11817
11916
|
type: "button",
|
|
11818
11917
|
onClick: handleSubmit,
|
|
11918
|
+
disabled: isSubmitting,
|
|
11819
11919
|
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",
|
|
11820
11920
|
children: [
|
|
11821
11921
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("svg", { className: "fc:w-4 fc:h-4", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("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" }) }),
|
|
11822
|
-
"Save Business Entity"
|
|
11922
|
+
isSubmitting ? "Saving..." : editData ? "Update Business Entity" : "Save Business Entity"
|
|
11823
11923
|
]
|
|
11824
11924
|
}
|
|
11825
11925
|
)
|
|
@@ -11829,192 +11929,242 @@ function AddBusinessEntityModal({ onClose }) {
|
|
|
11829
11929
|
}
|
|
11830
11930
|
|
|
11831
11931
|
// src/components/BuisnessEntity/BusinessEntitymain.js
|
|
11932
|
+
init_ApiEndpointsProvider();
|
|
11933
|
+
init_ApiServicepackage();
|
|
11832
11934
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
11833
|
-
var
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
}
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
DisplayNumber: "App-001",
|
|
11868
|
-
DisplayTitle: "Building Permission"
|
|
11869
|
-
}, {
|
|
11870
|
-
BusinessEntityId: 1,
|
|
11871
|
-
EntityType: "Application",
|
|
11872
|
-
EntityKey: "5001",
|
|
11873
|
-
DisplayNumber: "App-001",
|
|
11874
|
-
DisplayTitle: "Building Permission"
|
|
11875
|
-
}, {
|
|
11876
|
-
BusinessEntityId: 1,
|
|
11877
|
-
EntityType: "Application",
|
|
11878
|
-
EntityKey: "5001",
|
|
11879
|
-
DisplayNumber: "App-001",
|
|
11880
|
-
DisplayTitle: "Building Permission"
|
|
11881
|
-
}, {
|
|
11882
|
-
BusinessEntityId: 1,
|
|
11883
|
-
EntityType: "Application",
|
|
11884
|
-
EntityKey: "5001",
|
|
11885
|
-
DisplayNumber: "App-001",
|
|
11886
|
-
DisplayTitle: "Building Permission"
|
|
11887
|
-
}, {
|
|
11888
|
-
BusinessEntityId: 2,
|
|
11889
|
-
EntityType: "Application",
|
|
11890
|
-
EntityKey: "5002",
|
|
11891
|
-
DisplayNumber: "App-002",
|
|
11892
|
-
DisplayTitle: "Building Permission"
|
|
11893
|
-
}, {
|
|
11894
|
-
BusinessEntityId: 3,
|
|
11895
|
-
EntityType: "Application",
|
|
11896
|
-
EntityKey: "5003",
|
|
11897
|
-
DisplayNumber: "App-003",
|
|
11898
|
-
DisplayTitle: "Building Permission"
|
|
11899
|
-
}, {
|
|
11900
|
-
BusinessEntityId: 4,
|
|
11901
|
-
EntityType: "Application",
|
|
11902
|
-
EntityKey: "5004",
|
|
11903
|
-
DisplayNumber: "App-004",
|
|
11904
|
-
DisplayTitle: "Building Permission"
|
|
11905
|
-
}, {
|
|
11906
|
-
BusinessEntityId: 5,
|
|
11907
|
-
EntityType: "Application",
|
|
11908
|
-
EntityKey: "5005",
|
|
11909
|
-
DisplayNumber: "App-005",
|
|
11910
|
-
DisplayTitle: "Building Permission"
|
|
11911
|
-
}];
|
|
11935
|
+
var BUSINESS_ENTITY_ENDPOINTS = {
|
|
11936
|
+
create: "/api/flowcore/BusinessEntity/Create",
|
|
11937
|
+
update: "/api/flowcore/BusinessEntity/Update",
|
|
11938
|
+
getById: "/api/flowcore/BusinessEntity/GetById",
|
|
11939
|
+
getList: "/api/flowcore/BusinessEntity/GetList"
|
|
11940
|
+
};
|
|
11941
|
+
var getBusinessEntityEndpoint = (action) => {
|
|
11942
|
+
var _a, _b, _c, _d;
|
|
11943
|
+
try {
|
|
11944
|
+
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];
|
|
11945
|
+
} catch (e) {
|
|
11946
|
+
return BUSINESS_ENTITY_ENDPOINTS[action];
|
|
11947
|
+
}
|
|
11948
|
+
};
|
|
11949
|
+
var getBusinessEntityByIdEndpoint = (id) => {
|
|
11950
|
+
const endpoint2 = getBusinessEntityEndpoint("getById");
|
|
11951
|
+
return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
|
|
11952
|
+
};
|
|
11953
|
+
var getRows2 = (response) => {
|
|
11954
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11955
|
+
const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
|
|
11956
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
11957
|
+
};
|
|
11958
|
+
var normalise2 = (item) => {
|
|
11959
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
11960
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
11961
|
+
businessEntityId: (_b = (_a = item.businessEntityId) != null ? _a : item.BusinessEntityId) != null ? _b : item.id,
|
|
11962
|
+
entityType: (_d = (_c = item.entityType) != null ? _c : item.EntityType) != null ? _d : "",
|
|
11963
|
+
entityKey: (_f = (_e = item.entityKey) != null ? _e : item.EntityKey) != null ? _f : "",
|
|
11964
|
+
displayNumber: (_h = (_g = item.displayNumber) != null ? _g : item.DisplayNumber) != null ? _h : "",
|
|
11965
|
+
displayTitle: (_j = (_i = item.displayTitle) != null ? _i : item.DisplayTitle) != null ? _j : "",
|
|
11966
|
+
isActive: (_l = (_k = item.isActive) != null ? _k : item.IsActive) != null ? _l : true
|
|
11967
|
+
});
|
|
11968
|
+
};
|
|
11912
11969
|
function BusinessEntity() {
|
|
11913
|
-
const handleRefresh = () => {
|
|
11914
|
-
console.log("Refresh clicked");
|
|
11915
|
-
};
|
|
11916
|
-
const handleDownload = () => {
|
|
11917
|
-
console.log("Download clicked");
|
|
11918
|
-
};
|
|
11919
11970
|
const tableRef = (0, import_react80.useRef)(null);
|
|
11971
|
+
const [rows, setRows] = (0, import_react80.useState)([]);
|
|
11920
11972
|
const [showModal, setShowModal] = (0, import_react80.useState)(false);
|
|
11973
|
+
const [editingEntity, setEditingEntity] = (0, import_react80.useState)(null);
|
|
11921
11974
|
const [pageSize, setPageSize] = (0, import_react80.useState)(5);
|
|
11922
|
-
const [
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11975
|
+
const [search, setSearch] = (0, import_react80.useState)("");
|
|
11976
|
+
const [sortConfig, setSortConfig] = (0, import_react80.useState)({ key: "", direction: "asc" });
|
|
11977
|
+
const [refreshKey, setRefreshKey] = (0, import_react80.useState)(0);
|
|
11978
|
+
(0, import_react80.useEffect)(() => {
|
|
11979
|
+
const load = async () => {
|
|
11980
|
+
var _a, _b;
|
|
11981
|
+
try {
|
|
11982
|
+
const endpoint2 = getBusinessEntityEndpoint("getList");
|
|
11983
|
+
const response = await getApiService().get(endpoint2);
|
|
11984
|
+
setRows(getRows2(response).map(normalise2));
|
|
11985
|
+
} catch (error) {
|
|
11986
|
+
await import_sweetalert217.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load business entities.", "error");
|
|
11987
|
+
}
|
|
11988
|
+
};
|
|
11989
|
+
load();
|
|
11990
|
+
}, [refreshKey]);
|
|
11991
|
+
const refresh = () => setRefreshKey((value) => value + 1);
|
|
11992
|
+
const saveEntity = async (payload, isEdit) => {
|
|
11993
|
+
var _a, _b;
|
|
11994
|
+
try {
|
|
11995
|
+
const endpoint2 = getBusinessEntityEndpoint(isEdit ? "update" : "create");
|
|
11996
|
+
await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
|
|
11997
|
+
await import_sweetalert217.default.fire("Success", `Business entity ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
11998
|
+
refresh();
|
|
11999
|
+
return true;
|
|
12000
|
+
} catch (error) {
|
|
12001
|
+
await import_sweetalert217.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} business entity.`, "error");
|
|
12002
|
+
return false;
|
|
11930
12003
|
}
|
|
11931
|
-
setSortConfig({
|
|
11932
|
-
key,
|
|
11933
|
-
direction
|
|
11934
|
-
});
|
|
11935
12004
|
};
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
}
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
12005
|
+
const editEntity = async (entity) => {
|
|
12006
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12007
|
+
try {
|
|
12008
|
+
const response = await getApiService().get(getBusinessEntityByIdEndpoint(entity.businessEntityId));
|
|
12009
|
+
const data = (_f = (_e = (_d = (_b = getRows2(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
|
|
12010
|
+
setEditingEntity(normalise2(data));
|
|
12011
|
+
setShowModal(true);
|
|
12012
|
+
} catch (error) {
|
|
12013
|
+
await import_sweetalert217.default.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load business entity details.", "error");
|
|
12014
|
+
}
|
|
12015
|
+
};
|
|
12016
|
+
const visibleRows = rows.filter((item) => [item.entityType, item.entityKey, item.displayNumber, item.displayTitle].join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
|
|
12017
|
+
var _a, _b;
|
|
12018
|
+
if (!sortConfig.key) return 0;
|
|
12019
|
+
const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
|
|
12020
|
+
return sortConfig.direction === "asc" ? result : -result;
|
|
12021
|
+
});
|
|
12022
|
+
const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
|
|
12023
|
+
const columns = [["BusinessEntityId", "businessEntityId"], ["EntityType", "entityType"], ["EntityKey", "entityKey"], ["DisplayNumber", "displayNumber"], ["DisplayTitle", "displayTitle"]];
|
|
12024
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
|
|
12025
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CommonHeader, { title: "Business Entity", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Runtime", href: "/Sidebar" }, { label: "Business Entity", href: "/BuisnessEntity" }], buttonText: "Add Business Entity", onButtonClick: () => {
|
|
12026
|
+
setEditingEntity(null);
|
|
12027
|
+
setShowModal(true);
|
|
12028
|
+
} }),
|
|
11947
12029
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
|
|
11948
12030
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
|
|
11949
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.
|
|
11950
|
-
|
|
11951
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
11952
|
-
] }),
|
|
11953
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold", children: [
|
|
11954
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Refresh_default, { onRefresh: handleRefresh }),
|
|
12031
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("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" }),
|
|
12032
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
|
|
12033
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Refresh_default, { onRefresh: refresh }),
|
|
11955
12034
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Download_default, { targetRef: tableRef, fileName: "business-entity" }),
|
|
11956
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("select", { value: pageSize, onChange: (
|
|
12035
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("select", { value: pageSize, onChange: (event) => setPageSize(Number(event.target.value)), className: "fc:px-4 fc:py-2 fc:rounded-xl fc:border fc:border-slate-200", children: [
|
|
11957
12036
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("option", { value: 5, children: "5 Rows" }),
|
|
11958
12037
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("option", { value: 10, children: "10 Rows" }),
|
|
11959
12038
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("option", { value: 25, children: "25 Rows" })
|
|
11960
12039
|
] })
|
|
11961
12040
|
] })
|
|
11962
12041
|
] }),
|
|
11963
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-
|
|
11964
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("thead", { className: "fc:bg-slate-50
|
|
11965
|
-
label: "
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
|
|
11969
|
-
key
|
|
11970
|
-
|
|
11971
|
-
|
|
11972
|
-
|
|
11973
|
-
|
|
11974
|
-
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
|
|
11988
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("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 })
|
|
11989
|
-
] }, item.BusinessEntityId)) })
|
|
11990
|
-
] }) }) }),
|
|
11991
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: [
|
|
11992
|
-
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Footer, {}),
|
|
11993
|
-
showModal && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(AddBusinessEntityModal, { onClose: () => setShowModal(false) })
|
|
11994
|
-
] })
|
|
11995
|
-
] })
|
|
11996
|
-
] }) });
|
|
12042
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("table", { className: "fc:min-w-max fc:w-full", children: [
|
|
12043
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("tr", { children: [
|
|
12044
|
+
columns.map(([label, key]) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
|
|
12045
|
+
label,
|
|
12046
|
+
" ",
|
|
12047
|
+
sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
|
|
12048
|
+
] }, key)),
|
|
12049
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
|
|
12050
|
+
] }) }),
|
|
12051
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("tr", { className: "fc:border-t fc:border-slate-100", children: [
|
|
12052
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.businessEntityId }),
|
|
12053
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.entityType }),
|
|
12054
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.entityKey }),
|
|
12055
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.displayNumber }),
|
|
12056
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.displayTitle }),
|
|
12057
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("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" }) })
|
|
12058
|
+
] }, item.businessEntityId)) })
|
|
12059
|
+
] }) }),
|
|
12060
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(Footer, {})
|
|
12061
|
+
] }),
|
|
12062
|
+
showModal && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(AddBusinessEntityModal, { editData: editingEntity, onClose: () => {
|
|
12063
|
+
setShowModal(false);
|
|
12064
|
+
setEditingEntity(null);
|
|
12065
|
+
}, onSave: saveEntity })
|
|
12066
|
+
] });
|
|
11997
12067
|
}
|
|
11998
12068
|
|
|
11999
12069
|
// src/components/FileInstance/FileInstancemain.js
|
|
12000
12070
|
var import_react82 = __toESM(require("react"));
|
|
12001
|
-
var
|
|
12071
|
+
var import_sweetalert218 = __toESM(require("sweetalert2"));
|
|
12002
12072
|
|
|
12003
12073
|
// src/components/FileInstance/AddWorkFlowFileInstanceModal.js
|
|
12004
12074
|
var import_react81 = __toESM(require("react"));
|
|
12075
|
+
init_ApiEndpointsProvider();
|
|
12076
|
+
init_ApiServicepackage();
|
|
12005
12077
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12078
|
+
var LOOKUP_ENDPOINTS = {
|
|
12079
|
+
workflow: "/api/flowcore/WorkFlow/GetList",
|
|
12080
|
+
businessEntity: "/api/flowcore/BusinessEntity/GetList",
|
|
12081
|
+
hierarchyNode: "/api/flowcore/HierarchyNode/GetList"
|
|
12082
|
+
};
|
|
12083
|
+
var getLookupRows = (response) => {
|
|
12084
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12085
|
+
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;
|
|
12086
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
12087
|
+
};
|
|
12088
|
+
var getLookupEndpoint = (resource) => {
|
|
12089
|
+
var _a, _b, _c, _d;
|
|
12090
|
+
try {
|
|
12091
|
+
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];
|
|
12092
|
+
} catch (e) {
|
|
12093
|
+
return LOOKUP_ENDPOINTS[resource];
|
|
12094
|
+
}
|
|
12095
|
+
};
|
|
12096
|
+
function AddFileInstanceModal({ onClose, onSave, editData }) {
|
|
12097
|
+
const [formData, setFormData] = (0, import_react81.useState)(() => {
|
|
12098
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
12099
|
+
return {
|
|
12100
|
+
workflow: String((_b = (_a = editData == null ? void 0 : editData.workflowId) != null ? _a : editData == null ? void 0 : editData.WorkflowId) != null ? _b : ""),
|
|
12101
|
+
businessEntityType: (_d = (_c = editData == null ? void 0 : editData.businessEntityType) != null ? _c : editData == null ? void 0 : editData.BusinessEntityType) != null ? _d : "",
|
|
12102
|
+
businessEntity: String((_f = (_e = editData == null ? void 0 : editData.businessEntityId) != null ? _e : editData == null ? void 0 : editData.BusinessEntityId) != null ? _f : ""),
|
|
12103
|
+
hierarchyNode: String((_h = (_g = editData == null ? void 0 : editData.hierarchyNodeId) != null ? _g : editData == null ? void 0 : editData.HierarchyNodeId) != null ? _h : ""),
|
|
12104
|
+
currentStep: String((_j = (_i = editData == null ? void 0 : editData.currentStepId) != null ? _i : editData == null ? void 0 : editData.CurrentStepId) != null ? _j : ""),
|
|
12105
|
+
currentTaskInstance: String((_l = (_k = editData == null ? void 0 : editData.currentTaskInstanceId) != null ? _k : editData == null ? void 0 : editData.CurrentTaskInstanceId) != null ? _l : ""),
|
|
12106
|
+
status: (_n = (_m = editData == null ? void 0 : editData.status) != null ? _m : editData == null ? void 0 : editData.Status) != null ? _n : "Pending",
|
|
12107
|
+
priority: (_p = (_o = editData == null ? void 0 : editData.priority) != null ? _o : editData == null ? void 0 : editData.Priority) != null ? _p : "High"
|
|
12108
|
+
};
|
|
12016
12109
|
});
|
|
12017
12110
|
const [errors, setErrors] = (0, import_react81.useState)({});
|
|
12111
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react81.useState)(false);
|
|
12112
|
+
const [workflows, setWorkflows] = (0, import_react81.useState)([]);
|
|
12113
|
+
const [businessEntities, setBusinessEntities] = (0, import_react81.useState)([]);
|
|
12114
|
+
const [hierarchyNodes, setHierarchyNodes] = (0, import_react81.useState)([]);
|
|
12115
|
+
const [isLoadingLookups, setIsLoadingLookups] = (0, import_react81.useState)(true);
|
|
12116
|
+
(0, import_react81.useEffect)(() => {
|
|
12117
|
+
let isMounted = true;
|
|
12118
|
+
const loadLookups = async () => {
|
|
12119
|
+
try {
|
|
12120
|
+
const apiService2 = getApiService();
|
|
12121
|
+
const [workflowResponse, businessEntityResponse, hierarchyNodeResponse] = await Promise.all([
|
|
12122
|
+
apiService2.get(getLookupEndpoint("workflow")),
|
|
12123
|
+
apiService2.get(getLookupEndpoint("businessEntity")),
|
|
12124
|
+
apiService2.get(getLookupEndpoint("hierarchyNode"))
|
|
12125
|
+
]);
|
|
12126
|
+
if (!isMounted) return;
|
|
12127
|
+
setWorkflows(getLookupRows(workflowResponse));
|
|
12128
|
+
setBusinessEntities(getLookupRows(businessEntityResponse));
|
|
12129
|
+
setHierarchyNodes(getLookupRows(hierarchyNodeResponse));
|
|
12130
|
+
} catch (error) {
|
|
12131
|
+
if (!isMounted) return;
|
|
12132
|
+
setErrors((current) => {
|
|
12133
|
+
var _a, _b;
|
|
12134
|
+
return __spreadProps(__spreadValues({}, current), {
|
|
12135
|
+
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."
|
|
12136
|
+
});
|
|
12137
|
+
});
|
|
12138
|
+
} finally {
|
|
12139
|
+
if (isMounted) setIsLoadingLookups(false);
|
|
12140
|
+
}
|
|
12141
|
+
};
|
|
12142
|
+
loadLookups();
|
|
12143
|
+
return () => {
|
|
12144
|
+
isMounted = false;
|
|
12145
|
+
};
|
|
12146
|
+
}, []);
|
|
12147
|
+
const entityTypes = (0, import_react81.useMemo)(() => [...new Set(businessEntities.map((entity) => {
|
|
12148
|
+
var _a;
|
|
12149
|
+
return (_a = entity.entityType) != null ? _a : entity.EntityType;
|
|
12150
|
+
}).filter(Boolean))], [businessEntities]);
|
|
12151
|
+
const visibleBusinessEntities = (0, import_react81.useMemo)(() => businessEntities.filter((entity) => {
|
|
12152
|
+
var _a;
|
|
12153
|
+
const entityType = (_a = entity.entityType) != null ? _a : entity.EntityType;
|
|
12154
|
+
return !formData.businessEntityType || entityType === formData.businessEntityType;
|
|
12155
|
+
}), [businessEntities, formData.businessEntityType]);
|
|
12156
|
+
const handleSubmit = async () => {
|
|
12157
|
+
var _a, _b, _c, _d, _e;
|
|
12158
|
+
if (!validateForm() || !onSave) return;
|
|
12159
|
+
const isEdit = Boolean(editData);
|
|
12160
|
+
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" };
|
|
12161
|
+
setIsSubmitting(true);
|
|
12162
|
+
try {
|
|
12163
|
+
if (await onSave(payload, isEdit)) onClose();
|
|
12164
|
+
} finally {
|
|
12165
|
+
setIsSubmitting(false);
|
|
12166
|
+
}
|
|
12167
|
+
};
|
|
12018
12168
|
const validateForm = () => {
|
|
12019
12169
|
const newErrors = {};
|
|
12020
12170
|
if (!formData.workflow) newErrors.workflow = "Workflow is required.";
|
|
@@ -12039,7 +12189,7 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12039
12189
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
|
|
12040
12190
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-inner fc:border fc:border-indigo-100", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("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" }) }) }),
|
|
12041
12191
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
12042
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add FileInstance" }),
|
|
12192
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: editData ? "Edit FileInstance" : "Add FileInstance" }),
|
|
12043
12193
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new File Instance and configure its details" })
|
|
12044
12194
|
] })
|
|
12045
12195
|
] }),
|
|
@@ -12075,9 +12225,13 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12075
12225
|
},
|
|
12076
12226
|
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"}`,
|
|
12077
12227
|
children: [
|
|
12078
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: "Select Workflow" }),
|
|
12079
|
-
|
|
12080
|
-
|
|
12228
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: isLoadingLookups ? "Loading workflows..." : "Select Workflow" }),
|
|
12229
|
+
workflows.map((workflow) => {
|
|
12230
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12231
|
+
const id = (_b = (_a = workflow.workflowId) != null ? _a : workflow.WorkflowId) != null ? _b : workflow.id;
|
|
12232
|
+
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}`;
|
|
12233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: String(id), children: name }, id);
|
|
12234
|
+
})
|
|
12081
12235
|
]
|
|
12082
12236
|
}
|
|
12083
12237
|
),
|
|
@@ -12094,15 +12248,13 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12094
12248
|
{
|
|
12095
12249
|
value: formData.businessEntityType,
|
|
12096
12250
|
onChange: (e) => {
|
|
12097
|
-
setFormData(__spreadProps(__spreadValues({}, formData), { businessEntityType: e.target.value }));
|
|
12251
|
+
setFormData(__spreadProps(__spreadValues({}, formData), { businessEntityType: e.target.value, businessEntity: "" }));
|
|
12098
12252
|
setErrors(__spreadProps(__spreadValues({}, errors), { businessEntityType: "" }));
|
|
12099
12253
|
},
|
|
12100
12254
|
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"}`,
|
|
12101
12255
|
children: [
|
|
12102
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: "Select Type" }),
|
|
12103
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value:
|
|
12104
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "Petition", children: "Petition" }),
|
|
12105
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "Complaint", children: "Complaint" })
|
|
12256
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: isLoadingLookups ? "Loading types..." : "Select Type" }),
|
|
12257
|
+
entityTypes.map((entityType) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: entityType, children: entityType }, entityType))
|
|
12106
12258
|
]
|
|
12107
12259
|
}
|
|
12108
12260
|
),
|
|
@@ -12121,14 +12273,31 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12121
12273
|
{
|
|
12122
12274
|
value: formData.businessEntity,
|
|
12123
12275
|
onChange: (e) => {
|
|
12124
|
-
|
|
12276
|
+
var _a, _b;
|
|
12277
|
+
const entity = businessEntities.find((item) => {
|
|
12278
|
+
var _a2, _b2;
|
|
12279
|
+
return String((_b2 = (_a2 = item.businessEntityId) != null ? _a2 : item.BusinessEntityId) != null ? _b2 : item.id) === e.target.value;
|
|
12280
|
+
});
|
|
12281
|
+
setFormData(__spreadProps(__spreadValues({}, formData), {
|
|
12282
|
+
businessEntity: e.target.value,
|
|
12283
|
+
businessEntityType: (_b = (_a = entity == null ? void 0 : entity.entityType) != null ? _a : entity == null ? void 0 : entity.EntityType) != null ? _b : formData.businessEntityType
|
|
12284
|
+
}));
|
|
12125
12285
|
setErrors(__spreadProps(__spreadValues({}, errors), { businessEntity: "" }));
|
|
12126
12286
|
},
|
|
12127
12287
|
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"}`,
|
|
12128
12288
|
children: [
|
|
12129
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: "Select Business Entity" }),
|
|
12130
|
-
|
|
12131
|
-
|
|
12289
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: isLoadingLookups ? "Loading business entities..." : "Select Business Entity" }),
|
|
12290
|
+
visibleBusinessEntities.map((entity) => {
|
|
12291
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12292
|
+
const id = (_b = (_a = entity.businessEntityId) != null ? _a : entity.BusinessEntityId) != null ? _b : entity.id;
|
|
12293
|
+
const displayNumber = (_d = (_c = entity.displayNumber) != null ? _c : entity.DisplayNumber) != null ? _d : id;
|
|
12294
|
+
const displayTitle = (_f = (_e = entity.displayTitle) != null ? _e : entity.DisplayTitle) != null ? _f : "Business Entity";
|
|
12295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("option", { value: String(id), children: [
|
|
12296
|
+
displayNumber,
|
|
12297
|
+
" - ",
|
|
12298
|
+
displayTitle
|
|
12299
|
+
] }, id);
|
|
12300
|
+
})
|
|
12132
12301
|
]
|
|
12133
12302
|
}
|
|
12134
12303
|
),
|
|
@@ -12150,16 +12319,20 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12150
12319
|
},
|
|
12151
12320
|
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"}`,
|
|
12152
12321
|
children: [
|
|
12153
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: "Select Hierarchy" }),
|
|
12154
|
-
|
|
12155
|
-
|
|
12156
|
-
|
|
12322
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: isLoadingLookups ? "Loading hierarchy nodes..." : "Select Hierarchy" }),
|
|
12323
|
+
hierarchyNodes.map((node) => {
|
|
12324
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12325
|
+
const id = (_b = (_a = node.hierarchyNodeId) != null ? _a : node.HierarchyNodeId) != null ? _b : node.id;
|
|
12326
|
+
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}`;
|
|
12327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: String(id), children: name }, id);
|
|
12328
|
+
})
|
|
12157
12329
|
]
|
|
12158
12330
|
}
|
|
12159
12331
|
),
|
|
12160
12332
|
errors.hierarchyNode && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("p", { className: "fc:text-red-500 fc:text-[11px] fc:mt-1 fc:font-medium", children: errors.hierarchyNode })
|
|
12161
12333
|
] })
|
|
12162
12334
|
] }),
|
|
12335
|
+
errors.lookup && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("p", { className: "fc:text-red-500 fc:text-[11px] fc:font-medium", children: errors.lookup }),
|
|
12163
12336
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "fc:grid fc:grid-cols-2 md:fc:grid-cols-2 fc:gap-5", children: [
|
|
12164
12337
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
|
|
12165
12338
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("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: [
|
|
@@ -12178,8 +12351,8 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12178
12351
|
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"}`,
|
|
12179
12352
|
children: [
|
|
12180
12353
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "", children: "Select Step" }),
|
|
12181
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "
|
|
12182
|
-
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "
|
|
12354
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "1", children: "Scrutiny" }),
|
|
12355
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("option", { value: "2", children: "Approval" })
|
|
12183
12356
|
]
|
|
12184
12357
|
}
|
|
12185
12358
|
),
|
|
@@ -12268,15 +12441,12 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12268
12441
|
"button",
|
|
12269
12442
|
{
|
|
12270
12443
|
type: "button",
|
|
12271
|
-
onClick:
|
|
12272
|
-
|
|
12273
|
-
console.log("Form Submitted Successfully:", formData);
|
|
12274
|
-
}
|
|
12275
|
-
},
|
|
12444
|
+
onClick: handleSubmit,
|
|
12445
|
+
disabled: isSubmitting,
|
|
12276
12446
|
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",
|
|
12277
12447
|
children: [
|
|
12278
12448
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("svg", { className: "fc:w-3.5 fc:h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("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" }) }),
|
|
12279
|
-
"Save FileInstance"
|
|
12449
|
+
isSubmitting ? "Saving..." : editData ? "Update FileInstance" : "Save FileInstance"
|
|
12280
12450
|
]
|
|
12281
12451
|
}
|
|
12282
12452
|
)
|
|
@@ -12286,257 +12456,134 @@ function AddFileInstanceModal({ onClose }) {
|
|
|
12286
12456
|
}
|
|
12287
12457
|
|
|
12288
12458
|
// src/components/FileInstance/FileInstancemain.js
|
|
12459
|
+
init_ApiEndpointsProvider();
|
|
12460
|
+
init_ApiServicepackage();
|
|
12289
12461
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12290
|
-
var
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
}
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
HierarchyNodeId:
|
|
12316
|
-
|
|
12317
|
-
CurrentTaskInstanceId: 1,
|
|
12318
|
-
Status: "Pending",
|
|
12319
|
-
Priority: "High"
|
|
12320
|
-
}, {
|
|
12321
|
-
FileInstanceId: 1,
|
|
12322
|
-
workflowId: 1,
|
|
12323
|
-
BusinessEntityType: "Application",
|
|
12324
|
-
BusinessEntityId: 5001,
|
|
12325
|
-
HierarchyNodeId: 2,
|
|
12326
|
-
CurrentStepId: 1,
|
|
12327
|
-
CurrentTaskInstanceId: 1,
|
|
12328
|
-
Status: "Pending",
|
|
12329
|
-
Priority: "High"
|
|
12330
|
-
}, {
|
|
12331
|
-
FileInstanceId: 1,
|
|
12332
|
-
workflowId: 1,
|
|
12333
|
-
BusinessEntityType: "Application",
|
|
12334
|
-
BusinessEntityId: 5001,
|
|
12335
|
-
HierarchyNodeId: 2,
|
|
12336
|
-
CurrentStepId: 1,
|
|
12337
|
-
CurrentTaskInstanceId: 1,
|
|
12338
|
-
Status: "Pending",
|
|
12339
|
-
Priority: "High"
|
|
12340
|
-
}, {
|
|
12341
|
-
FileInstanceId: 1,
|
|
12342
|
-
workflowId: 1,
|
|
12343
|
-
BusinessEntityType: "Application",
|
|
12344
|
-
BusinessEntityId: 5001,
|
|
12345
|
-
HierarchyNodeId: 2,
|
|
12346
|
-
CurrentStepId: 1,
|
|
12347
|
-
CurrentTaskInstanceId: 1,
|
|
12348
|
-
Status: "Pending",
|
|
12349
|
-
Priority: "High"
|
|
12350
|
-
}, {
|
|
12351
|
-
FileInstanceId: 1,
|
|
12352
|
-
workflowId: 1,
|
|
12353
|
-
BusinessEntityType: "Application",
|
|
12354
|
-
BusinessEntityId: 5001,
|
|
12355
|
-
HierarchyNodeId: 2,
|
|
12356
|
-
CurrentStepId: 1,
|
|
12357
|
-
CurrentTaskInstanceId: 1,
|
|
12358
|
-
Status: "Pending",
|
|
12359
|
-
Priority: "High"
|
|
12360
|
-
}, {
|
|
12361
|
-
FileInstanceId: 1,
|
|
12362
|
-
workflowId: 1,
|
|
12363
|
-
BusinessEntityType: "Application",
|
|
12364
|
-
BusinessEntityId: 5001,
|
|
12365
|
-
HierarchyNodeId: 2,
|
|
12366
|
-
CurrentStepId: 1,
|
|
12367
|
-
CurrentTaskInstanceId: 1,
|
|
12368
|
-
Status: "Pending",
|
|
12369
|
-
Priority: "High"
|
|
12370
|
-
}, {
|
|
12371
|
-
FileInstanceId: 1,
|
|
12372
|
-
workflowId: 1,
|
|
12373
|
-
BusinessEntityType: "Application",
|
|
12374
|
-
BusinessEntityId: 5001,
|
|
12375
|
-
HierarchyNodeId: 2,
|
|
12376
|
-
CurrentStepId: 1,
|
|
12377
|
-
CurrentTaskInstanceId: 1,
|
|
12378
|
-
Status: "Pending",
|
|
12379
|
-
Priority: "High"
|
|
12380
|
-
}, {
|
|
12381
|
-
FileInstanceId: 1,
|
|
12382
|
-
workflowId: 1,
|
|
12383
|
-
BusinessEntityType: "Application",
|
|
12384
|
-
BusinessEntityId: 5001,
|
|
12385
|
-
HierarchyNodeId: 2,
|
|
12386
|
-
CurrentStepId: 1,
|
|
12387
|
-
CurrentTaskInstanceId: 1,
|
|
12388
|
-
Status: "Pending",
|
|
12389
|
-
Priority: "High"
|
|
12390
|
-
}, {
|
|
12391
|
-
FileInstanceId: 1,
|
|
12392
|
-
workflowId: 1,
|
|
12393
|
-
BusinessEntityType: "Application",
|
|
12394
|
-
BusinessEntityId: 5001,
|
|
12395
|
-
HierarchyNodeId: 2,
|
|
12396
|
-
CurrentStepId: 1,
|
|
12397
|
-
CurrentTaskInstanceId: 1,
|
|
12398
|
-
Status: "Pending",
|
|
12399
|
-
Priority: "High"
|
|
12400
|
-
}, {
|
|
12401
|
-
FileInstanceId: 1,
|
|
12402
|
-
workflowId: 1,
|
|
12403
|
-
BusinessEntityType: "Application",
|
|
12404
|
-
BusinessEntityId: 5001,
|
|
12405
|
-
HierarchyNodeId: 2,
|
|
12406
|
-
CurrentStepId: 1,
|
|
12407
|
-
CurrentTaskInstanceId: 1,
|
|
12408
|
-
Status: "Pending",
|
|
12409
|
-
Priority: "High"
|
|
12410
|
-
}, {
|
|
12411
|
-
FileInstanceId: 1,
|
|
12412
|
-
workflowId: 1,
|
|
12413
|
-
BusinessEntityType: "Application",
|
|
12414
|
-
BusinessEntityId: 5001,
|
|
12415
|
-
HierarchyNodeId: 2,
|
|
12416
|
-
CurrentStepId: 1,
|
|
12417
|
-
CurrentTaskInstanceId: 1,
|
|
12418
|
-
Status: "Pending",
|
|
12419
|
-
Priority: "High"
|
|
12420
|
-
}];
|
|
12462
|
+
var FILE_INSTANCE_ENDPOINTS = {
|
|
12463
|
+
create: "/api/flowcore/FileInstance/Create",
|
|
12464
|
+
update: "/api/flowcore/FileInstance/Update",
|
|
12465
|
+
getById: "/api/flowcore/FileInstance/GetById",
|
|
12466
|
+
getList: "/api/flowcore/FileInstance/GetList"
|
|
12467
|
+
};
|
|
12468
|
+
var getFileInstanceEndpoint = (action) => {
|
|
12469
|
+
var _a, _b, _c, _d;
|
|
12470
|
+
try {
|
|
12471
|
+
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];
|
|
12472
|
+
} catch (e) {
|
|
12473
|
+
return FILE_INSTANCE_ENDPOINTS[action];
|
|
12474
|
+
}
|
|
12475
|
+
};
|
|
12476
|
+
var getFileInstanceByIdEndpoint = (id) => {
|
|
12477
|
+
const endpoint2 = getFileInstanceEndpoint("getById");
|
|
12478
|
+
return typeof endpoint2 === "function" ? endpoint2(id) : `${endpoint2}/${id}`;
|
|
12479
|
+
};
|
|
12480
|
+
var getRows3 = (response) => {
|
|
12481
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
12482
|
+
const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
|
|
12483
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
12484
|
+
};
|
|
12485
|
+
var normalise3 = (item) => {
|
|
12486
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
12487
|
+
return __spreadProps(__spreadValues({}, item), { fileInstanceId: (_b = (_a = item.fileInstanceId) != null ? _a : item.FileInstanceId) != null ? _b : item.id, workflowId: (_d = (_c = item.workflowId) != null ? _c : item.WorkflowId) != null ? _d : "", businessEntityType: (_f = (_e = item.businessEntityType) != null ? _e : item.BusinessEntityType) != null ? _f : "", businessEntityId: (_h = (_g = item.businessEntityId) != null ? _g : item.BusinessEntityId) != null ? _h : "", hierarchyNodeId: (_j = (_i = item.hierarchyNodeId) != null ? _i : item.HierarchyNodeId) != null ? _j : "", currentStepId: (_l = (_k = item.currentStepId) != null ? _k : item.CurrentStepId) != null ? _l : "", currentTaskInstanceId: (_n = (_m = item.currentTaskInstanceId) != null ? _m : item.CurrentTaskInstanceId) != null ? _n : "", status: (_p = (_o = item.status) != null ? _o : item.Status) != null ? _p : "", priority: (_r = (_q = item.priority) != null ? _q : item.Priority) != null ? _r : "", isActive: (_t = (_s = item.isActive) != null ? _s : item.IsActive) != null ? _t : true });
|
|
12488
|
+
};
|
|
12421
12489
|
function FileInstance() {
|
|
12422
|
-
const handleRefresh = () => {
|
|
12423
|
-
console.log("Refresh clicked");
|
|
12424
|
-
};
|
|
12425
|
-
const handleDownload = () => {
|
|
12426
|
-
console.log("Download clicked");
|
|
12427
|
-
};
|
|
12428
12490
|
const tableRef = (0, import_react82.useRef)(null);
|
|
12491
|
+
const [rows, setRows] = (0, import_react82.useState)([]);
|
|
12429
12492
|
const [showModal, setShowModal] = (0, import_react82.useState)(false);
|
|
12493
|
+
const [editingFile, setEditingFile] = (0, import_react82.useState)(null);
|
|
12430
12494
|
const [pageSize, setPageSize] = (0, import_react82.useState)(5);
|
|
12431
|
-
const [
|
|
12432
|
-
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
|
|
12495
|
+
const [search, setSearch] = (0, import_react82.useState)("");
|
|
12496
|
+
const [sortConfig, setSortConfig] = (0, import_react82.useState)({ key: "", direction: "asc" });
|
|
12497
|
+
const [refreshKey, setRefreshKey] = (0, import_react82.useState)(0);
|
|
12498
|
+
(0, import_react82.useEffect)(() => {
|
|
12499
|
+
const load = async () => {
|
|
12500
|
+
var _a, _b;
|
|
12501
|
+
try {
|
|
12502
|
+
const response = await getApiService().get(getFileInstanceEndpoint("getList"));
|
|
12503
|
+
setRows(getRows3(response).map(normalise3));
|
|
12504
|
+
} catch (error) {
|
|
12505
|
+
await import_sweetalert218.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load file instances.", "error");
|
|
12506
|
+
}
|
|
12507
|
+
};
|
|
12508
|
+
load();
|
|
12509
|
+
}, [refreshKey]);
|
|
12510
|
+
const refresh = () => setRefreshKey((value) => value + 1);
|
|
12511
|
+
const saveFile = async (payload, isEdit) => {
|
|
12512
|
+
var _a, _b;
|
|
12513
|
+
try {
|
|
12514
|
+
const endpoint2 = getFileInstanceEndpoint(isEdit ? "update" : "create");
|
|
12515
|
+
await getApiService()[isEdit ? "put" : "post"](endpoint2, payload);
|
|
12516
|
+
await import_sweetalert218.default.fire("Success", `File instance ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
12517
|
+
refresh();
|
|
12518
|
+
return true;
|
|
12519
|
+
} catch (error) {
|
|
12520
|
+
await import_sweetalert218.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} file instance.`, "error");
|
|
12521
|
+
return false;
|
|
12439
12522
|
}
|
|
12440
|
-
setSortConfig({
|
|
12441
|
-
key,
|
|
12442
|
-
direction
|
|
12443
|
-
});
|
|
12444
12523
|
};
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
|
|
12452
|
-
|
|
12453
|
-
|
|
12454
|
-
|
|
12455
|
-
|
|
12456
|
-
|
|
12457
|
-
|
|
12458
|
-
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12524
|
+
const editFile = async (file) => {
|
|
12525
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12526
|
+
try {
|
|
12527
|
+
const response = await getApiService().get(getFileInstanceByIdEndpoint(file.fileInstanceId));
|
|
12528
|
+
const data = (_f = (_e = (_d = (_b = getRows3(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
|
|
12529
|
+
setEditingFile(normalise3(data));
|
|
12530
|
+
setShowModal(true);
|
|
12531
|
+
} catch (error) {
|
|
12532
|
+
await import_sweetalert218.default.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load file instance details.", "error");
|
|
12533
|
+
}
|
|
12534
|
+
};
|
|
12535
|
+
const columns = [["FileInstanceId", "fileInstanceId"], ["WorkflowId", "workflowId"], ["BusinessEntityType", "businessEntityType"], ["BusinessEntityId", "businessEntityId"], ["HierarchyNodeId", "hierarchyNodeId"], ["CurrentStepId", "currentStepId"], ["CurrentTaskInstanceId", "currentTaskInstanceId"], ["Status", "status"], ["Priority", "priority"]];
|
|
12536
|
+
const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
|
|
12537
|
+
const visibleRows = rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
|
|
12538
|
+
var _a, _b;
|
|
12539
|
+
if (!sortConfig.key) return 0;
|
|
12540
|
+
const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
|
|
12541
|
+
return sortConfig.direction === "asc" ? result : -result;
|
|
12542
|
+
});
|
|
12543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
|
|
12544
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(CommonHeader, { title: "File Instance", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Runtime", href: "/Sidebar" }, { label: "File Instance", href: "/FileInstance" }], buttonText: "Add File Instance", onButtonClick: () => {
|
|
12545
|
+
setEditingFile(null);
|
|
12546
|
+
setShowModal(true);
|
|
12547
|
+
} }),
|
|
12548
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
|
|
12549
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
|
|
12550
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("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" }),
|
|
12551
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
|
|
12552
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Refresh_default, { onRefresh: refresh }),
|
|
12553
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Download_default, { targetRef: tableRef, fileName: "file-instance" }),
|
|
12554
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("select", { value: pageSize, onChange: (event) => setPageSize(Number(event.target.value)), className: "fc:px-4 fc:py-2 fc:rounded-xl fc:border fc:border-slate-200", children: [
|
|
12555
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("option", { value: 5, children: "5 Rows" }),
|
|
12556
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("option", { value: 10, children: "10 Rows" }),
|
|
12557
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("option", { value: 25, children: "25 Rows" })
|
|
12471
12558
|
] })
|
|
12472
|
-
] })
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
key: "
|
|
12480
|
-
},
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
}, {
|
|
12490
|
-
label: "CurrentStepId",
|
|
12491
|
-
key: "CurrentStepId"
|
|
12492
|
-
}, {
|
|
12493
|
-
label: "CurrentTaskInstanceId",
|
|
12494
|
-
key: "CurrentTaskInstanceId"
|
|
12495
|
-
}, {
|
|
12496
|
-
label: "Status",
|
|
12497
|
-
key: "Status"
|
|
12498
|
-
}, {
|
|
12499
|
-
label: "Priority",
|
|
12500
|
-
key: "Priority"
|
|
12501
|
-
}].map((column) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("th", { onClick: () => handleSort(column.key), className: "fc:px-6 fc:py-4 fc:text-left fc:text-xs fc:font-bold fc:text-slate-500 fc:uppercase fc:tracking-wider fc:cursor-pointer fc:select-none hover:fc:fc:bg-slate-100 fc:transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
12502
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: column.label }),
|
|
12503
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "fc:text-gray-400 fc:text-xs", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
|
|
12504
|
-
] }) }, column.key)) }) }),
|
|
12505
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("tbody", { children: FileInstances.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
|
|
12506
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("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 }),
|
|
12507
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
|
|
12508
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("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 }),
|
|
12509
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px fc:text-slate-600 fc:font-bold", children: item.BusinessEntityId }),
|
|
12510
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.HierarchyNodeId }),
|
|
12511
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.CurrentStepId }),
|
|
12512
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.CurrentTaskInstanceId }),
|
|
12513
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:border-b fc:border-slate-100", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
12514
|
-
"span",
|
|
12515
|
-
{
|
|
12516
|
-
className: `fc:inline-flex fc:items-center fc:rounded-full fc:px-3 fc:py-1 fc:text-xs fc:font-semibold
|
|
12517
|
-
${item.Status === "Approved" ? "fc:bg-green-100 fc:text-green-700" : "fc:bg-red-100 fc:text-red-700"}`,
|
|
12518
|
-
children: item.Status
|
|
12519
|
-
}
|
|
12520
|
-
) }),
|
|
12521
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:border-b fc:border-slate-100", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
12522
|
-
"span",
|
|
12523
|
-
{
|
|
12524
|
-
className: `fc:inline-flex fc:items-center fc:rounded-full fc:px-3 fc:py-1 fc:text-xs fc:font-semibold
|
|
12525
|
-
${item.Priority === "High" ? "fc:bg-green-100 fc:text-green-700" : "fc:bg-red-100 fc:text-red-700"}`,
|
|
12526
|
-
children: item.Priority
|
|
12527
|
-
}
|
|
12528
|
-
) })
|
|
12529
|
-
] }, item.TransitionId)) })
|
|
12530
|
-
] }) }) }),
|
|
12531
|
-
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Footer, {}) })
|
|
12532
|
-
] })
|
|
12559
|
+
] })
|
|
12560
|
+
] }),
|
|
12561
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("table", { className: "fc:min-w-max fc:w-full", children: [
|
|
12562
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("tr", { children: [
|
|
12563
|
+
columns.map(([label, key]) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
|
|
12564
|
+
label,
|
|
12565
|
+
" ",
|
|
12566
|
+
sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
|
|
12567
|
+
] }, key)),
|
|
12568
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
|
|
12569
|
+
] }) }),
|
|
12570
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("tr", { className: "fc:border-t fc:border-slate-100", children: [
|
|
12571
|
+
columns.map(([, key]) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item[key] }, key)),
|
|
12572
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("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" }) })
|
|
12573
|
+
] }, item.fileInstanceId)) })
|
|
12574
|
+
] }) }),
|
|
12575
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Footer, {})
|
|
12533
12576
|
] }),
|
|
12534
|
-
showModal && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(AddFileInstanceModal, { onClose: () =>
|
|
12577
|
+
showModal && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(AddFileInstanceModal, { editData: editingFile, onClose: () => {
|
|
12578
|
+
setShowModal(false);
|
|
12579
|
+
setEditingFile(null);
|
|
12580
|
+
}, onSave: saveFile })
|
|
12535
12581
|
] });
|
|
12536
12582
|
}
|
|
12537
12583
|
|
|
12538
12584
|
// src/components/assignment-rule/AssignmentRuleMain.jsx
|
|
12539
12585
|
var import_react86 = __toESM(require("react"));
|
|
12586
|
+
var import_sweetalert219 = __toESM(require("sweetalert2"));
|
|
12540
12587
|
|
|
12541
12588
|
// src/components/assignment-rule/SearchBar.js
|
|
12542
12589
|
var import_react83 = __toESM(require("react"));
|
|
@@ -12561,457 +12608,333 @@ function SearchBar12({
|
|
|
12561
12608
|
// src/components/assignment-rule/Table.js
|
|
12562
12609
|
var import_react84 = __toESM(require("react"));
|
|
12563
12610
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
12564
|
-
function Table4({
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
currentPage,
|
|
12568
|
-
setCurrentPage,
|
|
12569
|
-
setTotalEntries
|
|
12570
|
-
}) {
|
|
12571
|
-
const initialData = [{
|
|
12572
|
-
id: 1,
|
|
12573
|
-
workflowStepId: "1",
|
|
12574
|
-
assignmentType: "Hierarchy",
|
|
12575
|
-
hierarchyNodeType: "Block",
|
|
12576
|
-
dynamicFunctionId: "N/A",
|
|
12577
|
-
isPoolEnabled: true
|
|
12578
|
-
}, {
|
|
12579
|
-
id: 2,
|
|
12580
|
-
workflowStepId: "2",
|
|
12581
|
-
assignmentType: "Dynamic",
|
|
12582
|
-
hierarchyNodeType: "District",
|
|
12583
|
-
dynamicFunctionId: "1",
|
|
12584
|
-
isPoolEnabled: false
|
|
12585
|
-
}, {
|
|
12586
|
-
id: 3,
|
|
12587
|
-
workflowStepId: "3",
|
|
12588
|
-
assignmentType: "Hierarchy",
|
|
12589
|
-
hierarchyNodeType: "District",
|
|
12590
|
-
dynamicFunctionId: "N/A",
|
|
12591
|
-
isPoolEnabled: true
|
|
12592
|
-
}, {
|
|
12593
|
-
id: 4,
|
|
12594
|
-
workflowStepId: "4",
|
|
12595
|
-
assignmentType: "Dynamic",
|
|
12596
|
-
hierarchyNodeType: "Block",
|
|
12597
|
-
dynamicFunctionId: "2",
|
|
12598
|
-
isPoolEnabled: false
|
|
12599
|
-
}, {
|
|
12600
|
-
id: 5,
|
|
12601
|
-
workflowStepId: "5",
|
|
12602
|
-
assignmentType: "Hierarchy",
|
|
12603
|
-
hierarchyNodeType: "Block",
|
|
12604
|
-
dynamicFunctionId: "N/A",
|
|
12605
|
-
isPoolEnabled: true
|
|
12606
|
-
}, {
|
|
12607
|
-
id: 6,
|
|
12608
|
-
workflowStepId: "6",
|
|
12609
|
-
assignmentType: "Dynamic",
|
|
12610
|
-
hierarchyNodeType: "District",
|
|
12611
|
-
dynamicFunctionId: "4",
|
|
12612
|
-
isPoolEnabled: true
|
|
12613
|
-
}, {
|
|
12614
|
-
id: 7,
|
|
12615
|
-
workflowStepId: "7",
|
|
12616
|
-
assignmentType: "Dynamic",
|
|
12617
|
-
hierarchyNodeType: "District",
|
|
12618
|
-
dynamicFunctionId: "4",
|
|
12619
|
-
isPoolEnabled: true
|
|
12620
|
-
}, {
|
|
12621
|
-
id: 8,
|
|
12622
|
-
workflowStepId: "8",
|
|
12623
|
-
assignmentType: "Dynamic",
|
|
12624
|
-
hierarchyNodeType: "District",
|
|
12625
|
-
dynamicFunctionId: "4",
|
|
12626
|
-
isPoolEnabled: true
|
|
12627
|
-
}, {
|
|
12628
|
-
id: 9,
|
|
12629
|
-
workflowStepId: "9",
|
|
12630
|
-
assignmentType: "Dynamic",
|
|
12631
|
-
hierarchyNodeType: "District",
|
|
12632
|
-
dynamicFunctionId: "4",
|
|
12633
|
-
isPoolEnabled: true
|
|
12634
|
-
}, {
|
|
12635
|
-
id: 10,
|
|
12636
|
-
workflowStepId: "10",
|
|
12637
|
-
assignmentType: "Hierarchy",
|
|
12638
|
-
hierarchyNodeType: "District",
|
|
12639
|
-
dynamicFunctionId: "4",
|
|
12640
|
-
isPoolEnabled: true
|
|
12641
|
-
}, {
|
|
12642
|
-
id: 11,
|
|
12643
|
-
workflowStepId: "11",
|
|
12644
|
-
assignmentType: "Dynamic",
|
|
12645
|
-
hierarchyNodeType: "District",
|
|
12646
|
-
dynamicFunctionId: "4",
|
|
12647
|
-
isPoolEnabled: true
|
|
12648
|
-
}, {
|
|
12649
|
-
id: 12,
|
|
12650
|
-
workflowStepId: "12",
|
|
12651
|
-
assignmentType: "Dynamic",
|
|
12652
|
-
hierarchyNodeType: "District",
|
|
12653
|
-
dynamicFunctionId: "4",
|
|
12654
|
-
isPoolEnabled: true
|
|
12655
|
-
}, {
|
|
12656
|
-
id: 13,
|
|
12657
|
-
workflowStepId: "13",
|
|
12658
|
-
assignmentType: "Dynamic",
|
|
12659
|
-
hierarchyNodeType: "District",
|
|
12660
|
-
dynamicFunctionId: "4",
|
|
12661
|
-
isPoolEnabled: true
|
|
12662
|
-
}, {
|
|
12663
|
-
id: 14,
|
|
12664
|
-
workflowStepId: "14",
|
|
12665
|
-
assignmentType: "Dynamic",
|
|
12666
|
-
hierarchyNodeType: "District",
|
|
12667
|
-
dynamicFunctionId: "4",
|
|
12668
|
-
isPoolEnabled: true
|
|
12669
|
-
}];
|
|
12670
|
-
const [data, setData] = (0, import_react84.useState)(initialData);
|
|
12671
|
-
const [sortOrder, setSortOrder] = (0, import_react84.useState)("asc");
|
|
12672
|
-
const [sortKey, setSortKey] = (0, import_react84.useState)("workflowStepId");
|
|
12673
|
-
const [selectedItem, setSelectedItem] = (0, import_react84.useState)(null);
|
|
12674
|
-
const [isEditModalOpen, setIsEditModalOpen] = (0, import_react84.useState)(false);
|
|
12675
|
-
const [isDeleteModalOpen, setIsDeleteModalOpen] = (0, import_react84.useState)(false);
|
|
12676
|
-
const handleEdit = (item) => {
|
|
12677
|
-
setSelectedItem(item);
|
|
12678
|
-
setIsEditModalOpen(true);
|
|
12679
|
-
};
|
|
12680
|
-
const handleDelete = (item) => {
|
|
12681
|
-
setSelectedItem(item);
|
|
12682
|
-
setIsDeleteModalOpen(true);
|
|
12683
|
-
};
|
|
12684
|
-
const confirmDelete = () => {
|
|
12685
|
-
if (selectedItem) {
|
|
12686
|
-
setData((prevData) => prevData.filter((item) => item.id !== selectedItem.id));
|
|
12687
|
-
}
|
|
12688
|
-
setIsDeleteModalOpen(false);
|
|
12689
|
-
setSelectedItem(null);
|
|
12690
|
-
};
|
|
12691
|
-
const handleSaveEdit = (e) => {
|
|
12692
|
-
e.preventDefault();
|
|
12693
|
-
const formData = new FormData(e.target);
|
|
12694
|
-
const updatedAssignmentType = formData.get("assignmentType");
|
|
12695
|
-
const updatedNodeType = formData.get("nodeType");
|
|
12696
|
-
const updatedDynamicFunctionId = formData.get("dynamicFunctionId");
|
|
12697
|
-
setData((prevData) => prevData.map((item) => item.id === selectedItem.id ? __spreadProps(__spreadValues({}, item), {
|
|
12698
|
-
assignmentType: updatedAssignmentType,
|
|
12699
|
-
nodeType: updatedNodeType,
|
|
12700
|
-
dynamicFunctionId: updatedDynamicFunctionId
|
|
12701
|
-
}) : item));
|
|
12702
|
-
setIsEditModalOpen(false);
|
|
12703
|
-
setSelectedItem(null);
|
|
12704
|
-
};
|
|
12705
|
-
const handleSort = (columnKey) => {
|
|
12706
|
-
const isAsc = sortKey === columnKey && sortOrder === "asc";
|
|
12707
|
-
setSortOrder(isAsc ? "desc" : "asc");
|
|
12708
|
-
setSortKey(columnKey);
|
|
12709
|
-
const sortedData = [...data].sort((a, b) => {
|
|
12710
|
-
let valA = a[columnKey];
|
|
12711
|
-
let valB = b[columnKey];
|
|
12712
|
-
if (typeof valA === "number" && typeof valB === "number") {
|
|
12713
|
-
return isAsc ? valA - valB : valB - valA;
|
|
12714
|
-
}
|
|
12715
|
-
valA = valA ? valA.toString().toLowerCase() : "";
|
|
12716
|
-
valB = valB ? valB.toString().toLowerCase() : "";
|
|
12717
|
-
if (valA < valB) return isAsc ? -1 : 1;
|
|
12718
|
-
if (valA > valB) return isAsc ? 1 : -1;
|
|
12719
|
-
return 0;
|
|
12720
|
-
});
|
|
12721
|
-
setData(sortedData);
|
|
12722
|
-
};
|
|
12723
|
-
const filteredData = data.filter((item) => {
|
|
12724
|
-
if (!searchQuery || searchQuery.trim() === "") return true;
|
|
12725
|
-
const query = searchQuery.toLowerCase().trim();
|
|
12726
|
-
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);
|
|
12727
|
-
});
|
|
12611
|
+
function Table4({ pageSize, searchQuery = "", currentPage, setCurrentPage, setTotalEntries, rows = [], loading, onEdit, onDelete }) {
|
|
12612
|
+
const [sort, setSort] = (0, import_react84.useState)({ key: "workflowStepId", direction: "asc" });
|
|
12613
|
+
const filteredRows = (0, import_react84.useMemo)(() => rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(searchQuery.toLowerCase().trim())), [rows, searchQuery]);
|
|
12728
12614
|
(0, import_react84.useEffect)(() => {
|
|
12729
|
-
|
|
12730
|
-
|
|
12731
|
-
|
|
12732
|
-
const
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
}
|
|
12737
|
-
const
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
|
|
12746
|
-
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
|
|
12750
|
-
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("th", { onClick: () => handleSort("hierarchyNodeType"), className: "fc:py-4 fc:px-5 fc:text-s fc:cursor-pointer fc:select-none fc:bg-slate-50 fc:whitespace-nowrap", children: [
|
|
12755
|
-
"NODE TYPE ",
|
|
12756
|
-
sortKey === "hierarchyNodeType" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
12757
|
-
] }),
|
|
12758
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("th", { onClick: () => handleSort("dynamicFunctionId"), className: "fc:py-4 fc:px-5 fc:text-s fc:cursor-pointer fc:select-none fc:bg-slate-50 fc:whitespace-nowrap fc:text-center", children: [
|
|
12759
|
-
"DYNAMIC FUNCTION ID ",
|
|
12760
|
-
sortKey === "dynamicFunctionId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
12761
|
-
] }),
|
|
12762
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "POOL ENABLED" }),
|
|
12763
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:py-4 fc:px-5 fc:text-s fc:bg-slate-50 fc:text-center fc:whitespace-nowrap", children: "ACTION" })
|
|
12615
|
+
setTotalEntries == null ? void 0 : setTotalEntries(filteredRows.length);
|
|
12616
|
+
if (currentPage > Math.max(1, Math.ceil(filteredRows.length / pageSize))) setCurrentPage(1);
|
|
12617
|
+
}, [filteredRows.length, pageSize, currentPage, setCurrentPage, setTotalEntries]);
|
|
12618
|
+
const sortedRows = [...filteredRows].sort((a, b) => {
|
|
12619
|
+
var _a, _b;
|
|
12620
|
+
const result = String((_a = a[sort.key]) != null ? _a : "").localeCompare(String((_b = b[sort.key]) != null ? _b : ""), void 0, { numeric: true });
|
|
12621
|
+
return sort.direction === "asc" ? result : -result;
|
|
12622
|
+
});
|
|
12623
|
+
const totalPages = Math.max(1, Math.ceil(sortedRows.length / pageSize));
|
|
12624
|
+
const visibleRows = sortedRows.slice((currentPage - 1) * pageSize, currentPage * pageSize);
|
|
12625
|
+
const sortBy = (key) => setSort((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
|
|
12626
|
+
const heading = (label, key) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("th", { onClick: () => sortBy(key), className: "fc:cursor-pointer fc:whitespace-nowrap fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-left fc:text-xs", children: [
|
|
12627
|
+
label,
|
|
12628
|
+
" ",
|
|
12629
|
+
sort.key === key ? sort.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
|
|
12630
|
+
] });
|
|
12631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:space-y-4", children: [
|
|
12632
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "fc:max-h-[420px] fc:overflow-auto fc:rounded-2xl fc:border fc:border-slate-200", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("table", { className: "fc:w-full fc:bg-white fc:text-left", children: [
|
|
12633
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("thead", { className: "fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tr", { children: [
|
|
12634
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:bg-slate-50 fc:px-4 fc:py-4 fc:text-xs", children: "S.NO" }),
|
|
12635
|
+
heading("WORKFLOW STEP ID", "workflowStepId"),
|
|
12636
|
+
heading("ASSIGNMENT TYPE", "assignmentType"),
|
|
12637
|
+
heading("NODE TYPE", "hierarchyNodeType"),
|
|
12638
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-xs", children: "POOL ENABLED" }),
|
|
12639
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("th", { className: "fc:bg-slate-50 fc:px-5 fc:py-4 fc:text-xs", children: "ACTION" })
|
|
12764
12640
|
] }) }),
|
|
12765
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.
|
|
12766
|
-
|
|
12767
|
-
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("
|
|
12773
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("
|
|
12774
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-800 fc:font-medium fc:text-center fc:whitespace-nowrap", children: item.dynamicFunctionId === "N/A" ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "fc:text-slate-400 fc:font-normal", children: "N/A" }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "fc:bg-slate-100 fc:text-slate-700 fc:px-2 fc:py-0.5 fc:rounded fc:text-xs", children: [
|
|
12775
|
-
"FN-",
|
|
12776
|
-
item.dynamicFunctionId
|
|
12777
|
-
] }) }),
|
|
12778
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12779
|
-
"button",
|
|
12780
|
-
{
|
|
12781
|
-
type: "button",
|
|
12782
|
-
onClick: () => toggleStatus(item.id),
|
|
12783
|
-
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"}`,
|
|
12784
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
12785
|
-
"span",
|
|
12786
|
-
{
|
|
12787
|
-
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"}`
|
|
12788
|
-
}
|
|
12789
|
-
)
|
|
12790
|
-
}
|
|
12791
|
-
) }),
|
|
12792
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
12793
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", onClick: () => handleEdit(item), className: "fc:px-3.5 fc:py-1 fc:text-xs fc:font-bold fc:text-blue-600 fc:bg-blue-50 hover:fc:fc:bg-blue-100 fc:rounded-full fc:transition-colors", children: "Edit" }),
|
|
12794
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", onClick: () => handleDelete(item), className: "fc:px-3.5 fc:py-1 fc:text-xs fc:font-bold fc:text-rose-600 fc:bg-rose-50 hover:fc:fc:bg-rose-100 fc:rounded-full fc:transition-colors", children: "Delete" })
|
|
12795
|
-
] }) })
|
|
12796
|
-
] }, item.id)),
|
|
12797
|
-
visibleData.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { colSpan: "6", className: "fc:py-8 fc:text-center fc:text-slate-400 fc:text-xs fc:font-medium fc:bg-slate-50/30", children: "No matching assignment rules found." }) })
|
|
12798
|
-
] })
|
|
12799
|
-
] }) }),
|
|
12800
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
|
|
12801
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)), disabled: currentPage === 1, className: "fc:px-2.5 fc:py-1 fc:text-slate-500 hover:fc:fc:text-slate-900 fc:mr-2 disabled:fc:fc:opacity-40", children: "\u2039 Prev" }),
|
|
12802
|
-
pageNumbers.map((pageNumber) => /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { onClick: () => setCurrentPage(pageNumber), className: `fc:px-3 fc:py-1 fc:text-center fc:rounded fc:transition-all fc:min-w-[28px]${currentPage === pageNumber ? "bg-blue-600 text-white font-medium shadow-sm" : "text-slate-600 hover:bg-slate-100"}`, children: pageNumber }, pageNumber)),
|
|
12803
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)), disabled: currentPage === totalPages, className: "fc:px-2.5 fc:py-1 fc:text-slate-500 hover:fc:fc:text-slate-900 fc:ml-2 disabled:fc:fc:opacity-40", children: "Next \u203A" })
|
|
12804
|
-
] }),
|
|
12805
|
-
isEditModalOpen && selectedItem && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/40 fc:backdrop-blur-sm", children: /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:bg-white fc:rounded-2xl fc:p-6 fc:w-full fc:max-w-md fc:shadow-2xl fc:transition-all", children: [
|
|
12806
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("h3", { className: "fc:text-lg fc:font-bold fc:text-slate-800 fc:mb-4", children: "Edit Workflow Step" }),
|
|
12807
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("form", { onSubmit: handleSaveEdit, className: "fc:space-y-4", children: [
|
|
12808
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
|
|
12809
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Workflow Step ID" }),
|
|
12810
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("input", { type: "text", value: selectedItem.workflowStepId || `STEP-${selectedItem.id}`, disabled: true, className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:bg-slate-100 fc:font-medium fc:text-slate-500 fc:cursor-not-allowed" })
|
|
12811
|
-
] }),
|
|
12812
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
|
|
12813
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Assignment Type" }),
|
|
12814
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("select", { name: "assignmentType", defaultValue: selectedItem.assignmentType || "Hierarchy", className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:outline-none focus:fc:fc:border-blue-500 fc:bg-white fc:font-medium fc:text-slate-700", children: [
|
|
12815
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "Hierarchy", children: "Hierarchy" }),
|
|
12816
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "Dynamic", children: "Dynamic" })
|
|
12817
|
-
] })
|
|
12818
|
-
] }),
|
|
12819
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
|
|
12820
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Node Type" }),
|
|
12821
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("select", { name: "nodeType", defaultValue: selectedItem.nodeType || "Block", className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:outline-none focus:fc:fc:border-blue-500 fc:bg-white fc:font-medium fc:text-slate-700", children: [
|
|
12822
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "Block", children: "Block" }),
|
|
12823
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "District", children: "District" }),
|
|
12824
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("option", { value: "State", children: "State" })
|
|
12825
|
-
] })
|
|
12826
|
-
] }),
|
|
12827
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { children: [
|
|
12828
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("label", { className: "fc:text-xs fc:font-medium fc:text-slate-500 fc:uppercase", children: "Dynamic Function ID" }),
|
|
12829
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("input", { type: "text", name: "dynamicFunctionId", defaultValue: selectedItem.dynamicFunctionId || "N/A", placeholder: "e.g. FN-1 or N/A", required: true, className: "fc:w-full fc:mt-1 fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-lg fc:text-sm fc:outline-none focus:fc:fc:border-blue-500 fc:font-medium fc:text-slate-700" })
|
|
12830
|
-
] }),
|
|
12831
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-3 fc:mt-6", children: [
|
|
12832
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", onClick: () => setIsEditModalOpen(false), className: "fc:px-4 fc:py-2 fc:text-xs fc:font-medium fc:text-slate-600 hover:fc:fc:bg-slate-100 fc:rounded-lg fc:transition", children: "Cancel" }),
|
|
12833
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "submit", className: "fc:px-4 fc:py-2 fc:text-xs fc:font-medium fc:text-white fc:bg-blue-600 hover:fc:fc:bg-blue-700 fc:rounded-lg fc:transition fc:shadow-sm", children: "Save Changes" })
|
|
12641
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tbody", { children: loading ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { colSpan: "6", className: "fc:p-8 fc:text-center fc:text-sm fc:text-slate-500", children: "Loading assignment rules..." }) }) : visibleRows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { colSpan: "6", className: "fc:p-8 fc:text-center fc:text-sm fc:text-slate-400", children: "No assignment rules found." }) }) : visibleRows.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("tr", { className: "fc:border-t fc:border-slate-100", children: [
|
|
12642
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-4 fc:py-4 fc:text-center fc:text-sm", children: (currentPage - 1) * pageSize + index + 1 }),
|
|
12643
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.workflowStepId }),
|
|
12644
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.assignmentType }),
|
|
12645
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.hierarchyNodeType }),
|
|
12646
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: item.isPoolEnabled ? "Yes" : "No" }),
|
|
12647
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("td", { className: "fc:px-5 fc:py-4 fc:text-sm", children: [
|
|
12648
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", onClick: () => onEdit(item), className: "fc:mr-2 fc:rounded-lg fc:bg-blue-50 fc:px-3 fc:py-1 fc:text-blue-600", children: "Edit" }),
|
|
12649
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", onClick: () => onDelete(item), className: "fc:rounded-lg fc:bg-rose-50 fc:px-3 fc:py-1 fc:text-rose-600", children: "Delete" })
|
|
12834
12650
|
] })
|
|
12835
|
-
] })
|
|
12651
|
+
] }, item.assignmentRuleId)) })
|
|
12836
12652
|
] }) }),
|
|
12837
|
-
|
|
12838
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("
|
|
12839
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.
|
|
12840
|
-
|
|
12841
|
-
"
|
|
12842
|
-
|
|
12843
|
-
"?"
|
|
12653
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-2 fc:text-sm", children: [
|
|
12654
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", disabled: currentPage === 1, onClick: () => setCurrentPage((page) => Math.max(1, page - 1)), className: "fc:px-3 fc:py-1 disabled:fc:opacity-40", children: "Prev" }),
|
|
12655
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("span", { className: "fc:px-2 fc:py-1", children: [
|
|
12656
|
+
currentPage,
|
|
12657
|
+
" / ",
|
|
12658
|
+
totalPages
|
|
12844
12659
|
] }),
|
|
12845
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.
|
|
12846
|
-
|
|
12847
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", onClick: confirmDelete, className: "fc:px-4 fc:py-2 fc:text-xs fc:font-semibold fc:text-white fc:bg-rose-600 hover:fc:fc:bg-rose-700 fc:rounded-lg fc:transition fc:shadow-sm", children: "Delete" })
|
|
12848
|
-
] })
|
|
12849
|
-
] }) })
|
|
12660
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("button", { type: "button", disabled: currentPage === totalPages, onClick: () => setCurrentPage((page) => Math.min(totalPages, page + 1)), className: "fc:px-3 fc:py-1 disabled:fc:opacity-40", children: "Next" })
|
|
12661
|
+
] })
|
|
12850
12662
|
] });
|
|
12851
12663
|
}
|
|
12852
12664
|
|
|
12853
12665
|
// src/components/assignment-rule/Popup.js
|
|
12854
12666
|
var import_react85 = __toESM(require("react"));
|
|
12667
|
+
init_ApiEndpointsProvider();
|
|
12668
|
+
init_ApiServicepackage();
|
|
12855
12669
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
12670
|
+
var rowsFrom2 = (response) => {
|
|
12671
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12672
|
+
const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
|
|
12673
|
+
const rows = Array.isArray(value) ? value : (_i = (_h = (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : value == null ? void 0 : value.data) != null ? _h : value == null ? void 0 : value.result) != null ? _i : [];
|
|
12674
|
+
return Array.isArray(rows) ? rows : [];
|
|
12675
|
+
};
|
|
12676
|
+
var formFrom = (item) => {
|
|
12677
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12678
|
+
return {
|
|
12679
|
+
workflowStepId: String((_b = (_a = item == null ? void 0 : item.workflowStepId) != null ? _a : item == null ? void 0 : item.WorkflowStepId) != null ? _b : ""),
|
|
12680
|
+
assignmentType: (_d = (_c = item == null ? void 0 : item.assignmentType) != null ? _c : item == null ? void 0 : item.AssignmentType) != null ? _d : "",
|
|
12681
|
+
hierarchyNodeType: (_f = (_e = item == null ? void 0 : item.hierarchyNodeType) != null ? _e : item == null ? void 0 : item.HierarchyNodeType) != null ? _f : "",
|
|
12682
|
+
isPoolEnabled: Boolean((_h = (_g = item == null ? void 0 : item.isPoolEnabled) != null ? _g : item == null ? void 0 : item.IsPoolEnabled) != null ? _h : false)
|
|
12683
|
+
};
|
|
12684
|
+
};
|
|
12685
|
+
function Popup4({ isOpen, onClose, onSave, editData }) {
|
|
12686
|
+
const [formData, setFormData] = (0, import_react85.useState)(() => formFrom(editData));
|
|
12687
|
+
const [workflowSteps, setWorkflowSteps] = (0, import_react85.useState)([]);
|
|
12688
|
+
const [loadingSteps, setLoadingSteps] = (0, import_react85.useState)(false);
|
|
12689
|
+
const [error, setError] = (0, import_react85.useState)("");
|
|
12690
|
+
const [saving, setSaving] = (0, import_react85.useState)(false);
|
|
12691
|
+
(0, import_react85.useEffect)(() => {
|
|
12692
|
+
if (!isOpen) return;
|
|
12693
|
+
setFormData(formFrom(editData));
|
|
12694
|
+
setError("");
|
|
12695
|
+
let active = true;
|
|
12696
|
+
(async () => {
|
|
12697
|
+
var _a, _b, _c, _d, _e;
|
|
12698
|
+
try {
|
|
12699
|
+
setLoadingSteps(true);
|
|
12700
|
+
const endpoint2 = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
12701
|
+
if (!endpoint2) throw new Error("Workflow step list endpoint is not configured.");
|
|
12702
|
+
const result = await getApiService().get(endpoint2);
|
|
12703
|
+
if (active) setWorkflowSteps(rowsFrom2(result));
|
|
12704
|
+
} catch (requestError) {
|
|
12705
|
+
if (active) setError(((_e = (_d = requestError == null ? void 0 : requestError.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (requestError == null ? void 0 : requestError.message) || "Unable to load workflow steps.");
|
|
12706
|
+
} finally {
|
|
12707
|
+
if (active) setLoadingSteps(false);
|
|
12708
|
+
}
|
|
12709
|
+
})();
|
|
12710
|
+
return () => {
|
|
12711
|
+
active = false;
|
|
12712
|
+
};
|
|
12713
|
+
}, [isOpen, editData]);
|
|
12861
12714
|
if (!isOpen) return null;
|
|
12862
|
-
const
|
|
12863
|
-
const
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
e.preventDefault();
|
|
12869
|
-
if (!workflowStepId || !assignmentType || !hierarchyNodeType) {
|
|
12870
|
-
alert("Please fill out all required fields!");
|
|
12715
|
+
const change = (field, value) => setFormData((current) => __spreadProps(__spreadValues({}, current), { [field]: value }));
|
|
12716
|
+
const submit = async (event) => {
|
|
12717
|
+
var _a, _b;
|
|
12718
|
+
event.preventDefault();
|
|
12719
|
+
if (!formData.workflowStepId || !formData.assignmentType || !formData.hierarchyNodeType) {
|
|
12720
|
+
setError("Please fill all required fields.");
|
|
12871
12721
|
return;
|
|
12872
12722
|
}
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12878
|
-
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
setAssignmentType("");
|
|
12882
|
-
setHierarchyNodeType("");
|
|
12883
|
-
setDynamicFunctionId("");
|
|
12884
|
-
setIsPoolEnabled(false);
|
|
12885
|
-
onClose();
|
|
12723
|
+
const isEdit = Boolean(editData);
|
|
12724
|
+
const payload = isEdit ? { assignmentRuleId: (_b = (_a = editData.assignmentRuleId) != null ? _a : editData.AssignmentRuleId) != null ? _b : editData.id, workflowStepId: Number(formData.workflowStepId), assignmentType: formData.assignmentType, hierarchyNodeType: formData.hierarchyNodeType, isPoolEnabled: Boolean(formData.isPoolEnabled) } : { workflowStepId: Number(formData.workflowStepId), assignmentType: formData.assignmentType, hierarchyNodeType: formData.hierarchyNodeType, isPoolEnabled: Boolean(formData.isPoolEnabled) };
|
|
12725
|
+
setSaving(true);
|
|
12726
|
+
try {
|
|
12727
|
+
if (await onSave(payload, isEdit)) onClose();
|
|
12728
|
+
} finally {
|
|
12729
|
+
setSaving(false);
|
|
12730
|
+
}
|
|
12886
12731
|
};
|
|
12887
12732
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
|
|
12888
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm
|
|
12889
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("
|
|
12890
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:
|
|
12891
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", {
|
|
12892
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("
|
|
12893
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.
|
|
12894
|
-
|
|
12895
|
-
|
|
12733
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "fc:fixed fc:inset-0 fc:bg-slate-900/50 fc:backdrop-blur-sm", onClick: onClose }),
|
|
12734
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("form", { onSubmit: submit, className: "fc:relative fc:z-10 fc:w-full fc:max-w-2xl fc:overflow-hidden fc:rounded-3xl fc:bg-white fc:shadow-2xl", children: [
|
|
12735
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-between fc:border-b fc:border-slate-100 fc:px-8 fc:py-5", children: [
|
|
12736
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
12737
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("h2", { className: "fc:text-lg fc:font-extrabold fc:text-slate-800", children: editData ? "Edit Assignment Rule" : "Add Assignment Rule" }),
|
|
12738
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:text-[10px] fc:text-slate-400", children: "Configure core task routing constraints" })
|
|
12739
|
+
] }),
|
|
12740
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onClose, className: "fc:text-slate-400 fc:text-sm fc:font-semibold", children: "\u2715" })
|
|
12741
|
+
] }),
|
|
12742
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:space-y-4 fc:bg-slate-50/30 fc:p-6", children: [
|
|
12743
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
|
|
12744
|
+
"Workflow Step ID *",
|
|
12745
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("select", { required: true, disabled: loadingSteps, value: formData.workflowStepId, onChange: (event) => change("workflowStepId", event.target.value), className: "fc:mt-1 fc:w-full fc:rounded-xl fc:border fc:border-slate-200 fc:bg-white fc:p-2.5 fc:text-xs", children: [
|
|
12746
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: loadingSteps ? "Loading workflow steps..." : "Select Workflow Step" }),
|
|
12747
|
+
workflowSteps.map((step) => {
|
|
12748
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12749
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
12750
|
+
const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.stepCode) != null ? _e : step.StepCode) != null ? _f : `Step ${id}`;
|
|
12751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("option", { value: String(id), children: [
|
|
12752
|
+
id,
|
|
12753
|
+
" - ",
|
|
12754
|
+
name
|
|
12755
|
+
] }, id);
|
|
12756
|
+
})
|
|
12896
12757
|
] })
|
|
12897
12758
|
] }),
|
|
12898
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.
|
|
12899
|
-
|
|
12900
|
-
|
|
12901
|
-
|
|
12902
|
-
|
|
12903
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("
|
|
12904
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("input", { type: "text", placeholder: "e.g., STEP-1", value: workflowStepId, onChange: (e) => setWorkflowStepId(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:placeholder-slate-400 focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500" })
|
|
12905
|
-
] }),
|
|
12906
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
12907
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Assignment Type *" }),
|
|
12908
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("select", { value: assignmentType, onChange: (e) => setAssignmentType(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:bg-white fc:text-slate-700 focus:fc:fc:border-blue-500", children: [
|
|
12909
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Assignment Engine Type" }),
|
|
12910
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Hierarchy", children: "Hierarchy" }),
|
|
12911
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Dynamic", children: "Dynamic" })
|
|
12912
|
-
] })
|
|
12913
|
-
] }),
|
|
12914
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
12915
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Hierarchy Node Type *" }),
|
|
12916
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("select", { value: hierarchyNodeType, onChange: (e) => setHierarchyNodeType(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:bg-white fc:text-slate-700 focus:fc:fc:border-blue-500", children: [
|
|
12917
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Node Level" }),
|
|
12918
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Block", children: "Block" }),
|
|
12919
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "District", children: "District" })
|
|
12920
|
-
] })
|
|
12921
|
-
] }),
|
|
12922
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { children: [
|
|
12923
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1", children: "Dynamic Function ID" }),
|
|
12924
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("input", { type: "text", placeholder: "e.g., 1, 2", value: dynamicFunctionId, onChange: (e) => setDynamicFunctionId(e.target.value), className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:placeholder-slate-400 focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500" })
|
|
12925
|
-
] }),
|
|
12926
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2 fc:pt-1", children: [
|
|
12927
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("input", { type: "checkbox", id: "isPoolEnabled", checked: isPoolEnabled, onChange: (e) => setIsPoolEnabled(e.target.checked), className: "fc:w-4 fc:h-4 fc:text-blue-600 fc:border-slate-300 fc:rounded focus:fc:fc:ring-blue-500" }),
|
|
12928
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("label", { htmlFor: "isPoolEnabled", className: "fc:text-xs fc:font-bold fc:text-slate-700 fc:select-none fc:cursor-pointer", children: "Enable Task Pooling" })
|
|
12759
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
|
|
12760
|
+
"Assignment Type *",
|
|
12761
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("select", { required: true, value: formData.assignmentType, onChange: (event) => change("assignmentType", event.target.value), className: "fc:mt-1 fc:w-full fc:rounded-xl fc:border fc:border-slate-200 fc:bg-white fc:p-2.5 fc:text-xs", children: [
|
|
12762
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Assignment Engine Type" }),
|
|
12763
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Hierarchy", children: "Hierarchy" }),
|
|
12764
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Dynamic", children: "Dynamic" })
|
|
12929
12765
|
] })
|
|
12930
12766
|
] }),
|
|
12931
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("
|
|
12932
|
-
|
|
12933
|
-
/* @__PURE__ */ (0, import_jsx_runtime85.
|
|
12934
|
-
|
|
12767
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:block fc:text-xs fc:font-bold fc:text-slate-700", children: [
|
|
12768
|
+
"Hierarchy Node Type *",
|
|
12769
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("select", { required: true, value: formData.hierarchyNodeType, onChange: (event) => change("hierarchyNodeType", event.target.value), className: "fc:mt-1 fc:w-full fc:rounded-xl fc:border fc:border-slate-200 fc:bg-white fc:p-2.5 fc:text-xs", children: [
|
|
12770
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "", children: "Select Node Level" }),
|
|
12771
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "Block", children: "Block" }),
|
|
12772
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "District", children: "District" }),
|
|
12773
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("option", { value: "State", children: "State" })
|
|
12774
|
+
] })
|
|
12775
|
+
] }),
|
|
12776
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-slate-700", children: [
|
|
12777
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("input", { type: "checkbox", checked: formData.isPoolEnabled, onChange: (event) => change("isPoolEnabled", event.target.checked), className: "fc:h-4 fc:w-4" }),
|
|
12778
|
+
"Enable Task Pooling"
|
|
12779
|
+
] }),
|
|
12780
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: "fc:text-xs fc:text-red-500", children: error })
|
|
12781
|
+
] }),
|
|
12782
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-2.5 fc:border-t fc:border-slate-100 fc:bg-white fc:px-6 fc:py-4", children: [
|
|
12783
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { type: "button", onClick: onClose, className: "fc:rounded-xl fc:border fc:border-slate-200 fc:px-4 fc:py-2 fc:text-xs", children: "Cancel" }),
|
|
12784
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { disabled: saving || loadingSteps, type: "submit", className: "fc:rounded-xl fc:bg-blue-600 fc:px-5 fc:py-2 fc:text-xs fc:font-bold fc:text-white", children: saving ? "Saving..." : editData ? "Update Rule" : "Save Rule" })
|
|
12935
12785
|
] })
|
|
12936
12786
|
] })
|
|
12937
12787
|
] });
|
|
12938
12788
|
}
|
|
12939
12789
|
|
|
12940
12790
|
// src/components/assignment-rule/AssignmentRuleMain.jsx
|
|
12791
|
+
init_ApiEndpointsProvider();
|
|
12792
|
+
init_ApiServicepackage();
|
|
12941
12793
|
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
12794
|
+
var getRows4 = (response) => {
|
|
12795
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
12796
|
+
const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
|
|
12797
|
+
const rows = Array.isArray(value) ? value : (_i = (_h = (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : value == null ? void 0 : value.data) != null ? _h : value == null ? void 0 : value.result) != null ? _i : [];
|
|
12798
|
+
return Array.isArray(rows) ? rows : [];
|
|
12799
|
+
};
|
|
12800
|
+
var endpoint = (action) => {
|
|
12801
|
+
var _a, _b, _c, _d, _e;
|
|
12802
|
+
const assignmentRule = (_e = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.assignmentRule) != null ? _e : (_d = (_c = getApiEndpoints()) == null ? void 0 : _c.flowCore) == null ? void 0 : _d.AssignmentRule;
|
|
12803
|
+
const value = assignmentRule == null ? void 0 : assignmentRule[action];
|
|
12804
|
+
if (!value) throw new Error(`Assignment Rule ${action} endpoint is not configured.`);
|
|
12805
|
+
return value;
|
|
12806
|
+
};
|
|
12807
|
+
var byId = (id) => {
|
|
12808
|
+
const value = endpoint("getById");
|
|
12809
|
+
return typeof value === "function" ? value(id) : `${value}/${id}`;
|
|
12810
|
+
};
|
|
12811
|
+
var normalise4 = (item) => {
|
|
12812
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
12813
|
+
return __spreadProps(__spreadValues({}, item), { assignmentRuleId: (_b = (_a = item.assignmentRuleId) != null ? _a : item.AssignmentRuleId) != null ? _b : item.id, workflowStepId: (_d = (_c = item.workflowStepId) != null ? _c : item.WorkflowStepId) != null ? _d : "", assignmentType: (_f = (_e = item.assignmentType) != null ? _e : item.AssignmentType) != null ? _f : "", hierarchyNodeType: (_h = (_g = item.hierarchyNodeType) != null ? _g : item.HierarchyNodeType) != null ? _h : "", isPoolEnabled: Boolean((_j = (_i = item.isPoolEnabled) != null ? _i : item.IsPoolEnabled) != null ? _j : false) });
|
|
12814
|
+
};
|
|
12942
12815
|
function AssignmentRuleMain() {
|
|
12943
|
-
const [refreshkey, setRefreshKey] = (0, import_react86.useState)(0);
|
|
12944
|
-
const handleRefresh = () => {
|
|
12945
|
-
console.log("Table data refreshed!");
|
|
12946
|
-
setRefreshKey((prev) => prev + 1);
|
|
12947
|
-
};
|
|
12948
12816
|
const tableRef = (0, import_react86.useRef)(null);
|
|
12949
|
-
const [
|
|
12817
|
+
const [rows, setRows] = (0, import_react86.useState)([]);
|
|
12818
|
+
const [modalOpen, setModalOpen] = (0, import_react86.useState)(false);
|
|
12819
|
+
const [editingRule, setEditingRule] = (0, import_react86.useState)(null);
|
|
12950
12820
|
const [pageSize, setPageSize] = (0, import_react86.useState)(10);
|
|
12951
12821
|
const [searchQuery, setSearchQuery] = (0, import_react86.useState)("");
|
|
12952
12822
|
const [currentPage, setCurrentPage] = (0, import_react86.useState)(1);
|
|
12953
12823
|
const [totalEntries, setTotalEntries] = (0, import_react86.useState)(0);
|
|
12954
|
-
const
|
|
12955
|
-
|
|
12956
|
-
|
|
12824
|
+
const [loading, setLoading] = (0, import_react86.useState)(true);
|
|
12825
|
+
const [refreshKey, setRefreshKey] = (0, import_react86.useState)(0);
|
|
12826
|
+
const refresh = () => setRefreshKey((value) => value + 1);
|
|
12827
|
+
(0, import_react86.useEffect)(() => {
|
|
12828
|
+
let active = true;
|
|
12829
|
+
const load = async () => {
|
|
12830
|
+
var _a, _b;
|
|
12831
|
+
setLoading(true);
|
|
12832
|
+
try {
|
|
12833
|
+
const response = await getApiService().get(endpoint("getList"));
|
|
12834
|
+
if (active) setRows(getRows4(response).map(normalise4));
|
|
12835
|
+
} catch (error) {
|
|
12836
|
+
if (active) await import_sweetalert219.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load assignment rules.", "error");
|
|
12837
|
+
} finally {
|
|
12838
|
+
if (active) setLoading(false);
|
|
12839
|
+
}
|
|
12840
|
+
};
|
|
12841
|
+
load();
|
|
12842
|
+
return () => {
|
|
12843
|
+
active = false;
|
|
12844
|
+
};
|
|
12845
|
+
}, [refreshKey]);
|
|
12846
|
+
const save = async (payload, isEdit) => {
|
|
12847
|
+
var _a, _b;
|
|
12848
|
+
try {
|
|
12849
|
+
await getApiService()[isEdit ? "put" : "post"](endpoint(isEdit ? "update" : "create"), payload);
|
|
12850
|
+
await import_sweetalert219.default.fire("Success", `Assignment rule ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
12851
|
+
refresh();
|
|
12852
|
+
return true;
|
|
12853
|
+
} catch (error) {
|
|
12854
|
+
await import_sweetalert219.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} assignment rule.`, "error");
|
|
12855
|
+
return false;
|
|
12856
|
+
}
|
|
12957
12857
|
};
|
|
12958
|
-
|
|
12959
|
-
|
|
12960
|
-
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
12967
|
-
|
|
12968
|
-
|
|
12969
|
-
|
|
12970
|
-
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
12858
|
+
const edit = async (item) => {
|
|
12859
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
12860
|
+
try {
|
|
12861
|
+
const response = await getApiService().get(byId(item.assignmentRuleId));
|
|
12862
|
+
const data = (_f = (_e = (_d = (_b = getRows4(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
|
|
12863
|
+
setEditingRule(normalise4(data));
|
|
12864
|
+
setModalOpen(true);
|
|
12865
|
+
} catch (error) {
|
|
12866
|
+
await import_sweetalert219.default.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load assignment rule details.", "error");
|
|
12867
|
+
}
|
|
12868
|
+
};
|
|
12869
|
+
const remove = async (item) => {
|
|
12870
|
+
var _a, _b;
|
|
12871
|
+
const confirmation = await import_sweetalert219.default.fire({ title: "Delete Assignment Rule?", text: "This rule will be marked inactive.", icon: "warning", showCancelButton: true, confirmButtonText: "Yes, Delete", confirmButtonColor: "#e11d48" });
|
|
12872
|
+
if (!confirmation.isConfirmed) return;
|
|
12873
|
+
try {
|
|
12874
|
+
await getApiService().put(endpoint("update"), { assignmentRuleId: item.assignmentRuleId, workflowStepId: Number(item.workflowStepId), assignmentType: item.assignmentType, hierarchyNodeType: item.hierarchyNodeType, isPoolEnabled: false });
|
|
12875
|
+
await import_sweetalert219.default.fire("Deleted", "Assignment rule deleted successfully.", "success");
|
|
12876
|
+
refresh();
|
|
12877
|
+
} catch (error) {
|
|
12878
|
+
await import_sweetalert219.default.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to delete assignment rule.", "error");
|
|
12879
|
+
}
|
|
12880
|
+
};
|
|
12881
|
+
const openCreate = () => {
|
|
12882
|
+
setEditingRule(null);
|
|
12883
|
+
setModalOpen(true);
|
|
12884
|
+
};
|
|
12885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:p-6", children: [
|
|
12886
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
12887
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CommonHeader, { title: "Assignment Rule", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Masters", href: "/masters" }, { label: "Permissions", href: "/permissions" }, { label: "AssignmentRule", href: "/assignment-rule" }], buttonText: "Add Assignment Rule", onButtonClick: openCreate }),
|
|
12888
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:space-y-5 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:bg-white fc:p-6", children: [
|
|
12889
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:flex fc:w-full fc:items-center fc:justify-between fc:gap-4", children: [
|
|
12890
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(SearchBar12, { searchQuery, setSearchQuery: (value) => {
|
|
12891
|
+
setSearchQuery(value);
|
|
12892
|
+
setCurrentPage(1);
|
|
12893
|
+
} }) }),
|
|
12894
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
|
|
12895
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Refresh_default, { onRefresh: refresh }),
|
|
12896
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Download_default, { targetRef: tableRef, fileName: "assignment-rules" }),
|
|
12897
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("select", { value: pageSize, onChange: (event) => {
|
|
12898
|
+
setPageSize(Number(event.target.value));
|
|
12899
|
+
setCurrentPage(1);
|
|
12900
|
+
}, className: "fc:rounded-lg fc:border fc:border-slate-200 fc:px-3 fc:py-2 fc:text-sm", children: [
|
|
12901
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 5, children: "5 Rows" }),
|
|
12902
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 10, children: "10 Rows" }),
|
|
12903
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 20, children: "20 Rows" }),
|
|
12904
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("option", { value: 25, children: "25 Rows" })
|
|
12987
12905
|
] })
|
|
12988
|
-
] })
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
] })
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12906
|
+
] })
|
|
12907
|
+
] }),
|
|
12908
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Table4, { rows, loading, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: edit, onDelete: remove }) })
|
|
12909
|
+
] })
|
|
12910
|
+
] }),
|
|
12911
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(Popup4, { isOpen: modalOpen, editData: editingRule, onClose: () => {
|
|
12912
|
+
setModalOpen(false);
|
|
12913
|
+
setEditingRule(null);
|
|
12914
|
+
}, onSave: save })
|
|
12915
|
+
] });
|
|
12995
12916
|
}
|
|
12996
12917
|
|
|
12997
12918
|
// src/components/Workflow_Step_Hierarchy_Mapping/Workflow_Step_Hierarchy_Mapping_Main.jsx
|
|
12998
12919
|
var import_react87 = __toESM(require("react"));
|
|
12999
|
-
var
|
|
12920
|
+
var import_sweetalert220 = __toESM(require("sweetalert2"));
|
|
13000
12921
|
init_ApiEndpointsProvider();
|
|
13001
12922
|
init_ApiServicepackage();
|
|
13002
12923
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13003
|
-
var emptyForm = { workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
|
|
13004
|
-
var
|
|
12924
|
+
var emptyForm = { workflowId: "", workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
|
|
12925
|
+
var getRows5 = (result) => {
|
|
13005
12926
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
13006
12927
|
const value = (_e = (_d = (_c = (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data) != null ? _c : (_b = result == null ? void 0 : result.data) == null ? void 0 : _b.result) != null ? _d : result == null ? void 0 : result.data) != null ? _e : result;
|
|
13007
12928
|
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
13008
12929
|
};
|
|
13009
12930
|
function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
12931
|
+
var _a, _b, _c, _d, _e, _f;
|
|
13010
12932
|
const tableRef = (0, import_react87.useRef)(null);
|
|
13011
12933
|
const [mappings, setMappings] = (0, import_react87.useState)([]);
|
|
13012
|
-
const [
|
|
12934
|
+
const [workflows, setWorkflows] = (0, import_react87.useState)([]);
|
|
13013
12935
|
const [hierarchyNodes, setHierarchyNodes] = (0, import_react87.useState)([]);
|
|
13014
12936
|
const [isLoading, setIsLoading] = (0, import_react87.useState)(false);
|
|
12937
|
+
const [isLoadingLookups, setIsLoadingLookups] = (0, import_react87.useState)(false);
|
|
13015
12938
|
const [refreshKey, setRefreshKey] = (0, import_react87.useState)(0);
|
|
13016
12939
|
const [searchQuery, setSearchQuery] = (0, import_react87.useState)("");
|
|
13017
12940
|
const [pageSize, setPageSize] = (0, import_react87.useState)(10);
|
|
@@ -13021,60 +12944,86 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13021
12944
|
const [formData, setFormData] = (0, import_react87.useState)(emptyForm);
|
|
13022
12945
|
const [isSaving, setIsSaving] = (0, import_react87.useState)(false);
|
|
13023
12946
|
const mappingEndpoints = () => {
|
|
13024
|
-
var
|
|
13025
|
-
const flowCore = (
|
|
12947
|
+
var _a2;
|
|
12948
|
+
const flowCore = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore;
|
|
13026
12949
|
return (flowCore == null ? void 0 : flowCore.WorkflowStepHierarchyMapping) || (flowCore == null ? void 0 : flowCore.workflowStepHierarchyMapping) || (flowCore == null ? void 0 : flowCore.WorkflowStepHierarchyMappings) || (flowCore == null ? void 0 : flowCore.workflowStepHierarchyMappings) || (flowCore == null ? void 0 : flowCore.WorkflowStepUserMapping) || (flowCore == null ? void 0 : flowCore.workflowStepUserMapping);
|
|
13027
12950
|
};
|
|
13028
|
-
const
|
|
12951
|
+
const workflowMap = (0, import_react87.useMemo)(
|
|
13029
12952
|
() => Object.fromEntries(
|
|
13030
|
-
|
|
13031
|
-
var
|
|
13032
|
-
const id = (
|
|
13033
|
-
const name = (
|
|
12953
|
+
workflows.map((wf) => {
|
|
12954
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
|
|
12955
|
+
const id = (_d2 = (_c2 = (_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id) != null ? _c2 : wf.workflowStepId) != null ? _d2 : wf.WorkflowStepId;
|
|
12956
|
+
const name = (_i = (_h = (_g = (_f2 = (_e2 = wf.workflowName) != null ? _e2 : wf.WorkflowName) != null ? _f2 : wf.name) != null ? _g : wf.stepName) != null ? _h : wf.StepName) != null ? _i : `Workflow ${id}`;
|
|
13034
12957
|
return [id, name];
|
|
13035
12958
|
})
|
|
13036
12959
|
),
|
|
13037
|
-
[
|
|
12960
|
+
[workflows]
|
|
13038
12961
|
);
|
|
13039
12962
|
const hierarchyNodeMap = (0, import_react87.useMemo)(
|
|
13040
12963
|
() => Object.fromEntries(
|
|
13041
12964
|
hierarchyNodes.map((node) => {
|
|
13042
|
-
var
|
|
13043
|
-
const id = (
|
|
13044
|
-
const name = (
|
|
12965
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
12966
|
+
const id = (_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id;
|
|
12967
|
+
const name = (_f2 = (_e2 = (_d2 = (_c2 = node.nodeName) != null ? _c2 : node.NodeName) != null ? _d2 : node.hierarchyNodeName) != null ? _e2 : node.HierarchyNodeName) != null ? _f2 : `Node ${id}`;
|
|
13045
12968
|
return [id, name];
|
|
13046
12969
|
})
|
|
13047
12970
|
),
|
|
13048
12971
|
[hierarchyNodes]
|
|
13049
12972
|
);
|
|
12973
|
+
(0, import_react87.useEffect)(() => {
|
|
12974
|
+
if (!isModalOpen) return;
|
|
12975
|
+
const loadLookups = async () => {
|
|
12976
|
+
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
12977
|
+
setIsLoadingLookups(true);
|
|
12978
|
+
try {
|
|
12979
|
+
const flowCore = (_a2 = getApiEndpoints()) == null ? void 0 : _a2.flowCore;
|
|
12980
|
+
const workflowEndpoint = ((_b2 = flowCore == null ? void 0 : flowCore.workflow) == null ? void 0 : _b2.getList) || ((_c2 = flowCore == null ? void 0 : flowCore.WorkFlow) == null ? void 0 : _c2.getList) || ((_d2 = flowCore == null ? void 0 : flowCore.workFlow) == null ? void 0 : _d2.getList);
|
|
12981
|
+
const nodeEndpoint = ((_e2 = flowCore == null ? void 0 : flowCore.hierarchyNode) == null ? void 0 : _e2.getList) || ((_f2 = flowCore == null ? void 0 : flowCore.HierarchyNode) == null ? void 0 : _f2.getList);
|
|
12982
|
+
const [workflowResult, hierarchyNodeResult] = await Promise.all([
|
|
12983
|
+
workflowEndpoint ? getApiService().get(workflowEndpoint).catch(async (err) => {
|
|
12984
|
+
var _a3;
|
|
12985
|
+
if (((_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.status) === 405) {
|
|
12986
|
+
return await getApiService().post(workflowEndpoint, {});
|
|
12987
|
+
}
|
|
12988
|
+
throw err;
|
|
12989
|
+
}) : Promise.resolve(null),
|
|
12990
|
+
nodeEndpoint ? getApiService().get(nodeEndpoint).catch(async (err) => {
|
|
12991
|
+
var _a3;
|
|
12992
|
+
if (((_a3 = err == null ? void 0 : err.response) == null ? void 0 : _a3.status) === 405) {
|
|
12993
|
+
return await getApiService().post(nodeEndpoint, {});
|
|
12994
|
+
}
|
|
12995
|
+
throw err;
|
|
12996
|
+
}) : Promise.resolve(null)
|
|
12997
|
+
]);
|
|
12998
|
+
setWorkflows(workflowResult ? getRows5(workflowResult) : []);
|
|
12999
|
+
setHierarchyNodes(
|
|
13000
|
+
hierarchyNodeResult ? getRows5(hierarchyNodeResult) : []
|
|
13001
|
+
);
|
|
13002
|
+
} catch (error) {
|
|
13003
|
+
console.error("Unable to load workflow or hierarchy node lookup options:", error);
|
|
13004
|
+
} finally {
|
|
13005
|
+
setIsLoadingLookups(false);
|
|
13006
|
+
}
|
|
13007
|
+
};
|
|
13008
|
+
loadLookups();
|
|
13009
|
+
}, [isModalOpen]);
|
|
13050
13010
|
(0, import_react87.useEffect)(() => {
|
|
13051
13011
|
const loadData = async () => {
|
|
13052
|
-
var
|
|
13012
|
+
var _a2, _b2;
|
|
13053
13013
|
setIsLoading(true);
|
|
13054
13014
|
try {
|
|
13055
13015
|
const endpoints = mappingEndpoints();
|
|
13056
13016
|
const mappingEndpoint = (endpoints == null ? void 0 : endpoints.getList) || (endpoints == null ? void 0 : endpoints.GetList);
|
|
13057
|
-
const flowCore = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
|
|
13058
13017
|
if (!mappingEndpoint)
|
|
13059
13018
|
throw new Error(
|
|
13060
13019
|
"Workflow step hierarchy mapping list endpoint is not configured."
|
|
13061
13020
|
);
|
|
13062
|
-
const
|
|
13063
|
-
|
|
13064
|
-
const [mappingResult, workflowStepResult, hierarchyNodeResult] = await Promise.all([
|
|
13065
|
-
getApiService().get(mappingEndpoint),
|
|
13066
|
-
stepEndpoint ? getApiService().get(stepEndpoint) : Promise.resolve(null),
|
|
13067
|
-
nodeEndpoint ? getApiService().get(nodeEndpoint) : Promise.resolve(null)
|
|
13068
|
-
]);
|
|
13069
|
-
setMappings(getRows(mappingResult));
|
|
13070
|
-
setWorkflowSteps(workflowStepResult ? getRows(workflowStepResult) : []);
|
|
13071
|
-
setHierarchyNodes(
|
|
13072
|
-
hierarchyNodeResult ? getRows(hierarchyNodeResult) : []
|
|
13073
|
-
);
|
|
13021
|
+
const mappingResult = await getApiService().get(mappingEndpoint);
|
|
13022
|
+
setMappings(getRows5(mappingResult));
|
|
13074
13023
|
} catch (error) {
|
|
13075
|
-
await
|
|
13024
|
+
await import_sweetalert220.default.fire(
|
|
13076
13025
|
"Error",
|
|
13077
|
-
((
|
|
13026
|
+
((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || (error == null ? void 0 : error.message) || "Unable to load workflow step hierarchy mappings.",
|
|
13078
13027
|
"error"
|
|
13079
13028
|
);
|
|
13080
13029
|
} finally {
|
|
@@ -13084,51 +13033,55 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13084
13033
|
loadData();
|
|
13085
13034
|
}, [refreshKey]);
|
|
13086
13035
|
const openModal = (mapping = null) => {
|
|
13087
|
-
var
|
|
13036
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
|
|
13088
13037
|
setEditingMapping(mapping);
|
|
13089
13038
|
setFormData(
|
|
13090
13039
|
mapping ? {
|
|
13040
|
+
workflowId: String(
|
|
13041
|
+
(_d2 = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId) != null ? _d2 : ""
|
|
13042
|
+
),
|
|
13091
13043
|
workflowStepId: String(
|
|
13092
|
-
(
|
|
13044
|
+
(_h = (_g = (_f2 = (_e2 = mapping.workflowStepId) != null ? _e2 : mapping.WorkflowStepId) != null ? _f2 : mapping.workflowId) != null ? _g : mapping.WorkflowId) != null ? _h : ""
|
|
13093
13045
|
),
|
|
13094
13046
|
hierarchyNodeId: String(
|
|
13095
|
-
(
|
|
13047
|
+
(_j = (_i = mapping.hierarchyNodeId) != null ? _i : mapping.HierarchyNodeId) != null ? _j : ""
|
|
13096
13048
|
),
|
|
13097
|
-
isActive: String((
|
|
13049
|
+
isActive: String((_l = (_k = mapping.isActive) != null ? _k : mapping.IsActive) != null ? _l : true)
|
|
13098
13050
|
} : emptyForm
|
|
13099
13051
|
);
|
|
13100
13052
|
setIsModalOpen(true);
|
|
13101
13053
|
};
|
|
13102
13054
|
const handleSave = async (event) => {
|
|
13103
|
-
var
|
|
13055
|
+
var _a2, _b2, _c2;
|
|
13104
13056
|
event.preventDefault();
|
|
13105
|
-
|
|
13106
|
-
|
|
13057
|
+
const selectedWorkflowId = formData.workflowId || formData.workflowStepId;
|
|
13058
|
+
if (!selectedWorkflowId || !formData.hierarchyNodeId)
|
|
13059
|
+
return import_sweetalert220.default.fire(
|
|
13107
13060
|
"Required fields",
|
|
13108
|
-
"Please select a workflow
|
|
13061
|
+
"Please select a workflow and hierarchy node.",
|
|
13109
13062
|
"warning"
|
|
13110
13063
|
);
|
|
13111
13064
|
setIsSaving(true);
|
|
13112
13065
|
try {
|
|
13113
13066
|
const endpoints = mappingEndpoints();
|
|
13114
|
-
const
|
|
13115
|
-
if (!
|
|
13067
|
+
const endpoint2 = editingMapping ? (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update) : (endpoints == null ? void 0 : endpoints.create) || (endpoints == null ? void 0 : endpoints.Create);
|
|
13068
|
+
if (!endpoint2)
|
|
13116
13069
|
throw new Error(
|
|
13117
13070
|
`Workflow step hierarchy mapping ${editingMapping ? "update" : "create"} endpoint is not configured.`
|
|
13118
13071
|
);
|
|
13119
|
-
const idValue = Number(
|
|
13072
|
+
const idValue = Number(selectedWorkflowId);
|
|
13120
13073
|
const nodeValue = Number(formData.hierarchyNodeId);
|
|
13121
13074
|
const payload = __spreadValues({
|
|
13122
13075
|
workflowId: idValue,
|
|
13123
13076
|
workflowStepId: idValue,
|
|
13124
13077
|
hierarchyNodeId: nodeValue,
|
|
13125
|
-
isActive: formData.isActive === "true"
|
|
13078
|
+
isActive: formData.isActive === "true" || formData.isActive === true
|
|
13126
13079
|
}, editingMapping ? {
|
|
13127
|
-
workflowStepHierarchyMappingId: (
|
|
13080
|
+
workflowStepHierarchyMappingId: (_a2 = editingMapping.workflowStepHierarchyMappingId) != null ? _a2 : editingMapping.WorkflowStepHierarchyMappingId,
|
|
13128
13081
|
updatedBy: "System"
|
|
13129
13082
|
} : { createdBy: "System" });
|
|
13130
|
-
await getApiService()[editingMapping ? "put" : "post"](
|
|
13131
|
-
await
|
|
13083
|
+
await getApiService()[editingMapping ? "put" : "post"](endpoint2, payload);
|
|
13084
|
+
await import_sweetalert220.default.fire(
|
|
13132
13085
|
"Success",
|
|
13133
13086
|
`Workflow step hierarchy mapping ${editingMapping ? "updated" : "created"} successfully.`,
|
|
13134
13087
|
"success"
|
|
@@ -13136,9 +13089,9 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13136
13089
|
setIsModalOpen(false);
|
|
13137
13090
|
setRefreshKey((previous) => previous + 1);
|
|
13138
13091
|
} catch (error) {
|
|
13139
|
-
await
|
|
13092
|
+
await import_sweetalert220.default.fire(
|
|
13140
13093
|
"Error",
|
|
13141
|
-
((
|
|
13094
|
+
((_c2 = (_b2 = error == null ? void 0 : error.response) == null ? void 0 : _b2.data) == null ? void 0 : _c2.message) || (error == null ? void 0 : error.message) || "Unable to save workflow step hierarchy mapping.",
|
|
13142
13095
|
"error"
|
|
13143
13096
|
);
|
|
13144
13097
|
} finally {
|
|
@@ -13146,8 +13099,8 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13146
13099
|
}
|
|
13147
13100
|
};
|
|
13148
13101
|
const handleDelete = async (mapping) => {
|
|
13149
|
-
var
|
|
13150
|
-
const confirmation = await
|
|
13102
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i;
|
|
13103
|
+
const confirmation = await import_sweetalert220.default.fire({
|
|
13151
13104
|
title: "Delete mapping?",
|
|
13152
13105
|
text: "This mapping will be marked inactive.",
|
|
13153
13106
|
icon: "warning",
|
|
@@ -13158,18 +13111,18 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13158
13111
|
if (!confirmation.isConfirmed) return;
|
|
13159
13112
|
try {
|
|
13160
13113
|
const endpoints = mappingEndpoints();
|
|
13161
|
-
const
|
|
13162
|
-
if (!
|
|
13114
|
+
const endpoint2 = (endpoints == null ? void 0 : endpoints.update) || (endpoints == null ? void 0 : endpoints.Update);
|
|
13115
|
+
if (!endpoint2)
|
|
13163
13116
|
throw new Error(
|
|
13164
13117
|
"Workflow step hierarchy mapping update endpoint is not configured."
|
|
13165
13118
|
);
|
|
13166
13119
|
const stepId = Number(
|
|
13167
|
-
(
|
|
13120
|
+
(_d2 = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId) != null ? _d2 : 0
|
|
13168
13121
|
);
|
|
13169
13122
|
const nodeId = Number(
|
|
13170
|
-
(
|
|
13123
|
+
(_f2 = (_e2 = mapping.hierarchyNodeId) != null ? _e2 : mapping.HierarchyNodeId) != null ? _f2 : 0
|
|
13171
13124
|
);
|
|
13172
|
-
await getApiService().put(
|
|
13125
|
+
await getApiService().put(endpoint2, {
|
|
13173
13126
|
workflowStepHierarchyMappingId: (_g = mapping.workflowStepHierarchyMappingId) != null ? _g : mapping.WorkflowStepHierarchyMappingId,
|
|
13174
13127
|
workflowId: stepId,
|
|
13175
13128
|
workflowStepId: stepId,
|
|
@@ -13177,14 +13130,14 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13177
13130
|
isActive: false,
|
|
13178
13131
|
updatedBy: "System"
|
|
13179
13132
|
});
|
|
13180
|
-
await
|
|
13133
|
+
await import_sweetalert220.default.fire(
|
|
13181
13134
|
"Deleted",
|
|
13182
13135
|
"Workflow step hierarchy mapping has been deactivated.",
|
|
13183
13136
|
"success"
|
|
13184
13137
|
);
|
|
13185
13138
|
setRefreshKey((previous) => previous + 1);
|
|
13186
13139
|
} catch (error) {
|
|
13187
|
-
await
|
|
13140
|
+
await import_sweetalert220.default.fire(
|
|
13188
13141
|
"Error",
|
|
13189
13142
|
((_i = (_h = error == null ? void 0 : error.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) || (error == null ? void 0 : error.message) || "Unable to delete workflow step hierarchy mapping.",
|
|
13190
13143
|
"error"
|
|
@@ -13192,11 +13145,11 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13192
13145
|
}
|
|
13193
13146
|
};
|
|
13194
13147
|
const filteredMappings = mappings.filter((mapping) => {
|
|
13195
|
-
var
|
|
13148
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
13196
13149
|
const query = searchQuery.trim().toLowerCase();
|
|
13197
|
-
const stepId = (
|
|
13198
|
-
const nodeId = (
|
|
13199
|
-
const stepName = (_j = (_i = (_h = (_g = (
|
|
13150
|
+
const stepId = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId;
|
|
13151
|
+
const nodeId = (_d2 = mapping.hierarchyNodeId) != null ? _d2 : mapping.HierarchyNodeId;
|
|
13152
|
+
const stepName = (_j = (_i = (_h = (_g = (_f2 = (_e2 = mapping.workflowName) != null ? _e2 : mapping.WorkflowName) != null ? _f2 : mapping.workflowStepName) != null ? _g : mapping.WorkflowStepName) != null ? _h : mapping.stepName) != null ? _i : mapping.StepName) != null ? _j : workflowMap[stepId];
|
|
13200
13153
|
const nodeName = (_n = (_m = (_l = (_k = mapping.hierarchyNodeName) != null ? _k : mapping.HierarchyNodeName) != null ? _l : mapping.nodeName) != null ? _m : mapping.NodeName) != null ? _n : hierarchyNodeMap[nodeId];
|
|
13201
13154
|
return !query || [
|
|
13202
13155
|
(_o = mapping.workflowStepHierarchyMappingId) != null ? _o : mapping.WorkflowStepHierarchyMappingId,
|
|
@@ -13280,8 +13233,8 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13280
13233
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("tr", { className: "fc:bg-slate-100 fc:text-slate-600", children: [
|
|
13281
13234
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "#" }),
|
|
13282
13235
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Mapping ID" }),
|
|
13283
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Workflow
|
|
13284
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Hierarchy Node" }),
|
|
13236
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Workflow Name" }),
|
|
13237
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Hierarchy Node Name" }),
|
|
13285
13238
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-left", children: "Active" }),
|
|
13286
13239
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("th", { className: "fc:p-3 fc:text-center", children: "Actions" })
|
|
13287
13240
|
] }) }),
|
|
@@ -13300,11 +13253,11 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13300
13253
|
children: "No workflow step hierarchy mappings found."
|
|
13301
13254
|
}
|
|
13302
13255
|
) }) : visibleMappings.map((mapping, index) => {
|
|
13303
|
-
var
|
|
13304
|
-
const stepId = (
|
|
13305
|
-
const nodeId = (
|
|
13306
|
-
const active = (
|
|
13307
|
-
const stepDisplayName = (_l = (_k = (_j = (_i = (_h = (_g = (
|
|
13256
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
13257
|
+
const stepId = (_c2 = (_b2 = (_a2 = mapping.workflowId) != null ? _a2 : mapping.WorkflowId) != null ? _b2 : mapping.workflowStepId) != null ? _c2 : mapping.WorkflowStepId;
|
|
13258
|
+
const nodeId = (_d2 = mapping.hierarchyNodeId) != null ? _d2 : mapping.HierarchyNodeId;
|
|
13259
|
+
const active = (_e2 = mapping.isActive) != null ? _e2 : mapping.IsActive;
|
|
13260
|
+
const stepDisplayName = (_l = (_k = (_j = (_i = (_h = (_g = (_f2 = mapping.workflowName) != null ? _f2 : mapping.WorkflowName) != null ? _g : mapping.workflowStepName) != null ? _h : mapping.WorkflowStepName) != null ? _i : mapping.stepName) != null ? _j : mapping.StepName) != null ? _k : workflowMap[stepId]) != null ? _l : stepId ? `Workflow ${stepId}` : "-";
|
|
13308
13261
|
const nodeDisplayName = (_q = (_p = (_o = (_n = (_m = mapping.hierarchyNodeName) != null ? _m : mapping.HierarchyNodeName) != null ? _n : mapping.nodeName) != null ? _o : mapping.NodeName) != null ? _p : hierarchyNodeMap[nodeId]) != null ? _q : nodeId ? `Node ${nodeId}` : "-";
|
|
13309
13262
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
13310
13263
|
"tr",
|
|
@@ -13396,26 +13349,31 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13396
13349
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("button", { type: "button", onClick: () => setIsModalOpen(false), children: "\xD7" })
|
|
13397
13350
|
] }),
|
|
13398
13351
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { children: [
|
|
13399
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("label", { className: "fc:block fc:mb-1.5 fc:text-sm fc:font-semibold", children: "Workflow
|
|
13352
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("label", { className: "fc:block fc:mb-1.5 fc:text-sm fc:font-semibold", children: "Workflow *" }),
|
|
13400
13353
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
13401
13354
|
"select",
|
|
13402
13355
|
{
|
|
13403
|
-
value: formData.workflowStepId,
|
|
13356
|
+
value: formData.workflowId || formData.workflowStepId,
|
|
13404
13357
|
onChange: (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), {
|
|
13358
|
+
workflowId: event.target.value,
|
|
13405
13359
|
workflowStepId: event.target.value
|
|
13406
13360
|
})),
|
|
13407
13361
|
className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-2.5",
|
|
13408
13362
|
children: [
|
|
13409
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: "Select workflow
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13363
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: isLoadingLookups ? "Loading workflows..." : "Select workflow" }),
|
|
13364
|
+
Boolean(
|
|
13365
|
+
(formData.workflowId || formData.workflowStepId) && !workflows.some(
|
|
13366
|
+
(wf) => {
|
|
13367
|
+
var _a2, _b2;
|
|
13368
|
+
return String((_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id) === String(formData.workflowId || formData.workflowStepId);
|
|
13369
|
+
}
|
|
13370
|
+
)
|
|
13371
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: formData.workflowId || formData.workflowStepId, children: (_c = (_b = (_a = editingMapping == null ? void 0 : editingMapping.workflowName) != null ? _a : editingMapping == null ? void 0 : editingMapping.WorkflowName) != null ? _b : editingMapping == null ? void 0 : editingMapping.stepName) != null ? _c : `Workflow ${formData.workflowId || formData.workflowStepId}` }),
|
|
13372
|
+
workflows.map((wf) => {
|
|
13373
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
13374
|
+
const id = (_b2 = (_a2 = wf.workflowId) != null ? _a2 : wf.WorkflowId) != null ? _b2 : wf.id;
|
|
13375
|
+
const name = (_e2 = (_d2 = (_c2 = wf.workflowName) != null ? _c2 : wf.WorkflowName) != null ? _d2 : wf.name) != null ? _e2 : `Workflow ${id}`;
|
|
13376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: id, children: name }, id);
|
|
13419
13377
|
})
|
|
13420
13378
|
]
|
|
13421
13379
|
}
|
|
@@ -13432,15 +13390,20 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
|
|
|
13432
13390
|
})),
|
|
13433
13391
|
className: "fc:w-full fc:border fc:border-slate-200 fc:rounded-xl fc:p-2.5",
|
|
13434
13392
|
children: [
|
|
13435
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: "Select hierarchy node" }),
|
|
13393
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: "", children: isLoadingLookups ? "Loading hierarchy nodes..." : "Select hierarchy node" }),
|
|
13394
|
+
Boolean(
|
|
13395
|
+
formData.hierarchyNodeId && !hierarchyNodes.some(
|
|
13396
|
+
(node) => {
|
|
13397
|
+
var _a2, _b2;
|
|
13398
|
+
return String((_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id) === String(formData.hierarchyNodeId);
|
|
13399
|
+
}
|
|
13400
|
+
)
|
|
13401
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: formData.hierarchyNodeId, children: (_f = (_e = (_d = editingMapping == null ? void 0 : editingMapping.hierarchyNodeName) != null ? _d : editingMapping == null ? void 0 : editingMapping.HierarchyNodeName) != null ? _e : editingMapping == null ? void 0 : editingMapping.nodeName) != null ? _f : `Node ${formData.hierarchyNodeId}` }),
|
|
13436
13402
|
hierarchyNodes.map((node) => {
|
|
13437
|
-
var
|
|
13438
|
-
const id = (
|
|
13439
|
-
const name = (
|
|
13440
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.
|
|
13441
|
-
id,
|
|
13442
|
-
name ? ` - ${name}` : ""
|
|
13443
|
-
] }, id);
|
|
13403
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
13404
|
+
const id = (_b2 = (_a2 = node.hierarchyNodeId) != null ? _a2 : node.HierarchyNodeId) != null ? _b2 : node.id;
|
|
13405
|
+
const name = (_e2 = (_d2 = (_c2 = node.nodeName) != null ? _c2 : node.NodeName) != null ? _d2 : node.hierarchyNodeName) != null ? _e2 : node.HierarchyNodeName;
|
|
13406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("option", { value: id, children: name ? name : `Node ${id}` }, id);
|
|
13444
13407
|
})
|
|
13445
13408
|
]
|
|
13446
13409
|
}
|
|
@@ -13516,8 +13479,8 @@ var workflowItems = [
|
|
|
13516
13479
|
}
|
|
13517
13480
|
];
|
|
13518
13481
|
var permissionItems = [{
|
|
13519
|
-
name: "
|
|
13520
|
-
component: "
|
|
13482
|
+
name: "Step Permission",
|
|
13483
|
+
component: "step_permission_main",
|
|
13521
13484
|
icon: import_react89.RiUserSettingsLine
|
|
13522
13485
|
}, {
|
|
13523
13486
|
name: "Assignment Rule",
|
|
@@ -13536,7 +13499,7 @@ var hierarchyItems = [
|
|
|
13536
13499
|
icon: import_react89.RiUserSharedLine
|
|
13537
13500
|
},
|
|
13538
13501
|
{
|
|
13539
|
-
name: "Workflow
|
|
13502
|
+
name: "Workflow Hierarchy Mapping",
|
|
13540
13503
|
component: "User_hierarchy_mapping_main",
|
|
13541
13504
|
icon: import_react89.RiUserSharedLine
|
|
13542
13505
|
},
|
|
@@ -13552,13 +13515,13 @@ var documentItems = [{
|
|
|
13552
13515
|
icon: import_react89.RiFileSettingsLine
|
|
13553
13516
|
}];
|
|
13554
13517
|
var fileItems = [{
|
|
13555
|
-
name: "File Instance",
|
|
13556
|
-
component: "FileInstanceMain",
|
|
13557
|
-
icon: import_react89.RiFileList3Line
|
|
13558
|
-
}, {
|
|
13559
13518
|
name: "Business Entity",
|
|
13560
13519
|
component: "BusinessEntitymain",
|
|
13561
13520
|
icon: import_react89.RiFileList3Line
|
|
13521
|
+
}, {
|
|
13522
|
+
name: "File Instance",
|
|
13523
|
+
component: "FileInstanceMain",
|
|
13524
|
+
icon: import_react89.RiFileList3Line
|
|
13562
13525
|
}, {
|
|
13563
13526
|
name: "File Pool",
|
|
13564
13527
|
component: "FilePoolMain",
|
|
@@ -13597,7 +13560,8 @@ function Sidebar({
|
|
|
13597
13560
|
childrens
|
|
13598
13561
|
}) {
|
|
13599
13562
|
const router = (0, import_router.useRouter)();
|
|
13600
|
-
const [
|
|
13563
|
+
const [activeComponent, setActiveComponent] = (0, import_react88.useState)("workflowType");
|
|
13564
|
+
const [workflowOpen, setWorkflowOpen] = (0, import_react88.useState)(true);
|
|
13601
13565
|
const [permissionOpen, setPermissionOpen] = (0, import_react88.useState)(false);
|
|
13602
13566
|
const [hierarchyOpen, setHierarchyOpen] = (0, import_react88.useState)(false);
|
|
13603
13567
|
const [documentOpen, setDocumentOpen] = (0, import_react88.useState)(false);
|
|
@@ -13605,14 +13569,25 @@ function Sidebar({
|
|
|
13605
13569
|
const [tasksOpen, setTasksOpen] = (0, import_react88.useState)(false);
|
|
13606
13570
|
const [trackingOpen, setTrackingOpen] = (0, import_react88.useState)(false);
|
|
13607
13571
|
const [communicationOpen, setCommunicationOpen] = (0, import_react88.useState)(false);
|
|
13608
|
-
|
|
13609
|
-
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13572
|
+
(0, import_react88.useEffect)(() => {
|
|
13573
|
+
if (workflowItems.some((item) => item.component === activeComponent)) {
|
|
13574
|
+
setWorkflowOpen(true);
|
|
13575
|
+
} else if (permissionItems.some((item) => item.component === activeComponent)) {
|
|
13576
|
+
setPermissionOpen(true);
|
|
13577
|
+
} else if (hierarchyItems.some((item) => item.component === activeComponent)) {
|
|
13578
|
+
setHierarchyOpen(true);
|
|
13579
|
+
} else if (documentItems.some((item) => item.component === activeComponent)) {
|
|
13580
|
+
setDocumentOpen(true);
|
|
13581
|
+
} else if (fileItems.some((item) => item.component === activeComponent)) {
|
|
13582
|
+
setFilesOpen(true);
|
|
13583
|
+
} else if (taskItems.some((item) => item.component === activeComponent)) {
|
|
13584
|
+
setTasksOpen(true);
|
|
13585
|
+
} else if (trackingItems.some((item) => item.component === activeComponent)) {
|
|
13586
|
+
setTrackingOpen(true);
|
|
13587
|
+
} else if (communicationItems.some((item) => item.component === activeComponent)) {
|
|
13588
|
+
setCommunicationOpen(true);
|
|
13589
|
+
}
|
|
13590
|
+
}, [activeComponent]);
|
|
13616
13591
|
const renderMenuItem = (item) => {
|
|
13617
13592
|
const Icon = item.icon;
|
|
13618
13593
|
const handleClick = () => {
|
|
@@ -13626,10 +13601,27 @@ function Sidebar({
|
|
|
13626
13601
|
router.push(item.path);
|
|
13627
13602
|
}
|
|
13628
13603
|
};
|
|
13629
|
-
|
|
13630
|
-
|
|
13631
|
-
|
|
13632
|
-
|
|
13604
|
+
const isActive = item.component ? activeComponent === item.component : router.pathname === item.path;
|
|
13605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
13606
|
+
"button",
|
|
13607
|
+
{
|
|
13608
|
+
type: "button",
|
|
13609
|
+
onClick: handleClick,
|
|
13610
|
+
title: item.name,
|
|
13611
|
+
className: `group fc:flex flex fc:h-[36px] h-[36px] fc:w-full w-full fc:min-w-0 min-w-0 fc:items-center items-center fc:gap-[8px] gap-[8px] fc:rounded-[7px] rounded-[7px] fc:px-[8px] px-[8px] fc:text-left text-left fc:transition-all transition-all fc:duration-150 duration-150 ${isActive ? "fc:bg-blue-50 bg-blue-50 fc:text-blue-600 text-blue-600 fc:font-semibold font-semibold" : "fc:text-[#405170] text-[#405170] hover:fc:bg-[#F6F8FC] hover:bg-[#F6F8FC] hover:fc:text-[#101318] hover:text-[#101318]"}`,
|
|
13612
|
+
children: [
|
|
13613
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13614
|
+
"span",
|
|
13615
|
+
{
|
|
13616
|
+
className: `fc:flex flex fc:h-[18px] h-[18px] fc:w-[18px] w-[18px] fc:shrink-0 shrink-0 fc:items-center items-center fc:justify-center justify-center fc:transition-colors transition-colors ${isActive ? "fc:text-blue-600 text-blue-600" : "fc:text-[#64748B] text-[#64748B] group-hover:fc:text-[#101318] group-hover:text-[#101318]"}`,
|
|
13617
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Icon, { size: 16 })
|
|
13618
|
+
}
|
|
13619
|
+
),
|
|
13620
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "fc:min-w-0 min-w-0 fc:flex-1 flex-1 fc:truncate truncate fc:text-[13px] text-[13px] fc:leading-[18px] leading-[18px] fc:text-left text-left", children: item.name })
|
|
13621
|
+
]
|
|
13622
|
+
},
|
|
13623
|
+
item.name
|
|
13624
|
+
);
|
|
13633
13625
|
};
|
|
13634
13626
|
const renderContent = () => {
|
|
13635
13627
|
switch (activeComponent) {
|
|
@@ -13647,7 +13639,7 @@ function Sidebar({
|
|
|
13647
13639
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Workflow_Step_Hierarchy_Mapping_Main, {});
|
|
13648
13640
|
case "DocumentConfigurationmain":
|
|
13649
13641
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DocumentConfigurationmain, {});
|
|
13650
|
-
case "
|
|
13642
|
+
case "step_permission_main":
|
|
13651
13643
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(TaskPermissionMain, {});
|
|
13652
13644
|
case "AssignmentRuleMain":
|
|
13653
13645
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(AssignmentRuleMain, {});
|
|
@@ -13678,15 +13670,58 @@ function Sidebar({
|
|
|
13678
13670
|
}
|
|
13679
13671
|
};
|
|
13680
13672
|
const renderDropdown = (title, open, setOpen, items, HeadingIcon) => {
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
|
|
13684
|
-
|
|
13685
|
-
|
|
13686
|
-
|
|
13687
|
-
|
|
13688
|
-
|
|
13689
|
-
|
|
13673
|
+
const hasActiveChild = items.some(
|
|
13674
|
+
(item) => item.component ? activeComponent === item.component : router.pathname === item.path
|
|
13675
|
+
);
|
|
13676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:mb-1 mb-1", children: [
|
|
13677
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(
|
|
13678
|
+
"button",
|
|
13679
|
+
{
|
|
13680
|
+
type: "button",
|
|
13681
|
+
onClick: () => setOpen(!open),
|
|
13682
|
+
className: `fc:flex flex fc:h-[42px] h-[42px] fc:w-full w-full fc:items-center items-center fc:justify-between justify-between fc:rounded-[8px] rounded-[8px] fc:px-[10px] px-[10px] fc:text-left text-left fc:transition-colors transition-colors fc:duration-150 duration-150 hover:fc:bg-[#F6F8FC] hover:bg-[#F6F8FC] ${hasActiveChild && !open ? "fc:bg-blue-50/60 bg-blue-50/60 fc:text-blue-600 text-blue-600" : "fc:text-[#344261] text-[#344261]"}`,
|
|
13683
|
+
children: [
|
|
13684
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex flex fc:items-center items-center fc:gap-[10px] gap-[10px] fc:min-w-0 min-w-0", children: [
|
|
13685
|
+
HeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13686
|
+
HeadingIcon,
|
|
13687
|
+
{
|
|
13688
|
+
size: 18,
|
|
13689
|
+
className: `fc:shrink-0 shrink-0 fc:transition-colors transition-colors ${hasActiveChild ? "fc:text-blue-600 text-blue-600" : "fc:text-[#405170] text-[#405170]"}`
|
|
13690
|
+
}
|
|
13691
|
+
),
|
|
13692
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: `fc:text-[14px] text-[14px] fc:font-semibold font-semibold fc:truncate truncate ${hasActiveChild && !open ? "fc:text-blue-600 text-blue-600" : "fc:text-[#273657] text-[#273657]"}`, children: title })
|
|
13693
|
+
] }),
|
|
13694
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13695
|
+
"span",
|
|
13696
|
+
{
|
|
13697
|
+
className: `fc:text-[#7E8B9E] text-[#7E8B9E] fc:shrink-0 shrink-0 fc:ml-2 ml-2 fc:transition-transform transition-transform fc:duration-200 duration-200 ${open ? "fc:rotate-90 rotate-90 fc:text-[#344261] text-[#344261]" : "rotate-0"}`,
|
|
13698
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiArrowRightSLine, { size: 18 })
|
|
13699
|
+
}
|
|
13700
|
+
)
|
|
13701
|
+
]
|
|
13702
|
+
}
|
|
13703
|
+
),
|
|
13704
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13705
|
+
"div",
|
|
13706
|
+
{
|
|
13707
|
+
style: {
|
|
13708
|
+
display: "grid",
|
|
13709
|
+
gridTemplateRows: open ? "1fr" : "0fr",
|
|
13710
|
+
transition: "grid-template-rows 220ms cubic-bezier(0.4, 0, 0.2, 1)"
|
|
13711
|
+
},
|
|
13712
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
13713
|
+
"div",
|
|
13714
|
+
{
|
|
13715
|
+
style: {
|
|
13716
|
+
overflow: "hidden",
|
|
13717
|
+
opacity: open ? 1 : 0,
|
|
13718
|
+
transition: "opacity 180ms ease-in-out"
|
|
13719
|
+
},
|
|
13720
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:ml-[18px] ml-[18px] fc:mt-0.5 mt-0.5 fc:mb-1 mb-1 fc:border-l-2 border-l-2 fc:border-[#E5E9F1] border-[#E5E9F1] fc:pl-[8px] pl-[8px] fc:space-y-0.5 space-y-0.5", children: items.map(renderMenuItem) })
|
|
13721
|
+
}
|
|
13722
|
+
)
|
|
13723
|
+
}
|
|
13724
|
+
)
|
|
13690
13725
|
] });
|
|
13691
13726
|
};
|
|
13692
13727
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
|
|
@@ -13704,31 +13739,31 @@ function Sidebar({
|
|
|
13704
13739
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
|
|
13705
13740
|
] })
|
|
13706
13741
|
] }),
|
|
13707
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("button", { type: "button", onClick: onToggle, className: "fc:flex fc:h-8 fc:w-8 fc:items-center fc:justify-center fc:rounded-lg hover:fc:
|
|
13742
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("button", { type: "button", onClick: onToggle, className: "fc:flex flex fc:h-8 h-8 fc:w-8 w-8 fc:items-center items-center fc:justify-center justify-center fc:rounded-lg rounded-lg hover:fc:bg-gray-100 hover:bg-gray-100 fc:transition-colors transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiMenuLine, { size: 18 }) })
|
|
13708
13743
|
] }),
|
|
13709
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:min-h-0 fc:flex-1 fc:overflow-y-auto fc:overflow-x-hidden fc:px-[
|
|
13710
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "fc:mb-[
|
|
13711
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex fc:flex-col fc:gap-[
|
|
13744
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:min-h-0 min-h-0 fc:flex-1 flex-1 fc:overflow-y-auto overflow-y-auto fc:overflow-x-hidden overflow-x-hidden fc:px-[12px] px-[12px] fc:pb-[24px] pb-[24px] fc:pt-[20px] pt-[20px]", children: [
|
|
13745
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Configuration Masters" }),
|
|
13746
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
|
|
13712
13747
|
renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, import_react89.RiNodeTree),
|
|
13713
13748
|
renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, import_react89.RiShieldUserLine),
|
|
13714
13749
|
renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, import_react89.RiFileSettingsLine),
|
|
13715
13750
|
renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, import_react89.RiNodeTree)
|
|
13716
13751
|
] }),
|
|
13717
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "fc:mb-[
|
|
13718
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex fc:flex-col fc:gap-[
|
|
13752
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:mt-[24px] mt-[24px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Runtime" }),
|
|
13753
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
|
|
13719
13754
|
renderDropdown("Files", filesOpen, setFilesOpen, fileItems, import_react89.RiFolder3Line),
|
|
13720
13755
|
renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, import_react89.RiCheckboxCircleLine),
|
|
13721
13756
|
renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, import_react89.RiRouteLine),
|
|
13722
13757
|
renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, import_react89.RiMessage2Line)
|
|
13723
13758
|
] })
|
|
13724
13759
|
] }),
|
|
13725
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:shrink-0 fc:bg-white fc:px-[
|
|
13760
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:shrink-0 shrink-0 fc:bg-white bg-white fc:px-[12px] px-[12px] fc:pb-[20px] pb-[20px] fc:pt-[12px] pt-[12px]", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("button", { type: "button", className: "fc:flex flex fc:h-[50px] h-[50px] fc:w-full w-full fc:items-center items-center fc:gap-[12px] gap-[12px] fc:rounded-[10px] rounded-[10px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:px-[14px] px-[14px] fc:text-left text-left fc:text-[15px] text-[15px] fc:font-semibold font-semibold fc:text-[#2D3A58] text-[#2D3A58] fc:shadow-sm shadow-sm hover:fc:bg-[#F7F8FC] hover:bg-[#F7F8FC] fc:transition transition", children: [
|
|
13726
13761
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiSettings4Line, { size: 20 }),
|
|
13727
13762
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { children: "Settings" })
|
|
13728
13763
|
] }) })
|
|
13729
13764
|
] }),
|
|
13730
|
-
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:flex-1 fc:overflow-auto fc:bg-[#F5F7FB]", children: renderContent() }),
|
|
13731
|
-
!isOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fc:left-[
|
|
13765
|
+
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { className: "fc:flex-1 flex-1 fc:overflow-auto overflow-auto fc:bg-[#F5F7FB] bg-[#F5F7FB]", children: renderContent() }),
|
|
13766
|
+
!isOpen && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fixed fc:left-[16px] left-[16px] fc:top-[30px] top-[30px] fc:z-[100] z-[100] fc:flex flex fc:h-[46px] h-[46px] fc:w-[46px] w-[46px] fc:items-center items-center fc:justify-center justify-center fc:rounded-[9px] rounded-[9px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:text-[#344261] text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors transition-colors hover:fc:bg-gray-100 hover:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react89.RiMenuLine, { size: 18 }) })
|
|
13732
13767
|
] });
|
|
13733
13768
|
}
|
|
13734
13769
|
|