flowcore-fn 9.3.1 → 9.3.3

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
@@ -709,7 +709,8 @@ var import_react5 = __toESM(require("react"));
709
709
  var import_jsx_runtime5 = require("react/jsx-runtime");
710
710
  function AddWorkflowModal({
711
711
  isOpen,
712
- onClose
712
+ onClose,
713
+ workflowTypes = []
713
714
  }) {
714
715
  if (!isOpen) return null;
715
716
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
@@ -739,9 +740,11 @@ function AddWorkflowModal({
739
740
  ] }),
740
741
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("select", { className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:bg-white fc:text-slate-700 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
741
742
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "", children: "Select workflow type" }),
742
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "petition", children: "Petition" }),
743
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "building", children: "Building Permission" }),
744
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "leave", children: "Leave" })
743
+ workflowTypes.length > 0 ? workflowTypes.map((type) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: type.workflowTypeId || type.WorkflowTypeId, children: type.workflowTypeName || type.WorkflowTypeName }, type.workflowTypeId || type.WorkflowTypeId)) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
744
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "petition", children: "Petition" }),
745
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "building", children: "Building Permission" }),
746
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: "leave", children: "Leave" })
747
+ ] })
745
748
  ] }),
746
749
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Choose the category this workflow belongs to" })
747
750
  ] }),
