flowcore-fn 10.1.8 → 10.1.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.css +6 -0
- package/dist/pkg-index.js +211 -124
- package/dist/pkg-index.mjs +211 -124
- package/package.json +1 -1
package/dist/pkg-index.css
CHANGED
|
@@ -1019,6 +1019,12 @@
|
|
|
1019
1019
|
margin-block-start: calc(calc(var(--fc-spacing) * 8) * var(--tw-space-y-reverse));
|
|
1020
1020
|
margin-block-end: calc(calc(var(--fc-spacing) * 8) * calc(1 - var(--tw-space-y-reverse)));
|
|
1021
1021
|
}
|
|
1022
|
+
.fc\:gap-x-3 {
|
|
1023
|
+
column-gap: calc(var(--fc-spacing) * 3);
|
|
1024
|
+
}
|
|
1025
|
+
.fc\:gap-y-0\.5 {
|
|
1026
|
+
row-gap: calc(var(--fc-spacing) * 0.5);
|
|
1027
|
+
}
|
|
1022
1028
|
:where(.fc\:divide-y > :not(:last-child)) {
|
|
1023
1029
|
--tw-divide-y-reverse: 0;
|
|
1024
1030
|
border-bottom-style: var(--tw-border-style);
|
package/dist/pkg-index.js
CHANGED
|
@@ -4817,25 +4817,27 @@ var getRows2 = (result) => {
|
|
|
4817
4817
|
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;
|
|
4818
4818
|
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
4819
4819
|
};
|
|
4820
|
+
var toApiDateTime = (value) => {
|
|
4821
|
+
if (!value) return null;
|
|
4822
|
+
if (value.includes("T")) {
|
|
4823
|
+
const parsed = new Date(value);
|
|
4824
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
4825
|
+
}
|
|
4826
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
4827
|
+
if (!year || !month || !day) return null;
|
|
4828
|
+
return new Date(Date.UTC(year, month - 1, day)).toISOString();
|
|
4829
|
+
};
|
|
4830
|
+
var getUserValues = (user) => (user == null ? void 0 : user.values) && typeof user.values === "object" ? user.values : user || {};
|
|
4820
4831
|
var getUserId = (user) => {
|
|
4821
|
-
var _a, _b, _c, _d, _e;
|
|
4822
|
-
return (
|
|
4832
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
4833
|
+
return (_k = (_i = (_g = (_e = (_c = (_a = getUserValues(user)) == null ? void 0 : _a.externalUserId) != null ? _c : (_b = getUserValues(user)) == null ? void 0 : _b.ExternalUserId) != null ? _e : (_d = getUserValues(user)) == null ? void 0 : _d.userId) != null ? _g : (_f = getUserValues(user)) == null ? void 0 : _f.UserId) != null ? _i : (_h = getUserValues(user)) == null ? void 0 : _h.id) != null ? _k : (_j = getUserValues(user)) == null ? void 0 : _j.Id;
|
|
4823
4834
|
};
|
|
4824
4835
|
var getUserName = (user) => {
|
|
4825
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4826
|
-
return (
|
|
4836
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4837
|
+
return (_m = (_k = (_i = (_g = (_e = (_c = (_a = getUserValues(user)) == null ? void 0 : _a.userName) != null ? _c : (_b = getUserValues(user)) == null ? void 0 : _b.UserName) != null ? _e : (_d = getUserValues(user)) == null ? void 0 : _d.externalUserName) != null ? _g : (_f = getUserValues(user)) == null ? void 0 : _f.ExternalUserName) != null ? _i : (_h = getUserValues(user)) == null ? void 0 : _h.name) != null ? _k : (_j = getUserValues(user)) == null ? void 0 : _j.Name) != null ? _m : `User ${(_l = getUserId(user)) != null ? _l : ""}`;
|
|
4827
4838
|
};
|
|
4828
|
-
var dummyUnmappedUsers = [
|
|
4829
|
-
|
|
4830
|
-
{ externalUserId: 9002, externalUserName: "Demo Unmapped User 2" }
|
|
4831
|
-
];
|
|
4832
|
-
var dummyMappedUsers = [
|
|
4833
|
-
{
|
|
4834
|
-
externalUserId: 9010,
|
|
4835
|
-
externalUserName: "Demo Mapped User 1",
|
|
4836
|
-
workflowStepUserMappingId: 1
|
|
4837
|
-
}
|
|
4838
|
-
];
|
|
4839
|
+
var dummyUnmappedUsers = [];
|
|
4840
|
+
var dummyMappedUsers = [];
|
|
4839
4841
|
var fieldStyle = {
|
|
4840
4842
|
border: "1px solid #cbd5e1",
|
|
4841
4843
|
backgroundColor: "#ffffff",
|
|
@@ -4850,49 +4852,61 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4850
4852
|
effectiveTo: ""
|
|
4851
4853
|
});
|
|
4852
4854
|
const [hierarchySelection, setHierarchySelection] = (0, import_react24.useState)(emptySelection);
|
|
4855
|
+
const [workflows, setWorkflows] = (0, import_react24.useState)([]);
|
|
4853
4856
|
const [workflowSteps, setWorkflowSteps] = (0, import_react24.useState)([]);
|
|
4854
4857
|
const [unmappedUsers, setUnmappedUsers] = (0, import_react24.useState)([]);
|
|
4855
4858
|
const [mappedUsers, setMappedUsers] = (0, import_react24.useState)([]);
|
|
4856
4859
|
const [isLoadingWorkflowSteps, setIsLoadingWorkflowSteps] = (0, import_react24.useState)(false);
|
|
4860
|
+
const [isLoadingWorkflows, setIsLoadingWorkflows] = (0, import_react24.useState)(false);
|
|
4857
4861
|
const [isFetching, setIsFetching] = (0, import_react24.useState)(false);
|
|
4858
4862
|
const [busyUserId, setBusyUserId] = (0, import_react24.useState)(null);
|
|
4863
|
+
const [selectedUnmappedIds, setSelectedUnmappedIds] = (0, import_react24.useState)([]);
|
|
4864
|
+
const [selectedMappedIds, setSelectedMappedIds] = (0, import_react24.useState)([]);
|
|
4859
4865
|
const [hasFetched, setHasFetched] = (0, import_react24.useState)(false);
|
|
4860
4866
|
const mappingEndpoints = () => {
|
|
4861
4867
|
var _a;
|
|
4862
4868
|
const flowCore = ((_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) || {};
|
|
4863
|
-
const mapping = flowCore.
|
|
4869
|
+
const mapping = flowCore.mapping || {};
|
|
4864
4870
|
return {
|
|
4865
|
-
create: mapping.
|
|
4866
|
-
update: mapping.
|
|
4867
|
-
unmapped: mapping.
|
|
4868
|
-
mapped: mapping.
|
|
4871
|
+
create: mapping.map || mapping.Map,
|
|
4872
|
+
update: mapping.unmap || mapping.Unmap,
|
|
4873
|
+
unmapped: mapping.GetUnMappedExternalUserList,
|
|
4874
|
+
mapped: mapping.GetMappedExternalUserList
|
|
4869
4875
|
};
|
|
4870
4876
|
};
|
|
4871
4877
|
(0, import_react24.useEffect)(() => {
|
|
4872
4878
|
if (!isOpen) return;
|
|
4873
|
-
const
|
|
4874
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4879
|
+
const loadLookups = async () => {
|
|
4880
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4875
4881
|
setIsLoadingWorkflowSteps(true);
|
|
4882
|
+
setIsLoadingWorkflows(true);
|
|
4876
4883
|
try {
|
|
4877
4884
|
const flowCore = ((_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) || {};
|
|
4878
|
-
const
|
|
4879
|
-
const
|
|
4880
|
-
|
|
4885
|
+
const workflowEndpoint = ((_b = flowCore.workflow) == null ? void 0 : _b.getList) || ((_c = flowCore.WorkFlow) == null ? void 0 : _c.getList) || ((_d = flowCore.workFlow) == null ? void 0 : _d.getList);
|
|
4886
|
+
const workflowStepEndpoint = ((_e = flowCore.workflowStep) == null ? void 0 : _e.getList) || ((_f = flowCore.WorkFlowStep) == null ? void 0 : _f.getList) || ((_g = flowCore.workFlowStep) == null ? void 0 : _g.getList);
|
|
4887
|
+
const [workflowResult, workflowStepResult] = await Promise.all([
|
|
4888
|
+
workflowEndpoint ? getApiService().get(workflowEndpoint) : null,
|
|
4889
|
+
workflowStepEndpoint ? getApiService().get(workflowStepEndpoint) : null
|
|
4890
|
+
]);
|
|
4891
|
+
setWorkflows(workflowResult ? getRows2(workflowResult) : []);
|
|
4892
|
+
setWorkflowSteps(workflowStepResult ? getRows2(workflowStepResult) : []);
|
|
4881
4893
|
} catch (error) {
|
|
4882
4894
|
await import_sweetalert210.default.fire(
|
|
4883
4895
|
"Error",
|
|
4884
|
-
((
|
|
4896
|
+
((_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 load workflow steps.",
|
|
4885
4897
|
"error"
|
|
4886
4898
|
);
|
|
4887
4899
|
} finally {
|
|
4888
4900
|
setIsLoadingWorkflowSteps(false);
|
|
4901
|
+
setIsLoadingWorkflows(false);
|
|
4889
4902
|
}
|
|
4890
4903
|
};
|
|
4891
|
-
|
|
4904
|
+
loadLookups();
|
|
4892
4905
|
}, [isOpen]);
|
|
4893
4906
|
(0, import_react24.useEffect)(() => {
|
|
4894
4907
|
if (isOpen) return;
|
|
4895
4908
|
setFormData({
|
|
4909
|
+
workflowId: "",
|
|
4896
4910
|
workflowStepId: "",
|
|
4897
4911
|
roleCode: "",
|
|
4898
4912
|
isPrimary: "",
|
|
@@ -4902,19 +4916,28 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4902
4916
|
setHierarchySelection(emptySelection);
|
|
4903
4917
|
setUnmappedUsers([]);
|
|
4904
4918
|
setMappedUsers([]);
|
|
4919
|
+
setSelectedUnmappedIds([]);
|
|
4920
|
+
setSelectedMappedIds([]);
|
|
4905
4921
|
setHasFetched(false);
|
|
4906
4922
|
}, [isOpen]);
|
|
4907
|
-
const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), {
|
|
4923
|
+
const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues(__spreadValues({}, previous), event.target.name === "workflowId" ? { workflowStepId: "" } : {}), {
|
|
4908
4924
|
[event.target.name]: event.target.value
|
|
4909
4925
|
}));
|
|
4926
|
+
const selectedWorkflowId = Number(formData.workflowId);
|
|
4927
|
+
const filteredWorkflowSteps = workflowSteps.filter((step) => {
|
|
4928
|
+
var _a;
|
|
4929
|
+
const stepWorkflowId = Number((_a = step.workflowId) != null ? _a : step.WorkflowId);
|
|
4930
|
+
return selectedWorkflowId && stepWorkflowId === selectedWorkflowId;
|
|
4931
|
+
});
|
|
4910
4932
|
const getQueryParams = () => ({
|
|
4911
4933
|
hierarchyNodeId: Number(hierarchySelection.finalNodeId),
|
|
4912
4934
|
hierarchyLevel: Number(hierarchySelection.selectedLevelId),
|
|
4935
|
+
workflowId: Number(formData.workflowId),
|
|
4913
4936
|
workflowStepId: Number(formData.workflowStepId)
|
|
4914
4937
|
});
|
|
4915
4938
|
const fetchUsers = async () => {
|
|
4916
4939
|
const params = getQueryParams();
|
|
4917
|
-
if (!params.workflowStepId || !params.hierarchyNodeId || !params.hierarchyLevel) {
|
|
4940
|
+
if (!params.workflowId || !params.workflowStepId || !params.hierarchyNodeId || !params.hierarchyLevel) {
|
|
4918
4941
|
await import_sweetalert210.default.fire(
|
|
4919
4942
|
"Required fields",
|
|
4920
4943
|
"Please select workflow step and final hierarchy node first.",
|
|
@@ -4925,53 +4948,62 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4925
4948
|
setIsFetching(true);
|
|
4926
4949
|
try {
|
|
4927
4950
|
const endpoints = mappingEndpoints();
|
|
4928
|
-
const [unmappedResult, mappedResult] = await Promise.
|
|
4929
|
-
getApiService().
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4951
|
+
const [unmappedResult, mappedResult] = await Promise.allSettled([
|
|
4952
|
+
getApiService().post(endpoints.unmapped, {
|
|
4953
|
+
hierarchyNodeId: params.hierarchyNodeId,
|
|
4954
|
+
hierarchyLevel: params.hierarchyLevel,
|
|
4955
|
+
workflowId: params.workflowId,
|
|
4956
|
+
workflowStepId: params.workflowStepId
|
|
4934
4957
|
}),
|
|
4935
|
-
getApiService().
|
|
4958
|
+
getApiService().post(endpoints.mapped, {
|
|
4959
|
+
hierarchyNodeId: params.hierarchyNodeId,
|
|
4960
|
+
hierarchyLevel: params.hierarchyLevel,
|
|
4961
|
+
workflowStepId: params.workflowStepId
|
|
4962
|
+
})
|
|
4936
4963
|
]);
|
|
4937
|
-
const unmappedRows = getRows2(unmappedResult);
|
|
4938
|
-
const mappedRows = getRows2(mappedResult);
|
|
4964
|
+
const unmappedRows = unmappedResult.status === "fulfilled" ? getRows2(unmappedResult.value) : [];
|
|
4965
|
+
const mappedRows = mappedResult.status === "fulfilled" ? getRows2(mappedResult.value) : [];
|
|
4939
4966
|
setUnmappedUsers(unmappedRows.length ? unmappedRows : dummyUnmappedUsers);
|
|
4940
4967
|
setMappedUsers(mappedRows.length ? mappedRows : dummyMappedUsers);
|
|
4968
|
+
setSelectedUnmappedIds([]);
|
|
4969
|
+
setSelectedMappedIds([]);
|
|
4941
4970
|
setHasFetched(true);
|
|
4942
|
-
} catch (
|
|
4943
|
-
console.warn(
|
|
4944
|
-
"Unable to fetch mapped users. Showing temporary demo data.",
|
|
4945
|
-
error
|
|
4946
|
-
);
|
|
4971
|
+
} catch (e) {
|
|
4947
4972
|
setUnmappedUsers(dummyUnmappedUsers);
|
|
4948
4973
|
setMappedUsers(dummyMappedUsers);
|
|
4974
|
+
setSelectedUnmappedIds([]);
|
|
4975
|
+
setSelectedMappedIds([]);
|
|
4949
4976
|
setHasFetched(true);
|
|
4950
4977
|
} finally {
|
|
4951
4978
|
setIsFetching(false);
|
|
4952
4979
|
}
|
|
4953
4980
|
};
|
|
4954
|
-
const
|
|
4981
|
+
const updateSelectedUsers = (setUserIds, userId, checked) => {
|
|
4982
|
+
const normalizedId = String(userId);
|
|
4983
|
+
setUserIds(
|
|
4984
|
+
(previous) => checked ? [.../* @__PURE__ */ new Set([...previous, normalizedId])] : previous.filter((id) => id !== normalizedId)
|
|
4985
|
+
);
|
|
4986
|
+
};
|
|
4987
|
+
const mapUsers = async (users = selectedUnmappedIds) => {
|
|
4955
4988
|
var _a, _b;
|
|
4956
|
-
const
|
|
4957
|
-
if (!
|
|
4958
|
-
setBusyUserId(
|
|
4989
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
4990
|
+
if (!externalUserIds.length) return;
|
|
4991
|
+
setBusyUserId("map");
|
|
4959
4992
|
try {
|
|
4960
4993
|
const endpoint2 = mappingEndpoints().create;
|
|
4961
4994
|
if (!endpoint2)
|
|
4962
4995
|
throw new Error(
|
|
4963
|
-
"
|
|
4996
|
+
"External user map endpoint is not configured."
|
|
4964
4997
|
);
|
|
4965
4998
|
await getApiService().post(endpoint2, {
|
|
4966
|
-
externalUserId,
|
|
4967
4999
|
workflowStepId: Number(formData.workflowStepId),
|
|
4968
|
-
|
|
4969
|
-
roleCode: formData.roleCode,
|
|
5000
|
+
externalUserIds,
|
|
4970
5001
|
isPrimary: formData.isPrimary === "true",
|
|
4971
|
-
effectiveFrom: formData.effectiveFrom
|
|
4972
|
-
effectiveTo: formData.effectiveTo
|
|
5002
|
+
effectiveFrom: toApiDateTime(formData.effectiveFrom),
|
|
5003
|
+
effectiveTo: toApiDateTime(formData.effectiveTo),
|
|
4973
5004
|
createdBy: "System"
|
|
4974
5005
|
});
|
|
5006
|
+
setSelectedUnmappedIds([]);
|
|
4975
5007
|
await fetchUsers();
|
|
4976
5008
|
} catch (error) {
|
|
4977
5009
|
await import_sweetalert210.default.fire(
|
|
@@ -4983,35 +5015,28 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4983
5015
|
setBusyUserId(null);
|
|
4984
5016
|
}
|
|
4985
5017
|
};
|
|
4986
|
-
const
|
|
4987
|
-
var _a, _b
|
|
4988
|
-
const
|
|
4989
|
-
if (!
|
|
4990
|
-
setBusyUserId(
|
|
5018
|
+
const unmapUsers = async (users = selectedMappedIds) => {
|
|
5019
|
+
var _a, _b;
|
|
5020
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
5021
|
+
if (!externalUserIds.length) return;
|
|
5022
|
+
setBusyUserId("unmap");
|
|
4991
5023
|
try {
|
|
4992
5024
|
const endpoint2 = mappingEndpoints().update;
|
|
4993
5025
|
if (!endpoint2)
|
|
4994
5026
|
throw new Error(
|
|
4995
|
-
"
|
|
5027
|
+
"External user unmap endpoint is not configured."
|
|
4996
5028
|
);
|
|
4997
|
-
await getApiService().
|
|
4998
|
-
workflowStepUserMappingId: Number(
|
|
4999
|
-
(_c = (_b = (_a = user.workflowStepUserMappingId) != null ? _a : user.WorkFlowStepUserMappingId) != null ? _b : user.mappingId) != null ? _c : user.id
|
|
5000
|
-
),
|
|
5001
|
-
externalUserId,
|
|
5029
|
+
await getApiService().post(endpoint2, {
|
|
5002
5030
|
workflowStepId: Number(formData.workflowStepId),
|
|
5003
|
-
|
|
5004
|
-
isPrimary: Boolean((_d = user.isPrimary) != null ? _d : user.IsPrimary),
|
|
5005
|
-
effectiveFrom: (_f = (_e = user.effectiveFrom) != null ? _e : user.EffectiveFrom) != null ? _f : null,
|
|
5006
|
-
effectiveTo: (_h = (_g = user.effectiveTo) != null ? _g : user.EffectiveTo) != null ? _h : null,
|
|
5007
|
-
isActive: false,
|
|
5031
|
+
externalUserIds,
|
|
5008
5032
|
updatedBy: "System"
|
|
5009
5033
|
});
|
|
5034
|
+
setSelectedMappedIds([]);
|
|
5010
5035
|
await fetchUsers();
|
|
5011
5036
|
} catch (error) {
|
|
5012
5037
|
await import_sweetalert210.default.fire(
|
|
5013
5038
|
"Error",
|
|
5014
|
-
((
|
|
5039
|
+
((_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 unmap user.",
|
|
5015
5040
|
"error"
|
|
5016
5041
|
);
|
|
5017
5042
|
} finally {
|
|
@@ -5019,27 +5044,48 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5019
5044
|
}
|
|
5020
5045
|
};
|
|
5021
5046
|
const renderUser = (user, mapped) => {
|
|
5022
|
-
const userId =
|
|
5047
|
+
const userId = getUserId(user);
|
|
5048
|
+
const userValues = getUserValues(user);
|
|
5049
|
+
const normalizedUserId = String(userId);
|
|
5050
|
+
const isSelected = (mapped ? selectedMappedIds : selectedUnmappedIds).includes(
|
|
5051
|
+
normalizedUserId
|
|
5052
|
+
);
|
|
5023
5053
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5024
5054
|
"div",
|
|
5025
5055
|
{
|
|
5026
5056
|
className: "fc:flex fc:items-center fc:justify-between fc:gap-3 fc:border-b fc:border-slate-100 fc:px-3 fc:py-2 last:fc:border-0",
|
|
5027
5057
|
children: [
|
|
5058
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5059
|
+
"input",
|
|
5060
|
+
{
|
|
5061
|
+
type: "checkbox",
|
|
5062
|
+
checked: isSelected,
|
|
5063
|
+
onChange: (event) => updateSelectedUsers(
|
|
5064
|
+
mapped ? setSelectedMappedIds : setSelectedUnmappedIds,
|
|
5065
|
+
userId,
|
|
5066
|
+
event.target.checked
|
|
5067
|
+
),
|
|
5068
|
+
className: "fc:shrink-0"
|
|
5069
|
+
}
|
|
5070
|
+
),
|
|
5028
5071
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:min-w-0", children: [
|
|
5029
5072
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fc:truncate fc:text-xs fc:font-semibold fc:text-slate-700", children: getUserName(user) }),
|
|
5030
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:text-[10px] fc:text-slate-
|
|
5031
|
-
"
|
|
5032
|
-
|
|
5033
|
-
|
|
5073
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fc:mt-1 fc:grid fc:grid-cols-2 fc:gap-x-3 fc:gap-y-0.5", children: Object.entries(userValues).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:min-w-0 fc:text-[10px] fc:text-slate-500", children: [
|
|
5074
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "fc:font-semibold fc:text-slate-600", children: [
|
|
5075
|
+
key,
|
|
5076
|
+
": "
|
|
5077
|
+
] }),
|
|
5078
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "fc:break-words", children: value === null || value === void 0 ? "-" : typeof value === "object" ? JSON.stringify(value) : String(value) })
|
|
5079
|
+
] }, key)) })
|
|
5034
5080
|
] }),
|
|
5035
5081
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5036
5082
|
"button",
|
|
5037
5083
|
{
|
|
5038
5084
|
type: "button",
|
|
5039
|
-
disabled: busyUserId
|
|
5040
|
-
onClick: () => mapped ?
|
|
5085
|
+
disabled: busyUserId !== null,
|
|
5086
|
+
onClick: () => mapped ? unmapUsers([userId]) : mapUsers([userId]),
|
|
5041
5087
|
className: `fc:shrink-0 fc:rounded-lg fc:px-2.5 fc:py-1 fc:text-[10px] fc:font-semibold disabled:fc:opacity-50 ${mapped ? "fc:bg-rose-50 fc:text-rose-600" : "fc:bg-emerald-50 fc:text-emerald-700"}`,
|
|
5042
|
-
children: busyUserId
|
|
5088
|
+
children: busyUserId !== null ? "..." : mapped ? "Unmap" : "Map"
|
|
5043
5089
|
}
|
|
5044
5090
|
)
|
|
5045
5091
|
]
|
|
@@ -5086,62 +5132,57 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5086
5132
|
"div",
|
|
5087
5133
|
{
|
|
5088
5134
|
className: "fc:grid fc:items-end fc:gap-3",
|
|
5089
|
-
style: { gridTemplateColumns: "repeat(
|
|
5135
|
+
style: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" },
|
|
5090
5136
|
children: [
|
|
5091
5137
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
5092
|
-
"Workflow
|
|
5138
|
+
"Workflow",
|
|
5093
5139
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5094
5140
|
"select",
|
|
5095
5141
|
{
|
|
5096
|
-
name: "
|
|
5097
|
-
value: formData.
|
|
5142
|
+
name: "workflowId",
|
|
5143
|
+
value: formData.workflowId,
|
|
5098
5144
|
onChange: handleChange,
|
|
5099
|
-
disabled:
|
|
5145
|
+
disabled: isLoadingWorkflows,
|
|
5100
5146
|
style: fieldStyle,
|
|
5101
5147
|
className: "fc:mt-1 fc:w-full fc:rounded-lg fc:border fc:border-slate-200 fc:bg-white fc:px-2 fc:py-1.5 fc:text-xs",
|
|
5102
5148
|
children: [
|
|
5103
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select
|
|
5104
|
-
|
|
5105
|
-
var _a, _b, _c, _d, _e
|
|
5106
|
-
const id = (_b = (_a =
|
|
5107
|
-
const name = (
|
|
5149
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select workflow" }),
|
|
5150
|
+
workflows.map((workflow) => {
|
|
5151
|
+
var _a, _b, _c, _d, _e;
|
|
5152
|
+
const id = (_b = (_a = workflow.workflowId) != null ? _a : workflow.WorkflowId) != null ? _b : workflow.id;
|
|
5153
|
+
const name = (_e = (_d = (_c = workflow.workflowName) != null ? _c : workflow.WorkflowName) != null ? _d : workflow.name) != null ? _e : `Workflow ${id}`;
|
|
5108
5154
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: id, children: [
|
|
5109
5155
|
id,
|
|
5110
|
-
|
|
5156
|
+
" - ",
|
|
5157
|
+
name
|
|
5111
5158
|
] }, id);
|
|
5112
5159
|
})
|
|
5113
5160
|
]
|
|
5114
5161
|
}
|
|
5115
5162
|
)
|
|
5116
5163
|
] }),
|
|
5117
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
5118
|
-
"Role Code",
|
|
5119
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5120
|
-
"input",
|
|
5121
|
-
{
|
|
5122
|
-
name: "roleCode",
|
|
5123
|
-
value: formData.roleCode,
|
|
5124
|
-
onChange: handleChange,
|
|
5125
|
-
placeholder: "DEO / RO",
|
|
5126
|
-
style: fieldStyle,
|
|
5127
|
-
className: "fc:mt-1 fc:w-full fc:rounded-lg fc:border fc:border-slate-200 fc:px-2 fc:py-1.5 fc:text-xs"
|
|
5128
|
-
}
|
|
5129
|
-
)
|
|
5130
|
-
] }) }),
|
|
5131
5164
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
5132
|
-
"
|
|
5165
|
+
"Workflow Step",
|
|
5133
5166
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5134
5167
|
"select",
|
|
5135
5168
|
{
|
|
5136
|
-
name: "
|
|
5137
|
-
value: formData.
|
|
5169
|
+
name: "workflowStepId",
|
|
5170
|
+
value: formData.workflowStepId,
|
|
5138
5171
|
onChange: handleChange,
|
|
5172
|
+
disabled: isLoadingWorkflowSteps || !formData.workflowId,
|
|
5139
5173
|
style: fieldStyle,
|
|
5140
5174
|
className: "fc:mt-1 fc:w-full fc:rounded-lg fc:border fc:border-slate-200 fc:bg-white fc:px-2 fc:py-1.5 fc:text-xs",
|
|
5141
5175
|
children: [
|
|
5142
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select" }),
|
|
5143
|
-
|
|
5144
|
-
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select step" }),
|
|
5177
|
+
filteredWorkflowSteps.map((step) => {
|
|
5178
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5179
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5180
|
+
const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.name) != null ? _e : step.workflowStepName) != null ? _f : step.WorkflowStepName;
|
|
5181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: id, children: [
|
|
5182
|
+
id,
|
|
5183
|
+
name ? ` - ${name}` : ""
|
|
5184
|
+
] }, id);
|
|
5185
|
+
})
|
|
5145
5186
|
]
|
|
5146
5187
|
}
|
|
5147
5188
|
)
|
|
@@ -5218,8 +5259,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5218
5259
|
style: { order: 2 },
|
|
5219
5260
|
children: [
|
|
5220
5261
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("header", { className: "fc:flex fc:justify-between fc:bg-amber-50 fc:px-4 fc:py-2.5", children: [
|
|
5221
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.
|
|
5222
|
-
|
|
5262
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-amber-800", children: [
|
|
5263
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5264
|
+
"input",
|
|
5265
|
+
{
|
|
5266
|
+
type: "checkbox",
|
|
5267
|
+
checked: unmappedUsers.length > 0 && selectedUnmappedIds.length === unmappedUsers.length,
|
|
5268
|
+
onChange: (event) => setSelectedUnmappedIds(
|
|
5269
|
+
event.target.checked ? unmappedUsers.map((user) => String(getUserId(user))) : []
|
|
5270
|
+
)
|
|
5271
|
+
}
|
|
5272
|
+
),
|
|
5273
|
+
"Unmapped Users (",
|
|
5274
|
+
unmappedUsers.length,
|
|
5275
|
+
")"
|
|
5276
|
+
] }),
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5278
|
+
"button",
|
|
5279
|
+
{
|
|
5280
|
+
type: "button",
|
|
5281
|
+
disabled: !selectedUnmappedIds.length || busyUserId !== null,
|
|
5282
|
+
onClick: () => mapUsers(),
|
|
5283
|
+
className: "fc:rounded-lg fc:bg-emerald-100 fc:px-2.5 fc:py-1 fc:text-[10px] fc:font-semibold fc:text-emerald-700 disabled:fc:opacity-50",
|
|
5284
|
+
children: "Map Selected"
|
|
5285
|
+
}
|
|
5286
|
+
)
|
|
5223
5287
|
] }),
|
|
5224
5288
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fc:max-h-64 fc:overflow-y-auto", children: unmappedUsers.length ? unmappedUsers.map((user) => renderUser(user, false)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "fc:p-5 fc:text-center fc:text-sm fc:text-slate-400", children: "No unmapped users" }) })
|
|
5225
5289
|
]
|
|
@@ -5232,8 +5296,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5232
5296
|
style: { order: 1 },
|
|
5233
5297
|
children: [
|
|
5234
5298
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("header", { className: "fc:flex fc:justify-between fc:bg-emerald-50 fc:px-4 fc:py-2.5", children: [
|
|
5235
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.
|
|
5236
|
-
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-emerald-800", children: [
|
|
5300
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5301
|
+
"input",
|
|
5302
|
+
{
|
|
5303
|
+
type: "checkbox",
|
|
5304
|
+
checked: mappedUsers.length > 0 && selectedMappedIds.length === mappedUsers.length,
|
|
5305
|
+
onChange: (event) => setSelectedMappedIds(
|
|
5306
|
+
event.target.checked ? mappedUsers.map((user) => String(getUserId(user))) : []
|
|
5307
|
+
)
|
|
5308
|
+
}
|
|
5309
|
+
),
|
|
5310
|
+
"Mapped Users (",
|
|
5311
|
+
mappedUsers.length,
|
|
5312
|
+
")"
|
|
5313
|
+
] }),
|
|
5314
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5315
|
+
"button",
|
|
5316
|
+
{
|
|
5317
|
+
type: "button",
|
|
5318
|
+
disabled: !selectedMappedIds.length || busyUserId !== null,
|
|
5319
|
+
onClick: () => unmapUsers(),
|
|
5320
|
+
className: "fc:rounded-lg fc:bg-rose-100 fc:px-2.5 fc:py-1 fc:text-[10px] fc:font-semibold fc:text-rose-700 disabled:fc:opacity-50",
|
|
5321
|
+
children: "Unmap Selected"
|
|
5322
|
+
}
|
|
5323
|
+
)
|
|
5237
5324
|
] }),
|
|
5238
5325
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "fc:max-h-64 fc:overflow-y-auto", children: mappedUsers.length ? mappedUsers.map((user) => renderUser(user, true)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "fc:p-5 fc:text-center fc:text-sm fc:text-slate-400", children: "No mapped users" }) })
|
|
5239
5326
|
]
|
|
@@ -5351,7 +5438,7 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5351
5438
|
[name]: value
|
|
5352
5439
|
}));
|
|
5353
5440
|
};
|
|
5354
|
-
const
|
|
5441
|
+
const toApiDateTime4 = (value) => {
|
|
5355
5442
|
if (!value) return null;
|
|
5356
5443
|
if (typeof value === "string" && value.includes("T")) {
|
|
5357
5444
|
const parsed = new Date(value);
|
|
@@ -5376,8 +5463,8 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5376
5463
|
externalUserId: Number(selectedMapping.externalUserId),
|
|
5377
5464
|
workflowStepId: Number(formData.workflowStepId),
|
|
5378
5465
|
isPrimary: formData.isPrimary === "true",
|
|
5379
|
-
effectiveFrom:
|
|
5380
|
-
effectiveTo:
|
|
5466
|
+
effectiveFrom: toApiDateTime4(formData.effectiveFrom),
|
|
5467
|
+
effectiveTo: toApiDateTime4(formData.effectiveTo),
|
|
5381
5468
|
isActive: (_e = (_d = selectedMapping.isActive) != null ? _d : selectedMapping.status) != null ? _e : true,
|
|
5382
5469
|
updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
|
|
5383
5470
|
});
|
|
@@ -10012,7 +10099,7 @@ var formatDateForInput = (value) => {
|
|
|
10012
10099
|
const day = String(date.getUTCDate()).padStart(2, "0");
|
|
10013
10100
|
return `${year}-${month}-${day}`;
|
|
10014
10101
|
};
|
|
10015
|
-
var
|
|
10102
|
+
var toApiDateTime2 = (value) => {
|
|
10016
10103
|
if (!value) return null;
|
|
10017
10104
|
if (typeof value === "string" && value.includes("T")) {
|
|
10018
10105
|
const parsed = new Date(value);
|
|
@@ -10124,10 +10211,10 @@ function EditTaskInstanceModal({
|
|
|
10124
10211
|
),
|
|
10125
10212
|
assignedUserId: Number(formData.assignedUserId),
|
|
10126
10213
|
status: formData.status,
|
|
10127
|
-
dueDate:
|
|
10214
|
+
dueDate: toApiDateTime2(formData.dueDate),
|
|
10128
10215
|
slaStatus: formData.slaStatus,
|
|
10129
|
-
reminderSentOn:
|
|
10130
|
-
escalatedOn:
|
|
10216
|
+
reminderSentOn: toApiDateTime2(formData.reminderSentOn),
|
|
10217
|
+
escalatedOn: toApiDateTime2(formData.escalatedOn),
|
|
10131
10218
|
isActive: formData.isActive === "true",
|
|
10132
10219
|
updatedBy: "System"
|
|
10133
10220
|
};
|
|
@@ -10964,7 +11051,7 @@ var getTaskInstanceEndpoint2 = (action) => {
|
|
|
10964
11051
|
return TASK_INSTANCE_ENDPOINTS2[action];
|
|
10965
11052
|
}
|
|
10966
11053
|
};
|
|
10967
|
-
var
|
|
11054
|
+
var toApiDateTime3 = (value) => {
|
|
10968
11055
|
if (!value) return null;
|
|
10969
11056
|
if (typeof value === "string" && value.includes("T")) {
|
|
10970
11057
|
const parsed = new Date(value);
|
|
@@ -11031,10 +11118,10 @@ function AddTaskInstanceModal({
|
|
|
11031
11118
|
workflowStepId: Number(formData.workflowStepId),
|
|
11032
11119
|
assignedUserId: Number(formData.assignedUserId),
|
|
11033
11120
|
status: formData.status,
|
|
11034
|
-
dueDate:
|
|
11121
|
+
dueDate: toApiDateTime3(formData.dueDate),
|
|
11035
11122
|
slaStatus: formData.slaStatus,
|
|
11036
|
-
reminderSentOn:
|
|
11037
|
-
escalatedOn:
|
|
11123
|
+
reminderSentOn: toApiDateTime3(formData.reminderSentOn),
|
|
11124
|
+
escalatedOn: toApiDateTime3(formData.escalatedOn),
|
|
11038
11125
|
createdBy: formData.createdBy || "System"
|
|
11039
11126
|
};
|
|
11040
11127
|
setIsSubmitting(true);
|
package/dist/pkg-index.mjs
CHANGED
|
@@ -4675,25 +4675,27 @@ var getRows2 = (result) => {
|
|
|
4675
4675
|
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;
|
|
4676
4676
|
return Array.isArray(value) ? value : (_g = (_f = value == null ? void 0 : value.items) != null ? _f : value == null ? void 0 : value.records) != null ? _g : [];
|
|
4677
4677
|
};
|
|
4678
|
+
var toApiDateTime = (value) => {
|
|
4679
|
+
if (!value) return null;
|
|
4680
|
+
if (value.includes("T")) {
|
|
4681
|
+
const parsed = new Date(value);
|
|
4682
|
+
return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();
|
|
4683
|
+
}
|
|
4684
|
+
const [year, month, day] = value.split("-").map(Number);
|
|
4685
|
+
if (!year || !month || !day) return null;
|
|
4686
|
+
return new Date(Date.UTC(year, month - 1, day)).toISOString();
|
|
4687
|
+
};
|
|
4688
|
+
var getUserValues = (user) => (user == null ? void 0 : user.values) && typeof user.values === "object" ? user.values : user || {};
|
|
4678
4689
|
var getUserId = (user) => {
|
|
4679
|
-
var _a, _b, _c, _d, _e;
|
|
4680
|
-
return (
|
|
4690
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
4691
|
+
return (_k = (_i = (_g = (_e = (_c = (_a = getUserValues(user)) == null ? void 0 : _a.externalUserId) != null ? _c : (_b = getUserValues(user)) == null ? void 0 : _b.ExternalUserId) != null ? _e : (_d = getUserValues(user)) == null ? void 0 : _d.userId) != null ? _g : (_f = getUserValues(user)) == null ? void 0 : _f.UserId) != null ? _i : (_h = getUserValues(user)) == null ? void 0 : _h.id) != null ? _k : (_j = getUserValues(user)) == null ? void 0 : _j.Id;
|
|
4681
4692
|
};
|
|
4682
4693
|
var getUserName = (user) => {
|
|
4683
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
4684
|
-
return (
|
|
4694
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4695
|
+
return (_m = (_k = (_i = (_g = (_e = (_c = (_a = getUserValues(user)) == null ? void 0 : _a.userName) != null ? _c : (_b = getUserValues(user)) == null ? void 0 : _b.UserName) != null ? _e : (_d = getUserValues(user)) == null ? void 0 : _d.externalUserName) != null ? _g : (_f = getUserValues(user)) == null ? void 0 : _f.ExternalUserName) != null ? _i : (_h = getUserValues(user)) == null ? void 0 : _h.name) != null ? _k : (_j = getUserValues(user)) == null ? void 0 : _j.Name) != null ? _m : `User ${(_l = getUserId(user)) != null ? _l : ""}`;
|
|
4685
4696
|
};
|
|
4686
|
-
var dummyUnmappedUsers = [
|
|
4687
|
-
|
|
4688
|
-
{ externalUserId: 9002, externalUserName: "Demo Unmapped User 2" }
|
|
4689
|
-
];
|
|
4690
|
-
var dummyMappedUsers = [
|
|
4691
|
-
{
|
|
4692
|
-
externalUserId: 9010,
|
|
4693
|
-
externalUserName: "Demo Mapped User 1",
|
|
4694
|
-
workflowStepUserMappingId: 1
|
|
4695
|
-
}
|
|
4696
|
-
];
|
|
4697
|
+
var dummyUnmappedUsers = [];
|
|
4698
|
+
var dummyMappedUsers = [];
|
|
4697
4699
|
var fieldStyle = {
|
|
4698
4700
|
border: "1px solid #cbd5e1",
|
|
4699
4701
|
backgroundColor: "#ffffff",
|
|
@@ -4708,49 +4710,61 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4708
4710
|
effectiveTo: ""
|
|
4709
4711
|
});
|
|
4710
4712
|
const [hierarchySelection, setHierarchySelection] = useState18(emptySelection);
|
|
4713
|
+
const [workflows, setWorkflows] = useState18([]);
|
|
4711
4714
|
const [workflowSteps, setWorkflowSteps] = useState18([]);
|
|
4712
4715
|
const [unmappedUsers, setUnmappedUsers] = useState18([]);
|
|
4713
4716
|
const [mappedUsers, setMappedUsers] = useState18([]);
|
|
4714
4717
|
const [isLoadingWorkflowSteps, setIsLoadingWorkflowSteps] = useState18(false);
|
|
4718
|
+
const [isLoadingWorkflows, setIsLoadingWorkflows] = useState18(false);
|
|
4715
4719
|
const [isFetching, setIsFetching] = useState18(false);
|
|
4716
4720
|
const [busyUserId, setBusyUserId] = useState18(null);
|
|
4721
|
+
const [selectedUnmappedIds, setSelectedUnmappedIds] = useState18([]);
|
|
4722
|
+
const [selectedMappedIds, setSelectedMappedIds] = useState18([]);
|
|
4717
4723
|
const [hasFetched, setHasFetched] = useState18(false);
|
|
4718
4724
|
const mappingEndpoints = () => {
|
|
4719
4725
|
var _a;
|
|
4720
4726
|
const flowCore = ((_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) || {};
|
|
4721
|
-
const mapping = flowCore.
|
|
4727
|
+
const mapping = flowCore.mapping || {};
|
|
4722
4728
|
return {
|
|
4723
|
-
create: mapping.
|
|
4724
|
-
update: mapping.
|
|
4725
|
-
unmapped: mapping.
|
|
4726
|
-
mapped: mapping.
|
|
4729
|
+
create: mapping.map || mapping.Map,
|
|
4730
|
+
update: mapping.unmap || mapping.Unmap,
|
|
4731
|
+
unmapped: mapping.GetUnMappedExternalUserList,
|
|
4732
|
+
mapped: mapping.GetMappedExternalUserList
|
|
4727
4733
|
};
|
|
4728
4734
|
};
|
|
4729
4735
|
useEffect16(() => {
|
|
4730
4736
|
if (!isOpen) return;
|
|
4731
|
-
const
|
|
4732
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4737
|
+
const loadLookups = async () => {
|
|
4738
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
4733
4739
|
setIsLoadingWorkflowSteps(true);
|
|
4740
|
+
setIsLoadingWorkflows(true);
|
|
4734
4741
|
try {
|
|
4735
4742
|
const flowCore = ((_a = getApiEndpoints()) == null ? void 0 : _a.flowCore) || {};
|
|
4736
|
-
const
|
|
4737
|
-
const
|
|
4738
|
-
|
|
4743
|
+
const workflowEndpoint = ((_b = flowCore.workflow) == null ? void 0 : _b.getList) || ((_c = flowCore.WorkFlow) == null ? void 0 : _c.getList) || ((_d = flowCore.workFlow) == null ? void 0 : _d.getList);
|
|
4744
|
+
const workflowStepEndpoint = ((_e = flowCore.workflowStep) == null ? void 0 : _e.getList) || ((_f = flowCore.WorkFlowStep) == null ? void 0 : _f.getList) || ((_g = flowCore.workFlowStep) == null ? void 0 : _g.getList);
|
|
4745
|
+
const [workflowResult, workflowStepResult] = await Promise.all([
|
|
4746
|
+
workflowEndpoint ? getApiService().get(workflowEndpoint) : null,
|
|
4747
|
+
workflowStepEndpoint ? getApiService().get(workflowStepEndpoint) : null
|
|
4748
|
+
]);
|
|
4749
|
+
setWorkflows(workflowResult ? getRows2(workflowResult) : []);
|
|
4750
|
+
setWorkflowSteps(workflowStepResult ? getRows2(workflowStepResult) : []);
|
|
4739
4751
|
} catch (error) {
|
|
4740
4752
|
await Swal10.fire(
|
|
4741
4753
|
"Error",
|
|
4742
|
-
((
|
|
4754
|
+
((_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 load workflow steps.",
|
|
4743
4755
|
"error"
|
|
4744
4756
|
);
|
|
4745
4757
|
} finally {
|
|
4746
4758
|
setIsLoadingWorkflowSteps(false);
|
|
4759
|
+
setIsLoadingWorkflows(false);
|
|
4747
4760
|
}
|
|
4748
4761
|
};
|
|
4749
|
-
|
|
4762
|
+
loadLookups();
|
|
4750
4763
|
}, [isOpen]);
|
|
4751
4764
|
useEffect16(() => {
|
|
4752
4765
|
if (isOpen) return;
|
|
4753
4766
|
setFormData({
|
|
4767
|
+
workflowId: "",
|
|
4754
4768
|
workflowStepId: "",
|
|
4755
4769
|
roleCode: "",
|
|
4756
4770
|
isPrimary: "",
|
|
@@ -4760,19 +4774,28 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4760
4774
|
setHierarchySelection(emptySelection);
|
|
4761
4775
|
setUnmappedUsers([]);
|
|
4762
4776
|
setMappedUsers([]);
|
|
4777
|
+
setSelectedUnmappedIds([]);
|
|
4778
|
+
setSelectedMappedIds([]);
|
|
4763
4779
|
setHasFetched(false);
|
|
4764
4780
|
}, [isOpen]);
|
|
4765
|
-
const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues({}, previous), {
|
|
4781
|
+
const handleChange = (event) => setFormData((previous) => __spreadProps(__spreadValues(__spreadValues({}, previous), event.target.name === "workflowId" ? { workflowStepId: "" } : {}), {
|
|
4766
4782
|
[event.target.name]: event.target.value
|
|
4767
4783
|
}));
|
|
4784
|
+
const selectedWorkflowId = Number(formData.workflowId);
|
|
4785
|
+
const filteredWorkflowSteps = workflowSteps.filter((step) => {
|
|
4786
|
+
var _a;
|
|
4787
|
+
const stepWorkflowId = Number((_a = step.workflowId) != null ? _a : step.WorkflowId);
|
|
4788
|
+
return selectedWorkflowId && stepWorkflowId === selectedWorkflowId;
|
|
4789
|
+
});
|
|
4768
4790
|
const getQueryParams = () => ({
|
|
4769
4791
|
hierarchyNodeId: Number(hierarchySelection.finalNodeId),
|
|
4770
4792
|
hierarchyLevel: Number(hierarchySelection.selectedLevelId),
|
|
4793
|
+
workflowId: Number(formData.workflowId),
|
|
4771
4794
|
workflowStepId: Number(formData.workflowStepId)
|
|
4772
4795
|
});
|
|
4773
4796
|
const fetchUsers = async () => {
|
|
4774
4797
|
const params = getQueryParams();
|
|
4775
|
-
if (!params.workflowStepId || !params.hierarchyNodeId || !params.hierarchyLevel) {
|
|
4798
|
+
if (!params.workflowId || !params.workflowStepId || !params.hierarchyNodeId || !params.hierarchyLevel) {
|
|
4776
4799
|
await Swal10.fire(
|
|
4777
4800
|
"Required fields",
|
|
4778
4801
|
"Please select workflow step and final hierarchy node first.",
|
|
@@ -4783,53 +4806,62 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4783
4806
|
setIsFetching(true);
|
|
4784
4807
|
try {
|
|
4785
4808
|
const endpoints = mappingEndpoints();
|
|
4786
|
-
const [unmappedResult, mappedResult] = await Promise.
|
|
4787
|
-
getApiService().
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4809
|
+
const [unmappedResult, mappedResult] = await Promise.allSettled([
|
|
4810
|
+
getApiService().post(endpoints.unmapped, {
|
|
4811
|
+
hierarchyNodeId: params.hierarchyNodeId,
|
|
4812
|
+
hierarchyLevel: params.hierarchyLevel,
|
|
4813
|
+
workflowId: params.workflowId,
|
|
4814
|
+
workflowStepId: params.workflowStepId
|
|
4792
4815
|
}),
|
|
4793
|
-
getApiService().
|
|
4816
|
+
getApiService().post(endpoints.mapped, {
|
|
4817
|
+
hierarchyNodeId: params.hierarchyNodeId,
|
|
4818
|
+
hierarchyLevel: params.hierarchyLevel,
|
|
4819
|
+
workflowStepId: params.workflowStepId
|
|
4820
|
+
})
|
|
4794
4821
|
]);
|
|
4795
|
-
const unmappedRows = getRows2(unmappedResult);
|
|
4796
|
-
const mappedRows = getRows2(mappedResult);
|
|
4822
|
+
const unmappedRows = unmappedResult.status === "fulfilled" ? getRows2(unmappedResult.value) : [];
|
|
4823
|
+
const mappedRows = mappedResult.status === "fulfilled" ? getRows2(mappedResult.value) : [];
|
|
4797
4824
|
setUnmappedUsers(unmappedRows.length ? unmappedRows : dummyUnmappedUsers);
|
|
4798
4825
|
setMappedUsers(mappedRows.length ? mappedRows : dummyMappedUsers);
|
|
4826
|
+
setSelectedUnmappedIds([]);
|
|
4827
|
+
setSelectedMappedIds([]);
|
|
4799
4828
|
setHasFetched(true);
|
|
4800
|
-
} catch (
|
|
4801
|
-
console.warn(
|
|
4802
|
-
"Unable to fetch mapped users. Showing temporary demo data.",
|
|
4803
|
-
error
|
|
4804
|
-
);
|
|
4829
|
+
} catch (e) {
|
|
4805
4830
|
setUnmappedUsers(dummyUnmappedUsers);
|
|
4806
4831
|
setMappedUsers(dummyMappedUsers);
|
|
4832
|
+
setSelectedUnmappedIds([]);
|
|
4833
|
+
setSelectedMappedIds([]);
|
|
4807
4834
|
setHasFetched(true);
|
|
4808
4835
|
} finally {
|
|
4809
4836
|
setIsFetching(false);
|
|
4810
4837
|
}
|
|
4811
4838
|
};
|
|
4812
|
-
const
|
|
4839
|
+
const updateSelectedUsers = (setUserIds, userId, checked) => {
|
|
4840
|
+
const normalizedId = String(userId);
|
|
4841
|
+
setUserIds(
|
|
4842
|
+
(previous) => checked ? [.../* @__PURE__ */ new Set([...previous, normalizedId])] : previous.filter((id) => id !== normalizedId)
|
|
4843
|
+
);
|
|
4844
|
+
};
|
|
4845
|
+
const mapUsers = async (users = selectedUnmappedIds) => {
|
|
4813
4846
|
var _a, _b;
|
|
4814
|
-
const
|
|
4815
|
-
if (!
|
|
4816
|
-
setBusyUserId(
|
|
4847
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
4848
|
+
if (!externalUserIds.length) return;
|
|
4849
|
+
setBusyUserId("map");
|
|
4817
4850
|
try {
|
|
4818
4851
|
const endpoint2 = mappingEndpoints().create;
|
|
4819
4852
|
if (!endpoint2)
|
|
4820
4853
|
throw new Error(
|
|
4821
|
-
"
|
|
4854
|
+
"External user map endpoint is not configured."
|
|
4822
4855
|
);
|
|
4823
4856
|
await getApiService().post(endpoint2, {
|
|
4824
|
-
externalUserId,
|
|
4825
4857
|
workflowStepId: Number(formData.workflowStepId),
|
|
4826
|
-
|
|
4827
|
-
roleCode: formData.roleCode,
|
|
4858
|
+
externalUserIds,
|
|
4828
4859
|
isPrimary: formData.isPrimary === "true",
|
|
4829
|
-
effectiveFrom: formData.effectiveFrom
|
|
4830
|
-
effectiveTo: formData.effectiveTo
|
|
4860
|
+
effectiveFrom: toApiDateTime(formData.effectiveFrom),
|
|
4861
|
+
effectiveTo: toApiDateTime(formData.effectiveTo),
|
|
4831
4862
|
createdBy: "System"
|
|
4832
4863
|
});
|
|
4864
|
+
setSelectedUnmappedIds([]);
|
|
4833
4865
|
await fetchUsers();
|
|
4834
4866
|
} catch (error) {
|
|
4835
4867
|
await Swal10.fire(
|
|
@@ -4841,35 +4873,28 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4841
4873
|
setBusyUserId(null);
|
|
4842
4874
|
}
|
|
4843
4875
|
};
|
|
4844
|
-
const
|
|
4845
|
-
var _a, _b
|
|
4846
|
-
const
|
|
4847
|
-
if (!
|
|
4848
|
-
setBusyUserId(
|
|
4876
|
+
const unmapUsers = async (users = selectedMappedIds) => {
|
|
4877
|
+
var _a, _b;
|
|
4878
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
4879
|
+
if (!externalUserIds.length) return;
|
|
4880
|
+
setBusyUserId("unmap");
|
|
4849
4881
|
try {
|
|
4850
4882
|
const endpoint2 = mappingEndpoints().update;
|
|
4851
4883
|
if (!endpoint2)
|
|
4852
4884
|
throw new Error(
|
|
4853
|
-
"
|
|
4885
|
+
"External user unmap endpoint is not configured."
|
|
4854
4886
|
);
|
|
4855
|
-
await getApiService().
|
|
4856
|
-
workflowStepUserMappingId: Number(
|
|
4857
|
-
(_c = (_b = (_a = user.workflowStepUserMappingId) != null ? _a : user.WorkFlowStepUserMappingId) != null ? _b : user.mappingId) != null ? _c : user.id
|
|
4858
|
-
),
|
|
4859
|
-
externalUserId,
|
|
4887
|
+
await getApiService().post(endpoint2, {
|
|
4860
4888
|
workflowStepId: Number(formData.workflowStepId),
|
|
4861
|
-
|
|
4862
|
-
isPrimary: Boolean((_d = user.isPrimary) != null ? _d : user.IsPrimary),
|
|
4863
|
-
effectiveFrom: (_f = (_e = user.effectiveFrom) != null ? _e : user.EffectiveFrom) != null ? _f : null,
|
|
4864
|
-
effectiveTo: (_h = (_g = user.effectiveTo) != null ? _g : user.EffectiveTo) != null ? _h : null,
|
|
4865
|
-
isActive: false,
|
|
4889
|
+
externalUserIds,
|
|
4866
4890
|
updatedBy: "System"
|
|
4867
4891
|
});
|
|
4892
|
+
setSelectedMappedIds([]);
|
|
4868
4893
|
await fetchUsers();
|
|
4869
4894
|
} catch (error) {
|
|
4870
4895
|
await Swal10.fire(
|
|
4871
4896
|
"Error",
|
|
4872
|
-
((
|
|
4897
|
+
((_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 unmap user.",
|
|
4873
4898
|
"error"
|
|
4874
4899
|
);
|
|
4875
4900
|
} finally {
|
|
@@ -4877,27 +4902,48 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4877
4902
|
}
|
|
4878
4903
|
};
|
|
4879
4904
|
const renderUser = (user, mapped) => {
|
|
4880
|
-
const userId =
|
|
4905
|
+
const userId = getUserId(user);
|
|
4906
|
+
const userValues = getUserValues(user);
|
|
4907
|
+
const normalizedUserId = String(userId);
|
|
4908
|
+
const isSelected = (mapped ? selectedMappedIds : selectedUnmappedIds).includes(
|
|
4909
|
+
normalizedUserId
|
|
4910
|
+
);
|
|
4881
4911
|
return /* @__PURE__ */ jsxs23(
|
|
4882
4912
|
"div",
|
|
4883
4913
|
{
|
|
4884
4914
|
className: "fc:flex fc:items-center fc:justify-between fc:gap-3 fc:border-b fc:border-slate-100 fc:px-3 fc:py-2 last:fc:border-0",
|
|
4885
4915
|
children: [
|
|
4916
|
+
/* @__PURE__ */ jsx24(
|
|
4917
|
+
"input",
|
|
4918
|
+
{
|
|
4919
|
+
type: "checkbox",
|
|
4920
|
+
checked: isSelected,
|
|
4921
|
+
onChange: (event) => updateSelectedUsers(
|
|
4922
|
+
mapped ? setSelectedMappedIds : setSelectedUnmappedIds,
|
|
4923
|
+
userId,
|
|
4924
|
+
event.target.checked
|
|
4925
|
+
),
|
|
4926
|
+
className: "fc:shrink-0"
|
|
4927
|
+
}
|
|
4928
|
+
),
|
|
4886
4929
|
/* @__PURE__ */ jsxs23("div", { className: "fc:min-w-0", children: [
|
|
4887
4930
|
/* @__PURE__ */ jsx24("div", { className: "fc:truncate fc:text-xs fc:font-semibold fc:text-slate-700", children: getUserName(user) }),
|
|
4888
|
-
/* @__PURE__ */ jsxs23("div", { className: "fc:text-[10px] fc:text-slate-
|
|
4889
|
-
"
|
|
4890
|
-
|
|
4891
|
-
|
|
4931
|
+
/* @__PURE__ */ jsx24("div", { className: "fc:mt-1 fc:grid fc:grid-cols-2 fc:gap-x-3 fc:gap-y-0.5", children: Object.entries(userValues).map(([key, value]) => /* @__PURE__ */ jsxs23("div", { className: "fc:min-w-0 fc:text-[10px] fc:text-slate-500", children: [
|
|
4932
|
+
/* @__PURE__ */ jsxs23("span", { className: "fc:font-semibold fc:text-slate-600", children: [
|
|
4933
|
+
key,
|
|
4934
|
+
": "
|
|
4935
|
+
] }),
|
|
4936
|
+
/* @__PURE__ */ jsx24("span", { className: "fc:break-words", children: value === null || value === void 0 ? "-" : typeof value === "object" ? JSON.stringify(value) : String(value) })
|
|
4937
|
+
] }, key)) })
|
|
4892
4938
|
] }),
|
|
4893
4939
|
/* @__PURE__ */ jsx24(
|
|
4894
4940
|
"button",
|
|
4895
4941
|
{
|
|
4896
4942
|
type: "button",
|
|
4897
|
-
disabled: busyUserId
|
|
4898
|
-
onClick: () => mapped ?
|
|
4943
|
+
disabled: busyUserId !== null,
|
|
4944
|
+
onClick: () => mapped ? unmapUsers([userId]) : mapUsers([userId]),
|
|
4899
4945
|
className: `fc:shrink-0 fc:rounded-lg fc:px-2.5 fc:py-1 fc:text-[10px] fc:font-semibold disabled:fc:opacity-50 ${mapped ? "fc:bg-rose-50 fc:text-rose-600" : "fc:bg-emerald-50 fc:text-emerald-700"}`,
|
|
4900
|
-
children: busyUserId
|
|
4946
|
+
children: busyUserId !== null ? "..." : mapped ? "Unmap" : "Map"
|
|
4901
4947
|
}
|
|
4902
4948
|
)
|
|
4903
4949
|
]
|
|
@@ -4944,62 +4990,57 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4944
4990
|
"div",
|
|
4945
4991
|
{
|
|
4946
4992
|
className: "fc:grid fc:items-end fc:gap-3",
|
|
4947
|
-
style: { gridTemplateColumns: "repeat(
|
|
4993
|
+
style: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" },
|
|
4948
4994
|
children: [
|
|
4949
4995
|
/* @__PURE__ */ jsxs23("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
4950
|
-
"Workflow
|
|
4996
|
+
"Workflow",
|
|
4951
4997
|
/* @__PURE__ */ jsxs23(
|
|
4952
4998
|
"select",
|
|
4953
4999
|
{
|
|
4954
|
-
name: "
|
|
4955
|
-
value: formData.
|
|
5000
|
+
name: "workflowId",
|
|
5001
|
+
value: formData.workflowId,
|
|
4956
5002
|
onChange: handleChange,
|
|
4957
|
-
disabled:
|
|
5003
|
+
disabled: isLoadingWorkflows,
|
|
4958
5004
|
style: fieldStyle,
|
|
4959
5005
|
className: "fc:mt-1 fc:w-full fc:rounded-lg fc:border fc:border-slate-200 fc:bg-white fc:px-2 fc:py-1.5 fc:text-xs",
|
|
4960
5006
|
children: [
|
|
4961
|
-
/* @__PURE__ */ jsx24("option", { value: "", children: "Select
|
|
4962
|
-
|
|
4963
|
-
var _a, _b, _c, _d, _e
|
|
4964
|
-
const id = (_b = (_a =
|
|
4965
|
-
const name = (
|
|
5007
|
+
/* @__PURE__ */ jsx24("option", { value: "", children: "Select workflow" }),
|
|
5008
|
+
workflows.map((workflow) => {
|
|
5009
|
+
var _a, _b, _c, _d, _e;
|
|
5010
|
+
const id = (_b = (_a = workflow.workflowId) != null ? _a : workflow.WorkflowId) != null ? _b : workflow.id;
|
|
5011
|
+
const name = (_e = (_d = (_c = workflow.workflowName) != null ? _c : workflow.WorkflowName) != null ? _d : workflow.name) != null ? _e : `Workflow ${id}`;
|
|
4966
5012
|
return /* @__PURE__ */ jsxs23("option", { value: id, children: [
|
|
4967
5013
|
id,
|
|
4968
|
-
|
|
5014
|
+
" - ",
|
|
5015
|
+
name
|
|
4969
5016
|
] }, id);
|
|
4970
5017
|
})
|
|
4971
5018
|
]
|
|
4972
5019
|
}
|
|
4973
5020
|
)
|
|
4974
5021
|
] }),
|
|
4975
|
-
/* @__PURE__ */ jsx24("div", { children: /* @__PURE__ */ jsxs23("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
4976
|
-
"Role Code",
|
|
4977
|
-
/* @__PURE__ */ jsx24(
|
|
4978
|
-
"input",
|
|
4979
|
-
{
|
|
4980
|
-
name: "roleCode",
|
|
4981
|
-
value: formData.roleCode,
|
|
4982
|
-
onChange: handleChange,
|
|
4983
|
-
placeholder: "DEO / RO",
|
|
4984
|
-
style: fieldStyle,
|
|
4985
|
-
className: "fc:mt-1 fc:w-full fc:rounded-lg fc:border fc:border-slate-200 fc:px-2 fc:py-1.5 fc:text-xs"
|
|
4986
|
-
}
|
|
4987
|
-
)
|
|
4988
|
-
] }) }),
|
|
4989
5022
|
/* @__PURE__ */ jsxs23("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
4990
|
-
"
|
|
5023
|
+
"Workflow Step",
|
|
4991
5024
|
/* @__PURE__ */ jsxs23(
|
|
4992
5025
|
"select",
|
|
4993
5026
|
{
|
|
4994
|
-
name: "
|
|
4995
|
-
value: formData.
|
|
5027
|
+
name: "workflowStepId",
|
|
5028
|
+
value: formData.workflowStepId,
|
|
4996
5029
|
onChange: handleChange,
|
|
5030
|
+
disabled: isLoadingWorkflowSteps || !formData.workflowId,
|
|
4997
5031
|
style: fieldStyle,
|
|
4998
5032
|
className: "fc:mt-1 fc:w-full fc:rounded-lg fc:border fc:border-slate-200 fc:bg-white fc:px-2 fc:py-1.5 fc:text-xs",
|
|
4999
5033
|
children: [
|
|
5000
|
-
/* @__PURE__ */ jsx24("option", { value: "", children: "Select" }),
|
|
5001
|
-
|
|
5002
|
-
|
|
5034
|
+
/* @__PURE__ */ jsx24("option", { value: "", children: "Select step" }),
|
|
5035
|
+
filteredWorkflowSteps.map((step) => {
|
|
5036
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5037
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5038
|
+
const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.name) != null ? _e : step.workflowStepName) != null ? _f : step.WorkflowStepName;
|
|
5039
|
+
return /* @__PURE__ */ jsxs23("option", { value: id, children: [
|
|
5040
|
+
id,
|
|
5041
|
+
name ? ` - ${name}` : ""
|
|
5042
|
+
] }, id);
|
|
5043
|
+
})
|
|
5003
5044
|
]
|
|
5004
5045
|
}
|
|
5005
5046
|
)
|
|
@@ -5076,8 +5117,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5076
5117
|
style: { order: 2 },
|
|
5077
5118
|
children: [
|
|
5078
5119
|
/* @__PURE__ */ jsxs23("header", { className: "fc:flex fc:justify-between fc:bg-amber-50 fc:px-4 fc:py-2.5", children: [
|
|
5079
|
-
/* @__PURE__ */
|
|
5080
|
-
|
|
5120
|
+
/* @__PURE__ */ jsxs23("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-amber-800", children: [
|
|
5121
|
+
/* @__PURE__ */ jsx24(
|
|
5122
|
+
"input",
|
|
5123
|
+
{
|
|
5124
|
+
type: "checkbox",
|
|
5125
|
+
checked: unmappedUsers.length > 0 && selectedUnmappedIds.length === unmappedUsers.length,
|
|
5126
|
+
onChange: (event) => setSelectedUnmappedIds(
|
|
5127
|
+
event.target.checked ? unmappedUsers.map((user) => String(getUserId(user))) : []
|
|
5128
|
+
)
|
|
5129
|
+
}
|
|
5130
|
+
),
|
|
5131
|
+
"Unmapped Users (",
|
|
5132
|
+
unmappedUsers.length,
|
|
5133
|
+
")"
|
|
5134
|
+
] }),
|
|
5135
|
+
/* @__PURE__ */ jsx24(
|
|
5136
|
+
"button",
|
|
5137
|
+
{
|
|
5138
|
+
type: "button",
|
|
5139
|
+
disabled: !selectedUnmappedIds.length || busyUserId !== null,
|
|
5140
|
+
onClick: () => mapUsers(),
|
|
5141
|
+
className: "fc:rounded-lg fc:bg-emerald-100 fc:px-2.5 fc:py-1 fc:text-[10px] fc:font-semibold fc:text-emerald-700 disabled:fc:opacity-50",
|
|
5142
|
+
children: "Map Selected"
|
|
5143
|
+
}
|
|
5144
|
+
)
|
|
5081
5145
|
] }),
|
|
5082
5146
|
/* @__PURE__ */ jsx24("div", { className: "fc:max-h-64 fc:overflow-y-auto", children: unmappedUsers.length ? unmappedUsers.map((user) => renderUser(user, false)) : /* @__PURE__ */ jsx24("p", { className: "fc:p-5 fc:text-center fc:text-sm fc:text-slate-400", children: "No unmapped users" }) })
|
|
5083
5147
|
]
|
|
@@ -5090,8 +5154,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5090
5154
|
style: { order: 1 },
|
|
5091
5155
|
children: [
|
|
5092
5156
|
/* @__PURE__ */ jsxs23("header", { className: "fc:flex fc:justify-between fc:bg-emerald-50 fc:px-4 fc:py-2.5", children: [
|
|
5093
|
-
/* @__PURE__ */
|
|
5094
|
-
|
|
5157
|
+
/* @__PURE__ */ jsxs23("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-emerald-800", children: [
|
|
5158
|
+
/* @__PURE__ */ jsx24(
|
|
5159
|
+
"input",
|
|
5160
|
+
{
|
|
5161
|
+
type: "checkbox",
|
|
5162
|
+
checked: mappedUsers.length > 0 && selectedMappedIds.length === mappedUsers.length,
|
|
5163
|
+
onChange: (event) => setSelectedMappedIds(
|
|
5164
|
+
event.target.checked ? mappedUsers.map((user) => String(getUserId(user))) : []
|
|
5165
|
+
)
|
|
5166
|
+
}
|
|
5167
|
+
),
|
|
5168
|
+
"Mapped Users (",
|
|
5169
|
+
mappedUsers.length,
|
|
5170
|
+
")"
|
|
5171
|
+
] }),
|
|
5172
|
+
/* @__PURE__ */ jsx24(
|
|
5173
|
+
"button",
|
|
5174
|
+
{
|
|
5175
|
+
type: "button",
|
|
5176
|
+
disabled: !selectedMappedIds.length || busyUserId !== null,
|
|
5177
|
+
onClick: () => unmapUsers(),
|
|
5178
|
+
className: "fc:rounded-lg fc:bg-rose-100 fc:px-2.5 fc:py-1 fc:text-[10px] fc:font-semibold fc:text-rose-700 disabled:fc:opacity-50",
|
|
5179
|
+
children: "Unmap Selected"
|
|
5180
|
+
}
|
|
5181
|
+
)
|
|
5095
5182
|
] }),
|
|
5096
5183
|
/* @__PURE__ */ jsx24("div", { className: "fc:max-h-64 fc:overflow-y-auto", children: mappedUsers.length ? mappedUsers.map((user) => renderUser(user, true)) : /* @__PURE__ */ jsx24("p", { className: "fc:p-5 fc:text-center fc:text-sm fc:text-slate-400", children: "No mapped users" }) })
|
|
5097
5184
|
]
|
|
@@ -5207,7 +5294,7 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5207
5294
|
[name]: value
|
|
5208
5295
|
}));
|
|
5209
5296
|
};
|
|
5210
|
-
const
|
|
5297
|
+
const toApiDateTime4 = (value) => {
|
|
5211
5298
|
if (!value) return null;
|
|
5212
5299
|
if (typeof value === "string" && value.includes("T")) {
|
|
5213
5300
|
const parsed = new Date(value);
|
|
@@ -5232,8 +5319,8 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5232
5319
|
externalUserId: Number(selectedMapping.externalUserId),
|
|
5233
5320
|
workflowStepId: Number(formData.workflowStepId),
|
|
5234
5321
|
isPrimary: formData.isPrimary === "true",
|
|
5235
|
-
effectiveFrom:
|
|
5236
|
-
effectiveTo:
|
|
5322
|
+
effectiveFrom: toApiDateTime4(formData.effectiveFrom),
|
|
5323
|
+
effectiveTo: toApiDateTime4(formData.effectiveTo),
|
|
5237
5324
|
isActive: (_e = (_d = selectedMapping.isActive) != null ? _d : selectedMapping.status) != null ? _e : true,
|
|
5238
5325
|
updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
|
|
5239
5326
|
});
|
|
@@ -9850,7 +9937,7 @@ var formatDateForInput = (value) => {
|
|
|
9850
9937
|
const day = String(date.getUTCDate()).padStart(2, "0");
|
|
9851
9938
|
return `${year}-${month}-${day}`;
|
|
9852
9939
|
};
|
|
9853
|
-
var
|
|
9940
|
+
var toApiDateTime2 = (value) => {
|
|
9854
9941
|
if (!value) return null;
|
|
9855
9942
|
if (typeof value === "string" && value.includes("T")) {
|
|
9856
9943
|
const parsed = new Date(value);
|
|
@@ -9962,10 +10049,10 @@ function EditTaskInstanceModal({
|
|
|
9962
10049
|
),
|
|
9963
10050
|
assignedUserId: Number(formData.assignedUserId),
|
|
9964
10051
|
status: formData.status,
|
|
9965
|
-
dueDate:
|
|
10052
|
+
dueDate: toApiDateTime2(formData.dueDate),
|
|
9966
10053
|
slaStatus: formData.slaStatus,
|
|
9967
|
-
reminderSentOn:
|
|
9968
|
-
escalatedOn:
|
|
10054
|
+
reminderSentOn: toApiDateTime2(formData.reminderSentOn),
|
|
10055
|
+
escalatedOn: toApiDateTime2(formData.escalatedOn),
|
|
9969
10056
|
isActive: formData.isActive === "true",
|
|
9970
10057
|
updatedBy: "System"
|
|
9971
10058
|
};
|
|
@@ -10800,7 +10887,7 @@ var getTaskInstanceEndpoint2 = (action) => {
|
|
|
10800
10887
|
return TASK_INSTANCE_ENDPOINTS2[action];
|
|
10801
10888
|
}
|
|
10802
10889
|
};
|
|
10803
|
-
var
|
|
10890
|
+
var toApiDateTime3 = (value) => {
|
|
10804
10891
|
if (!value) return null;
|
|
10805
10892
|
if (typeof value === "string" && value.includes("T")) {
|
|
10806
10893
|
const parsed = new Date(value);
|
|
@@ -10867,10 +10954,10 @@ function AddTaskInstanceModal({
|
|
|
10867
10954
|
workflowStepId: Number(formData.workflowStepId),
|
|
10868
10955
|
assignedUserId: Number(formData.assignedUserId),
|
|
10869
10956
|
status: formData.status,
|
|
10870
|
-
dueDate:
|
|
10957
|
+
dueDate: toApiDateTime3(formData.dueDate),
|
|
10871
10958
|
slaStatus: formData.slaStatus,
|
|
10872
|
-
reminderSentOn:
|
|
10873
|
-
escalatedOn:
|
|
10959
|
+
reminderSentOn: toApiDateTime3(formData.reminderSentOn),
|
|
10960
|
+
escalatedOn: toApiDateTime3(formData.escalatedOn),
|
|
10874
10961
|
createdBy: formData.createdBy || "System"
|
|
10875
10962
|
};
|
|
10876
10963
|
setIsSubmitting(true);
|