flowcore-fn 9.2.7 → 9.2.9

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
@@ -1066,7 +1066,6 @@ 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"));
1070
1069
 
1071
1070
  // src/components/workflow-type/SearchBar.jsx
1072
1071
  var import_react10 = __toESM(require("react"));
@@ -1093,89 +1092,475 @@ function SearchBar2({
1093
1092
  }
1094
1093
 
1095
1094
  // src/components/workflow-type/WorkflowTypeTable.jsx
1095
+ var import_react13 = __toESM(require("react"));
1096
+
1097
+ // src/components/workflow-type/DeleteWorkflowType.jsx
1096
1098
  var import_react11 = __toESM(require("react"));
1097
1099
  var import_jsx_runtime11 = require("react/jsx-runtime");
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");
1100
+ var DeleteWorkflowType = ({
1101
+ isOpen,
1102
+ onClose,
1103
+ onConfirm,
1104
+ itemData
1105
+ }) => {
1106
+ if (!isOpen) return null;
1107
+ return /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.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: [
1108
+ /* @__PURE__ */ (0, import_jsx_runtime11.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" }),
1109
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fc:p-8 fc:text-center", children: [
1110
+ /* @__PURE__ */ (0, import_jsx_runtime11.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_runtime11.jsx)("span", { className: "fc:text-2xl", children: "\u26A0\uFE0F" }) }),
1111
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h3", { className: "fc:text-xl fc:font-bold fc:text-gray-900 fc:tracking-tight fc:mb-2", children: "Delete Configuration" }),
1112
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("p", { className: "fc:text-sm fc:text-gray-500 fc:leading-relaxed fc:px-2 fc:mb-6", children: [
1113
+ "Are you sure you want to delete",
1114
+ " ",
1115
+ /* @__PURE__ */ (0, import_jsx_runtime11.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: [
1116
+ '"',
1117
+ (itemData == null ? void 0 : itemData.workflowTypeName) || (itemData == null ? void 0 : itemData.WorkflowTypeName) || "this item",
1118
+ '"'
1119
+ ] }),
1120
+ "? This action cannot be undone."
1121
+ ] }),
1122
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-3", children: [
1123
+ /* @__PURE__ */ (0, import_jsx_runtime11.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" }),
1124
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "button", onClick: () => {
1125
+ onConfirm(itemData);
1126
+ onClose();
1127
+ }, 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" })
1128
+ ] })
1129
+ ] })
1130
+ ] }) });
1131
+ };
1132
+ var DeleteWorkflowType_default = DeleteWorkflowType;
1133
+
1134
+ // src/components/workflow-type/EditWorkflowType.jsx
1135
+ var import_react12 = __toESM(require("react"));
1136
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1137
+ var EditWorkflowType = ({
1138
+ isOpen,
1139
+ onClose,
1140
+ onSave,
1141
+ selectedData
1142
+ }) => {
1143
+ const [formData, setFormData] = (0, import_react12.useState)({
1144
+ workflowTypeCode: "",
1145
+ workflowTypeName: "",
1146
+ description: "",
1147
+ isActive: true
1148
+ });
1149
+ (0, import_react12.useEffect)(() => {
1150
+ var _a, _b;
1151
+ if (selectedData) {
1152
+ setFormData({
1153
+ workflowTypeCode: selectedData.workflowTypeCode || selectedData.WorkflowTypeCode || "",
1154
+ workflowTypeName: selectedData.workflowTypeName || selectedData.WorkflowTypeName || "",
1155
+ description: selectedData.description || selectedData.Description || "",
1156
+ isActive: (_b = (_a = selectedData.isActive) != null ? _a : selectedData.IsActive) != null ? _b : true
1157
+ });
1158
+ }
1159
+ }, [selectedData]);
1160
+ if (!isOpen) return null;
1161
+ const handleChange = (e) => {
1162
+ const {
1163
+ name,
1164
+ value,
1165
+ type,
1166
+ checked
1167
+ } = e.target;
1168
+ setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
1169
+ [name]: type === "checkbox" ? checked : value
1170
+ }));
1171
+ };
1172
+ const handleSubmit = (e) => {
1173
+ e.preventDefault();
1174
+ onSave(__spreadValues(__spreadValues({}, selectedData), formData));
1175
+ onClose();
1176
+ };
1177
+ 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/40 fc:backdrop-blur-sm fc:p-4 fc:animate-in fc:fade-in fc:duration-200", children: /* @__PURE__ */ (0, import_jsx_runtime12.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: [
1178
+ /* @__PURE__ */ (0, import_jsx_runtime12.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: [
1179
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "fc:text-lg fc:font-bold fc:text-gray-900", children: "Edit Workflow Type" }),
1180
+ /* @__PURE__ */ (0, import_jsx_runtime12.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
+ ] }),
1182
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: handleSubmit, className: "fc:p-6 fc:space-y-4", children: [
1183
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
1184
+ /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1185
+ /* @__PURE__ */ (0, import_jsx_runtime12.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
+ ] }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
1188
+ /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1189
+ /* @__PURE__ */ (0, import_jsx_runtime12.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
+ ] }),
1191
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
1192
+ /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime12.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
+ ] }),
1195
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "fc:flex fc:items-center fc:pt-1", children: [
1196
+ /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1197
+ /* @__PURE__ */ (0, import_jsx_runtime12.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
+ ] }),
1199
+ /* @__PURE__ */ (0, import_jsx_runtime12.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: [
1200
+ /* @__PURE__ */ (0, import_jsx_runtime12.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" }),
1201
+ /* @__PURE__ */ (0, import_jsx_runtime12.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
+ ] })
1203
+ ] })
1204
+ ] }) });
1205
+ };
1206
+ var EditWorkflowType_default = EditWorkflowType;
1207
+
1208
+ // src/components/workflow-type/WorkflowTypeTable.jsx
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);
1101
1474
  const handleSort = (columnKey) => {
1102
1475
  const isAsc = sortKey === columnKey && sortOrder === "asc";
1103
1476
  setSortOrder(isAsc ? "desc" : "asc");
1104
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);
1105
1484
  };
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);
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);
1120
1491
  }, [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]);