@@ -1036,21 +1039,26 @@ function Workflow() {
1036
1039
  const [pageSize, setPageSize] = (0, import_react9.useState)(10);
1037
1040
  const [searchQuery, setSearchQuery] = (0, import_react9.useState)("");
1038
1041
  const [apiData, setApiData] = (0, import_react9.useState)([]);
1042
+ const [workflowTypes, setWorkflowTypes] = (0, import_react9.useState)([]);
1039
1043
  (0, import_react10.useEffect)(() => {
1040
1044
  (async () => {
1041
- var _a, _b, _c, _d, _e, _f, _g;
1045
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1042
1046
  try {
1043
1047
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
1048
+ const typeEndpoint = (_f = (_e = (_d = getApiEndpoints()) == null ? void 0 : _d.flowCore) == null ? void 0 : _e.workflowType) == null ? void 0 : _f.getList;
1044
1049
  if (!endpoint) throw Error("Workflow list endpoint is not configured.");
1045
- const result = await getApiService().get(endpoint);
1046
- 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;
1050
+ const [result, types] = await Promise.all([getApiService().get(endpoint), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
1051
+ const value = ((_g = result == null ? void 0 : result.data) == null ? void 0 : _g.data) || ((_h = result == null ? void 0 : result.data) == null ? void 0 : _h.result) || (result == null ? void 0 : result.data) || result;
1047
1052
  const rows = Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || [];
1053
+ const typeValue = ((_i = types == null ? void 0 : types.data) == null ? void 0 : _i.data) || ((_j = types == null ? void 0 : types.data) == null ? void 0 : _j.result) || (types == null ? void 0 : types.data) || types;
1054
+ const typeRows = Array.isArray(typeValue) ? typeValue : (typeValue == null ? void 0 : typeValue.items) || (typeValue == null ? void 0 : typeValue.records) || [];
1055
+ setWorkflowTypes(typeRows);
1048
1056
  setApiData(rows.map((item) => {
1049
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j;
1050
- return __spreadProps(__spreadValues({}, item), { id: (_b2 = (_a2 = item.id) != null ? _a2 : item.workflowId) != null ? _b2 : item.WorkflowId, name: (_d2 = (_c2 = item.name) != null ? _c2 : item.workflowName) != null ? _d2 : item.WorkflowName, code: (_f2 = (_e2 = item.code) != null ? _e2 : item.workflowCode) != null ? _f2 : item.WorkflowCode, type: (_h = (_g2 = item.type) != null ? _g2 : item.workflowTypeName) != null ? _h : item.WorkflowTypeName, status: (_j = (_i = item.status) != null ? _i : item.isActive) != null ? _j : item.IsActive });
1057
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
1058
+ return __spreadProps(__spreadValues({}, item), { id: (_b2 = (_a2 = item.id) != null ? _a2 : item.workflowId) != null ? _b2 : item.WorkflowId, name: (_d2 = (_c2 = item.name) != null ? _c2 : item.workflowName) != null ? _d2 : item.WorkflowName, code: (_f2 = (_e2 = item.code) != null ? _e2 : item.workflowCode) != null ? _f2 : item.WorkflowCode, type: (_h2 = (_g2 = item.type) != null ? _g2 : item.workflowTypeName) != null ? _h2 : item.WorkflowTypeName, status: (_j2 = (_i2 = item.status) != null ? _i2 : item.isActive) != null ? _j2 : item.IsActive });
1051
1059
  }));
1052
1060
  } catch (error) {
1053
- await import_sweetalert2.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 workflows.", "error");
1061
+ await import_sweetalert2.default.fire("Error", ((_l = (_k = error == null ? void 0 : error.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (error == null ? void 0 : error.message) || "Unable to load workflows.", "error");
1054
1062
  }
1055
1063
  })();
1056
1064
  }, [refreshKey]);
@@ -1131,7 +1139,8 @@ function Workflow() {
1131
1139
  AddWorkflowModal,
1132
1140
  {
1133
1141
  isOpen: modalOpen,
1134
- onClose: () => setModalOpen(false)
1142
+ onClose: () => setModalOpen(false),
1143
+ workflowTypes
1135
1144
  }
1136
1145
  )
1137
1146
  ] });
@@ -1287,7 +1296,10 @@ function WorkflowTypeTable({
1287
1296
  currentPage,
1288
1297
  setCurrentPage,
1289
1298
  setTotalEntries,
1290
- apiData
1299
+ apiData,
1300
+ onUpdate,
1301
+ onDeleteApi,
1302
+ onEdit
1291
1303
  }) {
1292
1304
  const initialData = [{
1293
1305
  workflowTypeId: 1,
@@ -1574,6 +1586,10 @@ function WorkflowTypeTable({
1574
1586
  length: totalPages
1575
1587
  }, (_, i) => i + 1);
1576
1588
  const handleEdit = (item) => {
1589
+ if (onEdit) {
1590
+ onEdit(item);
1591
+ return;
1592
+ }
1577
1593
  setSelectedItem(item);
1578
1594
  setIsEditOpen(true);
1579
1595
  };
@@ -1582,10 +1598,18 @@ function WorkflowTypeTable({
1582
1598
  setIsDeleteOpen(false);
1583
1599
  setIsDeleteOpen(true);
1584
1600
  };
1585
- const handleConfirmDelete = (itemToDelete) => {
1601
+ const handleConfirmDelete = async (itemToDelete) => {
1602
+ if (onDeleteApi) {
1603
+ await onDeleteApi(itemToDelete);
1604
+ return;
1605
+ }
1586
1606
  setData((prevData) => prevData.filter((i) => i.workflowTypeId !== itemToDelete.workflowTypeId));
1587
1607
  };
1588
- const handleSaveEdit = (updatedItem) => {
1608
+ const handleSaveEdit = async (updatedItem) => {
1609
+ if (onUpdate) {
1610
+ await onUpdate(updatedItem);
1611
+ return;
1612
+ }
1589
1613
  setData((prevData) => prevData.map((item) => item.workflowTypeId === updatedItem.workflowTypeId ? updatedItem : item));
1590
1614
  };
1591
1615
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:space-y-5", children: [
@@ -1748,6 +1772,23 @@ function WorkflowTypeMains() {
1748
1772
  console.log("Table data refreshed!");
1749
1773
  setRefreshKey((prev) => prev + 1);
1750
1774
  };
1775
+ const handleUpdateApi = async (item) => {
1776
+ var _a, _b, _c, _d, _e;
1777
+ try {
1778
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
1779
+ if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
1780
+ await getApiService().put(endpoint, { workflowTypeId: item.workflowTypeId, workflowTypeCode: item.workflowTypeCode.trim().toUpperCase(), workflowTypeName: item.workflowTypeName.trim(), description: (item.description || "").trim(), isActive: Boolean(item.isActive), updatedBy: item.updatedBy || item.createdBy || "System" });
1781
+ await import_sweetalert23.default.fire("Success", "Workflow type updated successfully.", "success");
1782
+ handleRefresh();
1783
+ return true;
1784
+ } catch (error) {
1785
+ await import_sweetalert23.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 workflow type.", "error");
1786
+ return false;
1787
+ }
1788
+ };
1789
+ const handleDeleteApi = async (item) => {
1790
+ return handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
1791
+ };
1751
1792
  const tableRef = (0, import_react16.useRef)(null);
1752
1793
  const [modalOpen, setModalOpen] = (0, import_react16.useState)(false);
1753
1794
  const [pageSize, setPageSize] = (0, import_react16.useState)(10);
@@ -1816,12 +1857,15 @@ function WorkflowTypeMains() {
1816
1857
  ] })
1817
1858
  ] }),
1818
1859
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: tableRef, children: [
1819
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorkflowTypeTable, { apiData, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onDelete: handleDelete }, refreshkey),
1860
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorkflowTypeTable, { apiData, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onUpdate: handleUpdateApi, onDeleteApi: handleDeleteApi }, refreshkey),
1820
1861
  " "
1821
1862
  ] })
