flowcore-fn 9.4.8 → 9.5.1
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/ApiEndpointsProvider-MDQW2LEP.mjs +9 -0
- package/dist/ApiServicepackage-PJH24ZGU.mjs +9 -0
- package/dist/chunk-3NI4QKQW.mjs +34 -0
- package/dist/chunk-HRODB3L2.mjs +22 -0
- package/dist/chunk-I4E63NIC.mjs +24 -0
- package/dist/pkg-index.js +328 -94
- package/dist/pkg-index.mjs +260 -146
- package/package.json +1 -1
package/dist/pkg-index.js
CHANGED
|
@@ -22,6 +22,9 @@ var __spreadValues = (a, b) => {
|
|
|
22
22
|
return a;
|
|
23
23
|
};
|
|
24
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __esm = (fn, res) => function __init() {
|
|
26
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
27
|
+
};
|
|
25
28
|
var __export = (target, all) => {
|
|
26
29
|
for (var name in all)
|
|
27
30
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -44,6 +47,76 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
44
47
|
));
|
|
45
48
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
49
|
|
|
50
|
+
// src/components/Service/ApiEndpointsProvider.js
|
|
51
|
+
var ApiEndpointsProvider_exports = {};
|
|
52
|
+
__export(ApiEndpointsProvider_exports, {
|
|
53
|
+
default: () => ApiEndpointsProvider_default,
|
|
54
|
+
getApiEndpoints: () => getApiEndpoints
|
|
55
|
+
});
|
|
56
|
+
var STORAGE_KEY, apiEndpoints, ApiEndpointsProvider, getApiEndpoints, ApiEndpointsProvider_default;
|
|
57
|
+
var init_ApiEndpointsProvider = __esm({
|
|
58
|
+
"src/components/Service/ApiEndpointsProvider.js"() {
|
|
59
|
+
"use strict";
|
|
60
|
+
STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
|
|
61
|
+
apiEndpoints = null;
|
|
62
|
+
ApiEndpointsProvider = ({ apiEndpoints: endpoints }) => {
|
|
63
|
+
if (typeof window !== "undefined" && endpoints) {
|
|
64
|
+
apiEndpoints = endpoints;
|
|
65
|
+
sessionStorage.setItem(
|
|
66
|
+
STORAGE_KEY,
|
|
67
|
+
JSON.stringify(endpoints)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
72
|
+
getApiEndpoints = () => {
|
|
73
|
+
if (apiEndpoints) {
|
|
74
|
+
return apiEndpoints;
|
|
75
|
+
}
|
|
76
|
+
if (typeof window !== "undefined") {
|
|
77
|
+
const data = sessionStorage.getItem(STORAGE_KEY);
|
|
78
|
+
if (data) {
|
|
79
|
+
apiEndpoints = JSON.parse(data);
|
|
80
|
+
return apiEndpoints;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
throw new Error(
|
|
84
|
+
"Api Endpoints not initialized. Please render <ApiEndpointsProvider apiEndpoints={ApiEndPoints} /> once before using FlowCore."
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
ApiEndpointsProvider_default = ApiEndpointsProvider;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// src/components/Service/ApiServicepackage.js
|
|
92
|
+
var ApiServicepackage_exports = {};
|
|
93
|
+
__export(ApiServicepackage_exports, {
|
|
94
|
+
default: () => ApiServicepackage_default,
|
|
95
|
+
getApiService: () => getApiService
|
|
96
|
+
});
|
|
97
|
+
var apiService, ApiServicepackage, getApiService, ApiServicepackage_default;
|
|
98
|
+
var init_ApiServicepackage = __esm({
|
|
99
|
+
"src/components/Service/ApiServicepackage.js"() {
|
|
100
|
+
"use strict";
|
|
101
|
+
apiService = null;
|
|
102
|
+
ApiServicepackage = ({ apiService: service }) => {
|
|
103
|
+
if (service) {
|
|
104
|
+
apiService = service;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
};
|
|
108
|
+
getApiService = () => {
|
|
109
|
+
if (apiService) {
|
|
110
|
+
return apiService;
|
|
111
|
+
}
|
|
112
|
+
throw new Error(
|
|
113
|
+
"ApiService not initialized. Please render <ApiServicepackage apiService={ApiService} /> once before using FlowCore."
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
ApiServicepackage_default = ApiServicepackage;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
47
120
|
// src/pkg-index.jsx
|
|
48
121
|
var pkg_index_exports = {};
|
|
49
122
|
__export(pkg_index_exports, {
|
|
@@ -62,54 +135,8 @@ var import_router = require("next/router");
|
|
|
62
135
|
// src/components/workflow/WorkflowMain.jsx
|
|
63
136
|
var import_react9 = __toESM(require("react"));
|
|
64
137
|
var import_sweetalert23 = __toESM(require("sweetalert2"));
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
|
|
68
|
-
var apiEndpoints = null;
|
|
69
|
-
var ApiEndpointsProvider = ({ apiEndpoints: endpoints }) => {
|
|
70
|
-
if (typeof window !== "undefined" && endpoints) {
|
|
71
|
-
apiEndpoints = endpoints;
|
|
72
|
-
sessionStorage.setItem(
|
|
73
|
-
STORAGE_KEY,
|
|
74
|
-
JSON.stringify(endpoints)
|
|
75
|
-
);
|
|
76
|
-
}
|
|
77
|
-
return null;
|
|
78
|
-
};
|
|
79
|
-
var getApiEndpoints = () => {
|
|
80
|
-
if (apiEndpoints) {
|
|
81
|
-
return apiEndpoints;
|
|
82
|
-
}
|
|
83
|
-
if (typeof window !== "undefined") {
|
|
84
|
-
const data = sessionStorage.getItem(STORAGE_KEY);
|
|
85
|
-
if (data) {
|
|
86
|
-
apiEndpoints = JSON.parse(data);
|
|
87
|
-
return apiEndpoints;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
throw new Error(
|
|
91
|
-
"Api Endpoints not initialized. Please render <ApiEndpointsProvider apiEndpoints={ApiEndPoints} /> once before using FlowCore."
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
var ApiEndpointsProvider_default = ApiEndpointsProvider;
|
|
95
|
-
|
|
96
|
-
// src/components/Service/ApiServicepackage.js
|
|
97
|
-
var apiService = null;
|
|
98
|
-
var ApiServicepackage = ({ apiService: service }) => {
|
|
99
|
-
if (service) {
|
|
100
|
-
apiService = service;
|
|
101
|
-
}
|
|
102
|
-
return null;
|
|
103
|
-
};
|
|
104
|
-
var getApiService = () => {
|
|
105
|
-
if (apiService) {
|
|
106
|
-
return apiService;
|
|
107
|
-
}
|
|
108
|
-
throw new Error(
|
|
109
|
-
"ApiService not initialized. Please render <ApiServicepackage apiService={ApiService} /> once before using FlowCore."
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
var ApiServicepackage_default = ApiServicepackage;
|
|
138
|
+
init_ApiEndpointsProvider();
|
|
139
|
+
init_ApiServicepackage();
|
|
113
140
|
|
|
114
141
|
// src/components/workflow/SearchBar.jsx
|
|
115
142
|
var import_react = __toESM(require("react"));
|
|
@@ -551,6 +578,8 @@ function WorkflowTable({ pageSize, searchQuery, apiData, onEdit, onDeleteApi })
|
|
|
551
578
|
// src/components/workflow/AddWorkflowModal.jsx
|
|
552
579
|
var import_react4 = __toESM(require("react"));
|
|
553
580
|
var import_sweetalert2 = __toESM(require("sweetalert2"));
|
|
581
|
+
init_ApiEndpointsProvider();
|
|
582
|
+
init_ApiServicepackage();
|
|
554
583
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
555
584
|
var INITIAL_FORM = {
|
|
556
585
|
workflowTypeId: "",
|
|
@@ -1905,6 +1934,8 @@ function WorkflowTypeTable({
|
|
|
1905
1934
|
// src/components/workflow-type/AddWorkflowTypeModal.jsx
|
|
1906
1935
|
var import_react14 = __toESM(require("react"));
|
|
1907
1936
|
var import_sweetalert24 = __toESM(require("sweetalert2"));
|
|
1937
|
+
init_ApiEndpointsProvider();
|
|
1938
|
+
init_ApiServicepackage();
|
|
1908
1939
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1909
1940
|
var initialFormData = {
|
|
1910
1941
|
workflowTypeCode: "",
|
|
@@ -2025,6 +2056,8 @@ var FormField = ({ label, required, error, children }) => /* @__PURE__ */ (0, im
|
|
|
2025
2056
|
var AddWorkflowTypeModal_default = AddWorkflowTypeModal;
|
|
2026
2057
|
|
|
2027
2058
|
// src/components/workflow-type/WorkflowTypeMains.js
|
|
2059
|
+
init_ApiEndpointsProvider();
|
|
2060
|
+
init_ApiServicepackage();
|
|
2028
2061
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2029
2062
|
function WorkflowTypeMains() {
|
|
2030
2063
|
const [refreshkey, setRefreshKey] = (0, import_react15.useState)(0);
|
|
@@ -2160,6 +2193,8 @@ function Footer() {
|
|
|
2160
2193
|
// src/components/WorkflowStep/AddWorkflowStepModal.js
|
|
2161
2194
|
var import_react17 = __toESM(require("react"));
|
|
2162
2195
|
var import_sweetalert26 = __toESM(require("sweetalert2"));
|
|
2196
|
+
init_ApiEndpointsProvider();
|
|
2197
|
+
init_ApiServicepackage();
|
|
2163
2198
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2164
2199
|
function AddWorkflowStepModal({ onClose, onSave }) {
|
|
2165
2200
|
const [formData, setFormData] = (0, import_react17.useState)({
|
|
@@ -2576,6 +2611,8 @@ function AddWorkflowStepModal({ onClose, onSave }) {
|
|
|
2576
2611
|
// src/components/WorkflowStep/EditWorkflowStepModal.js
|
|
2577
2612
|
var import_react18 = __toESM(require("react"));
|
|
2578
2613
|
var import_sweetalert27 = __toESM(require("sweetalert2"));
|
|
2614
|
+
init_ApiEndpointsProvider();
|
|
2615
|
+
init_ApiServicepackage();
|
|
2579
2616
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2580
2617
|
function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
|
|
2581
2618
|
const [formData, setFormData] = (0, import_react18.useState)({
|
|
@@ -3000,6 +3037,8 @@ function EditWorkflowStepModal({ isOpen, onClose, onSave, selectedData }) {
|
|
|
3000
3037
|
}
|
|
3001
3038
|
|
|
3002
3039
|
// src/components/WorkflowStep/main.js
|
|
3040
|
+
init_ApiEndpointsProvider();
|
|
3041
|
+
init_ApiServicepackage();
|
|
3003
3042
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3004
3043
|
function WorkflowStep() {
|
|
3005
3044
|
const tableRef = (0, import_react19.useRef)(null);
|
|
@@ -3863,9 +3902,13 @@ function WorkFlowTransition() {
|
|
|
3863
3902
|
// src/components/user-hierarchy-node-mapping/user_hierarachy_node_main.jsx
|
|
3864
3903
|
var import_react27 = __toESM(require("react"));
|
|
3865
3904
|
var import_sweetalert29 = __toESM(require("sweetalert2"));
|
|
3905
|
+
init_ApiEndpointsProvider();
|
|
3906
|
+
init_ApiServicepackage();
|
|
3866
3907
|
|
|
3867
3908
|
// src/components/user-hierarchy-node-mapping/adduserhierarchynode.jsx
|
|
3868
3909
|
var import_react22 = __toESM(require("react"));
|
|
3910
|
+
init_ApiEndpointsProvider();
|
|
3911
|
+
init_ApiServicepackage();
|
|
3869
3912
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3870
3913
|
function AddUserHierarchyNodeMappingModal({
|
|
3871
3914
|
isOpen,
|
|
@@ -4532,6 +4575,8 @@ function User_hierarchy_mapping_main() {
|
|
|
4532
4575
|
// src/components/user-hierarchy-node-mapping/Workflow_Step_Hierarchy_Mapping.jsx
|
|
4533
4576
|
var import_react28 = __toESM(require("react"));
|
|
4534
4577
|
var import_sweetalert210 = __toESM(require("sweetalert2"));
|
|
4578
|
+
init_ApiEndpointsProvider();
|
|
4579
|
+
init_ApiServicepackage();
|
|
4535
4580
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4536
4581
|
var emptyForm = { workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
|
|
4537
4582
|
var getRows = (result) => {
|
|
@@ -5010,6 +5055,9 @@ function Workflow_Step_Hierarchy_Mapping() {
|
|
|
5010
5055
|
|
|
5011
5056
|
// src/components/document-configuration/DocumentConfigurationmain.jsx
|
|
5012
5057
|
var import_react34 = __toESM(require("react"));
|
|
5058
|
+
var import_sweetalert212 = __toESM(require("sweetalert2"));
|
|
5059
|
+
init_ApiEndpointsProvider();
|
|
5060
|
+
init_ApiServicepackage();
|
|
5013
5061
|
|
|
5014
5062
|
// src/components/document-configuration/SearchBar.jsx
|
|
5015
5063
|
var import_react29 = __toESM(require("react"));
|
|
@@ -5030,9 +5078,12 @@ function SearchBar3({
|
|
|
5030
5078
|
|
|
5031
5079
|
// src/components/document-configuration/DocumentConfigurationTable.jsx
|
|
5032
5080
|
var import_react32 = __toESM(require("react"));
|
|
5081
|
+
var import_sweetalert211 = __toESM(require("sweetalert2"));
|
|
5033
5082
|
|
|
5034
5083
|
// src/components/document-configuration/Edit.jsx
|
|
5035
5084
|
var import_react30 = __toESM(require("react"));
|
|
5085
|
+
init_ApiEndpointsProvider();
|
|
5086
|
+
init_ApiServicepackage();
|
|
5036
5087
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5037
5088
|
function EditDocumentConfiguration({
|
|
5038
5089
|
isOpen,
|
|
@@ -5050,6 +5101,27 @@ function EditDocumentConfiguration({
|
|
|
5050
5101
|
status: "Active"
|
|
5051
5102
|
});
|
|
5052
5103
|
const [errors, setErrors] = (0, import_react30.useState)({});
|
|
5104
|
+
const [workflowSteps, setWorkflowSteps] = (0, import_react30.useState)([]);
|
|
5105
|
+
const [loadingSteps, setLoadingSteps] = (0, import_react30.useState)(false);
|
|
5106
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react30.useState)(false);
|
|
5107
|
+
(0, import_react30.useEffect)(() => {
|
|
5108
|
+
if (!isOpen) return;
|
|
5109
|
+
(async () => {
|
|
5110
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5111
|
+
try {
|
|
5112
|
+
setLoadingSteps(true);
|
|
5113
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
5114
|
+
if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
|
|
5115
|
+
const result = await getApiService().get(endpoint);
|
|
5116
|
+
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;
|
|
5117
|
+
setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
|
|
5118
|
+
} catch (_) {
|
|
5119
|
+
setWorkflowSteps([]);
|
|
5120
|
+
} finally {
|
|
5121
|
+
setLoadingSteps(false);
|
|
5122
|
+
}
|
|
5123
|
+
})();
|
|
5124
|
+
}, [isOpen]);
|
|
5053
5125
|
(0, import_react30.useEffect)(() => {
|
|
5054
5126
|
if (initialData) {
|
|
5055
5127
|
const sizeParts = (initialData.maxSize || "10 MB").split(" ");
|
|
@@ -5089,19 +5161,24 @@ function EditDocumentConfiguration({
|
|
|
5089
5161
|
setErrors(newErrors);
|
|
5090
5162
|
return Object.keys(newErrors).length === 0;
|
|
5091
5163
|
};
|
|
5092
|
-
const handleSubmit = (e) => {
|
|
5164
|
+
const handleSubmit = async (e) => {
|
|
5093
5165
|
e.preventDefault();
|
|
5094
5166
|
if (!validateForm()) return;
|
|
5095
5167
|
const payload = __spreadProps(__spreadValues({}, initialData), {
|
|
5096
5168
|
docName: formData.docName.trim(),
|
|
5097
|
-
stepId: formData.stepId.trim(),
|
|
5169
|
+
stepId: String(formData.stepId).trim(),
|
|
5098
5170
|
extensions: formData.extensions.trim(),
|
|
5099
5171
|
maxSize: `${formData.maxSizeNum} ${formData.maxSizeUnit}`,
|
|
5100
5172
|
isMandatory: formData.isMandatory,
|
|
5101
5173
|
status: formData.status
|
|
5102
5174
|
});
|
|
5103
|
-
|
|
5104
|
-
|
|
5175
|
+
setIsSubmitting(true);
|
|
5176
|
+
try {
|
|
5177
|
+
const saved = await onSave(payload);
|
|
5178
|
+
if (saved) onClose();
|
|
5179
|
+
} finally {
|
|
5180
|
+
setIsSubmitting(false);
|
|
5181
|
+
}
|
|
5105
5182
|
};
|
|
5106
5183
|
if (!isOpen) return null;
|
|
5107
5184
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/10 fc:p-4", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "fc:bg-white fc:rounded-2xl fc:shadow-2xl fc:border fc:border-gray-100 fc:w-full fc:max-w-2xl fc:overflow-hidden fc:transition-all", children: [
|
|
@@ -5130,7 +5207,15 @@ function EditDocumentConfiguration({
|
|
|
5130
5207
|
"Workflow Step ID ",
|
|
5131
5208
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
5132
5209
|
] }),
|
|
5133
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.
|
|
5210
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("select", { name: "stepId", value: formData.stepId, onChange: handleChange, disabled: loadingSteps, className: `fc:w-full fc:px-3 fc:py-2.5 fc:text-sm fc:bg-white fc:border fc:rounded-lg focus:fc:ring-2 focus:fc:ring-blue-500/20 focus:fc:border-[#2563eb] fc:outline-none fc:transition disabled:fc:opacity-60${errors.stepId ? "border-red-500" : "border-gray-200"}`, children: [
|
|
5211
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: "", children: loadingSteps ? "Loading workflow steps..." : "Select workflow step" }),
|
|
5212
|
+
workflowSteps.map((step) => {
|
|
5213
|
+
var _a, _b, _c, _d;
|
|
5214
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5215
|
+
const name = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : `Step ${id}`;
|
|
5216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("option", { value: id, children: name }, id);
|
|
5217
|
+
})
|
|
5218
|
+
] }),
|
|
5134
5219
|
errors.stepId && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fc:text-xs fc:text-red-500", children: errors.stepId })
|
|
5135
5220
|
] }),
|
|
5136
5221
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
@@ -5175,7 +5260,7 @@ function EditDocumentConfiguration({
|
|
|
5175
5260
|
] }) }),
|
|
5176
5261
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "fc:flex fc:justify-end fc:items-center fc:gap-3 fc:pt-2", children: [
|
|
5177
5262
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "button", onClick: onClose, className: "fc:px-5 fc:py-2.5 fc:text-sm fc:font-medium fc:text-gray-600 fc:bg-gray-100 hover:fc:bg-gray-200 fc:rounded-xl fc:transition", children: "Cancel" }),
|
|
5178
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "submit", className: "fc:px-6 fc:py-2.5 fc:text-sm fc:font-semibold fc:text-white fc:bg-[#2563eb] hover:fc:bg-[#1d4ed8] active:fc:scale-95 fc:rounded-xl fc:shadow-md fc:transition-all fc:flex fc:items-center fc:gap-2", children: "Save Document" })
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("button", { type: "submit", disabled: isSubmitting, className: "fc:px-6 fc:py-2.5 fc:text-sm fc:font-semibold fc:text-white fc:bg-[#2563eb] hover:fc:bg-[#1d4ed8] active:fc:scale-95 fc:rounded-xl fc:shadow-md fc:transition-all fc:flex fc:items-center fc:gap-2 disabled:fc:opacity-60", children: isSubmitting ? "Saving..." : "Save Document" })
|
|
5179
5264
|
] })
|
|
5180
5265
|
] })
|
|
5181
5266
|
] }) });
|
|
@@ -5224,6 +5309,8 @@ function DeleteDocumentConfiguration({
|
|
|
5224
5309
|
}
|
|
5225
5310
|
|
|
5226
5311
|
// src/components/document-configuration/DocumentConfigurationTable.jsx
|
|
5312
|
+
init_ApiEndpointsProvider();
|
|
5313
|
+
init_ApiServicepackage();
|
|
5227
5314
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5228
5315
|
function DocumentConfigTable({
|
|
5229
5316
|
pageSize,
|
|
@@ -5459,12 +5546,48 @@ function DocumentConfigTable({
|
|
|
5459
5546
|
status: "Active"
|
|
5460
5547
|
}
|
|
5461
5548
|
];
|
|
5462
|
-
const [data, setData] = (0, import_react32.useState)(
|
|
5549
|
+
const [data, setData] = (0, import_react32.useState)([]);
|
|
5550
|
+
const [isLoading, setIsLoading] = (0, import_react32.useState)(false);
|
|
5463
5551
|
const [sortOrder, setSortOrder] = (0, import_react32.useState)("asc");
|
|
5464
5552
|
const [sortKey, setSortKey] = (0, import_react32.useState)("docName");
|
|
5465
5553
|
const [isEditOpen, setIsEditOpen] = (0, import_react32.useState)(false);
|
|
5466
5554
|
const [isDeleteOpen, setIsDeleteOpen] = (0, import_react32.useState)(false);
|
|
5467
5555
|
const [selectedItem, setSelectedItem] = (0, import_react32.useState)(null);
|
|
5556
|
+
const unwrapRows = (result) => {
|
|
5557
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5558
|
+
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;
|
|
5559
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
5560
|
+
};
|
|
5561
|
+
const toUiItem = (item) => {
|
|
5562
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
5563
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
5564
|
+
id: (_b = (_a = item.documentConfigurationId) != null ? _a : item.DocumentConfigurationId) != null ? _b : item.id,
|
|
5565
|
+
docName: (_e = (_d = (_c = item.documentName) != null ? _c : item.DocumentName) != null ? _d : item.docName) != null ? _e : "",
|
|
5566
|
+
stepId: String((_h = (_g = (_f = item.workflowStepId) != null ? _f : item.WorkflowStepId) != null ? _g : item.stepId) != null ? _h : ""),
|
|
5567
|
+
extensions: (_k = (_j = (_i = item.allowedExtensions) != null ? _i : item.AllowedExtensions) != null ? _j : item.extensions) != null ? _k : "",
|
|
5568
|
+
maxSize: `${(_n = (_m = (_l = item.maxSizeMB) != null ? _l : item.MaxSizeMB) != null ? _m : item.maxSize) != null ? _n : ""} MB`,
|
|
5569
|
+
isMandatory: Boolean((_o = item.isMandatory) != null ? _o : item.IsMandatory),
|
|
5570
|
+
status: ((_q = (_p = item.isActive) != null ? _p : item.IsActive) != null ? _q : item.status !== "Inactive") ? "Active" : "Inactive"
|
|
5571
|
+
});
|
|
5572
|
+
};
|
|
5573
|
+
const loadData = async () => {
|
|
5574
|
+
var _a, _b, _c, _d, _e;
|
|
5575
|
+
try {
|
|
5576
|
+
setIsLoading(true);
|
|
5577
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
|
|
5578
|
+
if (!endpoint) throw new Error("Document Configuration list endpoint is not configured.");
|
|
5579
|
+
const result = await getApiService().post(endpoint, {});
|
|
5580
|
+
setData(unwrapRows(result).map(toUiItem));
|
|
5581
|
+
} catch (error) {
|
|
5582
|
+
setData([]);
|
|
5583
|
+
await import_sweetalert211.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");
|
|
5584
|
+
} finally {
|
|
5585
|
+
setIsLoading(false);
|
|
5586
|
+
}
|
|
5587
|
+
};
|
|
5588
|
+
(0, import_react32.useEffect)(() => {
|
|
5589
|
+
loadData();
|
|
5590
|
+
}, []);
|
|
5468
5591
|
const handleSort = (columnKey) => {
|
|
5469
5592
|
const isAsc = sortKey === columnKey && sortOrder === "asc";
|
|
5470
5593
|
setSortOrder(isAsc ? "desc" : "asc");
|
|
@@ -5478,7 +5601,7 @@ function DocumentConfigTable({
|
|
|
5478
5601
|
};
|
|
5479
5602
|
const filteredData = data.filter((item) => {
|
|
5480
5603
|
const query = (searchQuery || "").toLowerCase();
|
|
5481
|
-
return item.docName.toLowerCase().includes(query) || item.extensions.toLowerCase().includes(query) || item.stepId.toLowerCase().includes(query);
|
|
5604
|
+
return String(item.docName).toLowerCase().includes(query) || String(item.extensions).toLowerCase().includes(query) || String(item.stepId).toLowerCase().includes(query);
|
|
5482
5605
|
});
|
|
5483
5606
|
(0, import_react32.useEffect)(() => {
|
|
5484
5607
|
if (setTotalEntries) setTotalEntries(filteredData.length);
|
|
@@ -5492,30 +5615,54 @@ function DocumentConfigTable({
|
|
|
5492
5615
|
},
|
|
5493
5616
|
(_, i) => i + 1
|
|
5494
5617
|
);
|
|
5495
|
-
const
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
(item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
|
|
5499
|
-
isMandatory: !item.isMandatory
|
|
5500
|
-
}) : item
|
|
5501
|
-
)
|
|
5502
|
-
);
|
|
5618
|
+
const buildGetByIdUrl = (endpoint, id) => {
|
|
5619
|
+
if (endpoint.includes("{id}")) return endpoint.replace("{id}", encodeURIComponent(id));
|
|
5620
|
+
return `${endpoint.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
|
|
5503
5621
|
};
|
|
5504
|
-
const handleEdit = (item) => {
|
|
5505
|
-
|
|
5506
|
-
|
|
5622
|
+
const handleEdit = async (item) => {
|
|
5623
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5624
|
+
try {
|
|
5625
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
|
|
5626
|
+
if (!endpoint) throw new Error("Document Configuration get-by-id endpoint is not configured.");
|
|
5627
|
+
const result = await getApiService().get(buildGetByIdUrl(endpoint, item.id));
|
|
5628
|
+
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;
|
|
5629
|
+
setSelectedItem(toUiItem(value != null ? value : item));
|
|
5630
|
+
setIsEditOpen(true);
|
|
5631
|
+
} catch (error) {
|
|
5632
|
+
await import_sweetalert211.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");
|
|
5633
|
+
}
|
|
5507
5634
|
};
|
|
5508
5635
|
const handleDelete = (item) => {
|
|
5509
5636
|
setSelectedItem(item);
|
|
5510
5637
|
setIsDeleteOpen(true);
|
|
5511
5638
|
};
|
|
5512
|
-
const handleSaveEdit = (updatedData) => {
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5639
|
+
const handleSaveEdit = async (updatedData) => {
|
|
5640
|
+
var _a, _b, _c, _d, _e;
|
|
5641
|
+
try {
|
|
5642
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
|
|
5643
|
+
if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
|
|
5644
|
+
await getApiService().put(endpoint, {
|
|
5645
|
+
documentConfigurationId: updatedData.id,
|
|
5646
|
+
documentName: updatedData.docName.trim(),
|
|
5647
|
+
allowedExtensions: updatedData.extensions.trim(),
|
|
5648
|
+
maxSizeMB: Number(updatedData.maxSizeNum),
|
|
5649
|
+
isMandatory: Boolean(updatedData.isMandatory),
|
|
5650
|
+
isActive: updatedData.status === "Active",
|
|
5651
|
+
updatedBy: "System"
|
|
5652
|
+
});
|
|
5653
|
+
await import_sweetalert211.default.fire("Success", "Document configuration updated successfully.", "success");
|
|
5654
|
+
setIsEditOpen(false);
|
|
5655
|
+
await loadData();
|
|
5656
|
+
return true;
|
|
5657
|
+
} catch (error) {
|
|
5658
|
+
await import_sweetalert211.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to update document configuration.", "error");
|
|
5659
|
+
return false;
|
|
5660
|
+
}
|
|
5516
5661
|
};
|
|
5517
|
-
const handleConfirmDelete = (id) => {
|
|
5518
|
-
|
|
5662
|
+
const handleConfirmDelete = async (id) => {
|
|
5663
|
+
const item = data.find((record) => record.id === id);
|
|
5664
|
+
if (!item) return false;
|
|
5665
|
+
return handleSaveEdit(__spreadProps(__spreadValues({}, item), { maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""), status: "Inactive" }));
|
|
5519
5666
|
};
|
|
5520
5667
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "fc:space-y-5", children: [
|
|
5521
5668
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "fc:w-full fc:overflow-x-auto fc:border fc:border-slate-200 fc:rounded-2xl fc:shadow-sm fc:max-h-[420px] fc:overflow-y-auto fc:custom-scrollbar", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-fixed fc:min-w-[1050px]", children: [
|
|
@@ -5582,7 +5729,7 @@ function DocumentConfigTable({
|
|
|
5582
5729
|
),
|
|
5583
5730
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("th", { className: "fc:py-4 fc:px-2 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:text-slate-900 fc:bg-slate-50 fc:text-center fc:w-38", children: "Action" })
|
|
5584
5731
|
] }) }),
|
|
5585
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5732
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { colSpan: 8, className: "fc:py-10 fc:text-center fc:text-slate-400", children: "Loading document configurations..." }) }) : visibleData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { colSpan: 8, className: "fc:py-10 fc:text-center fc:text-slate-400", children: "No records found." }) }) : visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
5586
5733
|
"tr",
|
|
5587
5734
|
{
|
|
5588
5735
|
className: "hover:fc:bg-slate-50/50 fc:transition-colors",
|
|
@@ -5602,7 +5749,10 @@ function DocumentConfigTable({
|
|
|
5602
5749
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5603
5750
|
"button",
|
|
5604
5751
|
{
|
|
5605
|
-
onClick: () =>
|
|
5752
|
+
onClick: () => handleSaveEdit(__spreadProps(__spreadValues({}, item), {
|
|
5753
|
+
maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""),
|
|
5754
|
+
isMandatory: !item.isMandatory
|
|
5755
|
+
})),
|
|
5606
5756
|
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.isMandatory ? "fc:bg-blue-600" : "fc:bg-gray-200"}`,
|
|
5607
5757
|
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5608
5758
|
"span",
|
|
@@ -5690,7 +5840,8 @@ var import_react33 = __toESM(require("react"));
|
|
|
5690
5840
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
5691
5841
|
function AddDocumentConfigModal({
|
|
5692
5842
|
isOpen,
|
|
5693
|
-
onClose
|
|
5843
|
+
onClose,
|
|
5844
|
+
onSave
|
|
5694
5845
|
}) {
|
|
5695
5846
|
const [isMandatory, setIsMandatory] = (0, import_react33.useState)(false);
|
|
5696
5847
|
const [status, setStatus] = (0, import_react33.useState)("Active");
|
|
@@ -5699,7 +5850,41 @@ function AddDocumentConfigModal({
|
|
|
5699
5850
|
const [maxSize, setMaxSize] = (0, import_react33.useState)("");
|
|
5700
5851
|
const [allowedExtensions, setAllowedExtensions] = (0, import_react33.useState)("");
|
|
5701
5852
|
const [errors, setErrors] = (0, import_react33.useState)({});
|
|
5702
|
-
const
|
|
5853
|
+
const [workflowSteps, setWorkflowSteps] = (0, import_react33.useState)([]);
|
|
5854
|
+
const [loadingSteps, setLoadingSteps] = (0, import_react33.useState)(false);
|
|
5855
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react33.useState)(false);
|
|
5856
|
+
(0, import_react33.useEffect)(() => {
|
|
5857
|
+
if (!isOpen) return;
|
|
5858
|
+
(async () => {
|
|
5859
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5860
|
+
try {
|
|
5861
|
+
setLoadingSteps(true);
|
|
5862
|
+
const { getApiEndpoints: getApiEndpoints2 } = await Promise.resolve().then(() => (init_ApiEndpointsProvider(), ApiEndpointsProvider_exports));
|
|
5863
|
+
const { getApiService: getApiService2 } = await Promise.resolve().then(() => (init_ApiServicepackage(), ApiServicepackage_exports));
|
|
5864
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints2()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
5865
|
+
if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
|
|
5866
|
+
const result = await getApiService2().get(endpoint);
|
|
5867
|
+
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;
|
|
5868
|
+
setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
|
|
5869
|
+
} catch (_) {
|
|
5870
|
+
setWorkflowSteps([]);
|
|
5871
|
+
} finally {
|
|
5872
|
+
setLoadingSteps(false);
|
|
5873
|
+
}
|
|
5874
|
+
})();
|
|
5875
|
+
}, [isOpen]);
|
|
5876
|
+
(0, import_react33.useEffect)(() => {
|
|
5877
|
+
if (!isOpen) {
|
|
5878
|
+
setDocumentName("");
|
|
5879
|
+
setStepId("");
|
|
5880
|
+
setMaxSize("");
|
|
5881
|
+
setAllowedExtensions("");
|
|
5882
|
+
setIsMandatory(false);
|
|
5883
|
+
setStatus("Active");
|
|
5884
|
+
setErrors({});
|
|
5885
|
+
}
|
|
5886
|
+
}, [isOpen]);
|
|
5887
|
+
const handleSave = async () => {
|
|
5703
5888
|
let newErrors = {};
|
|
5704
5889
|
if (!documentName.trim()) {
|
|
5705
5890
|
newErrors.documentName = "Document Name is required";
|
|
@@ -5715,7 +5900,19 @@ function AddDocumentConfigModal({
|
|
|
5715
5900
|
}
|
|
5716
5901
|
setErrors(newErrors);
|
|
5717
5902
|
if (Object.keys(newErrors).length === 0) {
|
|
5718
|
-
|
|
5903
|
+
setIsSubmitting(true);
|
|
5904
|
+
try {
|
|
5905
|
+
await (onSave == null ? void 0 : onSave({
|
|
5906
|
+
workflowStepId: Number(stepId),
|
|
5907
|
+
documentName: documentName.trim(),
|
|
5908
|
+
allowedExtensions: allowedExtensions.trim(),
|
|
5909
|
+
maxSizeMB: Number(maxSize),
|
|
5910
|
+
isMandatory: Boolean(isMandatory),
|
|
5911
|
+
createdBy: "System"
|
|
5912
|
+
}));
|
|
5913
|
+
} finally {
|
|
5914
|
+
setIsSubmitting(false);
|
|
5915
|
+
}
|
|
5719
5916
|
}
|
|
5720
5917
|
};
|
|
5721
5918
|
if (!isOpen) return null;
|
|
@@ -5747,10 +5944,18 @@ function AddDocumentConfigModal({
|
|
|
5747
5944
|
"Workflow Step ID ",
|
|
5748
5945
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
5749
5946
|
] }),
|
|
5750
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.
|
|
5947
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("select", { value: stepId, disabled: loadingSteps, onChange: (e) => {
|
|
5751
5948
|
setStepId(e.target.value);
|
|
5752
5949
|
if (errors.stepId) setErrors(__spreadProps(__spreadValues({}, errors), { stepId: "" }));
|
|
5753
|
-
}, className: `fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:text-align-left fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 fc:
|
|
5950
|
+
}, className: `fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:text-align-left fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 fc:text-slate-700 disabled:fc:opacity-60 ${errors.stepId ? `fc:border-red-500 fc:ring-1 fc:ring-red-500` : `fc:border-slate-200 fc:border-indigo-500`}`, children: [
|
|
5951
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "", children: loadingSteps ? "Loading workflow steps..." : "Select workflow step" }),
|
|
5952
|
+
workflowSteps.map((step) => {
|
|
5953
|
+
var _a, _b, _c, _d;
|
|
5954
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5955
|
+
const name = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : `Step ${id}`;
|
|
5956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: id, children: name }, id);
|
|
5957
|
+
})
|
|
5958
|
+
] }),
|
|
5754
5959
|
errors.stepId && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "fc:text-red-500 fc:text-xs", children: errors.stepId })
|
|
5755
5960
|
] })
|
|
5756
5961
|
] }),
|
|
@@ -5822,7 +6027,7 @@ function AddDocumentConfigModal({
|
|
|
5822
6027
|
] }),
|
|
5823
6028
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-3 fc:px-8 fc:py-4 fc:border-t fc:border-slate-100 fc:bg-white", children: [
|
|
5824
6029
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: onClose, className: "fc:px-5 fc:py-2.5 fc:text-sm fc:font-medium fc:text-gray-600 fc:bg-gray-100 hover:fc:fc:bg-gray-200 fc:rounded-xl fc:transition", children: "\u2715 Cancel" }),
|
|
5825
|
-
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: handleSave, className: "fc:px-5 fc:py-2 fc:text-xs fc:font-bold fc:text-white fc:bg-blue-600 hover:fc:bg-blue-700 fc:rounded-xl fc:transition-all fc:shadow-sm", children: "Save Rules" })
|
|
6030
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("button", { onClick: handleSave, disabled: isSubmitting, className: "fc:px-5 fc:py-2 fc:text-xs fc:font-bold fc:text-white fc:bg-blue-600 hover:fc:bg-blue-700 fc:rounded-xl fc:transition-all fc:shadow-sm disabled:fc:opacity-60", children: isSubmitting ? "Saving..." : "Save Rules" })
|
|
5826
6031
|
] })
|
|
5827
6032
|
] })
|
|
5828
6033
|
] });
|
|
@@ -5842,6 +6047,21 @@ function DocumentConfigurationmain() {
|
|
|
5842
6047
|
const [searchQuery, setSearchQuery] = (0, import_react34.useState)("");
|
|
5843
6048
|
const [currentPage, setCurrentPage] = (0, import_react34.useState)(1);
|
|
5844
6049
|
const [totalEntries, setTotalEntries] = (0, import_react34.useState)(0);
|
|
6050
|
+
const handleCreate = async (payload) => {
|
|
6051
|
+
var _a, _b, _c, _d, _e;
|
|
6052
|
+
try {
|
|
6053
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
|
|
6054
|
+
if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
|
|
6055
|
+
await getApiService().post(endpoint, payload);
|
|
6056
|
+
await import_sweetalert212.default.fire("Success", "Document configuration created successfully.", "success");
|
|
6057
|
+
setModalOpen(false);
|
|
6058
|
+
handleRefresh();
|
|
6059
|
+
return true;
|
|
6060
|
+
} catch (error) {
|
|
6061
|
+
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 create document configuration.", "error");
|
|
6062
|
+
return false;
|
|
6063
|
+
}
|
|
6064
|
+
};
|
|
5845
6065
|
const handlePageSizeChange = (e) => {
|
|
5846
6066
|
setPageSize(Number(e.target.value));
|
|
5847
6067
|
setCurrentPage(1);
|
|
@@ -5876,7 +6096,7 @@ function DocumentConfigurationmain() {
|
|
|
5876
6096
|
] }),
|
|
5877
6097
|
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DocumentConfigTable, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries }, refreshkey) })
|
|
5878
6098
|
] }) }),
|
|
5879
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddDocumentConfigModal, { isOpen: modalOpen, onClose: () => setModalOpen(false) })
|
|
6099
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(AddDocumentConfigModal, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: handleCreate })
|
|
5880
6100
|
] });
|
|
5881
6101
|
}
|
|
5882
6102
|
|
|
@@ -6897,7 +7117,7 @@ function MovementHistorymain() {
|
|
|
6897
7117
|
|
|
6898
7118
|
// src/components/task-permission/TaskPermissionMain.jsx
|
|
6899
7119
|
var import_react47 = __toESM(require("react"));
|
|
6900
|
-
var
|
|
7120
|
+
var import_sweetalert214 = __toESM(require("sweetalert2"));
|
|
6901
7121
|
|
|
6902
7122
|
// src/components/task-permission/SearchBar.js
|
|
6903
7123
|
var import_react43 = __toESM(require("react"));
|
|
@@ -6929,6 +7149,8 @@ function SearchBar6({
|
|
|
6929
7149
|
|
|
6930
7150
|
// src/components/task-permission/Table.js
|
|
6931
7151
|
var import_react44 = __toESM(require("react"));
|
|
7152
|
+
init_ApiEndpointsProvider();
|
|
7153
|
+
init_ApiServicepackage();
|
|
6932
7154
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6933
7155
|
function Table({
|
|
6934
7156
|
pageSize,
|
|
@@ -7166,7 +7388,9 @@ function Table({
|
|
|
7166
7388
|
|
|
7167
7389
|
// src/components/task-permission/Popup.js
|
|
7168
7390
|
var import_react45 = __toESM(require("react"));
|
|
7169
|
-
var
|
|
7391
|
+
var import_sweetalert213 = __toESM(require("sweetalert2"));
|
|
7392
|
+
init_ApiEndpointsProvider();
|
|
7393
|
+
init_ApiServicepackage();
|
|
7170
7394
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
7171
7395
|
function Popup({ isOpen, onClose, onSave }) {
|
|
7172
7396
|
const [formData, setFormData] = (0, import_react45.useState)({
|
|
@@ -7236,7 +7460,7 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7236
7460
|
await (onSave == null ? void 0 : onSave());
|
|
7237
7461
|
} catch (error) {
|
|
7238
7462
|
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 task permission.";
|
|
7239
|
-
await
|
|
7463
|
+
await import_sweetalert213.default.fire("Error", msg, "error");
|
|
7240
7464
|
} finally {
|
|
7241
7465
|
setIsSubmitting(false);
|
|
7242
7466
|
}
|
|
@@ -7359,6 +7583,8 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7359
7583
|
|
|
7360
7584
|
// src/components/task-permission/EditTaskPermissionModal.js
|
|
7361
7585
|
var import_react46 = __toESM(require("react"));
|
|
7586
|
+
init_ApiEndpointsProvider();
|
|
7587
|
+
init_ApiServicepackage();
|
|
7362
7588
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
7363
7589
|
function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpdate }) {
|
|
7364
7590
|
var _a;
|
|
@@ -7577,6 +7803,8 @@ function EditTaskPermissionModal({ isOpen, onClose, onSave, selectedData, onUpda
|
|
|
7577
7803
|
}
|
|
7578
7804
|
|
|
7579
7805
|
// src/components/task-permission/TaskPermissionMain.jsx
|
|
7806
|
+
init_ApiEndpointsProvider();
|
|
7807
|
+
init_ApiServicepackage();
|
|
7580
7808
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
7581
7809
|
function TaskPermissionMain() {
|
|
7582
7810
|
const [refreshkey, setRefreshKey] = (0, import_react47.useState)(0);
|
|
@@ -7635,13 +7863,13 @@ function TaskPermissionMain() {
|
|
|
7635
7863
|
handleRefresh();
|
|
7636
7864
|
return true;
|
|
7637
7865
|
} catch (error) {
|
|
7638
|
-
await
|
|
7866
|
+
await import_sweetalert214.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 task permission.", "error");
|
|
7639
7867
|
return false;
|
|
7640
7868
|
}
|
|
7641
7869
|
};
|
|
7642
7870
|
const handleDeleteApi = async (item) => {
|
|
7643
7871
|
var _a;
|
|
7644
|
-
const confirm = await
|
|
7872
|
+
const confirm = await import_sweetalert214.default.fire({
|
|
7645
7873
|
title: "Delete Task Permission?",
|
|
7646
7874
|
text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
|
|
7647
7875
|
icon: "warning",
|
|
@@ -7651,7 +7879,7 @@ function TaskPermissionMain() {
|
|
|
7651
7879
|
});
|
|
7652
7880
|
if (!confirm.isConfirmed) return;
|
|
7653
7881
|
const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
|
|
7654
|
-
if (ok) await
|
|
7882
|
+
if (ok) await import_sweetalert214.default.fire("Deleted", "Task permission has been deactivated.", "success");
|
|
7655
7883
|
};
|
|
7656
7884
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
|
|
7657
7885
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
@@ -7704,7 +7932,7 @@ function TaskPermissionMain() {
|
|
|
7704
7932
|
isOpen: showModal,
|
|
7705
7933
|
onClose: () => setShowModal(false),
|
|
7706
7934
|
onSave: async () => {
|
|
7707
|
-
await
|
|
7935
|
+
await import_sweetalert214.default.fire("Success", "Task permission created successfully.", "success");
|
|
7708
7936
|
handleRefresh();
|
|
7709
7937
|
}
|
|
7710
7938
|
}
|
|
@@ -7716,7 +7944,7 @@ function TaskPermissionMain() {
|
|
|
7716
7944
|
onClose: () => setIsEditOpen(false),
|
|
7717
7945
|
selectedData: selectedItem,
|
|
7718
7946
|
onSave: async () => {
|
|
7719
|
-
await
|
|
7947
|
+
await import_sweetalert214.default.fire("Success", "Task permission updated successfully.", "success");
|
|
7720
7948
|
handleRefresh();
|
|
7721
7949
|
},
|
|
7722
7950
|
onUpdate: handleUpdateApi
|
|
@@ -10286,7 +10514,9 @@ function Comment_main() {
|
|
|
10286
10514
|
|
|
10287
10515
|
// src/components/hierarchy-node/HierarchyNodeMain.jsx
|
|
10288
10516
|
var import_react71 = __toESM(require("react"));
|
|
10289
|
-
var
|
|
10517
|
+
var import_sweetalert215 = __toESM(require("sweetalert2"));
|
|
10518
|
+
init_ApiEndpointsProvider();
|
|
10519
|
+
init_ApiServicepackage();
|
|
10290
10520
|
|
|
10291
10521
|
// src/components/hierarchy-node/SearchBar.jsx
|
|
10292
10522
|
var import_react66 = __toESM(require("react"));
|
|
@@ -10890,7 +11120,7 @@ function HierarchyNodeMain() {
|
|
|
10890
11120
|
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;
|
|
10891
11121
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
10892
11122
|
} catch (error) {
|
|
10893
|
-
await
|
|
11123
|
+
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 load hierarchy nodes.", "error");
|
|
10894
11124
|
}
|
|
10895
11125
|
})();
|
|
10896
11126
|
}, [refreshKey]);
|
|
@@ -10903,11 +11133,11 @@ function HierarchyNodeMain() {
|
|
|
10903
11133
|
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
|
|
10904
11134
|
if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
|
|
10905
11135
|
await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
|
|
10906
|
-
await
|
|
11136
|
+
await import_sweetalert215.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
10907
11137
|
handleRefresh();
|
|
10908
11138
|
return true;
|
|
10909
11139
|
} catch (error) {
|
|
10910
|
-
await
|
|
11140
|
+
await import_sweetalert215.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");
|
|
10911
11141
|
return false;
|
|
10912
11142
|
}
|
|
10913
11143
|
};
|
|
@@ -13342,6 +13572,10 @@ var Layout = ({ children }) => {
|
|
|
13342
13572
|
) });
|
|
13343
13573
|
};
|
|
13344
13574
|
var Layout_default = Layout;
|
|
13575
|
+
|
|
13576
|
+
// src/pkg-index.jsx
|
|
13577
|
+
init_ApiEndpointsProvider();
|
|
13578
|
+
init_ApiServicepackage();
|
|
13345
13579
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13346
13580
|
0 && (module.exports = {
|
|
13347
13581
|
ApiEndpointsProvider,
|