1492
+ const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
1125
1493
  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: [
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: [
1133
1517
  "ID ",
1134
- sortIcon("workflowTypeId")
1518
+ sortKey === "workflowTypeId" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
1135
1519
  ] }),
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: [
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: [
1137
1521
  "Code ",
1138
- sortIcon("workflowTypeCode")
1522
+ sortKey === "workflowTypeCode" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
1139
1523
  ] }),
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: [
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: [
1141
1525
  "Name ",
1142
- sortIcon("workflowTypeName")
1526
+ sortKey === "workflowTypeName" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
1143
1527
  ] }),
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: [
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: [
1145
1529
  "Description ",
1146
- sortIcon("description")
1530
+ sortKey === "description" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
1147
1531
  ] }),
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: [
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: [
1150
1534
  "Created On ",
1151
- sortIcon("createdOn")
1535
+ sortKey === "createdOn" ? sortOrder === "asc" ? "\u25B2" : "\u25BC" : "\u25B2"
1152
1536
  ] }),
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" })
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" })
1154
1538
  ] }) }),
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" })
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" })
1165
1549
  ] }) })
1166
1550
  ] }, item.workflowTypeId)) })
1167
1551
  ] }) }),
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
- ] })
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 })
1173
1559
  ] });
1174
1560
  }
1175
1561
 
1176
1562
  // src/components/workflow-type/AddWorkflowTypeModal.jsx
1177
- var import_react12 = __toESM(require("react"));
1178
- var import_sweetalert2 = __toESM(require("sweetalert2"));
1563
+ var import_react14 = __toESM(require("react"));
1179
1564
 
1180
1565
  // src/components/Service/ApiEndpointsProvider.js
1181
1566
  var STORAGE_KEY = "FLOWCORE_API_ENDPOINTS";