1822
1863
  ] }) }),
1823
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false) }),
1824
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleSaveEdit, selectedData: selectedItem }),
1864
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: async () => {
1865
+ await import_sweetalert23.default.fire("Success", "Workflow type created successfully.", "success");
1866
+ handleRefresh();
1867
+ } }),
1868
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleUpdateApi, selectedData: selectedItem }),
1825
1869
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DeleteWorkflowType_default, { isOpen: isDeleteOpen, onClose: () => setIsDeleteOpen(false), onConfirm: handleConfirmDelete, itemData: selectedItem })
1826
1870
  ] });
1827
1871
  }
@@ -670,10 +670,11 @@ function WorkflowTable({ pageSize, searchQuery, apiData }) {
670
670
 
671
671
  // src/components/workflow/AddWorkflowModal.jsx
672
672
  import React5 from "react";
673
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
673
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
674
674
  function AddWorkflowModal({
675
675
  isOpen,
676
- onClose
676
+ onClose,
677
+ workflowTypes = []
677
678
  }) {
678
679
  if (!isOpen) return null;
679
680
  return /* @__PURE__ */ jsxs5("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
@@ -703,9 +704,11 @@ function AddWorkflowModal({
703
704
  ] }),
704
705
  /* @__PURE__ */ jsxs5("select", { className: "fc:w-full fc:p-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:bg-white fc:text-slate-700 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-indigo-500/10 focus:fc:fc:border-indigo-500", children: [
705
706
  /* @__PURE__ */ jsx5("option", { value: "", children: "Select workflow type" }),
706
- /* @__PURE__ */ jsx5("option", { value: "petition", children: "Petition" }),
707
- /* @__PURE__ */ jsx5("option", { value: "building", children: "Building Permission" }),
708
- /* @__PURE__ */ jsx5("option", { value: "leave", children: "Leave" })
707
+ workflowTypes.length > 0 ? workflowTypes.map((type) => /* @__PURE__ */ jsx5("option", { value: type.workflowTypeId || type.WorkflowTypeId, children: type.workflowTypeName || type.WorkflowTypeName }, type.workflowTypeId || type.WorkflowTypeId)) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
708
+ /* @__PURE__ */ jsx5("option", { value: "petition", children: "Petition" }),
709
+ /* @__PURE__ */ jsx5("option", { value: "building", children: "Building Permission" }),
710
+ /* @__PURE__ */ jsx5("option", { value: "leave", children: "Leave" })
711
+ ] })
709
712
  ] }),
