flowcore-fn 9.4.9 → 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/pkg-index.js +144 -42
- package/dist/pkg-index.mjs +140 -42
- package/package.json +1 -1
package/dist/pkg-index.js
CHANGED
|
@@ -5055,7 +5055,7 @@ function Workflow_Step_Hierarchy_Mapping() {
|
|
|
5055
5055
|
|
|
5056
5056
|
// src/components/document-configuration/DocumentConfigurationmain.jsx
|
|
5057
5057
|
var import_react34 = __toESM(require("react"));
|
|
5058
|
-
var
|
|
5058
|
+
var import_sweetalert212 = __toESM(require("sweetalert2"));
|
|
5059
5059
|
init_ApiEndpointsProvider();
|
|
5060
5060
|
init_ApiServicepackage();
|
|
5061
5061
|
|
|
@@ -5078,9 +5078,12 @@ function SearchBar3({
|
|
|
5078
5078
|
|
|
5079
5079
|
// src/components/document-configuration/DocumentConfigurationTable.jsx
|
|
5080
5080
|
var import_react32 = __toESM(require("react"));
|
|
5081
|
+
var import_sweetalert211 = __toESM(require("sweetalert2"));
|
|
5081
5082
|
|
|
5082
5083
|
// src/components/document-configuration/Edit.jsx
|
|
5083
5084
|
var import_react30 = __toESM(require("react"));
|
|
5085
|
+
init_ApiEndpointsProvider();
|
|
5086
|
+
init_ApiServicepackage();
|
|
5084
5087
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5085
5088
|
function EditDocumentConfiguration({
|
|
5086
5089
|
isOpen,
|
|
@@ -5098,6 +5101,27 @@ function EditDocumentConfiguration({
|
|
|
5098
5101
|
status: "Active"
|
|
5099
5102
|
});
|
|
5100
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]);
|
|
5101
5125
|
(0, import_react30.useEffect)(() => {
|
|
5102
5126
|
if (initialData) {
|
|
5103
5127
|
const sizeParts = (initialData.maxSize || "10 MB").split(" ");
|
|
@@ -5137,19 +5161,24 @@ function EditDocumentConfiguration({
|
|
|
5137
5161
|
setErrors(newErrors);
|
|
5138
5162
|
return Object.keys(newErrors).length === 0;
|
|
5139
5163
|
};
|
|
5140
|
-
const handleSubmit = (e) => {
|
|
5164
|
+
const handleSubmit = async (e) => {
|
|
5141
5165
|
e.preventDefault();
|
|
5142
5166
|
if (!validateForm()) return;
|
|
5143
5167
|
const payload = __spreadProps(__spreadValues({}, initialData), {
|
|
5144
5168
|
docName: formData.docName.trim(),
|
|
5145
|
-
stepId: formData.stepId.trim(),
|
|
5169
|
+
stepId: String(formData.stepId).trim(),
|
|
5146
5170
|
extensions: formData.extensions.trim(),
|
|
5147
5171
|
maxSize: `${formData.maxSizeNum} ${formData.maxSizeUnit}`,
|
|
5148
5172
|
isMandatory: formData.isMandatory,
|
|
5149
5173
|
status: formData.status
|
|
5150
5174
|
});
|
|
5151
|
-
|
|
5152
|
-
|
|
5175
|
+
setIsSubmitting(true);
|
|
5176
|
+
try {
|
|
5177
|
+
const saved = await onSave(payload);
|
|
5178
|
+
if (saved) onClose();
|
|
5179
|
+
} finally {
|
|
5180
|
+
setIsSubmitting(false);
|
|
5181
|
+
}
|
|
5153
5182
|
};
|
|
5154
5183
|
if (!isOpen) return null;
|
|
5155
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: [
|
|
@@ -5178,7 +5207,15 @@ function EditDocumentConfiguration({
|
|
|
5178
5207
|
"Workflow Step ID ",
|
|
5179
5208
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
5180
5209
|
] }),
|
|
5181
|
-
/* @__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
|
+
] }),
|
|
5182
5219
|
errors.stepId && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "fc:text-xs fc:text-red-500", children: errors.stepId })
|
|
5183
5220
|
] }),
|
|
5184
5221
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
@@ -5223,7 +5260,7 @@ function EditDocumentConfiguration({
|
|
|
5223
5260
|
] }) }),
|
|
5224
5261
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "fc:flex fc:justify-end fc:items-center fc:gap-3 fc:pt-2", children: [
|
|
5225
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" }),
|
|
5226
|
-
/* @__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" })
|
|
5227
5264
|
] })
|
|
5228
5265
|
] })
|
|
5229
5266
|
] }) });
|
|
@@ -5272,6 +5309,8 @@ function DeleteDocumentConfiguration({
|
|
|
5272
5309
|
}
|
|
5273
5310
|
|
|
5274
5311
|
// src/components/document-configuration/DocumentConfigurationTable.jsx
|
|
5312
|
+
init_ApiEndpointsProvider();
|
|
5313
|
+
init_ApiServicepackage();
|
|
5275
5314
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
5276
5315
|
function DocumentConfigTable({
|
|
5277
5316
|
pageSize,
|
|
@@ -5507,12 +5546,48 @@ function DocumentConfigTable({
|
|
|
5507
5546
|
status: "Active"
|
|
5508
5547
|
}
|
|
5509
5548
|
];
|
|
5510
|
-
const [data, setData] = (0, import_react32.useState)(
|
|
5549
|
+
const [data, setData] = (0, import_react32.useState)([]);
|
|
5550
|
+
const [isLoading, setIsLoading] = (0, import_react32.useState)(false);
|
|
5511
5551
|
const [sortOrder, setSortOrder] = (0, import_react32.useState)("asc");
|
|
5512
5552
|
const [sortKey, setSortKey] = (0, import_react32.useState)("docName");
|
|
5513
5553
|
const [isEditOpen, setIsEditOpen] = (0, import_react32.useState)(false);
|
|
5514
5554
|
const [isDeleteOpen, setIsDeleteOpen] = (0, import_react32.useState)(false);
|
|
5515
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
|
+
}, []);
|
|
5516
5591
|
const handleSort = (columnKey) => {
|
|
5517
5592
|
const isAsc = sortKey === columnKey && sortOrder === "asc";
|
|
5518
5593
|
setSortOrder(isAsc ? "desc" : "asc");
|
|
@@ -5526,7 +5601,7 @@ function DocumentConfigTable({
|
|
|
5526
5601
|
};
|
|
5527
5602
|
const filteredData = data.filter((item) => {
|
|
5528
5603
|
const query = (searchQuery || "").toLowerCase();
|
|
5529
|
-
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);
|
|
5530
5605
|
});
|
|
5531
5606
|
(0, import_react32.useEffect)(() => {
|
|
5532
5607
|
if (setTotalEntries) setTotalEntries(filteredData.length);
|
|
@@ -5540,30 +5615,54 @@ function DocumentConfigTable({
|
|
|
5540
5615
|
},
|
|
5541
5616
|
(_, i) => i + 1
|
|
5542
5617
|
);
|
|
5543
|
-
const
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
(item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
|
|
5547
|
-
isMandatory: !item.isMandatory
|
|
5548
|
-
}) : item
|
|
5549
|
-
)
|
|
5550
|
-
);
|
|
5618
|
+
const buildGetByIdUrl = (endpoint, id) => {
|
|
5619
|
+
if (endpoint.includes("{id}")) return endpoint.replace("{id}", encodeURIComponent(id));
|
|
5620
|
+
return `${endpoint.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
|
|
5551
5621
|
};
|
|
5552
|
-
const handleEdit = (item) => {
|
|
5553
|
-
|
|
5554
|
-
|
|
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
|
+
}
|
|
5555
5634
|
};
|
|
5556
5635
|
const handleDelete = (item) => {
|
|
5557
5636
|
setSelectedItem(item);
|
|
5558
5637
|
setIsDeleteOpen(true);
|
|
5559
5638
|
};
|
|
5560
|
-
const handleSaveEdit = (updatedData) => {
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
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
|
+
}
|
|
5564
5661
|
};
|
|
5565
|
-
const handleConfirmDelete = (id) => {
|
|
5566
|
-
|
|
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" }));
|
|
5567
5666
|
};
|
|
5568
5667
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "fc:space-y-5", children: [
|
|
5569
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: [
|
|
@@ -5630,7 +5729,7 @@ function DocumentConfigTable({
|
|
|
5630
5729
|
),
|
|
5631
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" })
|
|
5632
5731
|
] }) }),
|
|
5633
|
-
/* @__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)(
|
|
5634
5733
|
"tr",
|
|
5635
5734
|
{
|
|
5636
5735
|
className: "hover:fc:bg-slate-50/50 fc:transition-colors",
|
|
@@ -5650,7 +5749,10 @@ function DocumentConfigTable({
|
|
|
5650
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)(
|
|
5651
5750
|
"button",
|
|
5652
5751
|
{
|
|
5653
|
-
onClick: () =>
|
|
5752
|
+
onClick: () => handleSaveEdit(__spreadProps(__spreadValues({}, item), {
|
|
5753
|
+
maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""),
|
|
5754
|
+
isMandatory: !item.isMandatory
|
|
5755
|
+
})),
|
|
5654
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"}`,
|
|
5655
5757
|
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
5656
5758
|
"span",
|
|
@@ -5951,12 +6053,12 @@ function DocumentConfigurationmain() {
|
|
|
5951
6053
|
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
|
|
5952
6054
|
if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
|
|
5953
6055
|
await getApiService().post(endpoint, payload);
|
|
5954
|
-
await
|
|
6056
|
+
await import_sweetalert212.default.fire("Success", "Document configuration created successfully.", "success");
|
|
5955
6057
|
setModalOpen(false);
|
|
5956
6058
|
handleRefresh();
|
|
5957
6059
|
return true;
|
|
5958
6060
|
} catch (error) {
|
|
5959
|
-
await
|
|
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");
|
|
5960
6062
|
return false;
|
|
5961
6063
|
}
|
|
5962
6064
|
};
|
|
@@ -7015,7 +7117,7 @@ function MovementHistorymain() {
|
|
|
7015
7117
|
|
|
7016
7118
|
// src/components/task-permission/TaskPermissionMain.jsx
|
|
7017
7119
|
var import_react47 = __toESM(require("react"));
|
|
7018
|
-
var
|
|
7120
|
+
var import_sweetalert214 = __toESM(require("sweetalert2"));
|
|
7019
7121
|
|
|
7020
7122
|
// src/components/task-permission/SearchBar.js
|
|
7021
7123
|
var import_react43 = __toESM(require("react"));
|
|
@@ -7286,7 +7388,7 @@ function Table({
|
|
|
7286
7388
|
|
|
7287
7389
|
// src/components/task-permission/Popup.js
|
|
7288
7390
|
var import_react45 = __toESM(require("react"));
|
|
7289
|
-
var
|
|
7391
|
+
var import_sweetalert213 = __toESM(require("sweetalert2"));
|
|
7290
7392
|
init_ApiEndpointsProvider();
|
|
7291
7393
|
init_ApiServicepackage();
|
|
7292
7394
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
@@ -7358,7 +7460,7 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7358
7460
|
await (onSave == null ? void 0 : onSave());
|
|
7359
7461
|
} catch (error) {
|
|
7360
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.";
|
|
7361
|
-
await
|
|
7463
|
+
await import_sweetalert213.default.fire("Error", msg, "error");
|
|
7362
7464
|
} finally {
|
|
7363
7465
|
setIsSubmitting(false);
|
|
7364
7466
|
}
|
|
@@ -7761,13 +7863,13 @@ function TaskPermissionMain() {
|
|
|
7761
7863
|
handleRefresh();
|
|
7762
7864
|
return true;
|
|
7763
7865
|
} catch (error) {
|
|
7764
|
-
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");
|
|
7765
7867
|
return false;
|
|
7766
7868
|
}
|
|
7767
7869
|
};
|
|
7768
7870
|
const handleDeleteApi = async (item) => {
|
|
7769
7871
|
var _a;
|
|
7770
|
-
const confirm = await
|
|
7872
|
+
const confirm = await import_sweetalert214.default.fire({
|
|
7771
7873
|
title: "Delete Task Permission?",
|
|
7772
7874
|
text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
|
|
7773
7875
|
icon: "warning",
|
|
@@ -7777,7 +7879,7 @@ function TaskPermissionMain() {
|
|
|
7777
7879
|
});
|
|
7778
7880
|
if (!confirm.isConfirmed) return;
|
|
7779
7881
|
const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
|
|
7780
|
-
if (ok) await
|
|
7882
|
+
if (ok) await import_sweetalert214.default.fire("Deleted", "Task permission has been deactivated.", "success");
|
|
7781
7883
|
};
|
|
7782
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: [
|
|
7783
7885
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
@@ -7830,7 +7932,7 @@ function TaskPermissionMain() {
|
|
|
7830
7932
|
isOpen: showModal,
|
|
7831
7933
|
onClose: () => setShowModal(false),
|
|
7832
7934
|
onSave: async () => {
|
|
7833
|
-
await
|
|
7935
|
+
await import_sweetalert214.default.fire("Success", "Task permission created successfully.", "success");
|
|
7834
7936
|
handleRefresh();
|
|
7835
7937
|
}
|
|
7836
7938
|
}
|
|
@@ -7842,7 +7944,7 @@ function TaskPermissionMain() {
|
|
|
7842
7944
|
onClose: () => setIsEditOpen(false),
|
|
7843
7945
|
selectedData: selectedItem,
|
|
7844
7946
|
onSave: async () => {
|
|
7845
|
-
await
|
|
7947
|
+
await import_sweetalert214.default.fire("Success", "Task permission updated successfully.", "success");
|
|
7846
7948
|
handleRefresh();
|
|
7847
7949
|
},
|
|
7848
7950
|
onUpdate: handleUpdateApi
|
|
@@ -10412,7 +10514,7 @@ function Comment_main() {
|
|
|
10412
10514
|
|
|
10413
10515
|
// src/components/hierarchy-node/HierarchyNodeMain.jsx
|
|
10414
10516
|
var import_react71 = __toESM(require("react"));
|
|
10415
|
-
var
|
|
10517
|
+
var import_sweetalert215 = __toESM(require("sweetalert2"));
|
|
10416
10518
|
init_ApiEndpointsProvider();
|
|
10417
10519
|
init_ApiServicepackage();
|
|
10418
10520
|
|
|
@@ -11018,7 +11120,7 @@ function HierarchyNodeMain() {
|
|
|
11018
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;
|
|
11019
11121
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
11020
11122
|
} catch (error) {
|
|
11021
|
-
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");
|
|
11022
11124
|
}
|
|
11023
11125
|
})();
|
|
11024
11126
|
}, [refreshKey]);
|
|
@@ -11031,11 +11133,11 @@ function HierarchyNodeMain() {
|
|
|
11031
11133
|
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
|
|
11032
11134
|
if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
|
|
11033
11135
|
await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
|
|
11034
|
-
await
|
|
11136
|
+
await import_sweetalert215.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
11035
11137
|
handleRefresh();
|
|
11036
11138
|
return true;
|
|
11037
11139
|
} catch (error) {
|
|
11038
|
-
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");
|
|
11039
11141
|
return false;
|
|
11040
11142
|
}
|
|
11041
11143
|
};
|
package/dist/pkg-index.mjs
CHANGED
|
@@ -4919,7 +4919,7 @@ function Workflow_Step_Hierarchy_Mapping() {
|
|
|
4919
4919
|
|
|
4920
4920
|
// src/components/document-configuration/DocumentConfigurationmain.jsx
|
|
4921
4921
|
import React34, { useState as useState24, useRef as useRef8 } from "react";
|
|
4922
|
-
import
|
|
4922
|
+
import Swal12 from "sweetalert2";
|
|
4923
4923
|
|
|
4924
4924
|
// src/components/document-configuration/SearchBar.jsx
|
|
4925
4925
|
import React29 from "react";
|
|
@@ -4940,6 +4940,7 @@ function SearchBar3({
|
|
|
4940
4940
|
|
|
4941
4941
|
// src/components/document-configuration/DocumentConfigurationTable.jsx
|
|
4942
4942
|
import React32, { useState as useState22, useEffect as useEffect18 } from "react";
|
|
4943
|
+
import Swal11 from "sweetalert2";
|
|
4943
4944
|
|
|
4944
4945
|
// src/components/document-configuration/Edit.jsx
|
|
4945
4946
|
import React30, { useState as useState21, useEffect as useEffect17 } from "react";
|
|
@@ -4960,6 +4961,27 @@ function EditDocumentConfiguration({
|
|
|
4960
4961
|
status: "Active"
|
|
4961
4962
|
});
|
|
4962
4963
|
const [errors, setErrors] = useState21({});
|
|
4964
|
+
const [workflowSteps, setWorkflowSteps] = useState21([]);
|
|
4965
|
+
const [loadingSteps, setLoadingSteps] = useState21(false);
|
|
4966
|
+
const [isSubmitting, setIsSubmitting] = useState21(false);
|
|
4967
|
+
useEffect17(() => {
|
|
4968
|
+
if (!isOpen) return;
|
|
4969
|
+
(async () => {
|
|
4970
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
4971
|
+
try {
|
|
4972
|
+
setLoadingSteps(true);
|
|
4973
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowStep) == null ? void 0 : _c.getList;
|
|
4974
|
+
if (!endpoint) throw new Error("Workflow step list endpoint is not configured.");
|
|
4975
|
+
const result = await getApiService().get(endpoint);
|
|
4976
|
+
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;
|
|
4977
|
+
setWorkflowSteps(Array.isArray(value) ? value : (_j = (_i = value == null ? void 0 : value.items) != null ? _i : value == null ? void 0 : value.records) != null ? _j : []);
|
|
4978
|
+
} catch (_) {
|
|
4979
|
+
setWorkflowSteps([]);
|
|
4980
|
+
} finally {
|
|
4981
|
+
setLoadingSteps(false);
|
|
4982
|
+
}
|
|
4983
|
+
})();
|
|
4984
|
+
}, [isOpen]);
|
|
4963
4985
|
useEffect17(() => {
|
|
4964
4986
|
if (initialData) {
|
|
4965
4987
|
const sizeParts = (initialData.maxSize || "10 MB").split(" ");
|
|
@@ -4999,19 +5021,24 @@ function EditDocumentConfiguration({
|
|
|
4999
5021
|
setErrors(newErrors);
|
|
5000
5022
|
return Object.keys(newErrors).length === 0;
|
|
5001
5023
|
};
|
|
5002
|
-
const handleSubmit = (e) => {
|
|
5024
|
+
const handleSubmit = async (e) => {
|
|
5003
5025
|
e.preventDefault();
|
|
5004
5026
|
if (!validateForm()) return;
|
|
5005
5027
|
const payload = __spreadProps(__spreadValues({}, initialData), {
|
|
5006
5028
|
docName: formData.docName.trim(),
|
|
5007
|
-
stepId: formData.stepId.trim(),
|
|
5029
|
+
stepId: String(formData.stepId).trim(),
|
|
5008
5030
|
extensions: formData.extensions.trim(),
|
|
5009
5031
|
maxSize: `${formData.maxSizeNum} ${formData.maxSizeUnit}`,
|
|
5010
5032
|
isMandatory: formData.isMandatory,
|
|
5011
5033
|
status: formData.status
|
|
5012
5034
|
});
|
|
5013
|
-
|
|
5014
|
-
|
|
5035
|
+
setIsSubmitting(true);
|
|
5036
|
+
try {
|
|
5037
|
+
const saved = await onSave(payload);
|
|
5038
|
+
if (saved) onClose();
|
|
5039
|
+
} finally {
|
|
5040
|
+
setIsSubmitting(false);
|
|
5041
|
+
}
|
|
5015
5042
|
};
|
|
5016
5043
|
if (!isOpen) return null;
|
|
5017
5044
|
return /* @__PURE__ */ jsx30("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__ */ jsxs29("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: [
|
|
@@ -5040,7 +5067,15 @@ function EditDocumentConfiguration({
|
|
|
5040
5067
|
"Workflow Step ID ",
|
|
5041
5068
|
/* @__PURE__ */ jsx30("span", { className: "fc:text-red-500", children: "*" })
|
|
5042
5069
|
] }),
|
|
5043
|
-
/* @__PURE__ */
|
|
5070
|
+
/* @__PURE__ */ jsxs29("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: [
|
|
5071
|
+
/* @__PURE__ */ jsx30("option", { value: "", children: loadingSteps ? "Loading workflow steps..." : "Select workflow step" }),
|
|
5072
|
+
workflowSteps.map((step) => {
|
|
5073
|
+
var _a, _b, _c, _d;
|
|
5074
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5075
|
+
const name = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : `Step ${id}`;
|
|
5076
|
+
return /* @__PURE__ */ jsx30("option", { value: id, children: name }, id);
|
|
5077
|
+
})
|
|
5078
|
+
] }),
|
|
5044
5079
|
errors.stepId && /* @__PURE__ */ jsx30("span", { className: "fc:text-xs fc:text-red-500", children: errors.stepId })
|
|
5045
5080
|
] }),
|
|
5046
5081
|
/* @__PURE__ */ jsxs29("div", { children: [
|
|
@@ -5085,7 +5120,7 @@ function EditDocumentConfiguration({
|
|
|
5085
5120
|
] }) }),
|
|
5086
5121
|
/* @__PURE__ */ jsxs29("div", { className: "fc:flex fc:justify-end fc:items-center fc:gap-3 fc:pt-2", children: [
|
|
5087
5122
|
/* @__PURE__ */ jsx30("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" }),
|
|
5088
|
-
/* @__PURE__ */ jsx30("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" })
|
|
5123
|
+
/* @__PURE__ */ jsx30("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" })
|
|
5089
5124
|
] })
|
|
5090
5125
|
] })
|
|
5091
5126
|
] }) });
|
|
@@ -5369,12 +5404,48 @@ function DocumentConfigTable({
|
|
|
5369
5404
|
status: "Active"
|
|
5370
5405
|
}
|
|
5371
5406
|
];
|
|
5372
|
-
const [data, setData] = useState22(
|
|
5407
|
+
const [data, setData] = useState22([]);
|
|
5408
|
+
const [isLoading, setIsLoading] = useState22(false);
|
|
5373
5409
|
const [sortOrder, setSortOrder] = useState22("asc");
|
|
5374
5410
|
const [sortKey, setSortKey] = useState22("docName");
|
|
5375
5411
|
const [isEditOpen, setIsEditOpen] = useState22(false);
|
|
5376
5412
|
const [isDeleteOpen, setIsDeleteOpen] = useState22(false);
|
|
5377
5413
|
const [selectedItem, setSelectedItem] = useState22(null);
|
|
5414
|
+
const unwrapRows = (result) => {
|
|
5415
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5416
|
+
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;
|
|
5417
|
+
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
5418
|
+
};
|
|
5419
|
+
const toUiItem = (item) => {
|
|
5420
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
5421
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
5422
|
+
id: (_b = (_a = item.documentConfigurationId) != null ? _a : item.DocumentConfigurationId) != null ? _b : item.id,
|
|
5423
|
+
docName: (_e = (_d = (_c = item.documentName) != null ? _c : item.DocumentName) != null ? _d : item.docName) != null ? _e : "",
|
|
5424
|
+
stepId: String((_h = (_g = (_f = item.workflowStepId) != null ? _f : item.WorkflowStepId) != null ? _g : item.stepId) != null ? _h : ""),
|
|
5425
|
+
extensions: (_k = (_j = (_i = item.allowedExtensions) != null ? _i : item.AllowedExtensions) != null ? _j : item.extensions) != null ? _k : "",
|
|
5426
|
+
maxSize: `${(_n = (_m = (_l = item.maxSizeMB) != null ? _l : item.MaxSizeMB) != null ? _m : item.maxSize) != null ? _n : ""} MB`,
|
|
5427
|
+
isMandatory: Boolean((_o = item.isMandatory) != null ? _o : item.IsMandatory),
|
|
5428
|
+
status: ((_q = (_p = item.isActive) != null ? _p : item.IsActive) != null ? _q : item.status !== "Inactive") ? "Active" : "Inactive"
|
|
5429
|
+
});
|
|
5430
|
+
};
|
|
5431
|
+
const loadData = async () => {
|
|
5432
|
+
var _a, _b, _c, _d, _e;
|
|
5433
|
+
try {
|
|
5434
|
+
setIsLoading(true);
|
|
5435
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getList;
|
|
5436
|
+
if (!endpoint) throw new Error("Document Configuration list endpoint is not configured.");
|
|
5437
|
+
const result = await getApiService().post(endpoint, {});
|
|
5438
|
+
setData(unwrapRows(result).map(toUiItem));
|
|
5439
|
+
} catch (error) {
|
|
5440
|
+
setData([]);
|
|
5441
|
+
await Swal11.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");
|
|
5442
|
+
} finally {
|
|
5443
|
+
setIsLoading(false);
|
|
5444
|
+
}
|
|
5445
|
+
};
|
|
5446
|
+
useEffect18(() => {
|
|
5447
|
+
loadData();
|
|
5448
|
+
}, []);
|
|
5378
5449
|
const handleSort = (columnKey) => {
|
|
5379
5450
|
const isAsc = sortKey === columnKey && sortOrder === "asc";
|
|
5380
5451
|
setSortOrder(isAsc ? "desc" : "asc");
|
|
@@ -5388,7 +5459,7 @@ function DocumentConfigTable({
|
|
|
5388
5459
|
};
|
|
5389
5460
|
const filteredData = data.filter((item) => {
|
|
5390
5461
|
const query = (searchQuery || "").toLowerCase();
|
|
5391
|
-
return item.docName.toLowerCase().includes(query) || item.extensions.toLowerCase().includes(query) || item.stepId.toLowerCase().includes(query);
|
|
5462
|
+
return String(item.docName).toLowerCase().includes(query) || String(item.extensions).toLowerCase().includes(query) || String(item.stepId).toLowerCase().includes(query);
|
|
5392
5463
|
});
|
|
5393
5464
|
useEffect18(() => {
|
|
5394
5465
|
if (setTotalEntries) setTotalEntries(filteredData.length);
|
|
@@ -5402,30 +5473,54 @@ function DocumentConfigTable({
|
|
|
5402
5473
|
},
|
|
5403
5474
|
(_, i) => i + 1
|
|
5404
5475
|
);
|
|
5405
|
-
const
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
(item) => item.id === id ? __spreadProps(__spreadValues({}, item), {
|
|
5409
|
-
isMandatory: !item.isMandatory
|
|
5410
|
-
}) : item
|
|
5411
|
-
)
|
|
5412
|
-
);
|
|
5476
|
+
const buildGetByIdUrl = (endpoint, id) => {
|
|
5477
|
+
if (endpoint.includes("{id}")) return endpoint.replace("{id}", encodeURIComponent(id));
|
|
5478
|
+
return `${endpoint.replace(/\/$/, "")}/${encodeURIComponent(id)}`;
|
|
5413
5479
|
};
|
|
5414
|
-
const handleEdit = (item) => {
|
|
5415
|
-
|
|
5416
|
-
|
|
5480
|
+
const handleEdit = async (item) => {
|
|
5481
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
5482
|
+
try {
|
|
5483
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.getById;
|
|
5484
|
+
if (!endpoint) throw new Error("Document Configuration get-by-id endpoint is not configured.");
|
|
5485
|
+
const result = await getApiService().get(buildGetByIdUrl(endpoint, item.id));
|
|
5486
|
+
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;
|
|
5487
|
+
setSelectedItem(toUiItem(value != null ? value : item));
|
|
5488
|
+
setIsEditOpen(true);
|
|
5489
|
+
} catch (error) {
|
|
5490
|
+
await Swal11.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");
|
|
5491
|
+
}
|
|
5417
5492
|
};
|
|
5418
5493
|
const handleDelete = (item) => {
|
|
5419
5494
|
setSelectedItem(item);
|
|
5420
5495
|
setIsDeleteOpen(true);
|
|
5421
5496
|
};
|
|
5422
|
-
const handleSaveEdit = (updatedData) => {
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5497
|
+
const handleSaveEdit = async (updatedData) => {
|
|
5498
|
+
var _a, _b, _c, _d, _e;
|
|
5499
|
+
try {
|
|
5500
|
+
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
|
|
5501
|
+
if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
|
|
5502
|
+
await getApiService().put(endpoint, {
|
|
5503
|
+
documentConfigurationId: updatedData.id,
|
|
5504
|
+
documentName: updatedData.docName.trim(),
|
|
5505
|
+
allowedExtensions: updatedData.extensions.trim(),
|
|
5506
|
+
maxSizeMB: Number(updatedData.maxSizeNum),
|
|
5507
|
+
isMandatory: Boolean(updatedData.isMandatory),
|
|
5508
|
+
isActive: updatedData.status === "Active",
|
|
5509
|
+
updatedBy: "System"
|
|
5510
|
+
});
|
|
5511
|
+
await Swal11.fire("Success", "Document configuration updated successfully.", "success");
|
|
5512
|
+
setIsEditOpen(false);
|
|
5513
|
+
await loadData();
|
|
5514
|
+
return true;
|
|
5515
|
+
} catch (error) {
|
|
5516
|
+
await Swal11.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");
|
|
5517
|
+
return false;
|
|
5518
|
+
}
|
|
5426
5519
|
};
|
|
5427
|
-
const handleConfirmDelete = (id) => {
|
|
5428
|
-
|
|
5520
|
+
const handleConfirmDelete = async (id) => {
|
|
5521
|
+
const item = data.find((record) => record.id === id);
|
|
5522
|
+
if (!item) return false;
|
|
5523
|
+
return handleSaveEdit(__spreadProps(__spreadValues({}, item), { maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""), status: "Inactive" }));
|
|
5429
5524
|
};
|
|
5430
5525
|
return /* @__PURE__ */ jsxs31("div", { className: "fc:space-y-5", children: [
|
|
5431
5526
|
/* @__PURE__ */ jsx32("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__ */ jsxs31("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-fixed fc:min-w-[1050px]", children: [
|
|
@@ -5492,7 +5587,7 @@ function DocumentConfigTable({
|
|
|
5492
5587
|
),
|
|
5493
5588
|
/* @__PURE__ */ jsx32("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" })
|
|
5494
5589
|
] }) }),
|
|
5495
|
-
/* @__PURE__ */ jsx32("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: visibleData.map((item, index) => /* @__PURE__ */ jsxs31(
|
|
5590
|
+
/* @__PURE__ */ jsx32("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-sm fc:text-slate-600", children: isLoading ? /* @__PURE__ */ jsx32("tr", { children: /* @__PURE__ */ jsx32("td", { colSpan: 8, className: "fc:py-10 fc:text-center fc:text-slate-400", children: "Loading document configurations..." }) }) : visibleData.length === 0 ? /* @__PURE__ */ jsx32("tr", { children: /* @__PURE__ */ jsx32("td", { colSpan: 8, className: "fc:py-10 fc:text-center fc:text-slate-400", children: "No records found." }) }) : visibleData.map((item, index) => /* @__PURE__ */ jsxs31(
|
|
5496
5591
|
"tr",
|
|
5497
5592
|
{
|
|
5498
5593
|
className: "hover:fc:bg-slate-50/50 fc:transition-colors",
|
|
@@ -5512,7 +5607,10 @@ function DocumentConfigTable({
|
|
|
5512
5607
|
/* @__PURE__ */ jsx32("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx32(
|
|
5513
5608
|
"button",
|
|
5514
5609
|
{
|
|
5515
|
-
onClick: () =>
|
|
5610
|
+
onClick: () => handleSaveEdit(__spreadProps(__spreadValues({}, item), {
|
|
5611
|
+
maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""),
|
|
5612
|
+
isMandatory: !item.isMandatory
|
|
5613
|
+
})),
|
|
5516
5614
|
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"}`,
|
|
5517
5615
|
children: /* @__PURE__ */ jsx32(
|
|
5518
5616
|
"span",
|
|
@@ -5813,12 +5911,12 @@ function DocumentConfigurationmain() {
|
|
|
5813
5911
|
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
|
|
5814
5912
|
if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
|
|
5815
5913
|
await getApiService().post(endpoint, payload);
|
|
5816
|
-
await
|
|
5914
|
+
await Swal12.fire("Success", "Document configuration created successfully.", "success");
|
|
5817
5915
|
setModalOpen(false);
|
|
5818
5916
|
handleRefresh();
|
|
5819
5917
|
return true;
|
|
5820
5918
|
} catch (error) {
|
|
5821
|
-
await
|
|
5919
|
+
await Swal12.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create document configuration.", "error");
|
|
5822
5920
|
return false;
|
|
5823
5921
|
}
|
|
5824
5922
|
};
|
|
@@ -6877,7 +6975,7 @@ function MovementHistorymain() {
|
|
|
6877
6975
|
|
|
6878
6976
|
// src/components/task-permission/TaskPermissionMain.jsx
|
|
6879
6977
|
import React47, { useState as useState34, useRef as useRef11 } from "react";
|
|
6880
|
-
import
|
|
6978
|
+
import Swal14 from "sweetalert2";
|
|
6881
6979
|
|
|
6882
6980
|
// src/components/task-permission/SearchBar.js
|
|
6883
6981
|
import React43 from "react";
|
|
@@ -7146,7 +7244,7 @@ function Table({
|
|
|
7146
7244
|
|
|
7147
7245
|
// src/components/task-permission/Popup.js
|
|
7148
7246
|
import React45, { useState as useState32, useEffect as useEffect23 } from "react";
|
|
7149
|
-
import
|
|
7247
|
+
import Swal13 from "sweetalert2";
|
|
7150
7248
|
import { jsx as jsx45, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
7151
7249
|
function Popup({ isOpen, onClose, onSave }) {
|
|
7152
7250
|
const [formData, setFormData] = useState32({
|
|
@@ -7216,7 +7314,7 @@ function Popup({ isOpen, onClose, onSave }) {
|
|
|
7216
7314
|
await (onSave == null ? void 0 : onSave());
|
|
7217
7315
|
} catch (error) {
|
|
7218
7316
|
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.";
|
|
7219
|
-
await
|
|
7317
|
+
await Swal13.fire("Error", msg, "error");
|
|
7220
7318
|
} finally {
|
|
7221
7319
|
setIsSubmitting(false);
|
|
7222
7320
|
}
|
|
@@ -7615,13 +7713,13 @@ function TaskPermissionMain() {
|
|
|
7615
7713
|
handleRefresh();
|
|
7616
7714
|
return true;
|
|
7617
7715
|
} catch (error) {
|
|
7618
|
-
await
|
|
7716
|
+
await Swal14.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");
|
|
7619
7717
|
return false;
|
|
7620
7718
|
}
|
|
7621
7719
|
};
|
|
7622
7720
|
const handleDeleteApi = async (item) => {
|
|
7623
7721
|
var _a;
|
|
7624
|
-
const confirm = await
|
|
7722
|
+
const confirm = await Swal14.fire({
|
|
7625
7723
|
title: "Delete Task Permission?",
|
|
7626
7724
|
text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
|
|
7627
7725
|
icon: "warning",
|
|
@@ -7631,7 +7729,7 @@ function TaskPermissionMain() {
|
|
|
7631
7729
|
});
|
|
7632
7730
|
if (!confirm.isConfirmed) return;
|
|
7633
7731
|
const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
|
|
7634
|
-
if (ok) await
|
|
7732
|
+
if (ok) await Swal14.fire("Deleted", "Task permission has been deactivated.", "success");
|
|
7635
7733
|
};
|
|
7636
7734
|
return /* @__PURE__ */ jsxs46("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
|
|
7637
7735
|
/* @__PURE__ */ jsxs46("div", { className: "fc:w-full fc:space-y-5", children: [
|
|
@@ -7684,7 +7782,7 @@ function TaskPermissionMain() {
|
|
|
7684
7782
|
isOpen: showModal,
|
|
7685
7783
|
onClose: () => setShowModal(false),
|
|
7686
7784
|
onSave: async () => {
|
|
7687
|
-
await
|
|
7785
|
+
await Swal14.fire("Success", "Task permission created successfully.", "success");
|
|
7688
7786
|
handleRefresh();
|
|
7689
7787
|
}
|
|
7690
7788
|
}
|
|
@@ -7696,7 +7794,7 @@ function TaskPermissionMain() {
|
|
|
7696
7794
|
onClose: () => setIsEditOpen(false),
|
|
7697
7795
|
selectedData: selectedItem,
|
|
7698
7796
|
onSave: async () => {
|
|
7699
|
-
await
|
|
7797
|
+
await Swal14.fire("Success", "Task permission updated successfully.", "success");
|
|
7700
7798
|
handleRefresh();
|
|
7701
7799
|
},
|
|
7702
7800
|
onUpdate: handleUpdateApi
|
|
@@ -10266,7 +10364,7 @@ function Comment_main() {
|
|
|
10266
10364
|
|
|
10267
10365
|
// src/components/hierarchy-node/HierarchyNodeMain.jsx
|
|
10268
10366
|
import React71, { useState as useState50, useRef as useRef16, useEffect as useEffect32 } from "react";
|
|
10269
|
-
import
|
|
10367
|
+
import Swal15 from "sweetalert2";
|
|
10270
10368
|
|
|
10271
10369
|
// src/components/hierarchy-node/SearchBar.jsx
|
|
10272
10370
|
import React66 from "react";
|
|
@@ -10870,7 +10968,7 @@ function HierarchyNodeMain() {
|
|
|
10870
10968
|
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;
|
|
10871
10969
|
setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
|
|
10872
10970
|
} catch (error) {
|
|
10873
|
-
await
|
|
10971
|
+
await Swal15.fire("Error", ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.message) || (error == null ? void 0 : error.message) || "Unable to load hierarchy nodes.", "error");
|
|
10874
10972
|
}
|
|
10875
10973
|
})();
|
|
10876
10974
|
}, [refreshKey]);
|
|
@@ -10883,11 +10981,11 @@ function HierarchyNodeMain() {
|
|
|
10883
10981
|
const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
|
|
10884
10982
|
if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
|
|
10885
10983
|
await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
|
|
10886
|
-
await
|
|
10984
|
+
await Swal15.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
|
|
10887
10985
|
handleRefresh();
|
|
10888
10986
|
return true;
|
|
10889
10987
|
} catch (error) {
|
|
10890
|
-
await
|
|
10988
|
+
await Swal15.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");
|
|
10891
10989
|
return false;
|
|
10892
10990
|
}
|
|
10893
10991
|
};
|