@@ -1226,7 +1611,7 @@ var getApiService = () => {
1226
1611
  var ApiServicepackage_default = ApiServicepackage;
1227
1612
 
1228
1613
  // src/components/workflow-type/AddWorkflowTypeModal.jsx
1229
- var import_jsx_runtime12 = require("react/jsx-runtime");
1614
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1230
1615
  var initialFormData = {
1231
1616
  workflowTypeCode: "",
1232
1617
  workflowTypeName: "",
@@ -1234,12 +1619,12 @@ var initialFormData = {
1234
1619
  createdBy: ""
1235
1620
  };
1236
1621
  var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1237
- const [formData, setFormData] = (0, import_react12.useState)(__spreadProps(__spreadValues({}, initialFormData), {
1622
+ const [formData, setFormData] = (0, import_react14.useState)(__spreadProps(__spreadValues({}, initialFormData), {
1238
1623
  createdBy
1239
1624
  }));
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)("");
1625
+ const [errors, setErrors] = (0, import_react14.useState)({});
1626
+ const [isSubmitting, setIsSubmitting] = (0, import_react14.useState)(false);
1627
+ const [submitError, setSubmitError] = (0, import_react14.useState)("");
1243
1628
  const handleChange = ({ target: { name, value } }) => {
1244
1629
  if (name === "description" && value.length > 500) return;
1245
1630
  setFormData((previous) => __spreadProps(__spreadValues({}, previous), { [name]: value }));
@@ -1258,7 +1643,7 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1258
1643
  if (!isSubmitting) onClose();
1259
1644
  };
1260
1645
  const handleSubmit = async (event) => {
1261
- var _a, _b, _c, _d, _e, _f, _g;
1646
+ var _a, _b, _c, _d, _e;
1262
1647
  event.preventDefault();
1263
1648
  if (!validateForm()) return;
1264
1649
  const payload = {
@@ -1271,7 +1656,7 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1271
1656
  setIsSubmitting(true);
1272
1657
  setSubmitError("");
1273
1658
  const endpoints = getApiEndpoints();
1274
- const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflowType) == null ? void 0 : _b.create;
1659
+ const endpoint = (_b = (_a = endpoints == null ? void 0 : endpoints.flowCore) == null ? void 0 : _a.workflow) == null ? void 0 : _b.createWorkflowList;
1275
1660
  if (!endpoint) throw new Error("Create workflow type endpoint is not configured.");
1276
1661
  const response = await getApiService().post(endpoint, payload);
1277
1662
  await (onSave == null ? void 0 : onSave((_c = response == null ? void 0 : response.data) != null ? _c : response));
@@ -1279,305 +1664,99 @@ var AddWorkflowTypeModal = ({ isOpen, onClose, onSave, createdBy = "" }) => {
1279
1664
  setErrors({});
1280
1665
  onClose();
1281
1666
  } 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");
1667
+ setSubmitError(
1668
+ ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || "Unable to create workflow type. Please try again."
1669
+ );
1285
1670
  } finally {
1286
1671
  setIsSubmitting(false);
1287
1672
  }
1288
1673
  };
1289
1674
  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" })
1675
+ 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/20 fc:p-4 fc:backdrop-blur-sm", children: /* @__PURE__ */ (0, import_jsx_runtime14.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: [
1676
+ /* @__PURE__ */ (0, import_jsx_runtime14.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: [
1677
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
1678
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h2", { className: "fc:text-xl fc:font-bold fc:text-gray-800", children: "Add Workflow Type" }),
1679
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "fc:text-xs fc:text-gray-400", children: "Create a new workflow type" })
1295
1680
  ] }),
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" })
1681
+ /* @__PURE__ */ (0, import_jsx_runtime14.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
1682
  ] }),
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) }) })
1683
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("form", { onSubmit: handleSubmit, className: "fc:space-y-4 fc:p-6", children: [
1684
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:grid fc:grid-cols-2 fc:gap-4", children: [
1685
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Workflow Type Code", required: true, error: errors.workflowTypeCode, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "workflowTypeCode", value: formData.workflowTypeCode, onChange: handleChange, placeholder: "e.g. PETITION", className: inputClass(errors.workflowTypeCode) }) }),
1686
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Workflow Type Name", required: true, error: errors.workflowTypeName, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "workflowTypeName", value: formData.workflowTypeName, onChange: handleChange, placeholder: "Enter workflow type name", className: inputClass(errors.workflowTypeName) }) })
1302
1687
  ] }),
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: [
1688
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Created By", required: true, error: errors.createdBy, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("input", { name: "createdBy", value: formData.createdBy, onChange: handleChange, placeholder: "Enter user name or ID", className: inputClass(errors.createdBy) }) }),
1689
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FormField, { label: "Description", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:relative", children: [
1690
+ /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1691
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "fc:absolute fc:bottom-2 fc:right-3 fc:text-xs fc:text-gray-400", children: [
1307
1692
  formData.description.length,
1308
1693
  "/500"
1309
1694
  ] })