710
713
  /* @__PURE__ */ jsx5("p", { className: "fc:text-[10px] fc:text-red-400 fc:mt-1", children: "Choose the category this workflow belongs to" })
711
714
  ] }),
@@ -1000,21 +1003,26 @@ function Workflow() {
1000
1003
  const [pageSize, setPageSize] = useState5(10);
1001
1004
  const [searchQuery, setSearchQuery] = useState5("");
1002
1005
  const [apiData, setApiData] = useState5([]);
1006
+ const [workflowTypes, setWorkflowTypes] = useState5([]);
1003
1007
  useEffect3(() => {
1004
1008
  (async () => {
1005
- var _a, _b, _c, _d, _e, _f, _g;
1009
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1006
1010
  try {
1007
1011
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflow) == null ? void 0 : _c.getList;
1012
+ const typeEndpoint = (_f = (_e = (_d = getApiEndpoints()) == null ? void 0 : _d.flowCore) == null ? void 0 : _e.workflowType) == null ? void 0 : _f.getList;
1008
1013
  if (!endpoint) throw Error("Workflow list endpoint is not configured.");
1009
- const result = await getApiService().get(endpoint);
1010
- 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;
1014
+ const [result, types] = await Promise.all([getApiService().get(endpoint), typeEndpoint ? getApiService().get(typeEndpoint) : Promise.resolve([])]);
1015
+ const value = ((_g = result == null ? void 0 : result.data) == null ? void 0 : _g.data) || ((_h = result == null ? void 0 : result.data) == null ? void 0 : _h.result) || (result == null ? void 0 : result.data) || result;
1011
1016
  const rows = Array.isArray(value) ? value : (value == null ? void 0 : value.items) || (value == null ? void 0 : value.records) || [];
1017
+ const typeValue = ((_i = types == null ? void 0 : types.data) == null ? void 0 : _i.data) || ((_j = types == null ? void 0 : types.data) == null ? void 0 : _j.result) || (types == null ? void 0 : types.data) || types;
1018
+ const typeRows = Array.isArray(typeValue) ? typeValue : (typeValue == null ? void 0 : typeValue.items) || (typeValue == null ? void 0 : typeValue.records) || [];
1019
+ setWorkflowTypes(typeRows);
1012
1020
  setApiData(rows.map((item) => {
1013
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h, _i, _j;
1014
- return __spreadProps(__spreadValues({}, item), { id: (_b2 = (_a2 = item.id) != null ? _a2 : item.workflowId) != null ? _b2 : item.WorkflowId, name: (_d2 = (_c2 = item.name) != null ? _c2 : item.workflowName) != null ? _d2 : item.WorkflowName, code: (_f2 = (_e2 = item.code) != null ? _e2 : item.workflowCode) != null ? _f2 : item.WorkflowCode, type: (_h = (_g2 = item.type) != null ? _g2 : item.workflowTypeName) != null ? _h : item.WorkflowTypeName, status: (_j = (_i = item.status) != null ? _i : item.isActive) != null ? _j : item.IsActive });
1021
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
1022
+ return __spreadProps(__spreadValues({}, item), { id: (_b2 = (_a2 = item.id) != null ? _a2 : item.workflowId) != null ? _b2 : item.WorkflowId, name: (_d2 = (_c2 = item.name) != null ? _c2 : item.workflowName) != null ? _d2 : item.WorkflowName, code: (_f2 = (_e2 = item.code) != null ? _e2 : item.workflowCode) != null ? _f2 : item.WorkflowCode, type: (_h2 = (_g2 = item.type) != null ? _g2 : item.workflowTypeName) != null ? _h2 : item.WorkflowTypeName, status: (_j2 = (_i2 = item.status) != null ? _i2 : item.isActive) != null ? _j2 : item.IsActive });
1015
1023
  }));
1016
1024
  } catch (error) {
1017
- await Swal.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 workflows.", "error");
1025
+ await Swal.fire("Error", ((_l = (_k = error == null ? void 0 : error.response) == null ? void 0 : _k.data) == null ? void 0 : _l.message) || (error == null ? void 0 : error.message) || "Unable to load workflows.", "error");
1018
1026
  }
1019
1027
  })();
1020
1028
  }, [refreshKey]);
