flowcore-fn 9.4.9 → 9.5.2

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 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 import_sweetalert211 = __toESM(require("sweetalert2"));
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
- onSave(payload);
5152
- onClose();
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.jsx)("input", { type: "text", name: "stepId", placeholder: "e.g. 1", value: formData.stepId, onChange: handleChange, 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${errors.stepId ? "border-red-500" : "border-gray-200"}` }),
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)(initialData);
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,55 @@ function DocumentConfigTable({
5540
5615
  },
5541
5616
  (_, i) => i + 1
5542
5617
  );
5543
- const toggleMandatory = (id) => {
5544
- setData(
5545
- (prev) => prev.map(
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
- setSelectedItem(item);
5554
- setIsEditOpen(true);
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 url = typeof endpoint === "function" ? endpoint(item.id) : buildGetByIdUrl(endpoint, item.id);
5628
+ const result = await getApiService().get(url);
5629
+ 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;
5630
+ setSelectedItem(toUiItem(value != null ? value : item));
5631
+ setIsEditOpen(true);
5632
+ } catch (error) {
5633
+ 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");
5634
+ }
5555
5635
  };
5556
5636
  const handleDelete = (item) => {
5557
5637
  setSelectedItem(item);
5558
5638
  setIsDeleteOpen(true);
5559
5639
  };
5560
- const handleSaveEdit = (updatedData) => {
5561
- setData(
5562
- (prev) => prev.map((item) => item.id === updatedData.id ? updatedData : item)
5563
- );
5640
+ const handleSaveEdit = async (updatedData) => {
5641
+ var _a, _b, _c, _d, _e;
5642
+ try {
5643
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5644
+ if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
5645
+ await getApiService().put(endpoint, {
5646
+ documentConfigurationId: updatedData.id,
5647
+ documentName: updatedData.docName.trim(),
5648
+ allowedExtensions: updatedData.extensions.trim(),
5649
+ maxSizeMB: Number(updatedData.maxSizeNum),
5650
+ isMandatory: Boolean(updatedData.isMandatory),
5651
+ isActive: updatedData.status === "Active",
5652
+ updatedBy: "System"
5653
+ });
5654
+ await import_sweetalert211.default.fire("Success", "Document configuration updated successfully.", "success");
5655
+ setIsEditOpen(false);
5656
+ await loadData();
5657
+ return true;
5658
+ } catch (error) {
5659
+ 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");
5660
+ return false;
5661
+ }
5564
5662
  };
5565
- const handleConfirmDelete = (id) => {
5566
- setData((prev) => prev.filter((item) => item.id !== id));
5663
+ const handleConfirmDelete = async (id) => {
5664
+ const item = data.find((record) => record.id === id);
5665
+ if (!item) return false;
5666
+ return handleSaveEdit(__spreadProps(__spreadValues({}, item), { maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""), status: "Inactive" }));
5567
5667
  };
5568
5668
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "fc:space-y-5", children: [
5569
5669
  /* @__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 +5730,7 @@ function DocumentConfigTable({
5630
5730
  ),
5631
5731
  /* @__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
5732
  ] }) }),
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)(
5733
+ /* @__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
5734
  "tr",
5635
5735
  {
5636
5736
  className: "hover:fc:bg-slate-50/50 fc:transition-colors",
@@ -5650,7 +5750,10 @@ function DocumentConfigTable({
5650
5750
  /* @__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
5751
  "button",
5652
5752
  {
5653
- onClick: () => toggleMandatory(item.id),
5753
+ onClick: () => handleSaveEdit(__spreadProps(__spreadValues({}, item), {
5754
+ maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""),
5755
+ isMandatory: !item.isMandatory
5756
+ })),
5654
5757
  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
5758
  children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
5656
5759
  "span",
@@ -5951,12 +6054,12 @@ function DocumentConfigurationmain() {
5951
6054
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
5952
6055
  if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
5953
6056
  await getApiService().post(endpoint, payload);
5954
- await import_sweetalert211.default.fire("Success", "Document configuration created successfully.", "success");
6057
+ await import_sweetalert212.default.fire("Success", "Document configuration created successfully.", "success");
5955
6058
  setModalOpen(false);
5956
6059
  handleRefresh();
5957
6060
  return true;
5958
6061
  } catch (error) {
5959
- 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 create document configuration.", "error");
6062
+ 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
6063
  return false;
5961
6064
  }
5962
6065
  };
@@ -7015,7 +7118,7 @@ function MovementHistorymain() {
7015
7118
 
7016
7119
  // src/components/task-permission/TaskPermissionMain.jsx
7017
7120
  var import_react47 = __toESM(require("react"));
7018
- var import_sweetalert213 = __toESM(require("sweetalert2"));
7121
+ var import_sweetalert214 = __toESM(require("sweetalert2"));
7019
7122
 
7020
7123
  // src/components/task-permission/SearchBar.js
7021
7124
  var import_react43 = __toESM(require("react"));
@@ -7286,7 +7389,7 @@ function Table({
7286
7389
 
7287
7390
  // src/components/task-permission/Popup.js
7288
7391
  var import_react45 = __toESM(require("react"));
7289
- var import_sweetalert212 = __toESM(require("sweetalert2"));
7392
+ var import_sweetalert213 = __toESM(require("sweetalert2"));
7290
7393
  init_ApiEndpointsProvider();
7291
7394
  init_ApiServicepackage();
7292
7395
  var import_jsx_runtime45 = require("react/jsx-runtime");
@@ -7358,7 +7461,7 @@ function Popup({ isOpen, onClose, onSave }) {
7358
7461
  await (onSave == null ? void 0 : onSave());
7359
7462
  } catch (error) {
7360
7463
  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 import_sweetalert212.default.fire("Error", msg, "error");
7464
+ await import_sweetalert213.default.fire("Error", msg, "error");
7362
7465
  } finally {
7363
7466
  setIsSubmitting(false);
7364
7467
  }
@@ -7761,13 +7864,13 @@ function TaskPermissionMain() {
7761
7864
  handleRefresh();
7762
7865
  return true;
7763
7866
  } catch (error) {
7764
- await import_sweetalert213.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");
7867
+ 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
7868
  return false;
7766
7869
  }
7767
7870
  };
7768
7871
  const handleDeleteApi = async (item) => {
7769
7872
  var _a;
7770
- const confirm = await import_sweetalert213.default.fire({
7873
+ const confirm = await import_sweetalert214.default.fire({
7771
7874
  title: "Delete Task Permission?",
7772
7875
  text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
7773
7876
  icon: "warning",
@@ -7777,7 +7880,7 @@ function TaskPermissionMain() {
7777
7880
  });
7778
7881
  if (!confirm.isConfirmed) return;
7779
7882
  const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
7780
- if (ok) await import_sweetalert213.default.fire("Deleted", "Task permission has been deactivated.", "success");
7883
+ if (ok) await import_sweetalert214.default.fire("Deleted", "Task permission has been deactivated.", "success");
7781
7884
  };
7782
7885
  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
7886
  /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "fc:w-full fc:space-y-5", children: [
@@ -7830,7 +7933,7 @@ function TaskPermissionMain() {
7830
7933
  isOpen: showModal,
7831
7934
  onClose: () => setShowModal(false),
7832
7935
  onSave: async () => {
7833
- await import_sweetalert213.default.fire("Success", "Task permission created successfully.", "success");
7936
+ await import_sweetalert214.default.fire("Success", "Task permission created successfully.", "success");
7834
7937
  handleRefresh();
7835
7938
  }
7836
7939
  }
@@ -7842,7 +7945,7 @@ function TaskPermissionMain() {
7842
7945
  onClose: () => setIsEditOpen(false),
7843
7946
  selectedData: selectedItem,
7844
7947
  onSave: async () => {
7845
- await import_sweetalert213.default.fire("Success", "Task permission updated successfully.", "success");
7948
+ await import_sweetalert214.default.fire("Success", "Task permission updated successfully.", "success");
7846
7949
  handleRefresh();
7847
7950
  },
7848
7951
  onUpdate: handleUpdateApi
@@ -10412,7 +10515,7 @@ function Comment_main() {
10412
10515
 
10413
10516
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
10414
10517
  var import_react71 = __toESM(require("react"));
10415
- var import_sweetalert214 = __toESM(require("sweetalert2"));
10518
+ var import_sweetalert215 = __toESM(require("sweetalert2"));
10416
10519
  init_ApiEndpointsProvider();
10417
10520
  init_ApiServicepackage();
10418
10521
 
@@ -11018,7 +11121,7 @@ function HierarchyNodeMain() {
11018
11121
  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
11122
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
11020
11123
  } catch (error) {
11021
- 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 load hierarchy nodes.", "error");
11124
+ 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
11125
  }
11023
11126
  })();
11024
11127
  }, [refreshKey]);
@@ -11031,11 +11134,11 @@ function HierarchyNodeMain() {
11031
11134
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
11032
11135
  if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
11033
11136
  await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
11034
- await import_sweetalert214.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
11137
+ await import_sweetalert215.default.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
11035
11138
  handleRefresh();
11036
11139
  return true;
11037
11140
  } catch (error) {
11038
- await import_sweetalert214.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");
11141
+ 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
11142
  return false;
11040
11143
  }
11041
11144
  };
@@ -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 Swal11 from "sweetalert2";
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
- onSave(payload);
5014
- onClose();
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__ */ jsx30("input", { type: "text", name: "stepId", placeholder: "e.g. 1", value: formData.stepId, onChange: handleChange, 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${errors.stepId ? "border-red-500" : "border-gray-200"}` }),
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(initialData);
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,55 @@ function DocumentConfigTable({
5402
5473
  },
5403
5474
  (_, i) => i + 1
5404
5475
  );