1310
1695
  ] }) }),
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" })
1696
+ submitError && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { role: "alert", className: "fc:rounded-lg fc:bg-red-50 fc:p-3 fc:text-sm fc:text-red-600", children: submitError }),
1697
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "fc:flex fc:justify-end fc:gap-3 fc:border-t fc:border-gray-100 fc:pt-4", children: [
1698
+ /* @__PURE__ */ (0, import_jsx_runtime14.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" }),
1699
+ /* @__PURE__ */ (0, import_jsx_runtime14.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" })
1315
1700
  ] })
1316
1701
  ] })
1317
1702
  ] }) });
1318
1703
  };
1319
1704
  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: [
1705
+ var FormField = ({ label, required, error, children }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { className: "fc:block fc:text-xs fc:font-semibold fc:text-gray-700", children: [
1321
1706
  label,
1322
1707
  " ",
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 })
1708
+ required && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:text-red-500", children: "*" }),
1709
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "fc:mt-1.5", children }),
1710
+ error && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "fc:mt-1 fc:block fc:text-xs fc:text-red-500", children: error })
1326
1711
  ] });
1327
1712
  var AddWorkflowTypeModal_default = AddWorkflowTypeModal;
1328
1713
 
1329
- // src/components/workflow-type/EditWorkflowType.jsx
1330
- var import_react13 = __toESM(require("react"));
1331
- var import_jsx_runtime13 = require("react/jsx-runtime");
1332
- var EditWorkflowType = ({
1333
- isOpen,
1334
- onClose,
1335
- onSave,
1336
- selectedData
1337
- }) => {
1338
- const [formData, setFormData] = (0, import_react13.useState)({
1339
- workflowTypeCode: "",
1340
- workflowTypeName: "",
1341
- description: "",
1342
- isActive: true
1343
- });
1344
- (0, import_react13.useEffect)(() => {
1345
- var _a, _b;
1346
- if (selectedData) {
1347
- setFormData({
1348
- workflowTypeCode: selectedData.workflowTypeCode || selectedData.WorkflowTypeCode || "",
1349
- workflowTypeName: selectedData.workflowTypeName || selectedData.WorkflowTypeName || "",
1350
- description: selectedData.description || selectedData.Description || "",
1351
- isActive: (_b = (_a = selectedData.isActive) != null ? _a : selectedData.IsActive) != null ? _b : true
1352
- });
1353
- }
1354
- }, [selectedData]);
1355
- if (!isOpen) return null;
1356
- const handleChange = (e) => {
1357
- const {
1358
- name,
1359
- value,
1360
- type,
1361
- checked
1362
- } = e.target;
1363
- setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
1364
- [name]: type === "checkbox" ? checked : value
1365
- }));
1366
- };
1367
- const handleSubmit = async (e) => {
1368
- e.preventDefault();
1369
- const wasSaved = await (onSave == null ? void 0 : onSave(__spreadValues(__spreadValues({}, selectedData), formData)));
1370
- if (wasSaved) onClose();
1371
- };
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" })
1376
- ] }),
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 })
1381
- ] }),
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 })
1385
- ] }),
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" })
1389
- ] }),
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" })
1393
- ] }),
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" })
1397
- ] })
1398
- ] })
1399
- ] }) });
1400
- };
1401
- var EditWorkflowType_default = EditWorkflowType;
1402
-
1403
- // src/components/workflow-type/DeleteWorkflowType.jsx
1404
- var import_react14 = __toESM(require("react"));
1405
- var import_jsx_runtime14 = require("react/jsx-runtime");
1406
- var DeleteWorkflowType = ({
1407
- isOpen,
1408
- onClose,
1409
- onConfirm,
1410
- itemData
1411
- }) => {
1412
- if (!isOpen) return null;
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
- '"'
1425
- ] }),
1426
- "? This action cannot be undone."
1427
- ] }),
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" })
1433
- ] })
1434
- ] })
1435
- ] }) });
1436
- };
1437
- var DeleteWorkflowType_default = DeleteWorkflowType;
1438
-
1439
1714
  // src/components/workflow-type/WorkflowTypeMains.js
1440
1715
  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
- };
1468
1716
  function WorkflowTypeMains() {
1469
1717
  const [refreshkey, setRefreshKey] = (0, import_react15.useState)(0);
1718
+ const handleRefresh = () => {
1719
+ console.log("Table data refreshed!");
1720
+ setRefreshKey((prev) => prev + 1);
1721
+ };
1470
1722
  const tableRef = (0, import_react15.useRef)(null);
1471
1723
  const [modalOpen, setModalOpen] = (0, import_react15.useState)(false);
1472
1724
  const [pageSize, setPageSize] = (0, import_react15.useState)(10);
1473
1725
  const [searchQuery, setSearchQuery] = (0, import_react15.useState)("");
1474
1726
  const [currentPage, setCurrentPage] = (0, import_react15.useState)(1);
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);
1727
+ const [totalEntries, setTotalEntries] = (0, import_react15.useState)(0);
1478
1728
  const [isEditOpen, setIsEditOpen] = (0, import_react15.useState)(false);
1479
1729
  const [isDeleteOpen, setIsDeleteOpen] = (0, import_react15.useState)(false);
1480
1730
  const [selectedItem, setSelectedItem] = (0, import_react15.useState)(null);
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));
1731
+ const handlePageSizeChange = (e) => {
1732
+ setPageSize(Number(e.target.value));
1505
1733
  setCurrentPage(1);
1506
1734
  };
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
- }
1735
+ const handleEdit = (item) => {
1736
+ setSelectedItem(item);
1737
+ setIsEditOpen(true);
1522
1738
  };
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
- }
1739
+ const handleSaveEdit = (updatedData) => {
1740
+ console.log("Updated Data:", updatedData);
1546
1741
  };
1547
1742
  const handleDelete = (item) => {
1548
1743
  setSelectedItem(item);
1549
1744
  setIsDeleteOpen(true);
1550
1745
  };
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();
1746
+ const handleConfirmDelete = (itemToDelete) => {
1747
+ console.log("Deleted Item:", itemToDelete);
1578
1748
  };
1579
1749
  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: [
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) }),
1750
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CommonHeader, { title: "Workflow Type", breadcrumbs: [{
1751
+ label: "Dashboard",
1752
+ href: "/dashboard"
1753
+ }, {
1754
+ label: "Masters",
1755
+ href: "/masters"
1756
+ }, {
1757
+ label: "Workflow Type",
1758
+ href: "/WorkflowType"
1759
+ }], buttonText: "Add Workflow Type", onButtonClick: () => setModalOpen(true) }),
1581
1760
  /* @__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: [
1582
1761
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "fc:flex fc:justify-between fc:items-center fc:w-full fc:gap-4", children: [
1583
1762
  /* @__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 }) }),
@@ -1592,9 +1771,12 @@ function WorkflowTypeMains() {
1592
1771
  ] })
1593
1772
  ] })
1594
1773
  ] }),
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 }) })
1774
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: tableRef, children: [
1775
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(WorkflowTypeTable, { pageSize, searchQuery, currentPage, setCurrentPage, setTotalEntries, onEdit: handleEdit, onDelete: handleDelete }, refreshkey),
1776
+ " "
1777
+ ] })
1596
1778
  ] }) }),
1597
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false), onSave: handleCreateSuccess }),
1779
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AddWorkflowTypeModal_default, { isOpen: modalOpen, onClose: () => setModalOpen(false) }),
1598
1780
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EditWorkflowType_default, { isOpen: isEditOpen, onClose: () => setIsEditOpen(false), onSave: handleSaveEdit, selectedData: selectedItem }),
1599
1781
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DeleteWorkflowType_default, { isOpen: isDeleteOpen, onClose: () => setIsDeleteOpen(false), onConfirm: handleConfirmDelete, itemData: selectedItem })
1600
1782
  ] });