@@ -1095,7 +1103,8 @@ function Workflow() {
1095
1103
  AddWorkflowModal,
1096
1104
  {
1097
1105
  isOpen: modalOpen,
1098
- onClose: () => setModalOpen(false)
1106
+ onClose: () => setModalOpen(false),
1107
+ workflowTypes
1099
1108
  }
1100
1109
  )
1101
1110
  ] });
@@ -1251,7 +1260,10 @@ function WorkflowTypeTable({
1251
1260
  currentPage,
1252
1261
  setCurrentPage,
1253
1262
  setTotalEntries,
1254
- apiData
1263
+ apiData,
1264
+ onUpdate,
1265
+ onDeleteApi,
1266
+ onEdit
1255
1267
  }) {
1256
1268
  const initialData = [{
1257
1269
  workflowTypeId: 1,
@@ -1538,6 +1550,10 @@ function WorkflowTypeTable({
1538
1550
  length: totalPages
1539
1551
  }, (_, i) => i + 1);
1540
1552
  const handleEdit = (item) => {
1553
+ if (onEdit) {
1554
+ onEdit(item);
1555
+ return;
1556
+ }
1541
1557
  setSelectedItem(item);
1542
1558
  setIsEditOpen(true);
1543
1559
  };
@@ -1546,10 +1562,18 @@ function WorkflowTypeTable({
1546
1562
  setIsDeleteOpen(false);
1547
1563
  setIsDeleteOpen(true);
1548
1564
  };
1549
- const handleConfirmDelete = (itemToDelete) => {
1565
+ const handleConfirmDelete = async (itemToDelete) => {
1566
+ if (onDeleteApi) {
1567
+ await onDeleteApi(itemToDelete);
1568
+ return;
1569
+ }
1550
1570
  setData((prevData) => prevData.filter((i) => i.workflowTypeId !== itemToDelete.workflowTypeId));
1551
1571
  };
1552
- const handleSaveEdit = (updatedItem) => {
1572
+ const handleSaveEdit = async (updatedItem) => {
1573
+ if (onUpdate) {
1574
+ await onUpdate(updatedItem);
1575
+ return;
1576
+ }
1553
1577
  setData((prevData) => prevData.map((item) => item.workflowTypeId === updatedItem.workflowTypeId ? updatedItem : item));
1554
1578
  };
1555
1579
  return /* @__PURE__ */ jsxs12("div", { className: "fc:space-y-5", children: [
@@ -1712,6 +1736,23 @@ function WorkflowTypeMains() {
1712
1736
  console.log("Table data refreshed!");
1713
1737
  setRefreshKey((prev) => prev + 1);
1714
1738
  };
1739
+ const handleUpdateApi = async (item) => {
1740
+ var _a, _b, _c, _d, _e;
1741
+ try {
1742
+ const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.update;
1743
+ if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
1744
+ await getApiService().put(endpoint, { workflowTypeId: item.workflowTypeId, workflowTypeCode: item.workflowTypeCode.trim().toUpperCase(), workflowTypeName: item.workflowTypeName.trim(), description: (item.description || "").trim(), isActive: Boolean(item.isActive), updatedBy: item.updatedBy || item.createdBy || "System" });
1745
+ await Swal3.fire("Success", "Workflow type updated successfully.", "success");
1746
+ handleRefresh();
1747
+ return true;
1748
+ } catch (error) {
1749
+ await Swal3.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 workflow type.", "error");
1750
+ return false;
1751
+ }
1752
+ };
1753
+ const handleDeleteApi = async (item) => {
1754
+ return handleUpdateApi(__spreadProps(__spreadValues({}, item), { isActive: false }));
1755
+ };
1715
1756
  const tableRef = useRef3(null);
1716
1757
  const [modalOpen, setModalOpen] = useState9(false);
1717
1758
  const [pageSize, setPageSize] = useState9(10);
@@ -1780,12 +1821,15 @@ function WorkflowTypeMains() {
1780
1821
  ] })
1781
1822
  ] }),
1782
1823
  /* @__PURE__ */ jsxs14("div", { ref: tableRef, children: [
1783
- /* @__PURE__ */ jsx15(WorkflowTypeTable, { apiData, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onDelete: handleDelete }, refreshkey),
1824
+ /* @__PURE__ */ jsx15(WorkflowTypeTable, { apiData, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onUpdate: handleUpdateApi, onDeleteApi: handleDeleteApi }, refreshkey),
1784
1825
  " "
1785
1826
  ] })
1786
1827
  ] }) }),
