flowcore-fn 9.2.5 → 9.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pkg-index.css +16 -10
- package/dist/pkg-index.js +400 -630
- package/dist/pkg-index.mjs +403 -633
- package/package.json +3 -2
package/dist/pkg-index.js
CHANGED
|
@@ -1066,6 +1066,7 @@ function Workflow() {
|
|
|
1066
1066
|
|
|
1067
1067
|
// src/components/workflow-type/WorkflowTypeMains.js
|
|
1068
1068
|
var import_react15 = __toESM(require("react"));
|
|
1069
|
+
var import_sweetalert22 = __toESM(require("sweetalert2"));
|
|
1069
1070
|
|
|
1070
1071
|
// src/components/workflow-type/SearchBar.jsx
|
|
1071
1072
|
var import_react10 = __toESM(require("react"));
|
|
@@ -1092,61 +1093,255 @@ function SearchBar2({
|
|
|
1092
1093
|
}
|
|
1093
1094
|
|
|
1094
1095
|
// src/components/workflow-type/WorkflowTypeTable.jsx
|
|
1095
|
-
var import_react13 = __toESM(require("react"));
|
|
1096
|
-
|
|
1097
|
-
// src/components/workflow-type/DeleteWorkflowType.jsx
|
|
1098
1096
|
var import_react11 = __toESM(require("react"));
|
|
1099
1097
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1098
|
+
function WorkflowTypeTable({ data = [], isLoading, pageSize, searchQuery = "", currentPage, setCurrentPage, setTotalEntries, onEdit, onDelete }) {
|
|
1099
|
+
const [sortOrder, setSortOrder] = (0, import_react11.useState)("asc");
|
|
1100
|
+
const [sortKey, setSortKey] = (0, import_react11.useState)("workflowTypeId");
|
|
1101
|
+
const handleSort = (columnKey) => {
|
|
1102
|
+
const isAsc = sortKey === columnKey && sortOrder === "asc";
|
|
1103
|
+
setSortOrder(isAsc ? "desc" : "asc");
|
|
1104
|
+
setSortKey(columnKey);
|
|
1105
|
+
};
|
|
1106
|
+
const filteredData = (0, import_react11.useMemo)(() => {
|
|
1107
|
+
const query = searchQuery.toLowerCase();
|
|
1108
|
+
return data.filter((item) => [item.workflowTypeName, item.workflowTypeCode, item.description].some((value) => String(value || "").toLowerCase().includes(query)));
|
|
1109
|
+
}, [data, searchQuery]);
|
|
1110
|
+
const sortedData = (0, import_react11.useMemo)(() => [...filteredData].sort((a, b) => {
|
|
1111
|
+
var _a, _b;
|
|
1112
|
+
const left = (_a = a[sortKey]) != null ? _a : "";
|
|
1113
|
+
const right = (_b = b[sortKey]) != null ? _b : "";
|
|
1114
|
+
if (left < right) return sortOrder === "asc" ? -1 : 1;
|
|
1115
|
+
if (left > right) return sortOrder === "asc" ? 1 : -1;
|
|
1116
|
+
return 0;
|
|
1117
|
+
}), [filteredData, sortKey, sortOrder]);
|
|
1118
|
+
(0, import_react11.useEffect)(() => {
|
|
1119
|
+
setTotalEntries == null ? void 0 : setTotalEntries(filteredData.length);
|
|
1120
|
+
}, [filteredData.length, setTotalEntries]);
|
|
1121
|
+
const totalPages = Math.ceil(sortedData.length / pageSize) || 1;
|
|
1122
|
+
(0, import_react11.useEffect)(() => {
|
|
1123
|
+
if (currentPage > totalPages) setCurrentPage(totalPages);
|
|
1124
|
+
}, [currentPage, setCurrentPage, totalPages]);
|
|
1125
|
+
const startIndex = (currentPage - 1) * pageSize;
|
|
1126
|
+
const visibleData = sortedData.slice(startIndex, startIndex + pageSize);
|
|
1127
|
+
const pageNumbers = Array.from({ length: totalPages }, (_, index) => index + 1);
|
|
1128
|
+
const sortIcon = (key) => sortKey === key ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2";
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fc:space-y-5", children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "fc:w-full fc:overflow-x-hidden fc:border fc:border-slate-200 fc:rounded-2xl fc:shadow-sm fc:max-h-[420px] fc:overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-fixed", children: [
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50 fc:shadow-[0_1px_0_0_rgba(226,232,240,1)]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { className: "fc:text-xs fc:font-bold fc:tracking-wider fc:text-slate-500", children: [
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("th", { onClick: () => handleSort("workflowTypeId"), className: "fc:py-3 fc:px-2 fc:text-sm fc:text-center fc:bg-slate-50 fc:cursor-pointer fc:select-none fc:w-[6%]", children: [
|
|
1133
|
+
"ID ",
|
|
1134
|
+
sortIcon("workflowTypeId")
|
|
1119
1135
|
] }),
|
|
1120
|
-
"
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("th", { onClick: () => handleSort("workflowTypeCode"), className: "fc:py-3 fc:px-3 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:w-[16%]", children: [
|
|
1137
|
+
"Code ",
|
|
1138
|
+
sortIcon("workflowTypeCode")
|
|
1139
|
+
] }),
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("th", { onClick: () => handleSort("workflowTypeName"), className: "fc:py-3 fc:px-3 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:w-[20%]", children: [
|
|
1141
|
+
"Name ",
|
|
1142
|
+
sortIcon("workflowTypeName")
|
|
1143
|
+
] }),
|
|
1144
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("th", { onClick: () => handleSort("description"), className: "fc:py-3 fc:px-3 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:w-[22%]", children: [
|
|
1145
|
+
"Description ",
|
|
1146
|
+
sortIcon("description")
|
|
1147
|
+
] }),
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "fc:py-3 fc:px-2 fc:text-sm fc:bg-slate-50 fc:text-center fc:w-[12%]", children: "Status" }),
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("th", { onClick: () => handleSort("createdOn"), className: "fc:py-3 fc:px-2 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:text-center fc:w-[12%]", children: [
|
|
1150
|
+
"Created On ",
|
|
1151
|
+
sortIcon("createdOn")
|
|
1152
|
+
] }),
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "fc:py-3 fc:px-2 fc:text-sm fc:bg-slate-50 fc:text-center fc:w-[12%]", children: "Action" })
|
|
1154
|
+
] }) }),
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-xs fc:text-slate-600", children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { colSpan: "7", className: "fc:py-8 fc:text-center fc:text-sm fc:text-slate-500", children: "Loading..." }) }) : visibleData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { colSpan: "7", className: "fc:py-8 fc:text-center fc:text-sm fc:text-slate-500", children: "No workflow types found." }) }) : visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
|
|
1156
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center fc:text-sm fc:font-medium fc:text-slate-700", children: startIndex + index + 1 }),
|
|
1157
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-3 fc:font-mono fc:text-sm fc:text-slate-700 fc:font-medium fc:break-words", children: item.workflowTypeCode }),
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-3 fc:font-medium fc:text-slate-700 fc:text-sm fc:break-words", children: item.workflowTypeName }),
|
|
1159
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-3 fc:text-slate-700 fc:text-sm fc:break-words", children: item.description }),
|
|
1160
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: `fc:px-2 fc:py-1 fc:text-[13px] fc:font-semibold fc:rounded-full fc:inline-block ${item.isActive ? "fc:bg-emerald-100 fc:text-emerald-700 fc:border fc:border-emerald-200" : "fc:bg-rose-100 fc:text-rose-700 fc:border fc:border-rose-200"}`, children: item.isActive ? "Active" : "Inactive" }) }),
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center fc:text-slate-700 fc:text-[13px] fc:font-mono", children: item.createdOn }),
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
1163
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { onClick: () => onEdit == null ? void 0 : onEdit(item), className: "fc:px-3 fc:py-1 fc:bg-blue-100/70 hover:fc:fc:bg-blue-200/80 fc:text-blue-600 fc:font-semibold fc:text-xs fc:rounded-full fc:transition-all fc:duration-150 fc:cursor-pointer", children: "Edit" }),
|
|
1164
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { onClick: () => onDelete == null ? void 0 : onDelete(item), className: "fc:px-3 fc:py-1 fc:bg-rose-100/70 hover:fc:fc:bg-rose-200/80 fc:text-rose-600 fc:font-semibold fc:text-xs fc:rounded-full fc:transition-all fc:duration-150 fc:cursor-pointer", children: "Delete" })
|
|
1165
|
+
] }) })
|
|
1166
|
+
] }, item.workflowTypeId)) })
|
|
1167
|
+
] }) }),
|
|
1168
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { onClick: () => setCurrentPage((previous) => Math.max(previous - 1, 1)), disabled: currentPage === 1, className: "fc:px-2 fc:py-1 fc:text-[15px] fc:border fc:border-slate-200 fc:rounded-lg fc:bg-white fc:text-slate-600 fc:shadow-sm fc:transition-all fc:duration-200 fc:hover:bg-blue-600 fc:hover:text-white fc:hover:border-blue-600", children: "\u2039 Prev" }),
|
|
1170
|
+
pageNumbers.map((pageNumber) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { onClick: () => setCurrentPage(pageNumber), className: `fc:px-2 fc:py-1 fc:text-[15px] fc:border fc:border-slate-200 fc:rounded-lg fc:bg-white fc:text-slate-600 fc:shadow-sm fc:transition-all fc:duration-200 fc:hover:bg-blue-600 fc:hover:text-white fc:hover:border-blue-600${currentPage === pageNumber ? "bg-blue-600 text-white font-medium shadow-sm" : "text-slate-600 hover:bg-slate-100"}`, children: pageNumber }, pageNumber)),
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { onClick: () => setCurrentPage((previous) => Math.min(previous + 1, totalPages)), disabled: currentPage === totalPages, className: "fc:px-2 fc:py-1 fc:text-[15px] fc:border fc:border-slate-200 fc:rounded-lg fc:bg-white fc:text-slate-600 fc:shadow-sm fc:transition-all fc:duration-200 fc:hover:bg-blue-600 fc:hover:text-white fc:hover:border-blue-600", children: "Next \u203A" })
|
|
1172
|
+
] })
|
|
1173
|
+
] });
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
// src/components/workflow-type/AddWorkflowTypeModal.jsx
|
|
1177
|
+
var import_react12 = __toESM(require("react"));
|
|
1178
|
+
var import_sweetalert2 = __toESM(require("sweetalert2"));
|
|
1179
|
+
|
|
1180
|
+
// src/components/Service/ApiEndpointsProvider.js
|
|
1181
|
+
var STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
|
|
1182
|
+
var apiEndpoints = null;
|
|
1183
|
+
var ApiEndpointsProvider = ({ apiEndpoints: endpoints }) => {
|
|
1184
|
+
if (typeof window !== "undefined" && endpoints) {
|
|
1185
|
+
apiEndpoints = endpoints;
|
|
1186
|
+
sessionStorage.setItem(
|
|
1187
|
+
STORAGE_KEY,
|
|
1188
|
+
JSON.stringify(endpoints)
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
return null;
|
|
1192
|
+
};
|
|
1193
|
+
var getApiEndpoints = () => {
|
|
1194
|
+
if (apiEndpoints) {
|
|
1195
|
+
return apiEndpoints;
|
|
1196
|
+
}
|
|
1197
|
+
if (typeof window !== "undefined") {
|
|
1198
|
+
const data = sessionStorage.getItem(STORAGE_KEY);
|
|
1199
|
+
if (data) {
|
|
1200
|
+
apiEndpoints = JSON.parse(data);
|
|
1201
|
+
return apiEndpoints;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
throw new Error(
|
|
1205
|
+
"Api Endpoints not initialized. Please render <ApiEndpointsProvider apiEndpoints={ApiEndPoints} /> once before using FlowCore."
|
|
1206
|
+
);
|
|
1207
|
+
};
|
|
1208
|
+
var ApiEndpointsProvider_default = ApiEndpointsProvider;
|
|
1209
|
+
|
|
1210
|
+
// src/components/Service/ApiServicepackage.js
|
|
1211
|
+
var apiService = null;
|
|
1212
|
+
var ApiServicepackage = ({ apiService: service }) => {
|
|
1213
|
+
if (service) {
|
|
1214
|
+
apiService = service;
|
|
1215
|
+
}
|
|
1216
|
+
return null;
|
|
1217
|
+
};
|
|
1218
|
+
var getApiService = () => {
|
|
1219
|
+
if (apiService) {
|
|
1220
|
+
return apiService;
|
|
1221
|
+
}
|
|
1222
|
+
throw new Error(
|
|
1223
|
+
"ApiService not initialized. Please render <ApiServicepackage apiService={ApiService} /> once before using FlowCore."
|
|
1224
|
+
);
|
|
1225
|
+
};
|
|
1226
|
+
var ApiServicepackage_default = ApiServicepackage;
|
|
1227
|
+
|
|
1228
|
+
// src/components/workflow-type/AddWorkflowTypeModal.jsx
|
|
1229
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1230
|
+
var initialFormData = {
|
|
1231
|
+
workflowTypeCode: "",
|
|
1232
|
+
workflowTypeName: "",
|
|
1233
|
+
description: "",
|
|
1234
|
+
createdBy: ""
|
|
1235
|
+
};
|
|
1236
|
+
var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
|
|
1237
|
+
const [formData, setFormData] = (0, import_react12.useState)(__spreadProps(__spreadValues({}, initialFormData), {
|
|
1238
|
+
createdBy
|
|
1239
|
+
}));
|
|
1240
|
+
const [errors, setErrors] = (0, import_react12.useState)({});
|
|
1241
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react12.useState)(false);
|
|
1242
|
+
const [submitError, setSubmitError] = (0, import_react12.useState)("");
|
|
1243
|
+
const handleChange = ({ target: { name, value } }) => {
|
|
1244
|
+
if (name === "description" && value.length > 500) return;
|
|
1245
|
+
setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [name]: value }));
|
|
1246
|
+
setErrors((previous) => __spreadProps(__spreadValues({}, previous), { [name]: "" }));
|
|
1247
|
+
setSubmitError("");
|
|
1248
|
+
};
|
|
1249
|
+
const validateForm = () => {
|
|
1250
|
+
const nextErrors = {};
|
|
1251
|
+
if (!formData.workflowTypeCode.trim()) nextErrors.workflowTypeCode = "Workflow type code is required";
|
|
1252
|
+
if (!formData.workflowTypeName.trim()) nextErrors.workflowTypeName = "Workflow type name is required";
|
|
1253
|
+
if (!formData.createdBy.trim()) nextErrors.createdBy = "Created by is required";
|
|
1254
|
+
setErrors(nextErrors);
|
|
1255
|
+
return Object.keys(nextErrors).length === 0;
|
|
1256
|
+
};
|
|
1257
|
+
const handleClose = () => {
|
|
1258
|
+
if (!isSubmitting) onClose();
|
|
1259
|
+
};
|
|
1260
|
+
const handleSubmit = async (event) => {
|
|
1261
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1262
|
+
event.preventDefault();
|
|
1263
|
+
if (!validateForm()) return;
|
|
1264
|
+
const payload = {
|
|
1265
|
+
workflowTypeCode: formData.workflowTypeCode.trim().toUpperCase(),
|
|
1266
|
+
workflowTypeName: formData.workflowTypeName.trim(),
|
|
1267
|
+
description: formData.description.trim(),
|
|
1268
|
+
createdBy: formData.createdBy.trim()
|
|
1269
|
+
};
|
|
1270
|
+
try {
|
|
1271
|
+
setIsSubmitting(true);
|
|
1272
|
+
setSubmitError("");
|
|
1273
|
+
const endpoints = getApiEndpoints();
|
|
1274
|
+
const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
|
|
1275
|
+
if (!endpoint) throw new Error("Create workflow type endpoint is not configured.");
|
|
1276
|
+
const response = await getApiService().post(endpoint, payload);
|
|
1277
|
+
await (onSave == null ? void 0 : onSave((_c = response == null ? void 0 : response.data) != null ? _c : response));
|
|
1278
|
+
setFormData(__spreadProps(__spreadValues({}, initialFormData), { createdBy }));
|
|
1279
|
+
setErrors({});
|
|
1280
|
+
onClose();
|
|
1281
|
+
} catch (error) {
|
|
1282
|
+
const message = ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || ((_g = (_f = error == null ? void 0 : error.response) == null ? void 0 : _f.data) == null ? void 0 : _g.title) || (error == null ? void 0 : error.message) || "Unable to create workflow type. Please try again.";
|
|
1283
|
+
setSubmitError(message);
|
|
1284
|
+
await import_sweetalert2.default.fire("Error", message, "error");
|
|
1285
|
+
} finally {
|
|
1286
|
+
setIsSubmitting(false);
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
if (!isOpen) return null;
|
|
1290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/20 fc:p-4 fc:backdrop-blur-sm", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fc:w-full fc:max-w-xl fc:overflow-hidden fc:rounded-2xl fc:border fc:border-gray-100 fc:bg-white fc:shadow-2xl", children: [
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-between fc:border-b fc:border-gray-100 fc:px-6 fc:py-4", children: [
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
1293
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { className: "fc:text-xl fc:font-bold fc:text-gray-800", children: "Add Workflow Type" }),
|
|
1294
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "fc:text-xs fc:text-gray-400", children: "Create a new workflow type" })
|
|
1121
1295
|
] }),
|
|
1122
|
-
/* @__PURE__ */ (0,
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1296
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: handleClose, disabled: isSubmitting, "aria-label": "Close", className: "fc:text-xl fc:text-gray-400 hover:fc:text-gray-600", children: "\xD7" })
|
|
1297
|
+
] }),
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: handleSubmit, className: "fc:space-y-4 fc:p-6", children: [
|
|
1299
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [
|
|
1300
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FormField, { label: "Workflow Type Code", required: true, error: errors.workflowTypeCode, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, placeholder: "e.g. PETITION", className: inputClass(errors.workflowTypeCode) }) }),
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FormField, { label: "Workflow Type Name", required: true, error: errors.workflowTypeName, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, placeholder: "Enter workflow type name", className: inputClass(errors.workflowTypeName) }) })
|
|
1302
|
+
] }),
|
|
1303
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FormField, { label: "Created By", required: true, error: errors.createdBy, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { name: "createdBy", value: formData.createdBy, onChange: handleChange, placeholder: "Enter user name or ID", className: inputClass(errors.createdBy) }) }),
|
|
1304
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FormField, { label: "Description", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fc:relative", children: [
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("textarea", { name: "description", rows: "3", value: formData.description, onChange: handleChange, placeholder: "Enter description", className: "fc:w-full fc:resize-none fc:rounded-xl fc:border fc:border-slate-200 fc:p-3 fc:text-sm fc:text-slate-700 fc:outline-none focus:fc:border-indigo-500" }),
|
|
1306
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "fc:absolute fc:bottom-2 fc:right-3 fc:text-xs fc:text-gray-400", children: [
|
|
1307
|
+
formData.description.length,
|
|
1308
|
+
"/500"
|
|
1309
|
+
] })
|
|
1310
|
+
] }) }),
|
|
1311
|
+
submitError && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "fc:rounded-lg fc:bg-red-50 fc:p-3 fc:text-sm fc:text-red-600", children: submitError }),
|
|
1312
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-3 fc:border-t fc:border-gray-100 fc:pt-4", children: [
|
|
1313
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "button", onClick: handleClose, disabled: isSubmitting, className: "fc:rounded-xl fc:bg-gray-100 fc:px-5 fc:py-2.5 fc:text-sm fc:font-medium fc:text-gray-600 disabled:fc:cursor-not-allowed", children: "Cancel" }),
|
|
1314
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "submit", disabled: isSubmitting, className: "fc:flex fc:min-w-32 fc:justify-center fc:rounded-xl fc:bg-[#2563eb] fc:px-6 fc:py-2.5 fc:text-sm fc:font-semibold fc:text-white disabled:fc:cursor-not-allowed disabled:fc:opacity-60", children: isSubmitting ? "Saving..." : "Save Workflow Type" })
|
|
1128
1315
|
] })
|
|
1129
1316
|
] })
|
|
1130
1317
|
] }) });
|
|
1131
1318
|
};
|
|
1132
|
-
var
|
|
1319
|
+
var inputClass = (hasError) => `fc:w-full fc:rounded-xl fc:border fc:bg-white fc:p-3 fc:text-sm fc:text-slate-700 fc:outline-none focus:fc:border-indigo-500 ${hasError ? "fc:border-red-500" : "fc:border-slate-200"}`;
|
|
1320
|
+
var FormField = ({ label, required, error, children }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700", children: [
|
|
1321
|
+
label,
|
|
1322
|
+
" ",
|
|
1323
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "fc:text-red-500", children: "*" }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "fc:mt-1.5", children }),
|
|
1325
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "fc:mt-1 fc:block fc:text-xs fc:text-red-500", children: error })
|
|
1326
|
+
] });
|
|
1327
|
+
var AddWorkflowTypeModal_default = AddWorkflowTypeModal;
|
|
1133
1328
|
|
|
1134
1329
|
// src/components/workflow-type/EditWorkflowType.jsx
|
|
1135
|
-
var
|
|
1136
|
-
var
|
|
1330
|
+
var import_react13 = __toESM(require("react"));
|
|
1331
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1137
1332
|
var EditWorkflowType = ({
|
|
1138
1333
|
isOpen,
|
|
1139
1334
|
onClose,
|
|
1140
1335
|
onSave,
|
|
1141
1336
|
selectedData
|
|
1142
1337
|
}) => {
|
|
1143
|
-
const [formData, setFormData] = (0,
|
|
1338
|
+
const [formData, setFormData] = (0, import_react13.useState)({
|
|
1144
1339
|
workflowTypeCode: "",
|
|
1145
1340
|
workflowTypeName: "",
|
|
1146
1341
|
description: "",
|
|
1147
1342
|
isActive: true
|
|
1148
1343
|
});
|
|
1149
|
-
(0,
|
|
1344
|
+
(0, import_react13.useEffect)(() => {
|
|
1150
1345
|
var _a, _b;
|
|
1151
1346
|
if (selectedData) {
|
|
1152
1347
|
setFormData({
|
|
@@ -1169,617 +1364,220 @@ var EditWorkflowType = ({
|
|
|
1169
1364
|
[name]: type === "checkbox" ? checked : value
|
|
1170
1365
|
}));
|
|
1171
1366
|
};
|
|
1172
|
-
const handleSubmit = (e) => {
|
|
1367
|
+
const handleSubmit = async (e) => {
|
|
1173
1368
|
e.preventDefault();
|
|
1174
|
-
onSave(__spreadValues(__spreadValues({}, selectedData), formData));
|
|
1175
|
-
onClose();
|
|
1369
|
+
const wasSaved = await (onSave == null ? void 0 : onSave(__spreadValues(__spreadValues({}, selectedData), formData)));
|
|
1370
|
+
if (wasSaved) onClose();
|
|
1176
1371
|
};
|
|
1177
|
-
return /* @__PURE__ */ (0,
|
|
1178
|
-
/* @__PURE__ */ (0,
|
|
1179
|
-
/* @__PURE__ */ (0,
|
|
1180
|
-
/* @__PURE__ */ (0,
|
|
1372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/40 fc:backdrop-blur-sm fc:p-4 fc:animate-in fc:fade-in fc:duration-200", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:relative fc:w-full fc:max-w-md fc:bg-white fc:rounded-3xl fc:shadow-2xl fc:border fc:border-gray-100 fc:overflow-hidden", children: [
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-between fc:px-6 fc:py-4 fc:border-b fc:border-gray-100", children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("h3", { className: "fc:text-lg fc:font-bold fc:text-gray-900", children: "Edit Workflow Type" }),
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: onClose, className: "fc:text-gray-400 hover:fc:fc:text-gray-600 fc:w-8 fc:h-8 fc:rounded-full fc:flex fc:items-center fc:justify-center fc:transition", children: "\u2715" })
|
|
1181
1376
|
] }),
|
|
1182
|
-
/* @__PURE__ */ (0,
|
|
1183
|
-
/* @__PURE__ */ (0,
|
|
1184
|
-
/* @__PURE__ */ (0,
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1377
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { onSubmit: handleSubmit, className: "fc:p-6 fc:space-y-4", children: [
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:uppercase fc:tracking-wider fc:mb-1", children: "Workflow Type Code" }),
|
|
1380
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "text", name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, className: "fc:w-full fc:rounded-xl fc:border fc:border-gray-200 fc:bg-gray-50 fc:px-3.5 fc:py-2 fc:text-sm fc:text-gray-900 focus:fc:fc:bg-white focus:fc:fc:border-blue-500 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/20 fc:transition", required: true })
|
|
1186
1381
|
] }),
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
1383
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:uppercase fc:tracking-wider fc:mb-1", children: "Workflow Type Name" }),
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "text", name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, className: "fc:w-full fc:rounded-xl fc:border fc:border-gray-200 fc:bg-gray-50 fc:px-3.5 fc:py-2 fc:text-sm fc:text-gray-900 focus:fc:fc:bg-white focus:fc:fc:border-blue-500 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/20 fc:transition", required: true })
|
|
1190
1385
|
] }),
|
|
1191
|
-
/* @__PURE__ */ (0,
|
|
1192
|
-
/* @__PURE__ */ (0,
|
|
1193
|
-
/* @__PURE__ */ (0,
|
|
1386
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:uppercase fc:tracking-wider fc:mb-1", children: "Description" }),
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("textarea", { name: "description", value: formData.description, onChange: handleChange, rows: "3", className: "fc:w-full fc:rounded-xl fc:border fc:border-gray-200 fc:bg-gray-50 fc:px-3.5 fc:py-2 fc:text-sm fc:text-gray-900 focus:fc:fc:bg-white focus:fc:fc:border-blue-500 focus:fc:fc:outline-none focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/20 fc:transition fc:resize-none" })
|
|
1194
1389
|
] }),
|
|
1195
|
-
/* @__PURE__ */ (0,
|
|
1196
|
-
/* @__PURE__ */ (0,
|
|
1197
|
-
/* @__PURE__ */ (0,
|
|
1390
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:flex fc:items-center fc:pt-1", children: [
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("input", { type: "checkbox", id: "isActive", name: "isActive", checked: formData.isActive, onChange: handleChange, className: "fc:h-4 fc:w-4 fc:rounded fc:border-gray-300 fc:text-blue-600 focus:fc:fc:ring-blue-500 fc:cursor-pointer" }),
|
|
1392
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("label", { htmlFor: "isActive", className: "fc:ml-2 fc:text-sm fc:font-medium fc:text-gray-700 fc:cursor-pointer", children: "Is Active" })
|
|
1198
1393
|
] }),
|
|
1199
|
-
/* @__PURE__ */ (0,
|
|
1200
|
-
/* @__PURE__ */ (0,
|
|
1201
|
-
/* @__PURE__ */ (0,
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-3 fc:pt-4 fc:border-t fc:border-gray-100", children: [
|
|
1395
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: onClose, className: "fc:py-2 fc:px-4 fc:text-sm fc:font-semibold fc:text-gray-700 fc:bg-gray-100 hover:fc:fc:bg-gray-200 fc:rounded-xl fc:transition", children: "Cancel" }),
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "submit", className: "fc:py-2 fc:px-5 fc:text-sm fc:font-semibold fc:text-white fc:bg-blue-600 hover:fc:fc:bg-blue-700 fc:rounded-xl fc:shadow-md fc:shadow-blue-500/20 fc:transition", children: "Update" })
|
|
1202
1397
|
] })
|
|
1203
1398
|
] })
|
|
1204
1399
|
] }) });
|
|
1205
1400
|
};
|
|
1206
1401
|
var EditWorkflowType_default = EditWorkflowType;
|
|
1207
1402
|
|
|
1208
|
-
// src/components/workflow-type/
|
|
1209
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1210
|
-
function WorkflowTypeTable({
|
|
1211
|
-
pageSize,
|
|
1212
|
-
searchQuery = "",
|
|
1213
|
-
currentPage,
|
|
1214
|
-
setCurrentPage,
|
|
1215
|
-
setTotalEntries
|
|
1216
|
-
}) {
|
|
1217
|
-
const initialData = [{
|
|
1218
|
-
workflowTypeId: 1,
|
|
1219
|
-
workflowTypeCode: "PETITION",
|
|
1220
|
-
workflowTypeName: "Citizen Petition",
|
|
1221
|
-
description: "Petition workflow for citizens",
|
|
1222
|
-
isActive: true,
|
|
1223
|
-
createdOn: "2026-01-01",
|
|
1224
|
-
createdBy: "1",
|
|
1225
|
-
updatedOn: "2026-01-05",
|
|
1226
|
-
updatedBy: "Admin"
|
|
1227
|
-
}, {
|
|
1228
|
-
workflowTypeId: 2,
|
|
1229
|
-
workflowTypeCode: "BUILDING",
|
|
1230
|
-
workflowTypeName: "Building Permission",
|
|
1231
|
-
description: "Building approval process",
|
|
1232
|
-
isActive: true,
|
|
1233
|
-
createdOn: "2026-01-01",
|
|
1234
|
-
createdBy: "1",
|
|
1235
|
-
updatedOn: "2026-01-06",
|
|
1236
|
-
updatedBy: "Admin"
|
|
1237
|
-
}, {
|
|
1238
|
-
workflowTypeId: 3,
|
|
1239
|
-
workflowTypeCode: "LEAVE",
|
|
1240
|
-
workflowTypeName: "Leave Application",
|
|
1241
|
-
description: "Employee leave management",
|
|
1242
|
-
isActive: true,
|
|
1243
|
-
createdOn: "2026-01-02",
|
|
1244
|
-
createdBy: "2",
|
|
1245
|
-
updatedOn: "2026-01-07",
|
|
1246
|
-
updatedBy: "HR"
|
|
1247
|
-
}, {
|
|
1248
|
-
workflowTypeId: 4,
|
|
1249
|
-
workflowTypeCode: "GRIEVANCE",
|
|
1250
|
-
workflowTypeName: "Grievance Redressal",
|
|
1251
|
-
description: "Public grievance workflow",
|
|
1252
|
-
isActive: false,
|
|
1253
|
-
createdOn: "2026-01-03",
|
|
1254
|
-
createdBy: "1",
|
|
1255
|
-
updatedOn: "2026-01-08",
|
|
1256
|
-
updatedBy: "Admin"
|
|
1257
|
-
}, {
|
|
1258
|
-
workflowTypeId: 5,
|
|
1259
|
-
workflowTypeCode: "TRADE",
|
|
1260
|
-
workflowTypeName: "Trade License",
|
|
1261
|
-
description: "Trade license issuance",
|
|
1262
|
-
isActive: true,
|
|
1263
|
-
createdOn: "2026-01-04",
|
|
1264
|
-
createdBy: "3",
|
|
1265
|
-
updatedOn: "2026-01-09",
|
|
1266
|
-
updatedBy: "Manager"
|
|
1267
|
-
}, {
|
|
1268
|
-
workflowTypeId: 6,
|
|
1269
|
-
workflowTypeCode: "DOC_VERIFY",
|
|
1270
|
-
workflowTypeName: "Document Verification",
|
|
1271
|
-
description: "Verification of identity documents",
|
|
1272
|
-
isActive: true,
|
|
1273
|
-
createdOn: "2026-01-05",
|
|
1274
|
-
createdBy: "2",
|
|
1275
|
-
updatedOn: "2026-01-10",
|
|
1276
|
-
updatedBy: "Admin"
|
|
1277
|
-
}, {
|
|
1278
|
-
workflowTypeId: 7,
|
|
1279
|
-
workflowTypeCode: "WATER_CONN",
|
|
1280
|
-
workflowTypeName: "Water Connection Approval",
|
|
1281
|
-
description: "New water connection requests",
|
|
1282
|
-
isActive: true,
|
|
1283
|
-
createdOn: "2026-01-05",
|
|
1284
|
-
createdBy: "1",
|
|
1285
|
-
updatedOn: "2026-01-11",
|
|
1286
|
-
updatedBy: "Admin"
|
|
1287
|
-
}, {
|
|
1288
|
-
workflowTypeId: 8,
|
|
1289
|
-
workflowTypeCode: "TAX_ASSESS",
|
|
1290
|
-
workflowTypeName: "Property Tax Assessment",
|
|
1291
|
-
description: "Annual property tax assessment",
|
|
1292
|
-
isActive: false,
|
|
1293
|
-
createdOn: "2026-01-06",
|
|
1294
|
-
createdBy: "4",
|
|
1295
|
-
updatedOn: "2026-01-12",
|
|
1296
|
-
updatedBy: "Officer"
|
|
1297
|
-
}, {
|
|
1298
|
-
workflowTypeId: 9,
|
|
1299
|
-
workflowTypeCode: "VENDOR_REG",
|
|
1300
|
-
workflowTypeName: "Vendor Registration",
|
|
1301
|
-
description: "Registration of new suppliers",
|
|
1302
|
-
isActive: true,
|
|
1303
|
-
createdOn: "2026-01-07",
|
|
1304
|
-
createdBy: "3",
|
|
1305
|
-
updatedOn: "2026-01-13",
|
|
1306
|
-
updatedBy: "Manager"
|
|
1307
|
-
}, {
|
|
1308
|
-
workflowTypeId: 10,
|
|
1309
|
-
workflowTypeCode: "BIRTH_CERT",
|
|
1310
|
-
workflowTypeName: "Birth Certificate Request",
|
|
1311
|
-
description: "Issuance of birth certificate",
|
|
1312
|
-
isActive: true,
|
|
1313
|
-
createdOn: "2026-01-08",
|
|
1314
|
-
createdBy: "1",
|
|
1315
|
-
updatedOn: "2026-01-14",
|
|
1316
|
-
updatedBy: "Admin"
|
|
1317
|
-
}, {
|
|
1318
|
-
workflowTypeId: 11,
|
|
1319
|
-
workflowTypeCode: "DEATH_CERT",
|
|
1320
|
-
workflowTypeName: "Death Certificate Request",
|
|
1321
|
-
description: "Issuance of death certificate",
|
|
1322
|
-
isActive: true,
|
|
1323
|
-
createdOn: "2026-01-08",
|
|
1324
|
-
createdBy: "1",
|
|
1325
|
-
updatedOn: "2026-01-15",
|
|
1326
|
-
updatedBy: "Admin"
|
|
1327
|
-
}, {
|
|
1328
|
-
workflowTypeId: 12,
|
|
1329
|
-
workflowTypeCode: "ROAD_REPAIR",
|
|
1330
|
-
workflowTypeName: "Road Repair Request",
|
|
1331
|
-
description: "PWD road maintenance flow",
|
|
1332
|
-
isActive: true,
|
|
1333
|
-
createdOn: "2026-01-09",
|
|
1334
|
-
createdBy: "5",
|
|
1335
|
-
updatedOn: "2026-01-16",
|
|
1336
|
-
updatedBy: "Engineer"
|
|
1337
|
-
}, {
|
|
1338
|
-
workflowTypeId: 13,
|
|
1339
|
-
workflowTypeCode: "WASTE_MGMT",
|
|
1340
|
-
workflowTypeName: "Waste Collection Issue",
|
|
1341
|
-
description: "Sanitation complaint tracking",
|
|
1342
|
-
isActive: false,
|
|
1343
|
-
createdOn: "2026-01-10",
|
|
1344
|
-
createdBy: "2",
|
|
1345
|
-
updatedOn: "2026-01-17",
|
|
1346
|
-
updatedBy: "Officer"
|
|
1347
|
-
}, {
|
|
1348
|
-
workflowTypeId: 14,
|
|
1349
|
-
workflowTypeCode: "FIRE_NOC",
|
|
1350
|
-
workflowTypeName: "Fire NOC Approval",
|
|
1351
|
-
description: "Safety clearance certificate",
|
|
1352
|
-
isActive: true,
|
|
1353
|
-
createdOn: "2026-01-11",
|
|
1354
|
-
createdBy: "1",
|
|
1355
|
-
updatedOn: "2026-01-18",
|
|
1356
|
-
updatedBy: "Admin"
|
|
1357
|
-
}, {
|
|
1358
|
-
workflowTypeId: 15,
|
|
1359
|
-
workflowTypeCode: "HEALTH_LIC",
|
|
1360
|
-
workflowTypeName: "Health License Approval",
|
|
1361
|
-
description: "Commercial health license",
|
|
1362
|
-
isActive: true,
|
|
1363
|
-
createdOn: "2026-01-12",
|
|
1364
|
-
createdBy: "3",
|
|
1365
|
-
updatedOn: "2026-01-19",
|
|
1366
|
-
updatedBy: "Manager"
|
|
1367
|
-
}, {
|
|
1368
|
-
workflowTypeId: 16,
|
|
1369
|
-
workflowTypeCode: "ADV_PERMIT",
|
|
1370
|
-
workflowTypeName: "Advertisement Board Perm",
|
|
1371
|
-
description: "Hoarding and billboard permit",
|
|
1372
|
-
isActive: true,
|
|
1373
|
-
createdOn: "2026-01-13",
|
|
1374
|
-
createdBy: "4",
|
|
1375
|
-
updatedOn: "2026-01-20",
|
|
1376
|
-
updatedBy: "Officer"
|
|
1377
|
-
}, {
|
|
1378
|
-
workflowTypeId: 17,
|
|
1379
|
-
workflowTypeCode: "MARRIAGE_REG",
|
|
1380
|
-
workflowTypeName: "Marriage Registration",
|
|
1381
|
-
description: "Legal marriage certificate flow",
|
|
1382
|
-
isActive: true,
|
|
1383
|
-
createdOn: "2026-01-14",
|
|
1384
|
-
createdBy: "1",
|
|
1385
|
-
updatedOn: "2026-01-21",
|
|
1386
|
-
updatedBy: "Admin"
|
|
1387
|
-
}, {
|
|
1388
|
-
workflowTypeId: 18,
|
|
1389
|
-
workflowTypeCode: "RTI_APP",
|
|
1390
|
-
workflowTypeName: "RTI Application Flow",
|
|
1391
|
-
description: "Right to information processing",
|
|
1392
|
-
isActive: true,
|
|
1393
|
-
createdOn: "2026-01-15",
|
|
1394
|
-
createdBy: "2",
|
|
1395
|
-
updatedOn: "2026-01-22",
|
|
1396
|
-
updatedBy: "Officer"
|
|
1397
|
-
}, {
|
|
1398
|
-
workflowTypeId: 19,
|
|
1399
|
-
workflowTypeCode: "CONTRACTOR",
|
|
1400
|
-
workflowTypeName: "Contractor Empanelment",
|
|
1401
|
-
description: "Procurement contractor onboarding",
|
|
1402
|
-
isActive: true,
|
|
1403
|
-
createdOn: "2026-01-16",
|
|
1404
|
-
createdBy: "3",
|
|
1405
|
-
updatedOn: "2026-01-23",
|
|
1406
|
-
updatedBy: "Manager"
|
|
1407
|
-
}, {
|
|
1408
|
-
workflowTypeId: 20,
|
|
1409
|
-
workflowTypeCode: "STREET_LIGHT",
|
|
1410
|
-
workflowTypeName: "Streetlight Maintenance",
|
|
1411
|
-
description: "Electrical infrastructure issue",
|
|
1412
|
-
isActive: true,
|
|
1413
|
-
createdOn: "2026-01-17",
|
|
1414
|
-
createdBy: "5",
|
|
1415
|
-
updatedOn: "2026-01-24",
|
|
1416
|
-
updatedBy: "Engineer"
|
|
1417
|
-
}, {
|
|
1418
|
-
workflowTypeId: 21,
|
|
1419
|
-
workflowTypeCode: "PARK_BOOKING",
|
|
1420
|
-
workflowTypeName: "Park Booking Approval",
|
|
1421
|
-
description: "Public event park reservation",
|
|
1422
|
-
isActive: false,
|
|
1423
|
-
createdOn: "2026-01-18",
|
|
1424
|
-
createdBy: "2",
|
|
1425
|
-
updatedOn: "2026-01-25",
|
|
1426
|
-
updatedBy: "Admin"
|
|
1427
|
-
}, {
|
|
1428
|
-
workflowTypeId: 22,
|
|
1429
|
-
workflowTypeCode: "DRAINAGE",
|
|
1430
|
-
workflowTypeName: "Drainage Issue Escalation",
|
|
1431
|
-
description: "Sewerage maintenance request",
|
|
1432
|
-
isActive: true,
|
|
1433
|
-
createdOn: "2026-01-19",
|
|
1434
|
-
createdBy: "5",
|
|
1435
|
-
updatedOn: "2026-01-26",
|
|
1436
|
-
updatedBy: "Engineer"
|
|
1437
|
-
}, {
|
|
1438
|
-
workflowTypeId: 23,
|
|
1439
|
-
workflowTypeCode: "COMM_HALL",
|
|
1440
|
-
workflowTypeName: "Community Hall Booking",
|
|
1441
|
-
description: "Civic facility reservation",
|
|
1442
|
-
isActive: true,
|
|
1443
|
-
createdOn: "2026-01-20",
|
|
1444
|
-
createdBy: "1",
|
|
1445
|
-
updatedOn: "2026-01-27",
|
|
1446
|
-
updatedBy: "Admin"
|
|
1447
|
-
}, {
|
|
1448
|
-
workflowTypeId: 24,
|
|
1449
|
-
workflowTypeCode: "SEISMIC_CLR",
|
|
1450
|
-
workflowTypeName: "Seismic Clearance Flow",
|
|
1451
|
-
description: "Environmental safety check",
|
|
1452
|
-
isActive: false,
|
|
1453
|
-
createdOn: "2026-01-21",
|
|
1454
|
-
createdBy: "4",
|
|
1455
|
-
updatedOn: "2026-01-28",
|
|
1456
|
-
updatedBy: "Officer"
|
|
1457
|
-
}, {
|
|
1458
|
-
workflowTypeId: 25,
|
|
1459
|
-
workflowTypeCode: "TREE_CUTTING",
|
|
1460
|
-
workflowTypeName: "Tree Cutting Permission",
|
|
1461
|
-
description: "Greenery regulation permit",
|
|
1462
|
-
isActive: true,
|
|
1463
|
-
createdOn: "2026-01-22",
|
|
1464
|
-
createdBy: "2",
|
|
1465
|
-
updatedOn: "2026-01-29",
|
|
1466
|
-
updatedBy: "Officer"
|
|
1467
|
-
}];
|
|
1468
|
-
const [data, setData] = (0, import_react13.useState)(initialData);
|
|
1469
|
-
const [sortOrder, setSortOrder] = (0, import_react13.useState)("asc");
|
|
1470
|
-
const [sortKey, setSortKey] = (0, import_react13.useState)("workflowTypeId");
|
|
1471
|
-
const [selectedItem, setSelectedItem] = (0, import_react13.useState)(null);
|
|
1472
|
-
const [isEditOpen, setIsEditOpen] = (0, import_react13.useState)(false);
|
|
1473
|
-
const [isDeleteOpen, setIsDeleteOpen] = (0, import_react13.useState)(false);
|
|
1474
|
-
const handleSort = (columnKey) => {
|
|
1475
|
-
const isAsc = sortKey === columnKey && sortOrder === "asc";
|
|
1476
|
-
setSortOrder(isAsc ? "desc" : "asc");
|
|
1477
|
-
setSortKey(columnKey);
|
|
1478
|
-
const sortedData = [...data].sort((a, b) => {
|
|
1479
|
-
if (a[columnKey] < b[columnKey]) return isAsc ? -1 : 1;
|
|
1480
|
-
if (a[columnKey] > b[columnKey]) return isAsc ? 1 : -1;
|
|
1481
|
-
return 0;
|
|
1482
|
-
});
|
|
1483
|
-
setData(sortedData);
|
|
1484
|
-
};
|
|
1485
|
-
const filteredData = data.filter((item) => {
|
|
1486
|
-
const query = (searchQuery || "").toLowerCase();
|
|
1487
|
-
return item.workflowTypeName.toLowerCase().includes(query) || item.workflowTypeCode.toLowerCase().includes(query) || item.description.toLowerCase().includes(query);
|
|
1488
|
-
});
|
|
1489
|
-
(0, import_react13.useEffect)(() => {
|
|
1490
|
-
if (setTotalEntries) setTotalEntries(filteredData.length);
|
|
1491
|
-
}, [filteredData.length, setTotalEntries]);
|
|
1492
|
-
const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
|
|
1493
|
-
const startIndex = (currentPage - 1) * pageSize;
|
|
1494
|
-
const visibleData = filteredData.slice(startIndex, startIndex + pageSize);
|
|
1495
|
-
const pageNumbers = Array.from({
|
|
1496
|
-
length: totalPages
|
|
1497
|
-
}, (_, i) => i + 1);
|
|
1498
|
-
const handleEdit = (item) => {
|
|
1499
|
-
setSelectedItem(item);
|
|
1500
|
-
setIsEditOpen(true);
|
|
1501
|
-
};
|
|
1502
|
-
const handleDelete = (item) => {
|
|
1503
|
-
setSelectedItem(item);
|
|
1504
|
-
setIsDeleteOpen(false);
|
|
1505
|
-
setIsDeleteOpen(true);
|
|
1506
|
-
};
|
|
1507
|
-
const handleConfirmDelete = (itemToDelete) => {
|
|
1508
|
-
setData((prevData) => prevData.filter((i) => i.workflowTypeId !== itemToDelete.workflowTypeId));
|
|
1509
|
-
};
|
|
1510
|
-
const handleSaveEdit = (updatedItem) => {
|
|
1511
|
-
setData((prevData) => prevData.map((item) => item.workflowTypeId === updatedItem.workflowTypeId ? updatedItem : item));
|
|
1512
|
-
};
|
|
1513
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:space-y-5", children: [
|
|
1514
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "fc:w-full fc:overflow-x-hidden fc:border fc:border-slate-200 fc:rounded-2xl fc:shadow-sm fc:max-h-[420px] fc:overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("table", { className: "fc:w-full fc:text-left fc:border-collapse fc:bg-white fc:table-fixed", children: [
|
|
1515
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("thead", { className: "fc:sticky fc:top-0 fc:z-10 fc:bg-slate-50 fc:shadow-[0_1px_0_0_rgba(226,232,240,1)]", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { className: "fc:text-xs fc:font-bold fc:tracking-wider fc:text-slate-500", children: [
|
|
1516
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("th", { onClick: () => handleSort("workflowTypeId"), className: "fc:py-3 fc:px-2 fc:text-sm fc:text-center fc:bg-slate-50 fc:cursor-pointer fc:select-none fc:w-[6%]", children: [
|
|
1517
|
-
"ID ",
|
|
1518
|
-
sortKey === "workflowTypeId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
1519
|
-
] }),
|
|
1520
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("th", { onClick: () => handleSort("workflowTypeCode"), className: "fc:py-3 fc:px-3 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:w-[16%]", children: [
|
|
1521
|
-
"Code ",
|
|
1522
|
-
sortKey === "workflowTypeCode" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
1523
|
-
] }),
|
|
1524
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("th", { onClick: () => handleSort("workflowTypeName"), className: "fc:py-3 fc:px-3 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:w-[20%]", children: [
|
|
1525
|
-
"Name ",
|
|
1526
|
-
sortKey === "workflowTypeName" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
1527
|
-
] }),
|
|
1528
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("th", { onClick: () => handleSort("description"), className: "fc:py-3 fc:px-3 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:w-[22%]", children: [
|
|
1529
|
-
"Description ",
|
|
1530
|
-
sortKey === "description" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
1531
|
-
] }),
|
|
1532
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "fc:py-3 fc:px-2 fc:text-sm fc:bg-slate-50 fc:text-center fc:w-[12%]", children: "Status" }),
|
|
1533
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("th", { onClick: () => handleSort("createdOn"), className: "fc:py-3 fc:px-2 fc:text-sm fc:cursor-pointer fc:select-none hover:fc:fc:text-slate-900 fc:bg-slate-50 fc:text-center fc:w-[12%]", children: [
|
|
1534
|
-
"Created On ",
|
|
1535
|
-
sortKey === "createdOn" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
|
|
1536
|
-
] }),
|
|
1537
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("th", { className: "fc:py-3 fc:px-2 fc:text-sm fc:bg-slate-50 fc:text-center fc:w-[12%]", children: "Action" })
|
|
1538
|
-
] }) }),
|
|
1539
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("tbody", { className: "fc:divide-y fc:divide-slate-100 fc:text-xs fc:text-slate-600", children: visibleData.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("tr", { className: "hover:fc:fc:bg-slate-50/50 fc:transition-colors", children: [
|
|
1540
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center fc:text-sm fc:font-medium fc:text-slate-700", children: startIndex + index + 1 }),
|
|
1541
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-3 fc:font-mono fc:text-sm fc:text-slate-700 fc:font-medium fc:break-words", children: item.workflowTypeCode }),
|
|
1542
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-3 fc:font-medium fc:text-slate-700 fc:text-sm fc:break-words", children: item.workflowTypeName }),
|
|
1543
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-3 fc:text-slate-700 fc:text-sm fc:break-words", children: item.description }),
|
|
1544
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `fc:px-2 fc:py-1 fc:text-[13px] fc:font-semibold fc:rounded-full fc:inline-block ${item.isActive ? "fc:bg-emerald-100 fc:text-emerald-700 fc:border fc:border-emerald-200" : "fc:bg-rose-100 fc:text-rose-700 fc:border fc:border-rose-200"}`, children: item.isActive ? "Active" : "Inactive" }) }),
|
|
1545
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center fc:text-slate-700 fc:text-[13px] fc:font-mono", children: item.createdOn }),
|
|
1546
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("td", { className: "fc:py-3 fc:px-2 fc:text-center", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
|
|
1547
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: () => handleEdit(item), className: "fc:px-3 fc:py-1 fc:bg-blue-100/70 hover:fc:fc:bg-blue-200/80 fc:text-blue-600 fc:font-semibold fc:text-xs fc:rounded-full fc:transition-all fc:duration-150 fc:cursor-pointer", children: "Edit" }),
|
|
1548
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: () => handleDelete(item), className: "fc:px-3 fc:py-1 fc:bg-rose-100/70 hover:fc:fc:bg-rose-200/80 fc:text-rose-600 fc:font-semibold fc:text-xs fc:rounded-full fc:transition-all fc:duration-150 fc:cursor-pointer", children: "Delete" })
|
|
1549
|
-
] }) })
|
|
1550
|
-
] }, item.workflowTypeId)) })
|
|
1551
|
-
] }) }),
|
|
1552
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "fc:flex fc:items-center fc:justify-end fc:gap-1 fc:text-[13px] fc:text-slate-700 fc:font-normal fc:mt-4 fc:bg-slate-50/50 fc:p-3 fc:rounded-xl fc:border fc:border-slate-100", children: [
|
|
1553
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: () => setCurrentPage((prev) => Math.max(prev - 1, 1)), disabled: currentPage === 1, className: "fc:px-2 fc:py-1 fc:text-[15px] fc:border fc:border-slate-200 fc:rounded-lg fc:bg-white fc:text-slate-600 fc:shadow-sm fc:transition-all fc:duration-200 fc:hover:bg-blue-600 fc:hover:text-white fc:hover:border-blue-600", children: "\u2039 Prev" }),
|
|
1554
|
-
pageNumbers.map((pageNumber) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: () => setCurrentPage(pageNumber), className: `fc:px-2 fc:py-1 fc:text-[15px] fc:border fc:border-slate-200 fc:rounded-lg fc:bg-white fc:text-slate-600 fc:shadow-sm fc:transition-all fc:duration-200 fc:hover:bg-blue-600 fc:hover:text-white fc:hover:border-blue-600${currentPage === pageNumber ? "bg-blue-600 text-white font-medium shadow-sm" : "text-slate-600 hover:bg-slate-100"}`, children: pageNumber }, pageNumber)),
|
|
1555
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { onClick: () => setCurrentPage((prev) => Math.min(prev + 1, totalPages)), disabled: currentPage === totalPages, className: "fc:px-2 fc:py-1 fc:text-[15px] fc:border fc:border-slate-200 fc:rounded-lg fc:bg-white fc:text-slate-600 fc:shadow-sm fc:transition-all fc:duration-200 fc:hover:bg-blue-600 fc:hover:text-white fc:hover:border-blue-600", children: "Next \u203A" })
|
|
1556
|
-
] }),
|
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), selectedData: selectedItem, onSave: handleSaveEdit }),
|
|
1558
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DeleteWorkflowType_default, { isOpen: isDeleteOpen, onClose: () => setIsDeleteOpen(false), itemData: selectedItem, onConfirm: handleConfirmDelete })
|
|
1559
|
-
] });
|
|
1560
|
-
}
|
|
1561
|
-
|
|
1562
|
-
// src/components/workflow-type/AddWorkflowTypeModal.jsx
|
|
1403
|
+
// src/components/workflow-type/DeleteWorkflowType.jsx
|
|
1563
1404
|
var import_react14 = __toESM(require("react"));
|
|
1564
1405
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1565
|
-
var
|
|
1406
|
+
var DeleteWorkflowType = ({
|
|
1566
1407
|
isOpen,
|
|
1567
1408
|
onClose,
|
|
1568
|
-
|
|
1409
|
+
onConfirm,
|
|
1410
|
+
itemData
|
|
1569
1411
|
}) => {
|
|
1570
|
-
const [formData, setFormData] = (0, import_react14.useState)({
|
|
1571
|
-
workflowTypeId: "",
|
|
1572
|
-
workflowCode: "",
|
|
1573
|
-
workflowName: "",
|
|
1574
|
-
version: 1,
|
|
1575
|
-
isPublished: "No",
|
|
1576
|
-
description: "",
|
|
1577
|
-
isActive: true
|
|
1578
|
-
});
|
|
1579
|
-
const [workflowTypeOptions, setWorkflowTypeOptions] = (0, import_react14.useState)([]);
|
|
1580
|
-
const [errors, setErrors] = (0, import_react14.useState)({});
|
|
1581
|
-
(0, import_react14.useEffect)(() => {
|
|
1582
|
-
const options = [{
|
|
1583
|
-
workflowTypeId: 1,
|
|
1584
|
-
workflowTypeName: "Citizen Petition",
|
|
1585
|
-
workflowTypeCode: "PETITION"
|
|
1586
|
-
}, {
|
|
1587
|
-
workflowTypeId: 2,
|
|
1588
|
-
workflowTypeName: "Building Permission",
|
|
1589
|
-
workflowTypeCode: "BUILDING"
|
|
1590
|
-
}, {
|
|
1591
|
-
workflowTypeId: 3,
|
|
1592
|
-
workflowTypeName: "Leave Application",
|
|
1593
|
-
workflowTypeCode: "LEAVE"
|
|
1594
|
-
}];
|
|
1595
|
-
setWorkflowTypeOptions(options);
|
|
1596
|
-
}, []);
|
|
1597
|
-
const handleChange = (e) => {
|
|
1598
|
-
const {
|
|
1599
|
-
name,
|
|
1600
|
-
value,
|
|
1601
|
-
type,
|
|
1602
|
-
checked
|
|
1603
|
-
} = e.target;
|
|
1604
|
-
if (name === "description" && value.length > 500) return;
|
|
1605
|
-
setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
1606
|
-
[name]: type === "checkbox" ? checked : value
|
|
1607
|
-
}));
|
|
1608
|
-
if (errors[name]) {
|
|
1609
|
-
setErrors((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
1610
|
-
[name]: ""
|
|
1611
|
-
}));
|
|
1612
|
-
}
|
|
1613
|
-
};
|
|
1614
|
-
const validateForm = () => {
|
|
1615
|
-
let newErrors = {};
|
|
1616
|
-
if (!formData.workflowTypeId) newErrors.workflowTypeId = "Workflow Type is required";
|
|
1617
|
-
if (!formData.workflowCode.trim()) newErrors.workflowCode = "Workflow Code is required";
|
|
1618
|
-
if (!formData.workflowName.trim()) newErrors.workflowName = "Workflow Name is required";
|
|
1619
|
-
setErrors(newErrors);
|
|
1620
|
-
return Object.keys(newErrors).length === 0;
|
|
1621
|
-
};
|
|
1622
|
-
const handleSubmit = (e) => {
|
|
1623
|
-
e.preventDefault();
|
|
1624
|
-
if (!validateForm()) return;
|
|
1625
|
-
const payload = {
|
|
1626
|
-
workflowTypeId: parseInt(formData.workflowTypeId, 10),
|
|
1627
|
-
workflowCode: formData.workflowCode.toUpperCase().trim(),
|
|
1628
|
-
workflowName: formData.workflowName.trim(),
|
|
1629
|
-
version: parseInt(formData.version, 10),
|
|
1630
|
-
isPublished: formData.isPublished === "Yes",
|
|
1631
|
-
isActive: formData.isActive,
|
|
1632
|
-
description: formData.description.trim()
|
|
1633
|
-
};
|
|
1634
|
-
onSave(payload);
|
|
1635
|
-
handleReset();
|
|
1636
|
-
onClose();
|
|
1637
|
-
};
|
|
1638
|
-
const handleReset = () => {
|
|
1639
|
-
setFormData({
|
|
1640
|
-
workflowTypeId: "",
|
|
1641
|
-
workflowCode: "",
|
|
1642
|
-
workflowName: "",
|
|
1643
|
-
version: 1,
|
|
1644
|
-
isPublished: "No",
|
|
1645
|
-
description: "",
|
|
1646
|
-
isActive: true
|
|
1647
|
-
});
|
|
1648
|
-
setErrors({});
|
|
1649
|
-
};
|
|
1650
1412
|
if (!isOpen) return null;
|
|
1651
|
-
return (
|
|
1652
|
-
/*
|
|
1653
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.
|
|
1654
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:bg-black/40 fc:backdrop-blur-sm fc:p-4 fc:animate-in fc:fade-in fc:duration-200", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:relative fc:w-full fc:max-w-md fc:bg-white fc:rounded-3xl fc:shadow-2xl fc:border fc:border-gray-100 fc:overflow-hidden", children: [
|
|
1414
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: onClose, className: "fc:absolute fc:top-4 fc:right-4 fc:z-10 fc:flex fc:items-center fc:justify-center fc:w-8 fc:h-8 fc:rounded-full fc:text-gray-400 hover:fc:fc:text-gray-600 hover:fc:fc:bg-gray-100 fc:transition", children: "\u2715" }),
|
|
1415
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:p-8 fc:text-center", children: [
|
|
1416
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fc:mx-auto fc:mb-4 fc:flex fc:h-14 fc:w-14 fc:items-center fc:justify-center fc:rounded-2xl fc:bg-red-50 fc:border fc:border-red-100 fc:text-red-500 fc:shadow-inner", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-2xl", children: "\u26A0\uFE0F" }) }),
|
|
1417
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "fc:text-xl fc:font-bold fc:text-gray-900 fc:tracking-tight fc:mb-2", children: "Delete Configuration" }),
|
|
1418
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "fc:text-sm fc:text-gray-500 fc:leading-relaxed fc:px-2 fc:mb-6", children: [
|
|
1419
|
+
"Are you sure you want to delete",
|
|
1420
|
+
" ",
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fc:font-semibold fc:text-gray-900 fc:bg-gray-100 fc:px-2 fc:py-0.5 fc:rounded-md", children: [
|
|
1422
|
+
'"',
|
|
1423
|
+
(itemData == null ? void 0 : itemData.workflowTypeName) || (itemData == null ? void 0 : itemData.WorkflowTypeName) || "this item",
|
|
1424
|
+
'"'
|
|
1661
1425
|
] }),
|
|
1662
|
-
|
|
1426
|
+
"? This action cannot be undone."
|
|
1663
1427
|
] }),
|
|
1664
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("
|
|
1665
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
] }),
|
|
1670
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-5", children: [
|
|
1671
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1672
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:mb-1.5", children: [
|
|
1673
|
-
"Workflow Type ",
|
|
1674
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
1675
|
-
] }),
|
|
1676
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { name: "workflowTypeId", value: formData.workflowTypeId, onChange: handleChange, className: `fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 ${errors.workflowTypeId ? "fc:border-red-500" : "fc:border-slate-200 fc:text-slate-700"}`, children: [
|
|
1677
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "", children: "Select workflow type" }),
|
|
1678
|
-
workflowTypeOptions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: item.workflowTypeId, children: item.workflowTypeName }, item.workflowTypeId))
|
|
1679
|
-
] }),
|
|
1680
|
-
errors.workflowTypeId && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-xs fc:text-red-500", children: errors.workflowTypeId })
|
|
1681
|
-
] }),
|
|
1682
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1683
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:mb-1.5", children: [
|
|
1684
|
-
"Workflow Code ",
|
|
1685
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
1686
|
-
] }),
|
|
1687
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "text", name: "workflowCode", placeholder: "Enter workflow code", value: formData.workflowCode, onChange: handleChange, className: `fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 ${errors.workflowCode ? "fc:border-red-500" : "fc:border-slate-200 fc:text-slate-700"}` }),
|
|
1688
|
-
errors.workflowCode && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-xs fc:text-red-500", children: errors.workflowCode })
|
|
1689
|
-
] }),
|
|
1690
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:col-span-2", children: [
|
|
1691
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:mb-1.5", children: [
|
|
1692
|
-
"Workflow Name ",
|
|
1693
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
1694
|
-
] }),
|
|
1695
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "text", name: "workflowName", placeholder: "Enter workflow name", value: formData.workflowName, onChange: handleChange, className: `fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 ${errors.workflowName ? "fc:border-red-500" : "fc:border-slate-200 fc:text-slate-700"}` }),
|
|
1696
|
-
errors.workflowName && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-xs fc:text-red-500", children: errors.workflowName })
|
|
1697
|
-
] }),
|
|
1698
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1699
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:mb-1.5", children: [
|
|
1700
|
-
"Version ",
|
|
1701
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
1702
|
-
] }),
|
|
1703
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { type: "number", name: "version", value: formData.version, onChange: handleChange, className: "fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 fc:border-slate-200 fc:text-slate-700", readOnly: true })
|
|
1704
|
-
] }),
|
|
1705
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1706
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700 fc:mb-1.5", children: [
|
|
1707
|
-
"Published ",
|
|
1708
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-red-500", children: "*" })
|
|
1709
|
-
] }),
|
|
1710
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("select", { name: "isPublished", value: formData.isPublished, onChange: handleChange, className: "fc:w-full fc:border fc:p-2.5 fc:pl-9 fc:rounded-xl fc:text-xs fc:bg-white fc:focus:outline-none fc:focus:ring-2 fc:focus:ring-indigo-500/10 fc:focus:border-indigo-500 fc:border-slate-200 fc:text-slate-700", children: [
|
|
1711
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "No", children: "No" }),
|
|
1712
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("option", { value: "Yes", children: "Yes" })
|
|
1713
|
-
] })
|
|
1714
|
-
] }),
|
|
1715
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:col-span-2", children: [
|
|
1716
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:mb-1.5", children: [
|
|
1717
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700", children: "Description" }),
|
|
1718
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fc:text-[11px] fc:text-gray-400", children: [
|
|
1719
|
-
formData.description.length,
|
|
1720
|
-
" / 500"
|
|
1721
|
-
] })
|
|
1722
|
-
] }),
|
|
1723
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("textarea", { name: "description", rows: "3", placeholder: "Enter detailed description...", value: formData.description, onChange: handleChange, className: "fc:w-full fc:px-3 fc:py-2.5 fc:text-sm fc:bg-white fc:border fc:border-gray-200 fc:rounded-lg focus:fc:fc:ring-2 focus:fc:fc:ring-blue-500/20 focus:fc:fc:border-[#2563eb] fc:outline-none fc:resize-none fc:transition" })
|
|
1724
|
-
] })
|
|
1725
|
-
] })
|
|
1726
|
-
] }),
|
|
1727
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:flex fc:justify-end fc:items-center fc:gap-3 fc:pt-2", children: [
|
|
1728
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.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:fc:bg-gray-200 fc:rounded-xl fc:transition", children: "\u2715 Cancel" }),
|
|
1729
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.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:fc:bg-[#1d4ed8] active:fc:fc:scale-95 fc:rounded-xl fc:shadow-md fc:transition-all fc:flex fc:items-center fc:gap-2", children: "Save Workflow" })
|
|
1730
|
-
] })
|
|
1428
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-3", children: [
|
|
1429
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: onClose, className: "fc:w-1/2 fc:py-2.5 fc:px-4 fc:text-sm fc:font-semibold fc:text-gray-700 fc:bg-gray-100 hover:fc:fc:bg-gray-200 fc:rounded-xl fc:transition", children: "Cancel" }),
|
|
1430
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: () => {
|
|
1431
|
+
onConfirm(itemData);
|
|
1432
|
+
}, className: "fc:w-1/2 fc:py-2.5 fc:px-4 fc:text-sm fc:font-semibold fc:text-white fc:bg-red-600 hover:fc:fc:bg-red-700 fc:rounded-xl fc:shadow-md fc:shadow-red-500/20 fc:transition", children: "Delete" })
|
|
1731
1433
|
] })
|
|
1732
|
-
] })
|
|
1733
|
-
);
|
|
1434
|
+
] })
|
|
1435
|
+
] }) });
|
|
1734
1436
|
};
|
|
1735
|
-
var
|
|
1437
|
+
var DeleteWorkflowType_default = DeleteWorkflowType;
|
|
1736
1438
|
|
|
1737
1439
|
// src/components/workflow-type/WorkflowTypeMains.js
|
|
1738
1440
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1441
|
+
var getErrorMessage = (error, fallback) => {
|
|
1442
|
+
var _a, _b, _c, _d;
|
|
1443
|
+
return ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || ((_d = (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.data) == null ? void 0 : _d.title) || (error == null ? void 0 : error.message) || fallback;
|
|
1444
|
+
};
|
|
1445
|
+
var getResponseData = (response) => {
|
|
1446
|
+
var _a;
|
|
1447
|
+
return (_a = response == null ? void 0 : response.data) != null ? _a : response;
|
|
1448
|
+
};
|
|
1449
|
+
var getWorkflowTypes = (response) => {
|
|
1450
|
+
const result = getResponseData(response);
|
|
1451
|
+
const payload = Array.isArray(result) ? result : (result == null ? void 0 : result.data) || (result == null ? void 0 : result.result) || result;
|
|
1452
|
+
const items = Array.isArray(payload) ? payload : (payload == null ? void 0 : payload.items) || (payload == null ? void 0 : payload.records) || (payload == null ? void 0 : payload.data) || (payload == null ? void 0 : payload.result) || [];
|
|
1453
|
+
return Array.isArray(items) ? items : [];
|
|
1454
|
+
};
|
|
1455
|
+
var normalizeWorkflowType = (item) => {
|
|
1456
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1457
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
1458
|
+
workflowTypeId: (_a = item == null ? void 0 : item.workflowTypeId) != null ? _a : item == null ? void 0 : item.WorkflowTypeId,
|
|
1459
|
+
workflowTypeCode: (_c = (_b = item == null ? void 0 : item.workflowTypeCode) != null ? _b : item == null ? void 0 : item.WorkflowTypeCode) != null ? _c : "",
|
|
1460
|
+
workflowTypeName: (_e = (_d = item == null ? void 0 : item.workflowTypeName) != null ? _d : item == null ? void 0 : item.WorkflowTypeName) != null ? _e : "",
|
|
1461
|
+
description: (_g = (_f = item == null ? void 0 : item.description) != null ? _f : item == null ? void 0 : item.Description) != null ? _g : "",
|
|
1462
|
+
isActive: (_i = (_h = item == null ? void 0 : item.isActive) != null ? _h : item == null ? void 0 : item.IsActive) != null ? _i : true,
|
|
1463
|
+
createdOn: (_k = (_j = item == null ? void 0 : item.createdOn) != null ? _j : item == null ? void 0 : item.CreatedOn) != null ? _k : "",
|
|
1464
|
+
createdBy: (_m = (_l = item == null ? void 0 : item.createdBy) != null ? _l : item == null ? void 0 : item.CreatedBy) != null ? _m : "",
|
|
1465
|
+
updatedBy: (_o = (_n = item == null ? void 0 : item.updatedBy) != null ? _n : item == null ? void 0 : item.UpdatedBy) != null ? _o : ""
|
|
1466
|
+
});
|
|
1467
|
+
};
|
|
1739
1468
|
function WorkflowTypeMains() {
|
|
1740
1469
|
const [refreshkey, setRefreshKey] = (0, import_react15.useState)(0);
|
|
1741
|
-
const handleRefresh = () => {
|
|
1742
|
-
console.log("Table data refreshed!");
|
|
1743
|
-
setRefreshKey((prev) => prev + 1);
|
|
1744
|
-
};
|
|
1745
1470
|
const tableRef = (0, import_react15.useRef)(null);
|
|
1746
1471
|
const [modalOpen, setModalOpen] = (0, import_react15.useState)(false);
|
|
1747
1472
|
const [pageSize, setPageSize] = (0, import_react15.useState)(10);
|
|
1748
1473
|
const [searchQuery, setSearchQuery] = (0, import_react15.useState)("");
|
|
1749
1474
|
const [currentPage, setCurrentPage] = (0, import_react15.useState)(1);
|
|
1750
|
-
const [
|
|
1475
|
+
const [, setTotalEntries] = (0, import_react15.useState)(0);
|
|
1476
|
+
const [data, setData] = (0, import_react15.useState)([]);
|
|
1477
|
+
const [isLoading, setIsLoading] = (0, import_react15.useState)(false);
|
|
1751
1478
|
const [isEditOpen, setIsEditOpen] = (0, import_react15.useState)(false);
|
|
1752
1479
|
const [isDeleteOpen, setIsDeleteOpen] = (0, import_react15.useState)(false);
|
|
1753
1480
|
const [selectedItem, setSelectedItem] = (0, import_react15.useState)(null);
|
|
1754
|
-
const
|
|
1755
|
-
|
|
1481
|
+
const loadWorkflowTypes = (0, import_react15.useCallback)(async (showError = true) => {
|
|
1482
|
+
var _a, _b;
|
|
1483
|
+
try {
|
|
1484
|
+
setIsLoading(true);
|
|
1485
|
+
const endpoints = getApiEndpoints();
|
|
1486
|
+
const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.getList;
|
|
1487
|
+
if (!endpoint) throw new Error("Workflow type list endpoint is not configured.");
|
|
1488
|
+
const response = await getApiService().get(endpoint);
|
|
1489
|
+
setData(getWorkflowTypes(response).map(normalizeWorkflowType));
|
|
1490
|
+
} catch (error) {
|
|
1491
|
+
setData([]);
|
|
1492
|
+
if (showError) {
|
|
1493
|
+
await import_sweetalert22.default.fire("Error", getErrorMessage(error, "Unable to load workflow types."), "error");
|
|
1494
|
+
}
|
|
1495
|
+
} finally {
|
|
1496
|
+
setIsLoading(false);
|
|
1497
|
+
}
|
|
1498
|
+
}, []);
|
|
1499
|
+
(0, import_react15.useEffect)(() => {
|
|
1500
|
+
loadWorkflowTypes();
|
|
1501
|
+
}, [loadWorkflowTypes, refreshkey]);
|
|
1502
|
+
const handleRefresh = () => setRefreshKey((previous) => previous + 1);
|
|
1503
|
+
const handlePageSizeChange = (event) => {
|
|
1504
|
+
setPageSize(Number(event.target.value));
|
|
1756
1505
|
setCurrentPage(1);
|
|
1757
1506
|
};
|
|
1758
|
-
const handleEdit = (item) => {
|
|
1759
|
-
|
|
1760
|
-
|
|
1507
|
+
const handleEdit = async (item) => {
|
|
1508
|
+
var _a, _b, _c, _d;
|
|
1509
|
+
try {
|
|
1510
|
+
const endpoints = getApiEndpoints();
|
|
1511
|
+
const id = (_a = item == null ? void 0 : item.workflowTypeId) != null ? _a : item == null ? void 0 : item.WorkflowTypeId;
|
|
1512
|
+
const endpoint = (_d = (_c = (_b = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _b.workflowType) == null ? void 0 : _c.getById) == null ? void 0 : _d.call(_c, id);
|
|
1513
|
+
if (!id || !endpoint) throw new Error("Workflow type details endpoint is not configured.");
|
|
1514
|
+
const response = await getApiService().get(endpoint);
|
|
1515
|
+
const result = getResponseData(response);
|
|
1516
|
+
const record = (result == null ? void 0 : result.data) || (result == null ? void 0 : result.result) || result;
|
|
1517
|
+
setSelectedItem(normalizeWorkflowType(record));
|
|
1518
|
+
setIsEditOpen(true);
|
|
1519
|
+
} catch (error) {
|
|
1520
|
+
await import_sweetalert22.default.fire("Error", getErrorMessage(error, "Unable to load workflow type details."), "error");
|
|
1521
|
+
}
|
|
1761
1522
|
};
|
|
1762
|
-
const handleSaveEdit = (updatedData) => {
|
|
1763
|
-
|
|
1523
|
+
const handleSaveEdit = async (updatedData) => {
|
|
1524
|
+
var _a, _b, _c;
|
|
1525
|
+
try {
|
|
1526
|
+
const endpoints = getApiEndpoints();
|
|
1527
|
+
const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.update;
|
|
1528
|
+
if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
|
|
1529
|
+
const payload = {
|
|
1530
|
+
workflowTypeId: (_c = updatedData.workflowTypeId) != null ? _c : updatedData.WorkflowTypeId,
|
|
1531
|
+
workflowTypeCode: updatedData.workflowTypeCode.trim().toUpperCase(),
|
|
1532
|
+
workflowTypeName: updatedData.workflowTypeName.trim(),
|
|
1533
|
+
description: updatedData.description.trim(),
|
|
1534
|
+
isActive: Boolean(updatedData.isActive),
|
|
1535
|
+
updatedBy: updatedData.updatedBy || updatedData.createdBy || "System"
|
|
1536
|
+
};
|
|
1537
|
+
await getApiService().put(endpoint, payload);
|
|
1538
|
+
await import_sweetalert22.default.fire("Success", "Workflow type updated successfully.", "success");
|
|
1539
|
+
setIsEditOpen(false);
|
|
1540
|
+
handleRefresh();
|
|
1541
|
+
return true;
|
|
1542
|
+
} catch (error) {
|
|
1543
|
+
await import_sweetalert22.default.fire("Error", getErrorMessage(error, "Unable to update workflow type."), "error");
|
|
1544
|
+
return false;
|
|
1545
|
+
}
|
|
1764
1546
|
};
|
|
1765
1547
|
const handleDelete = (item) => {
|
|
1766
1548
|
setSelectedItem(item);
|
|
1767
1549
|
setIsDeleteOpen(true);
|
|
1768
1550
|
};
|
|
1769
|
-
const handleConfirmDelete = (
|
|
1770
|
-
|
|
1551
|
+
const handleConfirmDelete = async (item) => {
|
|
1552
|
+
var _a, _b, _c;
|
|
1553
|
+
try {
|
|
1554
|
+
const endpoints = getApiEndpoints();
|
|
1555
|
+
const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.update;
|
|
1556
|
+
if (!endpoint) throw new Error("Workflow type update endpoint is not configured.");
|
|
1557
|
+
await getApiService().put(endpoint, {
|
|
1558
|
+
workflowTypeId: (_c = item.workflowTypeId) != null ? _c : item.WorkflowTypeId,
|
|
1559
|
+
workflowTypeCode: item.workflowTypeCode,
|
|
1560
|
+
workflowTypeName: item.workflowTypeName,
|
|
1561
|
+
description: item.description || "",
|
|
1562
|
+
isActive: false,
|
|
1563
|
+
updatedBy: item.updatedBy || item.createdBy || "System"
|
|
1564
|
+
});
|
|
1565
|
+
await import_sweetalert22.default.fire("Success", "Workflow type has been deactivated successfully.", "success");
|
|
1566
|
+
setIsDeleteOpen(false);
|
|
1567
|
+
handleRefresh();
|
|
1568
|
+
return true;
|
|
1569
|
+
} catch (error) {
|
|
1570
|
+
await import_sweetalert22.default.fire("Error", getErrorMessage(error, "Unable to deactivate workflow type."), "error");
|
|
1571
|
+
return false;
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
const handleCreateSuccess = async () => {
|
|
1575
|
+
await import_sweetalert22.default.fire("Success", "Workflow type created successfully.", "success");
|
|
1576
|
+
setModalOpen(false);
|
|
1577
|
+
handleRefresh();
|
|
1771
1578
|
};
|
|
1772
1579
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "fc:h-screen fc:overflow-hidden fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
|
|
1773
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommonHeader, { title: "Workflow Type", breadcrumbs: [{
|
|
1774
|
-
label: "Dashboard",
|
|
1775
|
-
href: "/dashboard"
|
|
1776
|
-
}, {
|
|
1777
|
-
label: "Masters",
|
|
1778
|
-
href: "/masters"
|
|
1779
|
-
}, {
|
|
1780
|
-
label: "Workflow Type",
|
|
1781
|
-
href: "/WorkflowType"
|
|
1782
|
-
}], buttonText: "Add Workflow Type", onButtonClick: () => setModalOpen(true) }),
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommonHeader, { title: "Workflow Type", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Masters", href: "/masters" }, { label: "Workflow Type", href: "/WorkflowType" }], buttonText: "Add Workflow Type", onButtonClick: () => setModalOpen(true) }),
|
|
1783
1581
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fc:w-full fc:space-y-5", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "fc:bg-white fc:p-6 fc:rounded-2xl fc:border fc:border-slate-200/80 fc:shadow-sm fc:space-y-5", children: [
|
|
1784
1582
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
|
|
1785
1583
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "fc:w-full fc:max-w-xs", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SearchBar2, { searchQuery, setSearchQuery, setCurrentPage }) }),
|
|
@@ -1794,12 +1592,9 @@ function WorkflowTypeMains() {
|
|
|
1794
1592
|
] })
|
|
1795
1593
|
] })
|
|
1796
1594
|
] }),
|
|
1797
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.
|
|
1798
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorkflowTypeTable, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onDelete: handleDelete }, refreshkey),
|
|
1799
|
-
" "
|
|
1800
|
-
] })
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { ref: tableRef, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorkflowTypeTable, { data, isLoading, pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onDelete: handleDelete }) })
|
|
1801
1596
|
] }) }),
|
|
1802
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false) }),
|
|
1597
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: handleCreateSuccess }),
|
|
1803
1598
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleSaveEdit, selectedData: selectedItem }),
|
|
1804
1599
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DeleteWorkflowType_default, { isOpen: isDeleteOpen, onClose: () => setIsDeleteOpen(false), onConfirm: handleConfirmDelete, itemData: selectedItem })
|
|
1805
1600
|
] });
|
|
@@ -11775,7 +11570,7 @@ function Sidebar({
|
|
|
11775
11570
|
const Icon = item.icon;
|
|
11776
11571
|
const handleClick = () => {
|
|
11777
11572
|
if (item.component) {
|
|
11778
|
-
router.push("/", void 0, {
|
|
11573
|
+
router.push("/flowCore", void 0, {
|
|
11779
11574
|
shallow: true
|
|
11780
11575
|
});
|
|
11781
11576
|
setActiveComponent(item.component);
|
|
@@ -11903,31 +11698,6 @@ var Layout = ({ children }) => {
|
|
|
11903
11698
|
) });
|
|
11904
11699
|
};
|
|
11905
11700
|
var Layout_default = Layout;
|
|
11906
|
-
|
|
11907
|
-
// src/components/Service/ApiEndpointsProvider.js
|
|
11908
|
-
var STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
|
|
11909
|
-
var apiEndpoints = null;
|
|
11910
|
-
var ApiEndpointsProvider = ({ apiEndpoints: endpoints }) => {
|
|
11911
|
-
if (typeof window !== "undefined" && endpoints) {
|
|
11912
|
-
apiEndpoints = endpoints;
|
|
11913
|
-
sessionStorage.setItem(
|
|
11914
|
-
STORAGE_KEY,
|
|
11915
|
-
JSON.stringify(endpoints)
|
|
11916
|
-
);
|
|
11917
|
-
}
|
|
11918
|
-
return null;
|
|
11919
|
-
};
|
|
11920
|
-
var ApiEndpointsProvider_default = ApiEndpointsProvider;
|
|
11921
|
-
|
|
11922
|
-
// src/components/Service/ApiServicepackage.js
|
|
11923
|
-
var apiService = null;
|
|
11924
|
-
var ApiServicepackage = ({ apiService: service }) => {
|
|
11925
|
-
if (service) {
|
|
11926
|
-
apiService = service;
|
|
11927
|
-
}
|
|
11928
|
-
return null;
|
|
11929
|
-
};
|
|
11930
|
-
var ApiServicepackage_default = ApiServicepackage;
|
|
11931
11701
|
// Annotate the CommonJS export names for ESM import in node:
|
|
11932
11702
|
0 && (module.exports = {
|
|
11933
11703
|
ApiEndpointsProvider,
|