5405
- const toggleMandatory = (id) => {
5406
- setData(
5407
- (prev) => prev.map(
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
- setSelectedItem(item);
5416
- setIsEditOpen(true);
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 url = typeof endpoint === "function" ? endpoint(item.id) : buildGetByIdUrl(endpoint, item.id);
5486
+ const result = await getApiService().get(url);
5487
+ 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;
5488
+ setSelectedItem(toUiItem(value != null ? value : item));
5489
+ setIsEditOpen(true);
5490
+ } catch (error) {
5491
+ 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");
5492
+ }
5417
5493
  };
5418
5494
  const handleDelete = (item) => {
5419
5495
  setSelectedItem(item);
5420
5496
  setIsDeleteOpen(true);
5421
5497
  };
5422
- const handleSaveEdit = (updatedData) => {
5423
- setData(
5424
- (prev) => prev.map((item) => item.id === updatedData.id ? updatedData : item)
5425
- );
5498
+ const handleSaveEdit = async (updatedData) => {
5499
+ var _a, _b, _c, _d, _e;
5500
+ try {
5501
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.update;
5502
+ if (!endpoint) throw new Error("Document Configuration update endpoint is not configured.");
5503
+ await getApiService().put(endpoint, {
5504
+ documentConfigurationId: updatedData.id,
5505
+ documentName: updatedData.docName.trim(),
5506
+ allowedExtensions: updatedData.extensions.trim(),
5507
+ maxSizeMB: Number(updatedData.maxSizeNum),
5508
+ isMandatory: Boolean(updatedData.isMandatory),
5509
+ isActive: updatedData.status === "Active",
5510
+ updatedBy: "System"
5511
+ });
5512
+ await Swal11.fire("Success", "Document configuration updated successfully.", "success");
5513
+ setIsEditOpen(false);
5514
+ await loadData();
5515
+ return true;
5516
+ } catch (error) {
5517
+ 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");
5518
+ return false;
5519
+ }
5426
5520
  };
5427
- const handleConfirmDelete = (id) => {
5428
- setData((prev) => prev.filter((item) => item.id !== id));
5521
+ const handleConfirmDelete = async (id) => {
5522
+ const item = data.find((record) => record.id === id);
5523
+ if (!item) return false;
5524
+ return handleSaveEdit(__spreadProps(__spreadValues({}, item), { maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""), status: "Inactive" }));
5429
5525
  };
5430
5526
  return /* @__PURE__ */ jsxs31("div", { className: "fc:space-y-5", children: [
5431
5527
  /* @__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 +5588,7 @@ function DocumentConfigTable({
5492
5588
  ),
5493
5589
  /* @__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
5590
  ] }) }),
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(
5591
+ /* @__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
5592
  "tr",
5497
5593
  {
5498
5594
  className: "hover:fc:bg-slate-50/50 fc:transition-colors",
@@ -5512,7 +5608,10 @@ function DocumentConfigTable({
5512
5608
  /* @__PURE__ */ jsx32("td", { className: "fc:py-4 fc:px-5 fc:text-center", children: /* @__PURE__ */ jsx32(
5513
5609
  "button",
5514
5610
  {
5515
- onClick: () => toggleMandatory(item.id),
5611
+ onClick: () => handleSaveEdit(__spreadProps(__spreadValues({}, item), {
5612
+ maxSizeNum: String(item.maxSize).replace(/\s*MB$/i, ""),
5613
+ isMandatory: !item.isMandatory
5614
+ })),
5516
5615
  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
5616
  children: /* @__PURE__ */ jsx32(
5518
5617
  "span",
@@ -5813,12 +5912,12 @@ function DocumentConfigurationmain() {
5813
5912
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.documentConfiguration) == null ? void 0 : _c.create;
5814
5913
  if (!endpoint) throw new Error("Document Configuration create endpoint is not configured.");
5815
5914
  await getApiService().post(endpoint, payload);
5816
- await Swal11.fire("Success", "Document configuration created successfully.", "success");
5915
+ await Swal12.fire("Success", "Document configuration created successfully.", "success");
5817
5916
  setModalOpen(false);
5818
5917
  handleRefresh();
5819
5918
  return true;
5820
5919
  } catch (error) {
5821
- 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 create document configuration.", "error");
5920
+ 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
5921
  return false;
5823
5922
  }
5824
5923
  };
@@ -6877,7 +6976,7 @@ function MovementHistorymain() {
6877
6976
 
6878
6977
  // src/components/task-permission/TaskPermissionMain.jsx
6879
6978
  import React47, { useState as useState34, useRef as useRef11 } from "react";
6880
- import Swal13 from "sweetalert2";
6979
+ import Swal14 from "sweetalert2";
6881
6980
 
6882
6981
  // src/components/task-permission/SearchBar.js
6883
6982
  import React43 from "react";
@@ -7146,7 +7245,7 @@ function Table({
7146
7245
 
7147
7246
  // src/components/task-permission/Popup.js
7148
7247
  import React45, { useState as useState32, useEffect as useEffect23 } from "react";
7149
- import Swal12 from "sweetalert2";
7248
+ import Swal13 from "sweetalert2";
7150
7249
  import { jsx as jsx45, jsxs as jsxs44 } from "react/jsx-runtime";
7151
7250
  function Popup({ isOpen, onClose, onSave }) {
7152
7251
  const [formData, setFormData] = useState32({
@@ -7216,7 +7315,7 @@ function Popup({ isOpen, onClose, onSave }) {
7216
7315
  await (onSave == null ? void 0 : onSave());
7217
7316
  } catch (error) {
7218
7317
  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 Swal12.fire("Error", msg, "error");
7318
+ await Swal13.fire("Error", msg, "error");
7220
7319
  } finally {
7221
7320
  setIsSubmitting(false);
7222
7321
  }
@@ -7615,13 +7714,13 @@ function TaskPermissionMain() {
7615
7714
  handleRefresh();
7616
7715
  return true;
7617
7716
  } catch (error) {
7618
- await Swal13.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");
7717
+ 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
7718
  return false;
7620
7719
  }
7621
7720
  };
7622
7721
  const handleDeleteApi = async (item) => {
7623
7722
  var _a;
7624
- const confirm = await Swal13.fire({
7723
+ const confirm = await Swal14.fire({
7625
7724
  title: "Delete Task Permission?",
7626
7725
  text: `Permission #${(_a = item.taskPermissionId) != null ? _a : item.TaskPermissionId} will be marked as inactive.`,
7627
7726
  icon: "warning",
@@ -7631,7 +7730,7 @@ function TaskPermissionMain() {
7631
7730
  });
7632
7731
  if (!confirm.isConfirmed) return;
7633
7732
  const ok = await handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
7634
- if (ok) await Swal13.fire("Deleted", "Task permission has been deactivated.", "success");
7733
+ if (ok) await Swal14.fire("Deleted", "Task permission has been deactivated.", "success");
7635
7734
  };
7636
7735
  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
7736
  /* @__PURE__ */ jsxs46("div", { className: "fc:w-full fc:space-y-5", children: [
@@ -7684,7 +7783,7 @@ function TaskPermissionMain() {
7684
7783
  isOpen: showModal,
7685
7784
  onClose: () => setShowModal(false),
7686
7785
  onSave: async () => {
7687
- await Swal13.fire("Success", "Task permission created successfully.", "success");
7786
+ await Swal14.fire("Success", "Task permission created successfully.", "success");
7688
7787
  handleRefresh();
7689
7788
  }
7690
7789
  }
@@ -7696,7 +7795,7 @@ function TaskPermissionMain() {
7696
7795
  onClose: () => setIsEditOpen(false),
7697
7796
  selectedData: selectedItem,
7698
7797
  onSave: async () => {
7699
- await Swal13.fire("Success", "Task permission updated successfully.", "success");
7798
+ await Swal14.fire("Success", "Task permission updated successfully.", "success");
7700
7799
  handleRefresh();
7701
7800
  },
7702
7801
  onUpdate: handleUpdateApi
@@ -10266,7 +10365,7 @@ function Comment_main() {
10266
10365
 
10267
10366
  // src/components/hierarchy-node/HierarchyNodeMain.jsx
10268
10367
  import React71, { useState as useState50, useRef as useRef16, useEffect as useEffect32 } from "react";
10269
- import Swal14 from "sweetalert2";
10368
+ import Swal15 from "sweetalert2";
10270
10369
 
10271
10370
  // src/components/hierarchy-node/SearchBar.jsx
10272
10371
  import React66 from "react";
@@ -10870,7 +10969,7 @@ function HierarchyNodeMain() {
10870
10969
  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
10970
  setApiData(Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || []);
10872
10971
  } catch (error) {
10873
- 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 load hierarchy nodes.", "error");
10972
+ 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
10973
  }
10875
10974
  })();
10876
10975
  }, [refreshKey]);
@@ -10883,11 +10982,11 @@ function HierarchyNodeMain() {
10883
10982
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.hierarchyNode) == null ? void 0 : _c[isEdit ? "update" : "create"];
10884
10983
  if (!endpoint) throw new Error(`Hierarchy node ${isEdit ? "update" : "create"} endpoint is not configured.`);
10885
10984
  await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
10886
- await Swal14.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
10985
+ await Swal15.fire("Success", `Hierarchy node ${isEdit ? "updated" : "created"} successfully.`, "success");
10887
10986
  handleRefresh();
10888
10987
  return true;
10889
10988
  } catch (error) {
10890
- await Swal14.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");
10989
+ 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
10990
  return false;
10892
10991
  }
10893
10992
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "9.4.9",
3
+ "version": "9.5.2",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [