flowcore-fn 10.1.2 → 10.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pkg-index.js CHANGED
@@ -4217,7 +4217,7 @@ function EditUserHierarchyNodeMappingModal({
4217
4217
  return new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0)).toISOString();
4218
4218
  };
4219
4219
  const handleSubmit = async (event) => {
4220
- var _a, _b, _c;
4220
+ var _a, _b, _c, _d, _e;
4221
4221
  event.preventDefault();
4222
4222
  if (!formData.workflowStepId) {
4223
4223
  alert("Please select a workflow step.");
@@ -4225,15 +4225,15 @@ function EditUserHierarchyNodeMappingModal({
4225
4225
  }
4226
4226
  if (onSave) {
4227
4227
  const success = await onSave({
4228
- mappingId: Number((_a = selectedMapping.mappingId) != null ? _a : selectedMapping.id),
4228
+ workflowStepUserMappingId: Number(
4229
+ (_c = (_b = (_a = selectedMapping.workflowStepUserMappingId) != null ? _a : selectedMapping.WorkFlowStepUserMappingId) != null ? _b : selectedMapping.mappingId) != null ? _c : selectedMapping.id
4230
+ ),
4229
4231
  externalUserId: Number(selectedMapping.externalUserId),
4230
4232
  workflowStepId: Number(formData.workflowStepId),
4231
- hierarchyNodeId: Number(formData.hierarchyNodeId),
4232
- roleCode: formData.roleCode,
4233
4233
  isPrimary: formData.isPrimary === "true",
4234
4234
  effectiveFrom: toApiDateTime(formData.effectiveFrom),
4235
4235
  effectiveTo: toApiDateTime(formData.effectiveTo),
4236
- isActive: (_c = (_b = selectedMapping.isActive) != null ? _b : selectedMapping.status) != null ? _c : true,
4236
+ isActive: (_e = (_d = selectedMapping.isActive) != null ? _d : selectedMapping.status) != null ? _e : true,
4237
4237
  updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
4238
4238
  });
4239
4239
  if (success) onClose();
@@ -4466,6 +4466,17 @@ function DeleteUserHierarchyNodeMappingModal({
4466
4466
 
4467
4467
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
4468
4468
  var import_jsx_runtime26 = require("react/jsx-runtime");
4469
+ var formatDateOnly = (value) => {
4470
+ if (!value) return "-";
4471
+ const date = new Date(value);
4472
+ if (Number.isNaN(date.getTime())) {
4473
+ return String(value).split("T")[0] || "-";
4474
+ }
4475
+ const year = date.getUTCFullYear();
4476
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
4477
+ const day = String(date.getUTCDate()).padStart(2, "0");
4478
+ return `${year}-${month}-${day}`;
4479
+ };
4469
4480
  function UserHierarchyNodeMappingTable({
4470
4481
  apiData,
4471
4482
  pageSize,
@@ -4575,8 +4586,8 @@ function UserHierarchyNodeMappingTable({
4575
4586
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.hierarchyNodeId }),
4576
4587
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.roleCode }),
4577
4588
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: `fc:px-2 fc:py-0.5 fc:text-xs fc:font-semibold fc:rounded${item.isPrimary ? "bg-emerald-50 text-emerald-600 border border-emerald-200" : "bg-rose-50 text-rose-600 border border-rose-200"}`, children: item.isPrimary ? "\u2713 Yes" : "\u2715 No" }) }),
4578
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveFrom }),
4579
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveTo }),
4589
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: formatDateOnly(item.effectiveFrom) }),
4590
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: formatDateOnly(item.effectiveTo) }),
4580
4591
  /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("button", { onClick: () => {
4581
4592
  var _a2;
4582
4593
  return toggleStatus((_a2 = item.mappingId) != null ? _a2 : item.id);
@@ -4655,16 +4666,28 @@ function User_hierarchy_mapping_main() {
4655
4666
  setCurrentPage(1);
4656
4667
  };
4657
4668
  const saveMapping = async (payload, isEdit = false) => {
4658
- var _a, _b, _c, _d, _e;
4669
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4659
4670
  try {
4660
4671
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
4661
4672
  if (!endpoint) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
4662
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
4673
+ const requestPayload = isEdit ? {
4674
+ workflowStepUserMappingId: Number(
4675
+ (_f = (_e = (_d = payload.workflowStepUserMappingId) != null ? _d : payload.WorkFlowStepUserMappingId) != null ? _e : payload.mappingId) != null ? _f : payload.id
4676
+ ),
4677
+ externalUserId: Number(payload.externalUserId),
4678
+ workflowStepId: Number(payload.workflowStepId),
4679
+ isPrimary: Boolean(payload.isPrimary),
4680
+ effectiveFrom: payload.effectiveFrom,
4681
+ effectiveTo: payload.effectiveTo || null,
4682
+ isActive: (_g = payload.isActive) != null ? _g : true,
4683
+ updatedBy: payload.updatedBy || "System"
4684
+ } : payload;
4685
+ await getApiService()[isEdit ? "put" : "post"](endpoint, requestPayload);
4663
4686
  await import_sweetalert210.default.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
4664
4687
  handleRefresh();
4665
4688
  return true;
4666
4689
  } catch (error) {
4667
- await import_sweetalert210.default.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
4690
+ await import_sweetalert210.default.fire("Error", ((_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 ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
4668
4691
  return false;
4669
4692
  }
4670
4693
  };
@@ -4081,7 +4081,7 @@ function EditUserHierarchyNodeMappingModal({
4081
4081
  return new Date(Date.UTC(year, month - 1, day, 0, 0, 0, 0)).toISOString();
4082
4082
  };
4083
4083
  const handleSubmit = async (event) => {
4084
- var _a, _b, _c;
4084
+ var _a, _b, _c, _d, _e;
4085
4085
  event.preventDefault();
4086
4086
  if (!formData.workflowStepId) {
4087
4087
  alert("Please select a workflow step.");
@@ -4089,15 +4089,15 @@ function EditUserHierarchyNodeMappingModal({
4089
4089
  }
4090
4090
  if (onSave) {
4091
4091
  const success = await onSave({
4092
- mappingId: Number((_a = selectedMapping.mappingId) != null ? _a : selectedMapping.id),
4092
+ workflowStepUserMappingId: Number(
4093
+ (_c = (_b = (_a = selectedMapping.workflowStepUserMappingId) != null ? _a : selectedMapping.WorkFlowStepUserMappingId) != null ? _b : selectedMapping.mappingId) != null ? _c : selectedMapping.id
4094
+ ),
4093
4095
  externalUserId: Number(selectedMapping.externalUserId),
4094
4096
  workflowStepId: Number(formData.workflowStepId),
4095
- hierarchyNodeId: Number(formData.hierarchyNodeId),
4096
- roleCode: formData.roleCode,
4097
4097
  isPrimary: formData.isPrimary === "true",
4098
4098
  effectiveFrom: toApiDateTime(formData.effectiveFrom),
4099
4099
  effectiveTo: toApiDateTime(formData.effectiveTo),
4100
- isActive: (_c = (_b = selectedMapping.isActive) != null ? _b : selectedMapping.status) != null ? _c : true,
4100
+ isActive: (_e = (_d = selectedMapping.isActive) != null ? _d : selectedMapping.status) != null ? _e : true,
4101
4101
  updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
4102
4102
  });
4103
4103
  if (success) onClose();
@@ -4330,6 +4330,17 @@ function DeleteUserHierarchyNodeMappingModal({
4330
4330
 
4331
4331
  // src/components/user-hierarchy-node-mapping/userhierarchynodetable.jsx
4332
4332
  import { jsx as jsx26, jsxs as jsxs25 } from "react/jsx-runtime";
4333
+ var formatDateOnly = (value) => {
4334
+ if (!value) return "-";
4335
+ const date = new Date(value);
4336
+ if (Number.isNaN(date.getTime())) {
4337
+ return String(value).split("T")[0] || "-";
4338
+ }
4339
+ const year = date.getUTCFullYear();
4340
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
4341
+ const day = String(date.getUTCDate()).padStart(2, "0");
4342
+ return `${year}-${month}-${day}`;
4343
+ };
4333
4344
  function UserHierarchyNodeMappingTable({
4334
4345
  apiData,
4335
4346
  pageSize,
@@ -4439,8 +4450,8 @@ function UserHierarchyNodeMappingTable({
4439
4450
  /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.hierarchyNodeId }),
4440
4451
  /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-slate-600 fc:whitespace-nowrap", children: item.roleCode }),
4441
4452
  /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx26("span", { className: `fc:px-2 fc:py-0.5 fc:text-xs fc:font-semibold fc:rounded${item.isPrimary ? "bg-emerald-50 text-emerald-600 border border-emerald-200" : "bg-rose-50 text-rose-600 border border-rose-200"}`, children: item.isPrimary ? "\u2713 Yes" : "\u2715 No" }) }),
4442
- /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveFrom }),
4443
- /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: item.effectiveTo }),
4453
+ /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: formatDateOnly(item.effectiveFrom) }),
4454
+ /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: formatDateOnly(item.effectiveTo) }),
4444
4455
  /* @__PURE__ */ jsx26("td", { className: "fc:py-4 fc:px-5 fc:text-center fc:whitespace-nowrap", children: /* @__PURE__ */ jsx26("button", { onClick: () => {
4445
4456
  var _a2;
4446
4457
  return toggleStatus((_a2 = item.mappingId) != null ? _a2 : item.id);
@@ -4519,16 +4530,28 @@ function User_hierarchy_mapping_main() {
4519
4530
  setCurrentPage(1);
4520
4531
  };
4521
4532
  const saveMapping = async (payload, isEdit = false) => {
4522
- var _a, _b, _c, _d, _e;
4533
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
4523
4534
  try {
4524
4535
  const endpoint = (_c = (_b = (_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) == null ? void 0 : _b.WorkflowStepUserMapping) == null ? void 0 : _c[isEdit ? "update" : "create"];
4525
4536
  if (!endpoint) throw new Error(`Workflow Step Hierarchy Mapping ${isEdit ? "update" : "create"} endpoint is not configured.`);
4526
- await getApiService()[isEdit ? "put" : "post"](endpoint, payload);
4537
+ const requestPayload = isEdit ? {
4538
+ workflowStepUserMappingId: Number(
4539
+ (_f = (_e = (_d = payload.workflowStepUserMappingId) != null ? _d : payload.WorkFlowStepUserMappingId) != null ? _e : payload.mappingId) != null ? _f : payload.id
4540
+ ),
4541
+ externalUserId: Number(payload.externalUserId),
4542
+ workflowStepId: Number(payload.workflowStepId),
4543
+ isPrimary: Boolean(payload.isPrimary),
4544
+ effectiveFrom: payload.effectiveFrom,
4545
+ effectiveTo: payload.effectiveTo || null,
4546
+ isActive: (_g = payload.isActive) != null ? _g : true,
4547
+ updatedBy: payload.updatedBy || "System"
4548
+ } : payload;
4549
+ await getApiService()[isEdit ? "put" : "post"](endpoint, requestPayload);
4527
4550
  await Swal10.fire("Success", `Workflow Step Hierarchy Mapping ${isEdit ? "updated" : "created"} successfully.`, "success");
4528
4551
  handleRefresh();
4529
4552
  return true;
4530
4553
  } catch (error) {
4531
- await Swal10.fire("Error", ((_e = (_d = error == null ? void 0 : error.response) == null ? void 0 : _d.data) == null ? void 0 : _e.message) || (error == null ? void 0 : error.message) || `Unable to ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
4554
+ await Swal10.fire("Error", ((_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 ${isEdit ? "update" : "create"} Workflow Step Hierarchy Mapping.`, "error");
4532
4555
  return false;
4533
4556
  }
4534
4557
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "10.1.2",
3
+ "version": "10.1.3",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [