flowcore-fn 10.1.4 → 10.1.5

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.
@@ -4557,7 +4557,7 @@ function User_hierarchy_mapping_main() {
4557
4557
  };
4558
4558
  return /* @__PURE__ */ jsxs26("div", { className: "fc:min-h-screen fc:bg-slate-50 fc:p-4 md:fc:fc:p-6", children: [
4559
4559
  /* @__PURE__ */ jsxs26("div", { className: "fc:w-full fc:space-y-5", children: [
4560
- /* @__PURE__ */ jsx27(CommonHeader, { title: "Workflow Step Hierarchy Mapping", breadcrumbs: [{
4560
+ /* @__PURE__ */ jsx27(CommonHeader, { title: "Workflow Step User Mapping", breadcrumbs: [{
4561
4561
  label: "Dashboard",
4562
4562
  href: "/dashboard"
4563
4563
  }, {
@@ -11373,23 +11373,27 @@ function UploadedDocumentMain() {
11373
11373
  }
11374
11374
 
11375
11375
  // src/components/BuisnessEntity/BusinessEntitymain.js
11376
- import React80, { useState as useState55, useRef as useRef18 } from "react";
11377
- import Link3 from "next/link";
11376
+ import React80, { useEffect as useEffect32, useRef as useRef18, useState as useState55 } from "react";
11377
+ import Swal16 from "sweetalert2";
11378
11378
 
11379
11379
  // src/components/BuisnessEntity/AddBusinessEntityModal.js
11380
11380
  import React79, { useState as useState54 } from "react";
11381
11381
  import { jsx as jsx79, jsxs as jsxs78 } from "react/jsx-runtime";
11382
- function AddBusinessEntityModal({ onClose }) {
11383
- const [formData, setFormData] = useState54({
11384
- entityType: "",
11385
- entityKey: "",
11386
- displayNumber: "",
11387
- displayTitle: "",
11388
- isDefault: false,
11389
- isVisible: true,
11390
- status: "Active"
11382
+ function AddBusinessEntityModal({ onClose, onSave, editData }) {
11383
+ const [formData, setFormData] = useState54(() => {
11384
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
11385
+ return {
11386
+ entityType: (_b = (_a = editData == null ? void 0 : editData.entityType) != null ? _a : editData == null ? void 0 : editData.EntityType) != null ? _b : "",
11387
+ entityKey: String((_d = (_c = editData == null ? void 0 : editData.entityKey) != null ? _c : editData == null ? void 0 : editData.EntityKey) != null ? _d : ""),
11388
+ displayNumber: (_f = (_e = editData == null ? void 0 : editData.displayNumber) != null ? _e : editData == null ? void 0 : editData.DisplayNumber) != null ? _f : "",
11389
+ displayTitle: (_h = (_g = editData == null ? void 0 : editData.displayTitle) != null ? _g : editData == null ? void 0 : editData.DisplayTitle) != null ? _h : "",
11390
+ isDefault: (_i = editData == null ? void 0 : editData.isDefault) != null ? _i : false,
11391
+ isVisible: (_j = editData == null ? void 0 : editData.isVisible) != null ? _j : true,
11392
+ status: ((_l = (_k = editData == null ? void 0 : editData.isActive) != null ? _k : editData == null ? void 0 : editData.IsActive) != null ? _l : true) ? "Active" : "Inactive"
11393
+ };
11391
11394
  });
11392
11395
  const [errors, setErrors] = useState54({});
11396
+ const [isSubmitting, setIsSubmitting] = useState54(false);
11393
11397
  const handleChange = (field, value) => {
11394
11398
  setFormData((prev) => __spreadProps(__spreadValues({}, prev), {
11395
11399
  [field]: value
@@ -11409,10 +11413,17 @@ function AddBusinessEntityModal({ onClose }) {
11409
11413
  setErrors(newErrors);
11410
11414
  return Object.keys(newErrors).length === 0;
11411
11415
  };
11412
- const handleSubmit = (e) => {
11416
+ const handleSubmit = async (e) => {
11417
+ var _a, _b, _c;
11413
11418
  e.preventDefault();
11414
- if (validate()) {
11415
- console.log("Form Submitted Successfully", formData);
11419
+ if (!validate() || !onSave) return;
11420
+ const isEdit = Boolean(editData);
11421
+ const payload = isEdit ? { businessEntityId: (_a = editData.businessEntityId) != null ? _a : editData.BusinessEntityId, entityType: formData.entityType, entityKey: Number(formData.entityKey), displayNumber: formData.displayNumber.trim(), displayTitle: formData.displayTitle.trim(), isActive: formData.status === "Active", updatedBy: (_c = (_b = editData.updatedBy) != null ? _b : editData.createdBy) != null ? _c : "System" } : { entityType: formData.entityType, entityKey: Number(formData.entityKey), displayNumber: formData.displayNumber.trim(), displayTitle: formData.displayTitle.trim(), createdBy: "System" };
11422
+ setIsSubmitting(true);
11423
+ try {
11424
+ if (await onSave(payload, isEdit)) onClose();
11425
+ } finally {
11426
+ setIsSubmitting(false);
11416
11427
  }
11417
11428
  };
11418
11429
  return /* @__PURE__ */ jsxs78("div", { className: "fc:fixed fc:inset-0 fc:z-50 fc:flex fc:items-center fc:justify-center fc:p-4", children: [
@@ -11428,7 +11439,7 @@ function AddBusinessEntityModal({ onClose }) {
11428
11439
  /* @__PURE__ */ jsxs78("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
11429
11440
  /* @__PURE__ */ jsx79("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-sm fc:transition-transform hover:fc:scale-105", children: /* @__PURE__ */ jsx79("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx79("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5m0 0v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" }) }) }),
11430
11441
  /* @__PURE__ */ jsxs78("div", { children: [
11431
- /* @__PURE__ */ jsx79("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add Business Entity" }),
11442
+ /* @__PURE__ */ jsx79("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: editData ? "Edit Business Entity" : "Add Business Entity" }),
11432
11443
  /* @__PURE__ */ jsx79("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new business entity for the workflow engine" })
11433
11444
  ] })
11434
11445
  ] }),
@@ -11664,10 +11675,11 @@ function AddBusinessEntityModal({ onClose }) {
11664
11675
  {
11665
11676
  type: "button",
11666
11677
  onClick: handleSubmit,
11678
+ disabled: isSubmitting,
11667
11679
  className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/20 hover:fc:shadow-indigo-500/30 fc:transition-all active:fc:scale-95 fc:flex fc:items-center fc:gap-2",
11668
11680
  children: [
11669
11681
  /* @__PURE__ */ jsx79("svg", { className: "fc:w-4 fc:h-4", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx79("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" }) }),
11670
- "Save Business Entity"
11682
+ isSubmitting ? "Saving..." : editData ? "Update Business Entity" : "Save Business Entity"
11671
11683
  ]
11672
11684
  }
11673
11685
  )
@@ -11677,192 +11689,238 @@ function AddBusinessEntityModal({ onClose }) {
11677
11689
  }
11678
11690
 
11679
11691
  // src/components/BuisnessEntity/BusinessEntitymain.js
11680
- import { Fragment as Fragment6, jsx as jsx80, jsxs as jsxs79 } from "react/jsx-runtime";
11681
- var BusinessEntitys = [{
11682
- BusinessEntityId: 1,
11683
- EntityType: "Application",
11684
- EntityKey: "5001",
11685
- DisplayNumber: "App-001",
11686
- DisplayTitle: "Building Permission"
11687
- }, {
11688
- BusinessEntityId: 1,
11689
- EntityType: "Application",
11690
- EntityKey: "5001",
11691
- DisplayNumber: "App-001",
11692
- DisplayTitle: "Building Permission"
11693
- }, {
11694
- BusinessEntityId: 1,
11695
- EntityType: "Application",
11696
- EntityKey: "5001",
11697
- DisplayNumber: "App-001",
11698
- DisplayTitle: "Building Permission"
11699
- }, {
11700
- BusinessEntityId: 1,
11701
- EntityType: "Application",
11702
- EntityKey: "5001",
11703
- DisplayNumber: "App-001",
11704
- DisplayTitle: "Building Permission"
11705
- }, {
11706
- BusinessEntityId: 1,
11707
- EntityType: "Application",
11708
- EntityKey: "5001",
11709
- DisplayNumber: "App-001",
11710
- DisplayTitle: "Building Permission"
11711
- }, {
11712
- BusinessEntityId: 1,
11713
- EntityType: "Application",
11714
- EntityKey: "5001",
11715
- DisplayNumber: "App-001",
11716
- DisplayTitle: "Building Permission"
11717
- }, {
11718
- BusinessEntityId: 1,
11719
- EntityType: "Application",
11720
- EntityKey: "5001",
11721
- DisplayNumber: "App-001",
11722
- DisplayTitle: "Building Permission"
11723
- }, {
11724
- BusinessEntityId: 1,
11725
- EntityType: "Application",
11726
- EntityKey: "5001",
11727
- DisplayNumber: "App-001",
11728
- DisplayTitle: "Building Permission"
11729
- }, {
11730
- BusinessEntityId: 1,
11731
- EntityType: "Application",
11732
- EntityKey: "5001",
11733
- DisplayNumber: "App-001",
11734
- DisplayTitle: "Building Permission"
11735
- }, {
11736
- BusinessEntityId: 2,
11737
- EntityType: "Application",
11738
- EntityKey: "5002",
11739
- DisplayNumber: "App-002",
11740
- DisplayTitle: "Building Permission"
11741
- }, {
11742
- BusinessEntityId: 3,
11743
- EntityType: "Application",
11744
- EntityKey: "5003",
11745
- DisplayNumber: "App-003",
11746
- DisplayTitle: "Building Permission"
11747
- }, {
11748
- BusinessEntityId: 4,
11749
- EntityType: "Application",
11750
- EntityKey: "5004",
11751
- DisplayNumber: "App-004",
11752
- DisplayTitle: "Building Permission"
11753
- }, {
11754
- BusinessEntityId: 5,
11755
- EntityType: "Application",
11756
- EntityKey: "5005",
11757
- DisplayNumber: "App-005",
11758
- DisplayTitle: "Building Permission"
11759
- }];
11692
+ import { jsx as jsx80, jsxs as jsxs79 } from "react/jsx-runtime";
11693
+ var BUSINESS_ENTITY_ENDPOINTS = {
11694
+ create: "/api/flowcore/BusinessEntity/Create",
11695
+ update: "/api/flowcore/BusinessEntity/Update",
11696
+ getById: "/api/flowcore/BusinessEntity/GetById",
11697
+ getList: "/api/flowcore/BusinessEntity/GetList"
11698
+ };
11699
+ var getBusinessEntityEndpoint = (action) => {
11700
+ var _a, _b, _c, _d;
11701
+ try {
11702
+ return (_d = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.businessEntity) == null ? void 0 : _c[action]) != null ? _d : BUSINESS_ENTITY_ENDPOINTS[action];
11703
+ } catch (e) {
11704
+ return BUSINESS_ENTITY_ENDPOINTS[action];
11705
+ }
11706
+ };
11707
+ var getBusinessEntityByIdEndpoint = (id) => {
11708
+ const endpoint = getBusinessEntityEndpoint("getById");
11709
+ return typeof endpoint === "function" ? endpoint(id) : `${endpoint}/${id}`;
11710
+ };
11711
+ var getRows = (response) => {
11712
+ var _a, _b, _c, _d, _e, _f, _g;
11713
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
11714
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
11715
+ };
11716
+ var normalise = (item) => {
11717
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
11718
+ return __spreadProps(__spreadValues({}, item), {
11719
+ businessEntityId: (_b = (_a = item.businessEntityId) != null ? _a : item.BusinessEntityId) != null ? _b : item.id,
11720
+ entityType: (_d = (_c = item.entityType) != null ? _c : item.EntityType) != null ? _d : "",
11721
+ entityKey: (_f = (_e = item.entityKey) != null ? _e : item.EntityKey) != null ? _f : "",
11722
+ displayNumber: (_h = (_g = item.displayNumber) != null ? _g : item.DisplayNumber) != null ? _h : "",
11723
+ displayTitle: (_j = (_i = item.displayTitle) != null ? _i : item.DisplayTitle) != null ? _j : "",
11724
+ isActive: (_l = (_k = item.isActive) != null ? _k : item.IsActive) != null ? _l : true
11725
+ });
11726
+ };
11760
11727
  function BusinessEntity() {
11761
- const handleRefresh = () => {
11762
- console.log("Refresh clicked");
11763
- };
11764
- const handleDownload = () => {
11765
- console.log("Download clicked");
11766
- };
11767
11728
  const tableRef = useRef18(null);
11729
+ const [rows, setRows] = useState55([]);
11768
11730
  const [showModal, setShowModal] = useState55(false);
11731
+ const [editingEntity, setEditingEntity] = useState55(null);
11769
11732
  const [pageSize, setPageSize] = useState55(5);
11770
- const [sortConfig, setSortConfig] = useState55({
11771
- key: "",
11772
- direction: "asc"
11773
- });
11774
- const handleSort = (key) => {
11775
- let direction = "asc";
11776
- if (sortConfig.key === key && sortConfig.direction === "asc") {
11777
- direction = "desc";
11733
+ const [search, setSearch] = useState55("");
11734
+ const [sortConfig, setSortConfig] = useState55({ key: "", direction: "asc" });
11735
+ const [refreshKey, setRefreshKey] = useState55(0);
11736
+ useEffect32(() => {
11737
+ const load = async () => {
11738
+ var _a, _b;
11739
+ try {
11740
+ const endpoint = getBusinessEntityEndpoint("getList");
11741
+ const response = await getApiService().get(endpoint);
11742
+ setRows(getRows(response).map(normalise));
11743
+ } catch (error) {
11744
+ await Swal16.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load business entities.", "error");
11745
+ }
11746
+ };
11747
+ load();
11748
+ }, [refreshKey]);
11749
+ const refresh = () => setRefreshKey((value) => value + 1);
11750
+ const saveEntity = async (payload, isEdit) => {
11751
+ var _a, _b;
11752
+ try {
11753
+ const endpoint = getBusinessEntityEndpoint(isEdit ? "update" : "create");
11754
+ await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
11755
+ await Swal16.fire("Success", `Business entity ${isEdit ? "updated" : "created"} successfully.`, "success");
11756
+ refresh();
11757
+ return true;
11758
+ } catch (error) {
11759
+ await Swal16.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} business entity.`, "error");
11760
+ return false;
11778
11761
  }
11779
- setSortConfig({
11780
- key,
11781
- direction
11782
- });
11783
11762
  };
11784
- return /* @__PURE__ */ jsx80(Fragment6, { children: /* @__PURE__ */ jsxs79("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
11785
- /* @__PURE__ */ jsx80(CommonHeader, { title: "Business Entity", breadcrumbs: [{
11786
- label: "Dashboard",
11787
- href: "/dashboard"
11788
- }, {
11789
- label: "Runtime",
11790
- href: "/Sidebar"
11791
- }, {
11792
- label: "Business Entity",
11793
- href: "/BuisnessEntity"
11794
- }], buttonText: "Add Business Entity", onButtonClick: () => setShowModal(true) }),
11763
+ const editEntity = async (entity) => {
11764
+ var _a, _b, _c, _d, _e, _f, _g, _h;
11765
+ try {
11766
+ const response = await getApiService().get(getBusinessEntityByIdEndpoint(entity.businessEntityId));
11767
+ const data = (_f = (_e = (_d = (_b = getRows(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
11768
+ setEditingEntity(normalise(data));
11769
+ setShowModal(true);
11770
+ } catch (error) {
11771
+ await Swal16.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load business entity details.", "error");
11772
+ }
11773
+ };
11774
+ const visibleRows = rows.filter((item) => [item.entityType, item.entityKey, item.displayNumber, item.displayTitle].join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
11775
+ var _a, _b;
11776
+ if (!sortConfig.key) return 0;
11777
+ const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
11778
+ return sortConfig.direction === "asc" ? result : -result;
11779
+ });
11780
+ const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
11781
+ const columns = [["BusinessEntityId", "businessEntityId"], ["EntityType", "entityType"], ["EntityKey", "entityKey"], ["DisplayNumber", "displayNumber"], ["DisplayTitle", "displayTitle"]];
11782
+ return /* @__PURE__ */ jsxs79("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
11783
+ /* @__PURE__ */ jsx80(CommonHeader, { title: "Business Entity", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Runtime", href: "/Sidebar" }, { label: "Business Entity", href: "/BuisnessEntity" }], buttonText: "Add Business Entity", onButtonClick: () => {
11784
+ setEditingEntity(null);
11785
+ setShowModal(true);
11786
+ } }),
11795
11787
  /* @__PURE__ */ jsxs79("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
11796
11788
  /* @__PURE__ */ jsxs79("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
11797
- /* @__PURE__ */ jsxs79("div", { className: "fc:relative fc:max-w-xs fc:w-full", children: [
11798
- /* @__PURE__ */ jsx80("span", { className: "fc:absolute fc:inset-y-0 fc:left-0 fc:flex fc:items-center fc:pl-3.5 fc:pointer-events-none", children: /* @__PURE__ */ jsx80("svg", { className: "fc:w-4 fc:h-5 fc:text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx80("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
11799
- /* @__PURE__ */ jsx80("input", { type: "text", placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
11800
- ] }),
11801
- /* @__PURE__ */ jsxs79("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold", children: [
11802
- /* @__PURE__ */ jsx80(Refresh_default, { onRefresh: handleRefresh }),
11789
+ /* @__PURE__ */ jsx80("input", { value: search, onChange: (event) => setSearch(event.target.value), type: "text", placeholder: "Search business entities...", className: "fc:max-w-xs fc:w-full fc:px-4 fc:py-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-sm" }),
11790
+ /* @__PURE__ */ jsxs79("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
11791
+ /* @__PURE__ */ jsx80(Refresh_default, { onRefresh: refresh }),
11803
11792
  /* @__PURE__ */ jsx80(Download_default, { targetRef: tableRef, fileName: "business-entity" }),
11804
- /* @__PURE__ */ jsxs79("select", { value: pageSize, onChange: (e) => setPageSize(Number(e.target.value)), className: "fc:inline-flex fc:items-center fc:px-4 fc:py-2 fc:rounded-xl fc:bg-white fc:text-slate-700 fc:text-[14px] fc:font-semibold fc:border fc:border-slate-200 focus:fc:fc:outline-none fc:cursor-pointer fc:shadow-md", children: [
11793
+ /* @__PURE__ */ jsxs79("select", { value: pageSize, onChange: (event) => setPageSize(Number(event.target.value)), className: "fc:px-4 fc:py-2 fc:rounded-xl fc:border fc:border-slate-200", children: [
11805
11794
  /* @__PURE__ */ jsx80("option", { value: 5, children: "5 Rows" }),
11806
11795
  /* @__PURE__ */ jsx80("option", { value: 10, children: "10 Rows" }),
11807
11796
  /* @__PURE__ */ jsx80("option", { value: 25, children: "25 Rows" })
11808
11797
  ] })
11809
11798
  ] })
11810
11799
  ] }),
11811
- /* @__PURE__ */ jsx80("div", { className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden fc:bg-white fc:shadow-md", children: /* @__PURE__ */ jsx80("div", { className: "fc:max-h-[350px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ jsxs79("table", { className: "fc:min-w-max fc:w-full fc:border-collapse", children: [
11812
- /* @__PURE__ */ jsx80("thead", { className: "fc:bg-slate-50 fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ jsx80("tr", { className: "fc:text-[11px] fc:font-bold fc:uppercase fc:tracking-wider fc:text-slate-400", children: [{
11813
- label: "BusinessEntityId",
11814
- key: "BusinessEntityId"
11815
- }, {
11816
- label: "EntityType",
11817
- key: "EntityType"
11818
- }, {
11819
- label: "EntityKey",
11820
- key: "EntityKey"
11821
- }, {
11822
- label: "DisplayNumber",
11823
- key: "DisplayNumber"
11824
- }, {
11825
- label: "DisplayTitle",
11826
- key: "DisplayTitle"
11827
- }].map((column) => /* @__PURE__ */ jsx80("th", { onClick: () => handleSort(column.key), className: "fc:px-6 fc:py-4 fc:text-left fc:text-xs fc:font-bold fc:text-slate-500 fc:uppercase fc:tracking-wider fc:cursor-pointer fc:select-none hover:fc:fc:bg-slate-100 fc:transition-colors", children: /* @__PURE__ */ jsxs79("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
11828
- /* @__PURE__ */ jsx80("span", { children: column.label }),
11829
- /* @__PURE__ */ jsx80("span", { className: "fc:text-gray-400 fc:text-xs", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
11830
- ] }) }, column.key)) }) }),
11831
- /* @__PURE__ */ jsx80("tbody", { children: BusinessEntitys.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs79("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
11832
- /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.BusinessEntityId }),
11833
- /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.EntityType }),
11834
- /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.EntityKey }),
11835
- /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.DisplayNumber }),
11836
- /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.DisplayTitle })
11837
- ] }, item.BusinessEntityId)) })
11838
- ] }) }) }),
11839
- /* @__PURE__ */ jsxs79("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: [
11840
- /* @__PURE__ */ jsx80(Footer, {}),
11841
- showModal && /* @__PURE__ */ jsx80(AddBusinessEntityModal, { onClose: () => setShowModal(false) })
11842
- ] })
11843
- ] })
11844
- ] }) });
11800
+ /* @__PURE__ */ jsx80("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ jsxs79("table", { className: "fc:min-w-max fc:w-full", children: [
11801
+ /* @__PURE__ */ jsx80("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ jsxs79("tr", { children: [
11802
+ columns.map(([label, key]) => /* @__PURE__ */ jsxs79("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
11803
+ label,
11804
+ " ",
11805
+ sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
11806
+ ] }, key)),
11807
+ /* @__PURE__ */ jsx80("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
11808
+ ] }) }),
11809
+ /* @__PURE__ */ jsx80("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs79("tr", { className: "fc:border-t fc:border-slate-100", children: [
11810
+ /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.businessEntityId }),
11811
+ /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.entityType }),
11812
+ /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.entityKey }),
11813
+ /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.displayNumber }),
11814
+ /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item.displayTitle }),
11815
+ /* @__PURE__ */ jsx80("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx80("button", { onClick: () => editEntity(item), className: "fc:bg-blue-50 hover:fc:bg-blue-100 fc:text-blue-600 fc:px-3 fc:py-1 fc:rounded-lg fc:text-xs fc:font-semibold", children: "Edit" }) })
11816
+ ] }, item.businessEntityId)) })
11817
+ ] }) }),
11818
+ /* @__PURE__ */ jsx80(Footer, {})
11819
+ ] }),
11820
+ showModal && /* @__PURE__ */ jsx80(AddBusinessEntityModal, { editData: editingEntity, onClose: () => {
11821
+ setShowModal(false);
11822
+ setEditingEntity(null);
11823
+ }, onSave: saveEntity })
11824
+ ] });
11845
11825
  }
11846
11826
 
11847
11827
  // src/components/FileInstance/FileInstancemain.js
11848
- import React82, { useState as useState57, useRef as useRef19 } from "react";
11849
- import Link4 from "next/link";
11828
+ import React82, { useEffect as useEffect34, useRef as useRef19, useState as useState57 } from "react";
11829
+ import Swal17 from "sweetalert2";
11850
11830
 
11851
11831
  // src/components/FileInstance/AddWorkFlowFileInstanceModal.js
11852
- import React81, { useState as useState56 } from "react";
11832
+ import React81, { useEffect as useEffect33, useMemo, useState as useState56 } from "react";
11853
11833
  import { jsx as jsx81, jsxs as jsxs80 } from "react/jsx-runtime";
11854
- function AddFileInstanceModal({ onClose }) {
11855
- const [formData, setFormData] = useState56({
11856
- workflow: "",
11857
- businessEntityType: "",
11858
- businessEntity: "",
11859
- hierarchyNode: "",
11860
- currentStep: "",
11861
- currentTaskInstance: "",
11862
- status: "Pending",
11863
- priority: "High"
11834
+ var LOOKUP_ENDPOINTS = {
11835
+ workflow: "/api/flowcore/WorkFlow/GetList",
11836
+ businessEntity: "/api/flowcore/BusinessEntity/GetList",
11837
+ hierarchyNode: "/api/flowcore/HierarchyNode/GetList"
11838
+ };
11839
+ var getLookupRows = (response) => {
11840
+ var _a, _b, _c, _d, _e, _f, _g;
11841
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
11842
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
11843
+ };
11844
+ var getLookupEndpoint = (resource) => {
11845
+ var _a, _b, _c, _d;
11846
+ try {
11847
+ return (_d = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b[resource]) == null ? void 0 : _c.getList) != null ? _d : LOOKUP_ENDPOINTS[resource];
11848
+ } catch (e) {
11849
+ return LOOKUP_ENDPOINTS[resource];
11850
+ }
11851
+ };
11852
+ function AddFileInstanceModal({ onClose, onSave, editData }) {
11853
+ const [formData, setFormData] = useState56(() => {
11854
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
11855
+ return {
11856
+ workflow: String((_b = (_a = editData == null ? void 0 : editData.workflowId) != null ? _a : editData == null ? void 0 : editData.WorkflowId) != null ? _b : ""),
11857
+ businessEntityType: (_d = (_c = editData == null ? void 0 : editData.businessEntityType) != null ? _c : editData == null ? void 0 : editData.BusinessEntityType) != null ? _d : "",
11858
+ businessEntity: String((_f = (_e = editData == null ? void 0 : editData.businessEntityId) != null ? _e : editData == null ? void 0 : editData.BusinessEntityId) != null ? _f : ""),
11859
+ hierarchyNode: String((_h = (_g = editData == null ? void 0 : editData.hierarchyNodeId) != null ? _g : editData == null ? void 0 : editData.HierarchyNodeId) != null ? _h : ""),
11860
+ currentStep: String((_j = (_i = editData == null ? void 0 : editData.currentStepId) != null ? _i : editData == null ? void 0 : editData.CurrentStepId) != null ? _j : ""),
11861
+ currentTaskInstance: String((_l = (_k = editData == null ? void 0 : editData.currentTaskInstanceId) != null ? _k : editData == null ? void 0 : editData.CurrentTaskInstanceId) != null ? _l : ""),
11862
+ status: (_n = (_m = editData == null ? void 0 : editData.status) != null ? _m : editData == null ? void 0 : editData.Status) != null ? _n : "Pending",
11863
+ priority: (_p = (_o = editData == null ? void 0 : editData.priority) != null ? _o : editData == null ? void 0 : editData.Priority) != null ? _p : "High"
11864
+ };
11864
11865
  });
11865
11866
  const [errors, setErrors] = useState56({});
11867
+ const [isSubmitting, setIsSubmitting] = useState56(false);
11868
+ const [workflows, setWorkflows] = useState56([]);
11869
+ const [businessEntities, setBusinessEntities] = useState56([]);
11870
+ const [hierarchyNodes, setHierarchyNodes] = useState56([]);
11871
+ const [isLoadingLookups, setIsLoadingLookups] = useState56(true);
11872
+ useEffect33(() => {
11873
+ let isMounted = true;
11874
+ const loadLookups = async () => {
11875
+ try {
11876
+ const apiService = getApiService();
11877
+ const [workflowResponse, businessEntityResponse, hierarchyNodeResponse] = await Promise.all([
11878
+ apiService.get(getLookupEndpoint("workflow")),
11879
+ apiService.get(getLookupEndpoint("businessEntity")),
11880
+ apiService.get(getLookupEndpoint("hierarchyNode"))
11881
+ ]);
11882
+ if (!isMounted) return;
11883
+ setWorkflows(getLookupRows(workflowResponse));
11884
+ setBusinessEntities(getLookupRows(businessEntityResponse));
11885
+ setHierarchyNodes(getLookupRows(hierarchyNodeResponse));
11886
+ } catch (error) {
11887
+ if (!isMounted) return;
11888
+ setErrors((current) => {
11889
+ var _a, _b;
11890
+ return __spreadProps(__spreadValues({}, current), {
11891
+ lookup: ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load workflow, Business Entity, or Hierarchy Node options."
11892
+ });
11893
+ });
11894
+ } finally {
11895
+ if (isMounted) setIsLoadingLookups(false);
11896
+ }
11897
+ };
11898
+ loadLookups();
11899
+ return () => {
11900
+ isMounted = false;
11901
+ };
11902
+ }, []);
11903
+ const entityTypes = useMemo(() => [...new Set(businessEntities.map((entity) => {
11904
+ var _a;
11905
+ return (_a = entity.entityType) != null ? _a : entity.EntityType;
11906
+ }).filter(Boolean))], [businessEntities]);
11907
+ const visibleBusinessEntities = useMemo(() => businessEntities.filter((entity) => {
11908
+ var _a;
11909
+ const entityType = (_a = entity.entityType) != null ? _a : entity.EntityType;
11910
+ return !formData.businessEntityType || entityType === formData.businessEntityType;
11911
+ }), [businessEntities, formData.businessEntityType]);
11912
+ const handleSubmit = async () => {
11913
+ var _a, _b, _c, _d, _e;
11914
+ if (!validateForm() || !onSave) return;
11915
+ const isEdit = Boolean(editData);
11916
+ const payload = isEdit ? { fileInstanceId: (_a = editData.fileInstanceId) != null ? _a : editData.FileInstanceId, currentStepId: Number(formData.currentStep), currentTaskInstanceId: Number(formData.currentTaskInstance), status: formData.status, priority: formData.priority, isActive: (_c = (_b = editData.isActive) != null ? _b : editData.IsActive) != null ? _c : true, updatedBy: (_e = (_d = editData.updatedBy) != null ? _d : editData.createdBy) != null ? _e : "System" } : { workflowId: Number(formData.workflow), businessEntityType: formData.businessEntityType, businessEntityId: Number(formData.businessEntity), hierarchyNodeId: Number(formData.hierarchyNode), currentStepId: Number(formData.currentStep), currentTaskInstanceId: Number(formData.currentTaskInstance), status: formData.status, priority: formData.priority, createdBy: "System" };
11917
+ setIsSubmitting(true);
11918
+ try {
11919
+ if (await onSave(payload, isEdit)) onClose();
11920
+ } finally {
11921
+ setIsSubmitting(false);
11922
+ }
11923
+ };
11866
11924
  const validateForm = () => {
11867
11925
  const newErrors = {};
11868
11926
  if (!formData.workflow) newErrors.workflow = "Workflow is required.";
@@ -11887,7 +11945,7 @@ function AddFileInstanceModal({ onClose }) {
11887
11945
  /* @__PURE__ */ jsxs80("div", { className: "fc:flex fc:items-center fc:gap-4", children: [
11888
11946
  /* @__PURE__ */ jsx81("div", { className: "fc:w-12 fc:h-12 fc:bg-indigo-50 fc:text-indigo-600 fc:rounded-xl fc:flex fc:items-center fc:justify-center fc:shadow-inner fc:border fc:border-indigo-100", children: /* @__PURE__ */ jsx81("svg", { className: "fc:w-6 fc:h-6", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx81("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h5l2 2h5a2 2 0 012 2v10a2 2 0 01-2 2H5a2 2 0 01-2-2z" }) }) }),
11889
11947
  /* @__PURE__ */ jsxs80("div", { children: [
11890
- /* @__PURE__ */ jsx81("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: "Add FileInstance" }),
11948
+ /* @__PURE__ */ jsx81("h2", { className: "fc:text-xl fc:font-extrabold fc:text-slate-800", children: editData ? "Edit FileInstance" : "Add FileInstance" }),
11891
11949
  /* @__PURE__ */ jsx81("p", { className: "fc:text-xs fc:text-slate-400 fc:mt-0.5", children: "Create a new File Instance and configure its details" })
11892
11950
  ] })
11893
11951
  ] }),
@@ -11923,9 +11981,13 @@ function AddFileInstanceModal({ onClose }) {
11923
11981
  },
11924
11982
  className: `fc:w-full fc:p-2.5 fc:border fc:rounded-xl fc:text-xs fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${formData.workflow ? "fc:text-slate-800 fc:font-medium" : "fc:text-slate-400"} ${errors.workflow ? "fc:border-red-500" : "fc:border-slate-200"}`,
11925
11983
  children: [
11926
- /* @__PURE__ */ jsx81("option", { value: "", children: "Select Workflow" }),
11927
- /* @__PURE__ */ jsx81("option", { value: "Petition Workflow", children: "Petition Workflow" }),
11928
- /* @__PURE__ */ jsx81("option", { value: "Building Workflow", children: "Building Workflow" })
11984
+ /* @__PURE__ */ jsx81("option", { value: "", children: isLoadingLookups ? "Loading workflows..." : "Select Workflow" }),
11985
+ workflows.map((workflow) => {
11986
+ var _a, _b, _c, _d, _e, _f, _g, _h;
11987
+ const id = (_b = (_a = workflow.workflowId) != null ? _a : workflow.WorkflowId) != null ? _b : workflow.id;
11988
+ const name = (_h = (_g = (_f = (_e = (_d = (_c = workflow.workflowName) != null ? _c : workflow.WorkflowName) != null ? _d : workflow.name) != null ? _e : workflow.Name) != null ? _f : workflow.workflowCode) != null ? _g : workflow.WorkflowCode) != null ? _h : `Workflow ${id}`;
11989
+ return /* @__PURE__ */ jsx81("option", { value: String(id), children: name }, id);
11990
+ })
11929
11991
  ]
11930
11992
  }
11931
11993
  ),
@@ -11942,15 +12004,13 @@ function AddFileInstanceModal({ onClose }) {
11942
12004
  {
11943
12005
  value: formData.businessEntityType,
11944
12006
  onChange: (e) => {
11945
- setFormData(__spreadProps(__spreadValues({}, formData), { businessEntityType: e.target.value }));
12007
+ setFormData(__spreadProps(__spreadValues({}, formData), { businessEntityType: e.target.value, businessEntity: "" }));
11946
12008
  setErrors(__spreadProps(__spreadValues({}, errors), { businessEntityType: "" }));
11947
12009
  },
11948
12010
  className: `fc:w-full fc:p-2.5 fc:border fc:rounded-xl fc:text-xs fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${formData.businessEntityType ? "fc:text-slate-800 fc:font-medium" : "fc:text-slate-400"} ${errors.businessEntityType ? "fc:border-red-500" : "fc:border-slate-200"}`,
11949
12011
  children: [
11950
- /* @__PURE__ */ jsx81("option", { value: "", children: "Select Type" }),
11951
- /* @__PURE__ */ jsx81("option", { value: "Application", children: "Application" }),
11952
- /* @__PURE__ */ jsx81("option", { value: "Petition", children: "Petition" }),
11953
- /* @__PURE__ */ jsx81("option", { value: "Complaint", children: "Complaint" })
12012
+ /* @__PURE__ */ jsx81("option", { value: "", children: isLoadingLookups ? "Loading types..." : "Select Type" }),
12013
+ entityTypes.map((entityType) => /* @__PURE__ */ jsx81("option", { value: entityType, children: entityType }, entityType))
11954
12014
  ]
11955
12015
  }
11956
12016
  ),
@@ -11969,14 +12029,31 @@ function AddFileInstanceModal({ onClose }) {
11969
12029
  {
11970
12030
  value: formData.businessEntity,
11971
12031
  onChange: (e) => {
11972
- setFormData(__spreadProps(__spreadValues({}, formData), { businessEntity: e.target.value }));
12032
+ var _a, _b;
12033
+ const entity = businessEntities.find((item) => {
12034
+ var _a2, _b2;
12035
+ return String((_b2 = (_a2 = item.businessEntityId) != null ? _a2 : item.BusinessEntityId) != null ? _b2 : item.id) === e.target.value;
12036
+ });
12037
+ setFormData(__spreadProps(__spreadValues({}, formData), {
12038
+ businessEntity: e.target.value,
12039
+ businessEntityType: (_b = (_a = entity == null ? void 0 : entity.entityType) != null ? _a : entity == null ? void 0 : entity.EntityType) != null ? _b : formData.businessEntityType
12040
+ }));
11973
12041
  setErrors(__spreadProps(__spreadValues({}, errors), { businessEntity: "" }));
11974
12042
  },
11975
12043
  className: `fc:w-full fc:p-2.5 fc:border fc:rounded-xl fc:text-xs fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${formData.businessEntity ? "fc:text-slate-800 fc:font-medium" : "fc:text-slate-400"} ${errors.businessEntity ? "fc:border-red-500" : "fc:border-slate-200"}`,
11976
12044
  children: [
11977
- /* @__PURE__ */ jsx81("option", { value: "", children: "Select Business Entity" }),
11978
- /* @__PURE__ */ jsx81("option", { value: "APP-001 - Building Permission", children: "APP-001 - Building Permission" }),
11979
- /* @__PURE__ */ jsx81("option", { value: "APP-002 - Citizen Petition", children: "APP-002 - Citizen Petition" })
12045
+ /* @__PURE__ */ jsx81("option", { value: "", children: isLoadingLookups ? "Loading business entities..." : "Select Business Entity" }),
12046
+ visibleBusinessEntities.map((entity) => {
12047
+ var _a, _b, _c, _d, _e, _f;
12048
+ const id = (_b = (_a = entity.businessEntityId) != null ? _a : entity.BusinessEntityId) != null ? _b : entity.id;
12049
+ const displayNumber = (_d = (_c = entity.displayNumber) != null ? _c : entity.DisplayNumber) != null ? _d : id;
12050
+ const displayTitle = (_f = (_e = entity.displayTitle) != null ? _e : entity.DisplayTitle) != null ? _f : "Business Entity";
12051
+ return /* @__PURE__ */ jsxs80("option", { value: String(id), children: [
12052
+ displayNumber,
12053
+ " - ",
12054
+ displayTitle
12055
+ ] }, id);
12056
+ })
11980
12057
  ]
11981
12058
  }
11982
12059
  ),
@@ -11998,16 +12075,20 @@ function AddFileInstanceModal({ onClose }) {
11998
12075
  },
11999
12076
  className: `fc:w-full fc:p-2.5 fc:border fc:rounded-xl fc:text-xs fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${formData.hierarchyNode ? "fc:text-slate-800 fc:font-medium" : "fc:text-slate-400"} ${errors.hierarchyNode ? "fc:border-red-500" : "fc:border-slate-200"}`,
12000
12077
  children: [
12001
- /* @__PURE__ */ jsx81("option", { value: "", children: "Select Hierarchy" }),
12002
- /* @__PURE__ */ jsx81("option", { value: "District Office", children: "District Office" }),
12003
- /* @__PURE__ */ jsx81("option", { value: "Block Office", children: "Block Office" }),
12004
- /* @__PURE__ */ jsx81("option", { value: "Panchayat", children: "Panchayat" })
12078
+ /* @__PURE__ */ jsx81("option", { value: "", children: isLoadingLookups ? "Loading hierarchy nodes..." : "Select Hierarchy" }),
12079
+ hierarchyNodes.map((node) => {
12080
+ var _a, _b, _c, _d, _e, _f;
12081
+ const id = (_b = (_a = node.hierarchyNodeId) != null ? _a : node.HierarchyNodeId) != null ? _b : node.id;
12082
+ const name = (_f = (_e = (_d = (_c = node.nodeName) != null ? _c : node.NodeName) != null ? _d : node.name) != null ? _e : node.Name) != null ? _f : `Hierarchy Node ${id}`;
12083
+ return /* @__PURE__ */ jsx81("option", { value: String(id), children: name }, id);
12084
+ })
12005
12085
  ]
12006
12086
  }
12007
12087
  ),
12008
12088
  errors.hierarchyNode && /* @__PURE__ */ jsx81("p", { className: "fc:text-red-500 fc:text-[11px] fc:mt-1 fc:font-medium", children: errors.hierarchyNode })
12009
12089
  ] })
12010
12090
  ] }),
12091
+ errors.lookup && /* @__PURE__ */ jsx81("p", { className: "fc:text-red-500 fc:text-[11px] fc:font-medium", children: errors.lookup }),
12011
12092
  /* @__PURE__ */ jsxs80("div", { className: "fc:grid fc:grid-cols-2 md:fc:grid-cols-2 fc:gap-5", children: [
12012
12093
  /* @__PURE__ */ jsxs80("div", { children: [
12013
12094
  /* @__PURE__ */ jsxs80("label", { className: "fc:flex fc:items-center fc:gap-1.5 fc:text-xs fc:font-bold fc:text-slate-700 fc:mb-1.5", children: [
@@ -12026,8 +12107,8 @@ function AddFileInstanceModal({ onClose }) {
12026
12107
  className: `fc:w-full fc:p-2.5 fc:border fc:rounded-xl fc:text-xs fc:bg-white focus:fc:outline-none focus:fc:ring-2 focus:fc:ring-indigo-500/20 focus:fc:border-indigo-500 fc:transition-all ${formData.currentStep ? "fc:text-slate-800 fc:font-medium" : "fc:text-slate-400"} ${errors.currentStep ? "fc:border-red-500" : "fc:border-slate-200"}`,
12027
12108
  children: [
12028
12109
  /* @__PURE__ */ jsx81("option", { value: "", children: "Select Step" }),
12029
- /* @__PURE__ */ jsx81("option", { value: "Scrutiny", children: "Scrutiny" }),
12030
- /* @__PURE__ */ jsx81("option", { value: "Approval", children: "Approval" })
12110
+ /* @__PURE__ */ jsx81("option", { value: "1", children: "Scrutiny" }),
12111
+ /* @__PURE__ */ jsx81("option", { value: "2", children: "Approval" })
12031
12112
  ]
12032
12113
  }
12033
12114
  ),
@@ -12116,15 +12197,12 @@ function AddFileInstanceModal({ onClose }) {
12116
12197
  "button",
12117
12198
  {
12118
12199
  type: "button",
12119
- onClick: () => {
12120
- if (validateForm()) {
12121
- console.log("Form Submitted Successfully:", formData);
12122
- }
12123
- },
12200
+ onClick: handleSubmit,
12201
+ disabled: isSubmitting,
12124
12202
  className: "fc:px-6 fc:py-2.5 fc:bg-indigo-600 hover:fc:bg-indigo-700 fc:text-white fc:text-xs fc:font-bold fc:rounded-xl fc:shadow-md fc:shadow-indigo-500/20 hover:fc:shadow-indigo-500/30 fc:transition-all fc:flex fc:items-center fc:gap-2",
12125
12203
  children: [
12126
12204
  /* @__PURE__ */ jsx81("svg", { className: "fc:w-3.5 fc:h-3.5", fill: "none", stroke: "currentColor", strokeWidth: "2", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx81("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8 7H5a2 2 0 00-2 2v9a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-3m-1 4l-3 3m0 0l-3-3m3 3V4" }) }),
12127
- "Save FileInstance"
12205
+ isSubmitting ? "Saving..." : editData ? "Update FileInstance" : "Save FileInstance"
12128
12206
  ]
12129
12207
  }
12130
12208
  )
@@ -12134,252 +12212,126 @@ function AddFileInstanceModal({ onClose }) {
12134
12212
  }
12135
12213
 
12136
12214
  // src/components/FileInstance/FileInstancemain.js
12137
- import { Fragment as Fragment7, jsx as jsx82, jsxs as jsxs81 } from "react/jsx-runtime";
12138
- var FileInstances = [{
12139
- FileInstanceId: 1,
12140
- workflowId: 1,
12141
- BusinessEntityType: "Application",
12142
- BusinessEntityId: 5001,
12143
- HierarchyNodeId: 2,
12144
- CurrentStepId: 1,
12145
- CurrentTaskInstanceId: 1,
12146
- Status: "Approved",
12147
- Priority: "High"
12148
- }, {
12149
- FileInstanceId: 1,
12150
- workflowId: 1,
12151
- BusinessEntityType: "Application",
12152
- BusinessEntityId: 5001,
12153
- HierarchyNodeId: 2,
12154
- CurrentStepId: 1,
12155
- CurrentTaskInstanceId: 1,
12156
- Status: "Pending",
12157
- Priority: "High"
12158
- }, {
12159
- FileInstanceId: 1,
12160
- workflowId: 1,
12161
- BusinessEntityType: "Application",
12162
- BusinessEntityId: 5001,
12163
- HierarchyNodeId: 2,
12164
- CurrentStepId: 1,
12165
- CurrentTaskInstanceId: 1,
12166
- Status: "Pending",
12167
- Priority: "High"
12168
- }, {
12169
- FileInstanceId: 1,
12170
- workflowId: 1,
12171
- BusinessEntityType: "Application",
12172
- BusinessEntityId: 5001,
12173
- HierarchyNodeId: 2,
12174
- CurrentStepId: 1,
12175
- CurrentTaskInstanceId: 1,
12176
- Status: "Pending",
12177
- Priority: "High"
12178
- }, {
12179
- FileInstanceId: 1,
12180
- workflowId: 1,
12181
- BusinessEntityType: "Application",
12182
- BusinessEntityId: 5001,
12183
- HierarchyNodeId: 2,
12184
- CurrentStepId: 1,
12185
- CurrentTaskInstanceId: 1,
12186
- Status: "Pending",
12187
- Priority: "High"
12188
- }, {
12189
- FileInstanceId: 1,
12190
- workflowId: 1,
12191
- BusinessEntityType: "Application",
12192
- BusinessEntityId: 5001,
12193
- HierarchyNodeId: 2,
12194
- CurrentStepId: 1,
12195
- CurrentTaskInstanceId: 1,
12196
- Status: "Pending",
12197
- Priority: "High"
12198
- }, {
12199
- FileInstanceId: 1,
12200
- workflowId: 1,
12201
- BusinessEntityType: "Application",
12202
- BusinessEntityId: 5001,
12203
- HierarchyNodeId: 2,
12204
- CurrentStepId: 1,
12205
- CurrentTaskInstanceId: 1,
12206
- Status: "Pending",
12207
- Priority: "High"
12208
- }, {
12209
- FileInstanceId: 1,
12210
- workflowId: 1,
12211
- BusinessEntityType: "Application",
12212
- BusinessEntityId: 5001,
12213
- HierarchyNodeId: 2,
12214
- CurrentStepId: 1,
12215
- CurrentTaskInstanceId: 1,
12216
- Status: "Pending",
12217
- Priority: "High"
12218
- }, {
12219
- FileInstanceId: 1,
12220
- workflowId: 1,
12221
- BusinessEntityType: "Application",
12222
- BusinessEntityId: 5001,
12223
- HierarchyNodeId: 2,
12224
- CurrentStepId: 1,
12225
- CurrentTaskInstanceId: 1,
12226
- Status: "Pending",
12227
- Priority: "High"
12228
- }, {
12229
- FileInstanceId: 1,
12230
- workflowId: 1,
12231
- BusinessEntityType: "Application",
12232
- BusinessEntityId: 5001,
12233
- HierarchyNodeId: 2,
12234
- CurrentStepId: 1,
12235
- CurrentTaskInstanceId: 1,
12236
- Status: "Pending",
12237
- Priority: "High"
12238
- }, {
12239
- FileInstanceId: 1,
12240
- workflowId: 1,
12241
- BusinessEntityType: "Application",
12242
- BusinessEntityId: 5001,
12243
- HierarchyNodeId: 2,
12244
- CurrentStepId: 1,
12245
- CurrentTaskInstanceId: 1,
12246
- Status: "Pending",
12247
- Priority: "High"
12248
- }, {
12249
- FileInstanceId: 1,
12250
- workflowId: 1,
12251
- BusinessEntityType: "Application",
12252
- BusinessEntityId: 5001,
12253
- HierarchyNodeId: 2,
12254
- CurrentStepId: 1,
12255
- CurrentTaskInstanceId: 1,
12256
- Status: "Pending",
12257
- Priority: "High"
12258
- }, {
12259
- FileInstanceId: 1,
12260
- workflowId: 1,
12261
- BusinessEntityType: "Application",
12262
- BusinessEntityId: 5001,
12263
- HierarchyNodeId: 2,
12264
- CurrentStepId: 1,
12265
- CurrentTaskInstanceId: 1,
12266
- Status: "Pending",
12267
- Priority: "High"
12268
- }];
12215
+ import { jsx as jsx82, jsxs as jsxs81 } from "react/jsx-runtime";
12216
+ var FILE_INSTANCE_ENDPOINTS = {
12217
+ create: "/api/flowcore/FileInstance/Create",
12218
+ update: "/api/flowcore/FileInstance/Update",
12219
+ getById: "/api/flowcore/FileInstance/GetById",
12220
+ getList: "/api/flowcore/FileInstance/GetList"
12221
+ };
12222
+ var getFileInstanceEndpoint = (action) => {
12223
+ var _a, _b, _c, _d;
12224
+ try {
12225
+ return (_d = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.fileInstance) == null ? void 0 : _c[action]) != null ? _d : FILE_INSTANCE_ENDPOINTS[action];
12226
+ } catch (e) {
12227
+ return FILE_INSTANCE_ENDPOINTS[action];
12228
+ }
12229
+ };
12230
+ var getFileInstanceByIdEndpoint = (id) => {
12231
+ const endpoint = getFileInstanceEndpoint("getById");
12232
+ return typeof endpoint === "function" ? endpoint(id) : `${endpoint}/${id}`;
12233
+ };
12234
+ var getRows2 = (response) => {
12235
+ var _a, _b, _c, _d, _e, _f, _g;
12236
+ const value = (_e = (_d = (_c = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _c : (_b = response == null ? void 0 : response.data) == null ? void 0 : _b.result) != null ? _d : response == null ? void 0 : response.data) != null ? _e : response;
12237
+ return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
12238
+ };
12239
+ var normalise2 = (item) => {
12240
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
12241
+ return __spreadProps(__spreadValues({}, item), { fileInstanceId: (_b = (_a = item.fileInstanceId) != null ? _a : item.FileInstanceId) != null ? _b : item.id, workflowId: (_d = (_c = item.workflowId) != null ? _c : item.WorkflowId) != null ? _d : "", businessEntityType: (_f = (_e = item.businessEntityType) != null ? _e : item.BusinessEntityType) != null ? _f : "", businessEntityId: (_h = (_g = item.businessEntityId) != null ? _g : item.BusinessEntityId) != null ? _h : "", hierarchyNodeId: (_j = (_i = item.hierarchyNodeId) != null ? _i : item.HierarchyNodeId) != null ? _j : "", currentStepId: (_l = (_k = item.currentStepId) != null ? _k : item.CurrentStepId) != null ? _l : "", currentTaskInstanceId: (_n = (_m = item.currentTaskInstanceId) != null ? _m : item.CurrentTaskInstanceId) != null ? _n : "", status: (_p = (_o = item.status) != null ? _o : item.Status) != null ? _p : "", priority: (_r = (_q = item.priority) != null ? _q : item.Priority) != null ? _r : "", isActive: (_t = (_s = item.isActive) != null ? _s : item.IsActive) != null ? _t : true });
12242
+ };
12269
12243
  function FileInstance() {
12270
- const handleRefresh = () => {
12271
- console.log("Refresh clicked");
12272
- };
12273
- const handleDownload = () => {
12274
- console.log("Download clicked");
12275
- };
12276
12244
  const tableRef = useRef19(null);
12245
+ const [rows, setRows] = useState57([]);
12277
12246
  const [showModal, setShowModal] = useState57(false);
12247
+ const [editingFile, setEditingFile] = useState57(null);
12278
12248
  const [pageSize, setPageSize] = useState57(5);
12279
- const [sortConfig, setSortConfig] = useState57({
12280
- key: "",
12281
- direction: "asc"
12282
- });
12283
- const handleSort = (key) => {
12284
- let direction = "asc";
12285
- if (sortConfig.key === key && sortConfig.direction === "asc") {
12286
- direction = "desc";
12249
+ const [search, setSearch] = useState57("");
12250
+ const [sortConfig, setSortConfig] = useState57({ key: "", direction: "asc" });
12251
+ const [refreshKey, setRefreshKey] = useState57(0);
12252
+ useEffect34(() => {
12253
+ const load = async () => {
12254
+ var _a, _b;
12255
+ try {
12256
+ const response = await getApiService().get(getFileInstanceEndpoint("getList"));
12257
+ setRows(getRows2(response).map(normalise2));
12258
+ } catch (error) {
12259
+ await Swal17.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || "Unable to load file instances.", "error");
12260
+ }
12261
+ };
12262
+ load();
12263
+ }, [refreshKey]);
12264
+ const refresh = () => setRefreshKey((value) => value + 1);
12265
+ const saveFile = async (payload, isEdit) => {
12266
+ var _a, _b;
12267
+ try {
12268
+ const endpoint = getFileInstanceEndpoint(isEdit ? "update" : "create");
12269
+ await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
12270
+ await Swal17.fire("Success", `File instance ${isEdit ? "updated" : "created"} successfully.`, "success");
12271
+ refresh();
12272
+ return true;
12273
+ } catch (error) {
12274
+ await Swal17.fire("Error", ((_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data) == null ? void 0 : _b.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} file instance.`, "error");
12275
+ return false;
12287
12276
  }
12288
- setSortConfig({
12289
- key,
12290
- direction
12291
- });
12292
12277
  };
12293
- return /* @__PURE__ */ jsxs81(Fragment7, { children: [
12294
- /* @__PURE__ */ jsxs81("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
12295
- /* @__PURE__ */ jsx82(CommonHeader, { title: "File Instance ", breadcrumbs: [{
12296
- label: "Dashboard",
12297
- href: "/dashboard"
12298
- }, {
12299
- label: "Runtime",
12300
- href: "/Sidebar"
12301
- }, {
12302
- label: "File Instance",
12303
- href: "/FileInstance"
12304
- }], buttonText: "Add File Instance", onButtonClick: () => setShowModal(true) }),
12305
- /* @__PURE__ */ jsxs81("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
12306
- /* @__PURE__ */ jsxs81("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
12307
- /* @__PURE__ */ jsxs81("div", { className: "fc:relative fc:max-w-xs fc:w-full", children: [
12308
- /* @__PURE__ */ jsx82("span", { className: "fc:absolute fc:inset-y-0 fc:left-0 fc:flex fc:items-center fc:pl-3.5 fc:pointer-events-none", children: /* @__PURE__ */ jsx82("svg", { className: "fc:w-4 fc:h-5 fc:text-slate-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx82("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" }) }) }),
12309
- /* @__PURE__ */ jsx82("input", { type: "text", placeholder: "Search workflow name or code...", className: "fc:w-full fc:pl-10 fc:pr-4 fc:py-2.5 fc:shadow-md fc:border fc:border-slate-200 fc:rounded-xl fc:text-xs fc:text-[14px] fc:text-bold fc:bg-slate-50/50 focus:fc:fc:outline-none focus:fc:fc:ring-4 focus:fc:fc:ring-blue-500/10 focus:fc:fc:border-blue-500 fc:text-slate-700 fc:placeholder-slate-400 fc:transition-all" })
12310
- ] }),
12311
- /* @__PURE__ */ jsxs81("div", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:text-slate-500 fc:font-semibold ", children: [
12312
- /* @__PURE__ */ jsx82(Refresh_default, { onRefresh: handleRefresh }),
12313
- /* @__PURE__ */ jsx82(Download_default, { targetRef: tableRef, fileName: "file-instance" }),
12314
- /* @__PURE__ */ jsxs81("select", { value: pageSize, onChange: (e) => setPageSize(Number(e.target.value)), className: "fc:inline-flex fc:items-center fc:px-4 fc:py-2 fc:rounded-xl fc:bg-white fc:text-slate-700 fc:text-[14px] fc:font-semibold fc:border fc:border-slate-200 focus:fc:fc:outline-none fc:cursor-pointer fc:shadow-md", children: [
12315
- /* @__PURE__ */ jsx82("option", { value: 5, children: "5 Rows" }),
12316
- /* @__PURE__ */ jsx82("option", { value: 10, children: "10 Rows" }),
12317
- /* @__PURE__ */ jsx82("option", { value: 25, children: "25 Rows" })
12318
- ] })
12278
+ const editFile = async (file) => {
12279
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12280
+ try {
12281
+ const response = await getApiService().get(getFileInstanceByIdEndpoint(file.fileInstanceId));
12282
+ const data = (_f = (_e = (_d = (_b = getRows2(response)[0]) != null ? _b : (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.data) != null ? _d : (_c = response == null ? void 0 : response.data) == null ? void 0 : _c.result) != null ? _e : response == null ? void 0 : response.data) != null ? _f : response;
12283
+ setEditingFile(normalise2(data));
12284
+ setShowModal(true);
12285
+ } catch (error) {
12286
+ await Swal17.fire("Error", ((_h = (_g = error == null ? void 0 : error.response) == null ? void 0 : _g.data) == null ? void 0 : _h.message) || (error == null ? void 0 : error.message) || "Unable to load file instance details.", "error");
12287
+ }
12288
+ };
12289
+ const columns = [["FileInstanceId", "fileInstanceId"], ["WorkflowId", "workflowId"], ["BusinessEntityType", "businessEntityType"], ["BusinessEntityId", "businessEntityId"], ["HierarchyNodeId", "hierarchyNodeId"], ["CurrentStepId", "currentStepId"], ["CurrentTaskInstanceId", "currentTaskInstanceId"], ["Status", "status"], ["Priority", "priority"]];
12290
+ const sort = (key) => setSortConfig((current) => ({ key, direction: current.key === key && current.direction === "asc" ? "desc" : "asc" }));
12291
+ const visibleRows = rows.filter((item) => Object.values(item).join(" ").toLowerCase().includes(search.toLowerCase())).sort((a, b) => {
12292
+ var _a, _b;
12293
+ if (!sortConfig.key) return 0;
12294
+ const result = String((_a = a[sortConfig.key]) != null ? _a : "").localeCompare(String((_b = b[sortConfig.key]) != null ? _b : ""), void 0, { numeric: true });
12295
+ return sortConfig.direction === "asc" ? result : -result;
12296
+ });
12297
+ return /* @__PURE__ */ jsxs81("div", { className: "fc:p-5 fc:bg-[#f5f7fb] fc:min-h-screen fc:font-sans fc:text-slate-700 fc:flex fc:flex-col", children: [
12298
+ /* @__PURE__ */ jsx82(CommonHeader, { title: "File Instance", breadcrumbs: [{ label: "Dashboard", href: "/dashboard" }, { label: "Runtime", href: "/Sidebar" }, { label: "File Instance", href: "/FileInstance" }], buttonText: "Add File Instance", onButtonClick: () => {
12299
+ setEditingFile(null);
12300
+ setShowModal(true);
12301
+ } }),
12302
+ /* @__PURE__ */ jsxs81("div", { className: "fc:bg-white fc:rounded-3xl fc:shadow-sm fc:border fc:border-slate-100 fc:p-6 fc:flex fc:flex-col fc:gap-6", children: [
12303
+ /* @__PURE__ */ jsxs81("div", { className: "fc:flex fc:justify-between fc:items-center fc:flex-wrap fc:gap-3", children: [
12304
+ /* @__PURE__ */ jsx82("input", { value: search, onChange: (event) => setSearch(event.target.value), type: "text", placeholder: "Search file instances...", className: "fc:max-w-xs fc:w-full fc:px-4 fc:py-2.5 fc:border fc:border-slate-200 fc:rounded-xl fc:text-sm" }),
12305
+ /* @__PURE__ */ jsxs81("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
12306
+ /* @__PURE__ */ jsx82(Refresh_default, { onRefresh: refresh }),
12307
+ /* @__PURE__ */ jsx82(Download_default, { targetRef: tableRef, fileName: "file-instance" }),
12308
+ /* @__PURE__ */ jsxs81("select", { value: pageSize, onChange: (event) => setPageSize(Number(event.target.value)), className: "fc:px-4 fc:py-2 fc:rounded-xl fc:border fc:border-slate-200", children: [
12309
+ /* @__PURE__ */ jsx82("option", { value: 5, children: "5 Rows" }),
12310
+ /* @__PURE__ */ jsx82("option", { value: 10, children: "10 Rows" }),
12311
+ /* @__PURE__ */ jsx82("option", { value: 25, children: "25 Rows" })
12319
12312
  ] })
12320
- ] }),
12321
- /* @__PURE__ */ jsx82("div", { className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-hidden fc:bg-white fc:shadow-md", children: /* @__PURE__ */ jsx82("div", { className: "fc:max-h-[350px] fc:overflow-y-auto fc:overflow-x-auto", children: /* @__PURE__ */ jsxs81("table", { className: "fc:min-w-max fc:w-full fc:border-collapse", children: [
12322
- /* @__PURE__ */ jsx82("thead", { className: "fc:bg-slate-50 fc:sticky fc:top-0 fc:z-10", children: /* @__PURE__ */ jsx82("tr", { className: "fc:text-[11px] fc:font-bold fc:uppercase fc:tracking-wider fc:text-slate-400", children: [{
12323
- label: "FileInstanceId",
12324
- key: "FileInstanceId"
12325
- }, {
12326
- label: "WorkflowId",
12327
- key: "workflowId"
12328
- }, {
12329
- label: "BusinessEntityType",
12330
- key: "BusinessEntityType"
12331
- }, {
12332
- label: "BusinessEntityId",
12333
- key: "BusinessEntityId"
12334
- }, {
12335
- label: "HierarchyNodeId",
12336
- key: "HierarchyNodeId"
12337
- }, {
12338
- label: "CurrentStepId",
12339
- key: "CurrentStepId"
12340
- }, {
12341
- label: "CurrentTaskInstanceId",
12342
- key: "CurrentTaskInstanceId"
12343
- }, {
12344
- label: "Status",
12345
- key: "Status"
12346
- }, {
12347
- label: "Priority",
12348
- key: "Priority"
12349
- }].map((column) => /* @__PURE__ */ jsx82("th", { onClick: () => handleSort(column.key), className: "fc:px-6 fc:py-4 fc:text-left fc:text-xs fc:font-bold fc:text-slate-500 fc:uppercase fc:tracking-wider fc:cursor-pointer fc:select-none hover:fc:fc:bg-slate-100 fc:transition-colors", children: /* @__PURE__ */ jsxs81("div", { className: "fc:flex fc:items-center fc:justify-center fc:gap-2", children: [
12350
- /* @__PURE__ */ jsx82("span", { children: column.label }),
12351
- /* @__PURE__ */ jsx82("span", { className: "fc:text-gray-400 fc:text-xs", children: sortConfig.key === column.key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195" })
12352
- ] }) }, column.key)) }) }),
12353
- /* @__PURE__ */ jsx82("tbody", { children: FileInstances.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs81("tr", { className: "hover:fc:fc:bg-slate-50/80 fc:transition-colors fc:border-b fc:border-slate-100 last:fc:fc:border-0", children: [
12354
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:p-4 fc:border-b fc:border-slate-100 fc:text-[14px] fc:text-center fc:text-slate-600 fc:font-bold", children: item.FileInstanceId }),
12355
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.workflowId }),
12356
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-500 fc:font-semibold", children: item.BusinessEntityType }),
12357
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px fc:text-slate-600 fc:font-bold", children: item.BusinessEntityId }),
12358
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.HierarchyNodeId }),
12359
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.CurrentStepId }),
12360
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-align fc:center fc:text-[14px] fc:text-slate-600 fc:font-bold", children: item.CurrentTaskInstanceId }),
12361
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:border-b fc:border-slate-100", children: /* @__PURE__ */ jsx82(
12362
- "span",
12363
- {
12364
- className: `fc:inline-flex fc:items-center fc:rounded-full fc:px-3 fc:py-1 fc:text-xs fc:font-semibold
12365
- ${item.Status === "Approved" ? "fc:bg-green-100 fc:text-green-700" : "fc:bg-red-100 fc:text-red-700"}`,
12366
- children: item.Status
12367
- }
12368
- ) }),
12369
- /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:border-b fc:border-slate-100", children: /* @__PURE__ */ jsx82(
12370
- "span",
12371
- {
12372
- className: `fc:inline-flex fc:items-center fc:rounded-full fc:px-3 fc:py-1 fc:text-xs fc:font-semibold
12373
- ${item.Priority === "High" ? "fc:bg-green-100 fc:text-green-700" : "fc:bg-red-100 fc:text-red-700"}`,
12374
- children: item.Priority
12375
- }
12376
- ) })
12377
- ] }, item.TransitionId)) })
12378
- ] }) }) }),
12379
- /* @__PURE__ */ jsx82("div", { className: "fc:rounded-xl fc:bg-slate-50/50", children: /* @__PURE__ */ jsx82(Footer, {}) })
12380
- ] })
12313
+ ] })
12314
+ ] }),
12315
+ /* @__PURE__ */ jsx82("div", { ref: tableRef, className: "fc:border fc:border-slate-200 fc:rounded-2xl fc:overflow-auto", children: /* @__PURE__ */ jsxs81("table", { className: "fc:min-w-max fc:w-full", children: [
12316
+ /* @__PURE__ */ jsx82("thead", { className: "fc:bg-slate-50", children: /* @__PURE__ */ jsxs81("tr", { children: [
12317
+ columns.map(([label, key]) => /* @__PURE__ */ jsxs81("th", { onClick: () => sort(key), className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs fc:cursor-pointer", children: [
12318
+ label,
12319
+ " ",
12320
+ sortConfig.key === key ? sortConfig.direction === "asc" ? "\u25B2" : "\u25BC" : "\u2195"
12321
+ ] }, key)),
12322
+ /* @__PURE__ */ jsx82("th", { className: "fc:px-6 fc:py-4 fc:text-center fc:text-xs", children: "Action" })
12323
+ ] }) }),
12324
+ /* @__PURE__ */ jsx82("tbody", { children: visibleRows.slice(0, pageSize).map((item) => /* @__PURE__ */ jsxs81("tr", { className: "fc:border-t fc:border-slate-100", children: [
12325
+ columns.map(([, key]) => /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: item[key] }, key)),
12326
+ /* @__PURE__ */ jsx82("td", { className: "fc:px-6 fc:py-4 fc:text-center", children: /* @__PURE__ */ jsx82("button", { onClick: () => editFile(item), className: "fc:bg-blue-50 hover:fc:bg-blue-100 fc:text-blue-600 fc:px-3 fc:py-1 fc:rounded-lg fc:text-xs fc:font-semibold", children: "Edit" }) })
12327
+ ] }, item.fileInstanceId)) })
12328
+ ] }) }),
12329
+ /* @__PURE__ */ jsx82(Footer, {})
12381
12330
  ] }),
12382
- showModal && /* @__PURE__ */ jsx82(AddFileInstanceModal, { onClose: () => setShowModal(false) })
12331
+ showModal && /* @__PURE__ */ jsx82(AddFileInstanceModal, { editData: editingFile, onClose: () => {
12332
+ setShowModal(false);
12333
+ setEditingFile(null);
12334
+ }, onSave: saveFile })
12383
12335
  ] });
12384
12336
  }
12385
12337
 
@@ -12407,7 +12359,7 @@ function SearchBar12({
12407
12359
  }
12408
12360
 
12409
12361
  // src/components/assignment-rule/Table.js
12410
- import React84, { useState as useState58, useEffect as useEffect32 } from "react";
12362
+ import React84, { useState as useState58, useEffect as useEffect35 } from "react";
12411
12363
  import { jsx as jsx84, jsxs as jsxs83 } from "react/jsx-runtime";
12412
12364
  function Table4({
12413
12365
  pageSize,
@@ -12573,7 +12525,7 @@ function Table4({
12573
12525
  const query = searchQuery.toLowerCase().trim();
12574
12526
  return item.workflowStepId && item.workflowStepId.toString().toLowerCase().includes(query) || item.assignmentType && item.assignmentType.toLowerCase().includes(query) || item.hierarchyNodeType && item.hierarchyNodeType.toLowerCase().includes(query) || item.dynamicFunctionId && item.dynamicFunctionId.toString().toLowerCase().includes(query);
12575
12527
  });
12576
- useEffect32(() => {
12528
+ useEffect35(() => {
12577
12529
  if (setTotalEntries) setTotalEntries(filteredData.length);
12578
12530
  }, [filteredData.length, setTotalEntries]);
12579
12531
  const totalPages = Math.ceil(filteredData.length / pageSize) || 1;
@@ -12843,11 +12795,11 @@ function AssignmentRuleMain() {
12843
12795
  }
12844
12796
 
12845
12797
  // src/components/Workflow_Step_Hierarchy_Mapping/Workflow_Step_Hierarchy_Mapping_Main.jsx
12846
- import React87, { useEffect as useEffect33, useMemo, useRef as useRef21, useState as useState61 } from "react";
12847
- import Swal16 from "sweetalert2";
12798
+ import React87, { useEffect as useEffect36, useMemo as useMemo2, useRef as useRef21, useState as useState61 } from "react";
12799
+ import Swal18 from "sweetalert2";
12848
12800
  import { jsx as jsx87, jsxs as jsxs86 } from "react/jsx-runtime";
12849
12801
  var emptyForm = { workflowStepId: "", hierarchyNodeId: "", isActive: "true" };
12850
- var getRows = (result) => {
12802
+ var getRows3 = (result) => {
12851
12803
  var _a, _b, _c, _d, _e, _f, _g;
12852
12804
  const value = (_e = (_d = (_c = (_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data) != null ? _c : (_b = result == null ? void 0 : result.data) == null ? void 0 : _b.result) != null ? _d : result == null ? void 0 : result.data) != null ? _e : result;
12853
12805
  return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
@@ -12871,7 +12823,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12871
12823
  const flowCore = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore;
12872
12824
  return (flowCore == null ? void 0 : flowCore.WorkflowStepHierarchyMapping) || (flowCore == null ? void 0 : flowCore.workflowStepHierarchyMapping) || (flowCore == null ? void 0 : flowCore.WorkflowStepHierarchyMappings) || (flowCore == null ? void 0 : flowCore.workflowStepHierarchyMappings) || (flowCore == null ? void 0 : flowCore.WorkflowStepUserMapping) || (flowCore == null ? void 0 : flowCore.workflowStepUserMapping);
12873
12825
  };
12874
- const workflowStepMap = useMemo(
12826
+ const workflowStepMap = useMemo2(
12875
12827
  () => Object.fromEntries(
12876
12828
  workflowSteps.map((step) => {
12877
12829
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
@@ -12882,7 +12834,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12882
12834
  ),
12883
12835
  [workflowSteps]
12884
12836
  );
12885
- const hierarchyNodeMap = useMemo(
12837
+ const hierarchyNodeMap = useMemo2(
12886
12838
  () => Object.fromEntries(
12887
12839
  hierarchyNodes.map((node) => {
12888
12840
  var _a, _b, _c, _d, _e, _f;
@@ -12893,7 +12845,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12893
12845
  ),
12894
12846
  [hierarchyNodes]
12895
12847
  );
12896
- useEffect33(() => {
12848
+ useEffect36(() => {
12897
12849
  const loadData = async () => {
12898
12850
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
12899
12851
  setIsLoading(true);
@@ -12912,13 +12864,13 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12912
12864
  stepEndpoint ? getApiService().get(stepEndpoint) : Promise.resolve(null),
12913
12865
  nodeEndpoint ? getApiService().get(nodeEndpoint) : Promise.resolve(null)
12914
12866
  ]);
12915
- setMappings(getRows(mappingResult));
12916
- setWorkflowSteps(workflowStepResult ? getRows(workflowStepResult) : []);
12867
+ setMappings(getRows3(mappingResult));
12868
+ setWorkflowSteps(workflowStepResult ? getRows3(workflowStepResult) : []);
12917
12869
  setHierarchyNodes(
12918
- hierarchyNodeResult ? getRows(hierarchyNodeResult) : []
12870
+ hierarchyNodeResult ? getRows3(hierarchyNodeResult) : []
12919
12871
  );
12920
12872
  } catch (error) {
12921
- await Swal16.fire(
12873
+ await Swal18.fire(
12922
12874
  "Error",
12923
12875
  ((_j = (_i = error == null ? void 0 : error.response) == null ? void 0 : _i.data) == null ? void 0 : _j.message) || (error == null ? void 0 : error.message) || "Unable to load workflow step hierarchy mappings.",
12924
12876
  "error"
@@ -12949,7 +12901,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12949
12901
  var _a, _b, _c;
12950
12902
  event.preventDefault();
12951
12903
  if (!formData.workflowStepId || !formData.hierarchyNodeId)
12952
- return Swal16.fire(
12904
+ return Swal18.fire(
12953
12905
  "Required fields",
12954
12906
  "Please select a workflow step and hierarchy node.",
12955
12907
  "warning"
@@ -12974,7 +12926,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12974
12926
  updatedBy: "System"
12975
12927
  } : { createdBy: "System" });
12976
12928
  await getApiService()[editingMapping ? "put" : "post"](endpoint, payload);
12977
- await Swal16.fire(
12929
+ await Swal18.fire(
12978
12930
  "Success",
12979
12931
  `Workflow step hierarchy mapping ${editingMapping ? "updated" : "created"} successfully.`,
12980
12932
  "success"
@@ -12982,7 +12934,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12982
12934
  setIsModalOpen(false);
12983
12935
  setRefreshKey((previous) => previous + 1);
12984
12936
  } catch (error) {
12985
- await Swal16.fire(
12937
+ await Swal18.fire(
12986
12938
  "Error",
12987
12939
  ((_c = (_b = error == null ? void 0 : error.response) == null ? void 0 : _b.data) == null ? void 0 : _c.message) || (error == null ? void 0 : error.message) || "Unable to save workflow step hierarchy mapping.",
12988
12940
  "error"
@@ -12993,7 +12945,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
12993
12945
  };
12994
12946
  const handleDelete = async (mapping) => {
12995
12947
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
12996
- const confirmation = await Swal16.fire({
12948
+ const confirmation = await Swal18.fire({
12997
12949
  title: "Delete mapping?",
12998
12950
  text: "This mapping will be marked inactive.",
12999
12951
  icon: "warning",
@@ -13023,14 +12975,14 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13023
12975
  isActive: false,
13024
12976
  updatedBy: "System"
13025
12977
  });
13026
- await Swal16.fire(
12978
+ await Swal18.fire(
13027
12979
  "Deleted",
13028
12980
  "Workflow step hierarchy mapping has been deactivated.",
13029
12981
  "success"
13030
12982
  );
13031
12983
  setRefreshKey((previous) => previous + 1);
13032
12984
  } catch (error) {
13033
- await Swal16.fire(
12985
+ await Swal18.fire(
13034
12986
  "Error",
13035
12987
  ((_i = (_h = error == null ? void 0 : error.response) == null ? void 0 : _h.data) == null ? void 0 : _i.message) || (error == null ? void 0 : error.message) || "Unable to delete workflow step hierarchy mapping.",
13036
12988
  "error"
@@ -13337,7 +13289,7 @@ function Workflow_Step_Hierarchy_Mapping_Main() {
13337
13289
  }
13338
13290
 
13339
13291
  // src/components/Sidebar.jsx
13340
- import { Fragment as Fragment8, jsx as jsx88, jsxs as jsxs87 } from "react/jsx-runtime";
13292
+ import { Fragment as Fragment6, jsx as jsx88, jsxs as jsxs87 } from "react/jsx-runtime";
13341
13293
  var workflowItems = [
13342
13294
  // Menu Name testing // component or page-Use function name
13343
13295
  {
@@ -13398,13 +13350,13 @@ var documentItems = [{
13398
13350
  icon: RiFileSettingsLine
13399
13351
  }];
13400
13352
  var fileItems = [{
13401
- name: "File Instance",
13402
- component: "FileInstanceMain",
13403
- icon: RiFileList3Line
13404
- }, {
13405
13353
  name: "Business Entity",
13406
13354
  component: "BusinessEntitymain",
13407
13355
  icon: RiFileList3Line
13356
+ }, {
13357
+ name: "File Instance",
13358
+ component: "FileInstanceMain",
13359
+ icon: RiFileList3Line
13408
13360
  }, {
13409
13361
  name: "File Pool",
13410
13362
  component: "FilePoolMain",
@@ -13535,7 +13487,7 @@ function Sidebar({
13535
13487
  open && /* @__PURE__ */ jsx88("div", { className: "fc:ml-[2px] fc:border-l fc:border-[#E5E9F1] fc:pl-[2px]", children: items.map(renderMenuItem) })
13536
13488
  ] });
13537
13489
  };
13538
- return /* @__PURE__ */ jsxs87(Fragment8, { children: [
13490
+ return /* @__PURE__ */ jsxs87(Fragment6, { children: [
13539
13491
  /* @__PURE__ */ jsxs87("aside", { className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`, children: [
13540
13492
  /* @__PURE__ */ jsxs87("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
13541
13493
  /* @__PURE__ */ jsxs87("div", { className: "fc:flex fc:items-center fc:gap-2", children: [