1787
- /* @__PURE__ */ jsx15(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false) }),
1788
- /* @__PURE__ */ jsx15(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleSaveEdit, selectedData: selectedItem }),
1828
+ /* @__PURE__ */ jsx15(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: async () => {
1829
+ await Swal3.fire("Success", "Workflow type created successfully.", "success");
1830
+ handleRefresh();
1831
+ } }),
1832
+ /* @__PURE__ */ jsx15(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleUpdateApi, selectedData: selectedItem }),
1789
1833
  /* @__PURE__ */ jsx15(DeleteWorkflowType_default, { isOpen: isDeleteOpen, onClose: () => setIsDeleteOpen(false), onConfirm: handleConfirmDelete, itemData: selectedItem })
1790
1834
  ] });
1791
1835
  }
@@ -2177,7 +2221,7 @@ function AddWorkflowStepModal({ onClose }) {
2177
2221
  }
2178
2222
 
2179
2223
  // src/components/WorkflowStep/main.js
2180
- import { Fragment as Fragment2, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2224
+ import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2181
2225
  var workflowSteps = [{
2182
2226
  workflowStepId: 1,
2183
2227
  workflowId: 1,
@@ -2323,7 +2367,7 @@ function WorkflowStep() {
2323
2367
  direction
2324
2368
  });
2325
2369
  };
2326
- return /* @__PURE__ */ jsxs17(Fragment2, { children: [
2370
+ return /* @__PURE__ */ jsxs17(Fragment3, { children: [
2327
2371
  /* @__PURE__ */ jsxs17("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
2328
2372
  /* @__PURE__ */ jsx18(CommonHeader, { title: "Workflow Step", breadcrumbs: [{
2329
2373
  label: "Dashboard",
@@ -2781,7 +2825,7 @@ function AddWorkTransitionStepModal({ onClose, onSubmit }) {
2781
2825
  }
2782
2826
 
2783
2827
  // src/components/WorkFlowTransition/Transitiontable.js
2784
- import { Fragment as Fragment3, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
2828
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
2785
2829
  var WorkflowTransition = [{
2786
2830
  TransitionId: 1,
2787
2831
  workflowId: 1,
@@ -2877,7 +2921,7 @@ function WorkFlowTransition() {
2877
2921
  direction
2878
2922
  });
2879
2923
  };
2880
- return /* @__PURE__ */ jsxs19(Fragment3, { children: [
2924
+ return /* @__PURE__ */ jsxs19(Fragment4, { children: [
2881
2925
  /* @__PURE__ */ jsxs19("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
2882
2926
  /* @__PURE__ */ jsx20(CommonHeader, { title: "WorkFlow Transition", breadcrumbs: [{
2883
2927
  label: "Dashboard",
@@ -10498,7 +10542,7 @@ function AddBusinessEntityModal({ onClose }) {
10498
10542
  }
10499
10543
 
10500
10544
  // src/components/BuisnessEntity/BusinessEntitymain.js
10501
- import { Fragment as Fragment4, jsx as jsx78, jsxs as jsxs77 } from "react/jsx-runtime";
10545
+ import { Fragment as Fragment5, jsx as jsx78, jsxs as jsxs77 } from "react/jsx-runtime";
10502
10546
  var BusinessEntitys = [{
10503
10547
  BusinessEntityId: 1,
10504
10548
  EntityType: "Application",
@@ -10602,7 +10646,7 @@ function BusinessEntity() {
10602
10646
  direction
10603
10647
  });
10604
10648
  };
10605
- return /* @__PURE__ */ jsx78(Fragment4, { children: /* @__PURE__ */ jsxs77("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
10649
+ return /* @__PURE__ */ jsx78(Fragment5, { children: /* @__PURE__ */ jsxs77("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
10606
10650
  /* @__PURE__ */ jsx78(CommonHeader, { title: "Business Entity", breadcrumbs: [{
10607
10651
  label: "Dashboard",
10608
10652
  href: "/dashboard"
@@ -10955,7 +10999,7 @@ function AddFileInstanceModal({ onClose }) {
10955
10999
  }
10956
11000
 
10957
11001
  // src/components/FileInstance/FileInstancemain.js
10958
- import { Fragment as Fragment5, jsx as jsx80, jsxs as jsxs79 } from "react/jsx-runtime";
11002
+ import { Fragment as Fragment6, jsx as jsx80, jsxs as jsxs79 } from "react/jsx-runtime";
10959
11003
  var FileInstances = [{
10960
11004
  FileInstanceId: 1,
10961
11005
  workflowId: 1,
@@ -11111,7 +11155,7 @@ function FileInstance() {
11111
11155
  direction
11112
11156
  });
11113
11157
  };
11114
- return /* @__PURE__ */ jsxs79(Fragment5, { children: [
11158
+ return /* @__PURE__ */ jsxs79(Fragment6, { children: [
11115
11159
  /* @__PURE__ */ jsxs79("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
11116
11160
  /* @__PURE__ */ jsx80(CommonHeader, { title: "File Instance ", breadcrumbs: [{
11117
11161
  label: "Dashboard",
@@ -11664,7 +11708,7 @@ function AssignmentRuleMain() {
11664
11708
  }
11665
11709
 
11666
11710
  // src/components/Sidebar.jsx
11667
- import { Fragment as Fragment6, jsx as jsx85, jsxs as jsxs84 } from "react/jsx-runtime";
11711
+ import { Fragment as Fragment7, jsx as jsx85, jsxs as jsxs84 } from "react/jsx-runtime";
11668
11712
  var workflowItems = [
11669
11713
  // Menu Name testing // component or page-Use function name
11670
11714
  {
@@ -11851,7 +11895,7 @@ function Sidebar({
11851
11895
  open && /* @__PURE__ */ jsx85("div", { className: "fc:ml-[2px] fc:border-l fc:border-[#E5E9F1] fc:pl-[2px]", children: items.map(renderMenuItem) })
11852
11896
  ] });
11853
11897
  };
11854
- return /* @__PURE__ */ jsxs84(Fragment6, { children: [
11898
+ return /* @__PURE__ */ jsxs84(Fragment7, { children: [
11855
11899
  /* @__PURE__ */ jsxs84("aside", { className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`, children: [
11856
11900
  /* @__PURE__ */ jsxs84("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
11857
11901
  /* @__PURE__ */ jsxs84("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "9.3.1",
3
+ "version": "9.3.3",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [