flowcore-fn 10.1.8 → 10.2.1
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 +213 -124
- package/dist/pkg-index.mjs +213 -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,64 @@ 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
|
+
workflowId: params.workflowId,
|
|
4962
|
+
workflowStepId: params.workflowStepId
|
|
4963
|
+
})
|
|
4936
4964
|
]);
|
|
4937
|
-
const unmappedRows = getRows2(unmappedResult);
|
|
4938
|
-
const mappedRows = getRows2(mappedResult);
|
|
4965
|
+
const unmappedRows = unmappedResult.status === "fulfilled" ? getRows2(unmappedResult.value) : [];
|
|
4966
|
+
const mappedRows = mappedResult.status === "fulfilled" ? getRows2(mappedResult.value) : [];
|
|
4939
4967
|
setUnmappedUsers(unmappedRows.length ? unmappedRows : dummyUnmappedUsers);
|
|
4940
4968
|
setMappedUsers(mappedRows.length ? mappedRows : dummyMappedUsers);
|
|
4969
|
+
setSelectedUnmappedIds([]);
|
|
4970
|
+
setSelectedMappedIds([]);
|
|
4941
4971
|
setHasFetched(true);
|
|
4942
|
-
} catch (
|
|
4943
|
-
console.warn(
|
|
4944
|
-
"Unable to fetch mapped users. Showing temporary demo data.",
|
|
4945
|
-
error
|
|
4946
|
-
);
|
|
4972
|
+
} catch (e) {
|
|
4947
4973
|
setUnmappedUsers(dummyUnmappedUsers);
|
|
4948
4974
|
setMappedUsers(dummyMappedUsers);
|
|
4975
|
+
setSelectedUnmappedIds([]);
|
|
4976
|
+
setSelectedMappedIds([]);
|
|
4949
4977
|
setHasFetched(true);
|
|
4950
4978
|
} finally {
|
|
4951
4979
|
setIsFetching(false);
|
|
4952
4980
|
}
|
|
4953
4981
|
};
|
|
4954
|
-
const
|
|
4982
|
+
const updateSelectedUsers = (setUserIds, userId, checked) => {
|
|
4983
|
+
const normalizedId = String(userId);
|
|
4984
|
+
setUserIds(
|
|
4985
|
+
(previous) => checked ? [.../* @__PURE__ */ new Set([...previous, normalizedId])] : previous.filter((id) => id !== normalizedId)
|
|
4986
|
+
);
|
|
4987
|
+
};
|
|
4988
|
+
const mapUsers = async (users = selectedUnmappedIds) => {
|
|
4955
4989
|
var _a, _b;
|
|
4956
|
-
const
|
|
4957
|
-
if (!
|
|
4958
|
-
setBusyUserId(
|
|
4990
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
4991
|
+
if (!externalUserIds.length) return;
|
|
4992
|
+
setBusyUserId("map");
|
|
4959
4993
|
try {
|
|
4960
4994
|
const endpoint2 = mappingEndpoints().create;
|
|
4961
4995
|
if (!endpoint2)
|
|
4962
4996
|
throw new Error(
|
|
4963
|
-
"
|
|
4997
|
+
"External user map endpoint is not configured."
|
|
4964
4998
|
);
|
|
4965
4999
|
await getApiService().post(endpoint2, {
|
|
4966
|
-
|
|
5000
|
+
workflowId: Number(formData.workflowId),
|
|
4967
5001
|
workflowStepId: Number(formData.workflowStepId),
|
|
4968
|
-
|
|
4969
|
-
roleCode: formData.roleCode,
|
|
5002
|
+
externalUserIds,
|
|
4970
5003
|
isPrimary: formData.isPrimary === "true",
|
|
4971
|
-
effectiveFrom: formData.effectiveFrom
|
|
4972
|
-
effectiveTo: formData.effectiveTo
|
|
5004
|
+
effectiveFrom: toApiDateTime(formData.effectiveFrom),
|
|
5005
|
+
effectiveTo: toApiDateTime(formData.effectiveTo),
|
|
4973
5006
|
createdBy: "System"
|
|
4974
5007
|
});
|
|
5008
|
+
setSelectedUnmappedIds([]);
|
|
4975
5009
|
await fetchUsers();
|
|
4976
5010
|
} catch (error) {
|
|
4977
5011
|
await import_sweetalert210.default.fire(
|
|
@@ -4983,35 +5017,28 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4983
5017
|
setBusyUserId(null);
|
|
4984
5018
|
}
|
|
4985
5019
|
};
|
|
4986
|
-
const
|
|
4987
|
-
var _a, _b
|
|
4988
|
-
const
|
|
4989
|
-
if (!
|
|
4990
|
-
setBusyUserId(
|
|
5020
|
+
const unmapUsers = async (users = selectedMappedIds) => {
|
|
5021
|
+
var _a, _b;
|
|
5022
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
5023
|
+
if (!externalUserIds.length) return;
|
|
5024
|
+
setBusyUserId("unmap");
|
|
4991
5025
|
try {
|
|
4992
5026
|
const endpoint2 = mappingEndpoints().update;
|
|
4993
5027
|
if (!endpoint2)
|
|
4994
5028
|
throw new Error(
|
|
4995
|
-
"
|
|
5029
|
+
"External user unmap endpoint is not configured."
|
|
4996
5030
|
);
|
|
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,
|
|
5031
|
+
await getApiService().post(endpoint2, {
|
|
5002
5032
|
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,
|
|
5033
|
+
externalUserIds,
|
|
5008
5034
|
updatedBy: "System"
|
|
5009
5035
|
});
|
|
5036
|
+
setSelectedMappedIds([]);
|
|
5010
5037
|
await fetchUsers();
|
|
5011
5038
|
} catch (error) {
|
|
5012
5039
|
await import_sweetalert210.default.fire(
|
|
5013
5040
|
"Error",
|
|
5014
|
-
((
|
|
5041
|
+
((_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
5042
|
"error"
|
|
5016
5043
|
);
|
|
5017
5044
|
} finally {
|
|
@@ -5019,27 +5046,48 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5019
5046
|
}
|
|
5020
5047
|
};
|
|
5021
5048
|
const renderUser = (user, mapped) => {
|
|
5022
|
-
const userId =
|
|
5049
|
+
const userId = getUserId(user);
|
|
5050
|
+
const userValues = getUserValues(user);
|
|
5051
|
+
const normalizedUserId = String(userId);
|
|
5052
|
+
const isSelected = (mapped ? selectedMappedIds : selectedUnmappedIds).includes(
|
|
5053
|
+
normalizedUserId
|
|
5054
|
+
);
|
|
5023
5055
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5024
5056
|
"div",
|
|
5025
5057
|
{
|
|
5026
5058
|
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
5059
|
children: [
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5061
|
+
"input",
|
|
5062
|
+
{
|
|
5063
|
+
type: "checkbox",
|
|
5064
|
+
checked: isSelected,
|
|
5065
|
+
onChange: (event) => updateSelectedUsers(
|
|
5066
|
+
mapped ? setSelectedMappedIds : setSelectedUnmappedIds,
|
|
5067
|
+
userId,
|
|
5068
|
+
event.target.checked
|
|
5069
|
+
),
|
|
5070
|
+
className: "fc:shrink-0"
|
|
5071
|
+
}
|
|
5072
|
+
),
|
|
5028
5073
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "fc:min-w-0", children: [
|
|
5029
5074
|
/* @__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
|
-
|
|
5075
|
+
/* @__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: [
|
|
5076
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("span", { className: "fc:font-semibold fc:text-slate-600", children: [
|
|
5077
|
+
key,
|
|
5078
|
+
": "
|
|
5079
|
+
] }),
|
|
5080
|
+
/* @__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) })
|
|
5081
|
+
] }, key)) })
|
|
5034
5082
|
] }),
|
|
5035
5083
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5036
5084
|
"button",
|
|
5037
5085
|
{
|
|
5038
5086
|
type: "button",
|
|
5039
|
-
disabled: busyUserId
|
|
5040
|
-
onClick: () => mapped ?
|
|
5087
|
+
disabled: busyUserId !== null,
|
|
5088
|
+
onClick: () => mapped ? unmapUsers([userId]) : mapUsers([userId]),
|
|
5041
5089
|
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
|
|
5090
|
+
children: busyUserId !== null ? "..." : mapped ? "Unmap" : "Map"
|
|
5043
5091
|
}
|
|
5044
5092
|
)
|
|
5045
5093
|
]
|
|
@@ -5086,62 +5134,57 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5086
5134
|
"div",
|
|
5087
5135
|
{
|
|
5088
5136
|
className: "fc:grid fc:items-end fc:gap-3",
|
|
5089
|
-
style: { gridTemplateColumns: "repeat(
|
|
5137
|
+
style: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" },
|
|
5090
5138
|
children: [
|
|
5091
5139
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
5092
|
-
"Workflow
|
|
5140
|
+
"Workflow",
|
|
5093
5141
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5094
5142
|
"select",
|
|
5095
5143
|
{
|
|
5096
|
-
name: "
|
|
5097
|
-
value: formData.
|
|
5144
|
+
name: "workflowId",
|
|
5145
|
+
value: formData.workflowId,
|
|
5098
5146
|
onChange: handleChange,
|
|
5099
|
-
disabled:
|
|
5147
|
+
disabled: isLoadingWorkflows,
|
|
5100
5148
|
style: fieldStyle,
|
|
5101
5149
|
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
5150
|
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 = (
|
|
5151
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select workflow" }),
|
|
5152
|
+
workflows.map((workflow) => {
|
|
5153
|
+
var _a, _b, _c, _d, _e;
|
|
5154
|
+
const id = (_b = (_a = workflow.workflowId) != null ? _a : workflow.WorkflowId) != null ? _b : workflow.id;
|
|
5155
|
+
const name = (_e = (_d = (_c = workflow.workflowName) != null ? _c : workflow.WorkflowName) != null ? _d : workflow.name) != null ? _e : `Workflow ${id}`;
|
|
5108
5156
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: id, children: [
|
|
5109
5157
|
id,
|
|
5110
|
-
|
|
5158
|
+
" - ",
|
|
5159
|
+
name
|
|
5111
5160
|
] }, id);
|
|
5112
5161
|
})
|
|
5113
5162
|
]
|
|
5114
5163
|
}
|
|
5115
5164
|
)
|
|
5116
5165
|
] }),
|
|
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
5166
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
5132
|
-
"
|
|
5167
|
+
"Workflow Step",
|
|
5133
5168
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
5134
5169
|
"select",
|
|
5135
5170
|
{
|
|
5136
|
-
name: "
|
|
5137
|
-
value: formData.
|
|
5171
|
+
name: "workflowStepId",
|
|
5172
|
+
value: formData.workflowStepId,
|
|
5138
5173
|
onChange: handleChange,
|
|
5174
|
+
disabled: isLoadingWorkflowSteps || !formData.workflowId,
|
|
5139
5175
|
style: fieldStyle,
|
|
5140
5176
|
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
5177
|
children: [
|
|
5142
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select" }),
|
|
5143
|
-
|
|
5144
|
-
|
|
5178
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("option", { value: "", children: "Select step" }),
|
|
5179
|
+
filteredWorkflowSteps.map((step) => {
|
|
5180
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5181
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5182
|
+
const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.name) != null ? _e : step.workflowStepName) != null ? _f : step.WorkflowStepName;
|
|
5183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("option", { value: id, children: [
|
|
5184
|
+
id,
|
|
5185
|
+
name ? ` - ${name}` : ""
|
|
5186
|
+
] }, id);
|
|
5187
|
+
})
|
|
5145
5188
|
]
|
|
5146
5189
|
}
|
|
5147
5190
|
)
|
|
@@ -5218,8 +5261,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5218
5261
|
style: { order: 2 },
|
|
5219
5262
|
children: [
|
|
5220
5263
|
/* @__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
|
-
|
|
5264
|
+
/* @__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: [
|
|
5265
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5266
|
+
"input",
|
|
5267
|
+
{
|
|
5268
|
+
type: "checkbox",
|
|
5269
|
+
checked: unmappedUsers.length > 0 && selectedUnmappedIds.length === unmappedUsers.length,
|
|
5270
|
+
onChange: (event) => setSelectedUnmappedIds(
|
|
5271
|
+
event.target.checked ? unmappedUsers.map((user) => String(getUserId(user))) : []
|
|
5272
|
+
)
|
|
5273
|
+
}
|
|
5274
|
+
),
|
|
5275
|
+
"Unmapped Users (",
|
|
5276
|
+
unmappedUsers.length,
|
|
5277
|
+
")"
|
|
5278
|
+
] }),
|
|
5279
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5280
|
+
"button",
|
|
5281
|
+
{
|
|
5282
|
+
type: "button",
|
|
5283
|
+
disabled: !selectedUnmappedIds.length || busyUserId !== null,
|
|
5284
|
+
onClick: () => mapUsers(),
|
|
5285
|
+
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",
|
|
5286
|
+
children: "Map Selected"
|
|
5287
|
+
}
|
|
5288
|
+
)
|
|
5223
5289
|
] }),
|
|
5224
5290
|
/* @__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
5291
|
]
|
|
@@ -5232,8 +5298,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5232
5298
|
style: { order: 1 },
|
|
5233
5299
|
children: [
|
|
5234
5300
|
/* @__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
|
-
|
|
5301
|
+
/* @__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: [
|
|
5302
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5303
|
+
"input",
|
|
5304
|
+
{
|
|
5305
|
+
type: "checkbox",
|
|
5306
|
+
checked: mappedUsers.length > 0 && selectedMappedIds.length === mappedUsers.length,
|
|
5307
|
+
onChange: (event) => setSelectedMappedIds(
|
|
5308
|
+
event.target.checked ? mappedUsers.map((user) => String(getUserId(user))) : []
|
|
5309
|
+
)
|
|
5310
|
+
}
|
|
5311
|
+
),
|
|
5312
|
+
"Mapped Users (",
|
|
5313
|
+
mappedUsers.length,
|
|
5314
|
+
")"
|
|
5315
|
+
] }),
|
|
5316
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
5317
|
+
"button",
|
|
5318
|
+
{
|
|
5319
|
+
type: "button",
|
|
5320
|
+
disabled: !selectedMappedIds.length || busyUserId !== null,
|
|
5321
|
+
onClick: () => unmapUsers(),
|
|
5322
|
+
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",
|
|
5323
|
+
children: "Unmap Selected"
|
|
5324
|
+
}
|
|
5325
|
+
)
|
|
5237
5326
|
] }),
|
|
5238
5327
|
/* @__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
5328
|
]
|
|
@@ -5351,7 +5440,7 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5351
5440
|
[name]: value
|
|
5352
5441
|
}));
|
|
5353
5442
|
};
|
|
5354
|
-
const
|
|
5443
|
+
const toApiDateTime4 = (value) => {
|
|
5355
5444
|
if (!value) return null;
|
|
5356
5445
|
if (typeof value === "string" && value.includes("T")) {
|
|
5357
5446
|
const parsed = new Date(value);
|
|
@@ -5376,8 +5465,8 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5376
5465
|
externalUserId: Number(selectedMapping.externalUserId),
|
|
5377
5466
|
workflowStepId: Number(formData.workflowStepId),
|
|
5378
5467
|
isPrimary: formData.isPrimary === "true",
|
|
5379
|
-
effectiveFrom:
|
|
5380
|
-
effectiveTo:
|
|
5468
|
+
effectiveFrom: toApiDateTime4(formData.effectiveFrom),
|
|
5469
|
+
effectiveTo: toApiDateTime4(formData.effectiveTo),
|
|
5381
5470
|
isActive: (_e = (_d = selectedMapping.isActive) != null ? _d : selectedMapping.status) != null ? _e : true,
|
|
5382
5471
|
updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
|
|
5383
5472
|
});
|
|
@@ -10012,7 +10101,7 @@ var formatDateForInput = (value) => {
|
|
|
10012
10101
|
const day = String(date.getUTCDate()).padStart(2, "0");
|
|
10013
10102
|
return `${year}-${month}-${day}`;
|
|
10014
10103
|
};
|
|
10015
|
-
var
|
|
10104
|
+
var toApiDateTime2 = (value) => {
|
|
10016
10105
|
if (!value) return null;
|
|
10017
10106
|
if (typeof value === "string" && value.includes("T")) {
|
|
10018
10107
|
const parsed = new Date(value);
|
|
@@ -10124,10 +10213,10 @@ function EditTaskInstanceModal({
|
|
|
10124
10213
|
),
|
|
10125
10214
|
assignedUserId: Number(formData.assignedUserId),
|
|
10126
10215
|
status: formData.status,
|
|
10127
|
-
dueDate:
|
|
10216
|
+
dueDate: toApiDateTime2(formData.dueDate),
|
|
10128
10217
|
slaStatus: formData.slaStatus,
|
|
10129
|
-
reminderSentOn:
|
|
10130
|
-
escalatedOn:
|
|
10218
|
+
reminderSentOn: toApiDateTime2(formData.reminderSentOn),
|
|
10219
|
+
escalatedOn: toApiDateTime2(formData.escalatedOn),
|
|
10131
10220
|
isActive: formData.isActive === "true",
|
|
10132
10221
|
updatedBy: "System"
|
|
10133
10222
|
};
|
|
@@ -10964,7 +11053,7 @@ var getTaskInstanceEndpoint2 = (action) => {
|
|
|
10964
11053
|
return TASK_INSTANCE_ENDPOINTS2[action];
|
|
10965
11054
|
}
|
|
10966
11055
|
};
|
|
10967
|
-
var
|
|
11056
|
+
var toApiDateTime3 = (value) => {
|
|
10968
11057
|
if (!value) return null;
|
|
10969
11058
|
if (typeof value === "string" && value.includes("T")) {
|
|
10970
11059
|
const parsed = new Date(value);
|
|
@@ -11031,10 +11120,10 @@ function AddTaskInstanceModal({
|
|
|
11031
11120
|
workflowStepId: Number(formData.workflowStepId),
|
|
11032
11121
|
assignedUserId: Number(formData.assignedUserId),
|
|
11033
11122
|
status: formData.status,
|
|
11034
|
-
dueDate:
|
|
11123
|
+
dueDate: toApiDateTime3(formData.dueDate),
|
|
11035
11124
|
slaStatus: formData.slaStatus,
|
|
11036
|
-
reminderSentOn:
|
|
11037
|
-
escalatedOn:
|
|
11125
|
+
reminderSentOn: toApiDateTime3(formData.reminderSentOn),
|
|
11126
|
+
escalatedOn: toApiDateTime3(formData.escalatedOn),
|
|
11038
11127
|
createdBy: formData.createdBy || "System"
|
|
11039
11128
|
};
|
|
11040
11129
|
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,64 @@ 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
|
+
workflowId: params.workflowId,
|
|
4820
|
+
workflowStepId: params.workflowStepId
|
|
4821
|
+
})
|
|
4794
4822
|
]);
|
|
4795
|
-
const unmappedRows = getRows2(unmappedResult);
|
|
4796
|
-
const mappedRows = getRows2(mappedResult);
|
|
4823
|
+
const unmappedRows = unmappedResult.status === "fulfilled" ? getRows2(unmappedResult.value) : [];
|
|
4824
|
+
const mappedRows = mappedResult.status === "fulfilled" ? getRows2(mappedResult.value) : [];
|
|
4797
4825
|
setUnmappedUsers(unmappedRows.length ? unmappedRows : dummyUnmappedUsers);
|
|
4798
4826
|
setMappedUsers(mappedRows.length ? mappedRows : dummyMappedUsers);
|
|
4827
|
+
setSelectedUnmappedIds([]);
|
|
4828
|
+
setSelectedMappedIds([]);
|
|
4799
4829
|
setHasFetched(true);
|
|
4800
|
-
} catch (
|
|
4801
|
-
console.warn(
|
|
4802
|
-
"Unable to fetch mapped users. Showing temporary demo data.",
|
|
4803
|
-
error
|
|
4804
|
-
);
|
|
4830
|
+
} catch (e) {
|
|
4805
4831
|
setUnmappedUsers(dummyUnmappedUsers);
|
|
4806
4832
|
setMappedUsers(dummyMappedUsers);
|
|
4833
|
+
setSelectedUnmappedIds([]);
|
|
4834
|
+
setSelectedMappedIds([]);
|
|
4807
4835
|
setHasFetched(true);
|
|
4808
4836
|
} finally {
|
|
4809
4837
|
setIsFetching(false);
|
|
4810
4838
|
}
|
|
4811
4839
|
};
|
|
4812
|
-
const
|
|
4840
|
+
const updateSelectedUsers = (setUserIds, userId, checked) => {
|
|
4841
|
+
const normalizedId = String(userId);
|
|
4842
|
+
setUserIds(
|
|
4843
|
+
(previous) => checked ? [.../* @__PURE__ */ new Set([...previous, normalizedId])] : previous.filter((id) => id !== normalizedId)
|
|
4844
|
+
);
|
|
4845
|
+
};
|
|
4846
|
+
const mapUsers = async (users = selectedUnmappedIds) => {
|
|
4813
4847
|
var _a, _b;
|
|
4814
|
-
const
|
|
4815
|
-
if (!
|
|
4816
|
-
setBusyUserId(
|
|
4848
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
4849
|
+
if (!externalUserIds.length) return;
|
|
4850
|
+
setBusyUserId("map");
|
|
4817
4851
|
try {
|
|
4818
4852
|
const endpoint2 = mappingEndpoints().create;
|
|
4819
4853
|
if (!endpoint2)
|
|
4820
4854
|
throw new Error(
|
|
4821
|
-
"
|
|
4855
|
+
"External user map endpoint is not configured."
|
|
4822
4856
|
);
|
|
4823
4857
|
await getApiService().post(endpoint2, {
|
|
4824
|
-
|
|
4858
|
+
workflowId: Number(formData.workflowId),
|
|
4825
4859
|
workflowStepId: Number(formData.workflowStepId),
|
|
4826
|
-
|
|
4827
|
-
roleCode: formData.roleCode,
|
|
4860
|
+
externalUserIds,
|
|
4828
4861
|
isPrimary: formData.isPrimary === "true",
|
|
4829
|
-
effectiveFrom: formData.effectiveFrom
|
|
4830
|
-
effectiveTo: formData.effectiveTo
|
|
4862
|
+
effectiveFrom: toApiDateTime(formData.effectiveFrom),
|
|
4863
|
+
effectiveTo: toApiDateTime(formData.effectiveTo),
|
|
4831
4864
|
createdBy: "System"
|
|
4832
4865
|
});
|
|
4866
|
+
setSelectedUnmappedIds([]);
|
|
4833
4867
|
await fetchUsers();
|
|
4834
4868
|
} catch (error) {
|
|
4835
4869
|
await Swal10.fire(
|
|
@@ -4841,35 +4875,28 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4841
4875
|
setBusyUserId(null);
|
|
4842
4876
|
}
|
|
4843
4877
|
};
|
|
4844
|
-
const
|
|
4845
|
-
var _a, _b
|
|
4846
|
-
const
|
|
4847
|
-
if (!
|
|
4848
|
-
setBusyUserId(
|
|
4878
|
+
const unmapUsers = async (users = selectedMappedIds) => {
|
|
4879
|
+
var _a, _b;
|
|
4880
|
+
const externalUserIds = users.map(String).filter(Boolean);
|
|
4881
|
+
if (!externalUserIds.length) return;
|
|
4882
|
+
setBusyUserId("unmap");
|
|
4849
4883
|
try {
|
|
4850
4884
|
const endpoint2 = mappingEndpoints().update;
|
|
4851
4885
|
if (!endpoint2)
|
|
4852
4886
|
throw new Error(
|
|
4853
|
-
"
|
|
4887
|
+
"External user unmap endpoint is not configured."
|
|
4854
4888
|
);
|
|
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,
|
|
4889
|
+
await getApiService().post(endpoint2, {
|
|
4860
4890
|
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,
|
|
4891
|
+
externalUserIds,
|
|
4866
4892
|
updatedBy: "System"
|
|
4867
4893
|
});
|
|
4894
|
+
setSelectedMappedIds([]);
|
|
4868
4895
|
await fetchUsers();
|
|
4869
4896
|
} catch (error) {
|
|
4870
4897
|
await Swal10.fire(
|
|
4871
4898
|
"Error",
|
|
4872
|
-
((
|
|
4899
|
+
((_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
4900
|
"error"
|
|
4874
4901
|
);
|
|
4875
4902
|
} finally {
|
|
@@ -4877,27 +4904,48 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4877
4904
|
}
|
|
4878
4905
|
};
|
|
4879
4906
|
const renderUser = (user, mapped) => {
|
|
4880
|
-
const userId =
|
|
4907
|
+
const userId = getUserId(user);
|
|
4908
|
+
const userValues = getUserValues(user);
|
|
4909
|
+
const normalizedUserId = String(userId);
|
|
4910
|
+
const isSelected = (mapped ? selectedMappedIds : selectedUnmappedIds).includes(
|
|
4911
|
+
normalizedUserId
|
|
4912
|
+
);
|
|
4881
4913
|
return /* @__PURE__ */ jsxs23(
|
|
4882
4914
|
"div",
|
|
4883
4915
|
{
|
|
4884
4916
|
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
4917
|
children: [
|
|
4918
|
+
/* @__PURE__ */ jsx24(
|
|
4919
|
+
"input",
|
|
4920
|
+
{
|
|
4921
|
+
type: "checkbox",
|
|
4922
|
+
checked: isSelected,
|
|
4923
|
+
onChange: (event) => updateSelectedUsers(
|
|
4924
|
+
mapped ? setSelectedMappedIds : setSelectedUnmappedIds,
|
|
4925
|
+
userId,
|
|
4926
|
+
event.target.checked
|
|
4927
|
+
),
|
|
4928
|
+
className: "fc:shrink-0"
|
|
4929
|
+
}
|
|
4930
|
+
),
|
|
4886
4931
|
/* @__PURE__ */ jsxs23("div", { className: "fc:min-w-0", children: [
|
|
4887
4932
|
/* @__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
|
-
|
|
4933
|
+
/* @__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: [
|
|
4934
|
+
/* @__PURE__ */ jsxs23("span", { className: "fc:font-semibold fc:text-slate-600", children: [
|
|
4935
|
+
key,
|
|
4936
|
+
": "
|
|
4937
|
+
] }),
|
|
4938
|
+
/* @__PURE__ */ jsx24("span", { className: "fc:break-words", children: value === null || value === void 0 ? "-" : typeof value === "object" ? JSON.stringify(value) : String(value) })
|
|
4939
|
+
] }, key)) })
|
|
4892
4940
|
] }),
|
|
4893
4941
|
/* @__PURE__ */ jsx24(
|
|
4894
4942
|
"button",
|
|
4895
4943
|
{
|
|
4896
4944
|
type: "button",
|
|
4897
|
-
disabled: busyUserId
|
|
4898
|
-
onClick: () => mapped ?
|
|
4945
|
+
disabled: busyUserId !== null,
|
|
4946
|
+
onClick: () => mapped ? unmapUsers([userId]) : mapUsers([userId]),
|
|
4899
4947
|
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
|
|
4948
|
+
children: busyUserId !== null ? "..." : mapped ? "Unmap" : "Map"
|
|
4901
4949
|
}
|
|
4902
4950
|
)
|
|
4903
4951
|
]
|
|
@@ -4944,62 +4992,57 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
4944
4992
|
"div",
|
|
4945
4993
|
{
|
|
4946
4994
|
className: "fc:grid fc:items-end fc:gap-3",
|
|
4947
|
-
style: { gridTemplateColumns: "repeat(
|
|
4995
|
+
style: { gridTemplateColumns: "repeat(4, minmax(0, 1fr))" },
|
|
4948
4996
|
children: [
|
|
4949
4997
|
/* @__PURE__ */ jsxs23("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
4950
|
-
"Workflow
|
|
4998
|
+
"Workflow",
|
|
4951
4999
|
/* @__PURE__ */ jsxs23(
|
|
4952
5000
|
"select",
|
|
4953
5001
|
{
|
|
4954
|
-
name: "
|
|
4955
|
-
value: formData.
|
|
5002
|
+
name: "workflowId",
|
|
5003
|
+
value: formData.workflowId,
|
|
4956
5004
|
onChange: handleChange,
|
|
4957
|
-
disabled:
|
|
5005
|
+
disabled: isLoadingWorkflows,
|
|
4958
5006
|
style: fieldStyle,
|
|
4959
5007
|
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
5008
|
children: [
|
|
4961
|
-
/* @__PURE__ */ jsx24("option", { value: "", children: "Select
|
|
4962
|
-
|
|
4963
|
-
var _a, _b, _c, _d, _e
|
|
4964
|
-
const id = (_b = (_a =
|
|
4965
|
-
const name = (
|
|
5009
|
+
/* @__PURE__ */ jsx24("option", { value: "", children: "Select workflow" }),
|
|
5010
|
+
workflows.map((workflow) => {
|
|
5011
|
+
var _a, _b, _c, _d, _e;
|
|
5012
|
+
const id = (_b = (_a = workflow.workflowId) != null ? _a : workflow.WorkflowId) != null ? _b : workflow.id;
|
|
5013
|
+
const name = (_e = (_d = (_c = workflow.workflowName) != null ? _c : workflow.WorkflowName) != null ? _d : workflow.name) != null ? _e : `Workflow ${id}`;
|
|
4966
5014
|
return /* @__PURE__ */ jsxs23("option", { value: id, children: [
|
|
4967
5015
|
id,
|
|
4968
|
-
|
|
5016
|
+
" - ",
|
|
5017
|
+
name
|
|
4969
5018
|
] }, id);
|
|
4970
5019
|
})
|
|
4971
5020
|
]
|
|
4972
5021
|
}
|
|
4973
5022
|
)
|
|
4974
5023
|
] }),
|
|
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
5024
|
/* @__PURE__ */ jsxs23("label", { className: "fc:text-xs fc:font-semibold fc:text-slate-600", children: [
|
|
4990
|
-
"
|
|
5025
|
+
"Workflow Step",
|
|
4991
5026
|
/* @__PURE__ */ jsxs23(
|
|
4992
5027
|
"select",
|
|
4993
5028
|
{
|
|
4994
|
-
name: "
|
|
4995
|
-
value: formData.
|
|
5029
|
+
name: "workflowStepId",
|
|
5030
|
+
value: formData.workflowStepId,
|
|
4996
5031
|
onChange: handleChange,
|
|
5032
|
+
disabled: isLoadingWorkflowSteps || !formData.workflowId,
|
|
4997
5033
|
style: fieldStyle,
|
|
4998
5034
|
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
5035
|
children: [
|
|
5000
|
-
/* @__PURE__ */ jsx24("option", { value: "", children: "Select" }),
|
|
5001
|
-
|
|
5002
|
-
|
|
5036
|
+
/* @__PURE__ */ jsx24("option", { value: "", children: "Select step" }),
|
|
5037
|
+
filteredWorkflowSteps.map((step) => {
|
|
5038
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5039
|
+
const id = (_b = (_a = step.workflowStepId) != null ? _a : step.WorkflowStepId) != null ? _b : step.id;
|
|
5040
|
+
const name = (_f = (_e = (_d = (_c = step.stepName) != null ? _c : step.StepName) != null ? _d : step.name) != null ? _e : step.workflowStepName) != null ? _f : step.WorkflowStepName;
|
|
5041
|
+
return /* @__PURE__ */ jsxs23("option", { value: id, children: [
|
|
5042
|
+
id,
|
|
5043
|
+
name ? ` - ${name}` : ""
|
|
5044
|
+
] }, id);
|
|
5045
|
+
})
|
|
5003
5046
|
]
|
|
5004
5047
|
}
|
|
5005
5048
|
)
|
|
@@ -5076,8 +5119,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5076
5119
|
style: { order: 2 },
|
|
5077
5120
|
children: [
|
|
5078
5121
|
/* @__PURE__ */ jsxs23("header", { className: "fc:flex fc:justify-between fc:bg-amber-50 fc:px-4 fc:py-2.5", children: [
|
|
5079
|
-
/* @__PURE__ */
|
|
5080
|
-
|
|
5122
|
+
/* @__PURE__ */ jsxs23("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-amber-800", children: [
|
|
5123
|
+
/* @__PURE__ */ jsx24(
|
|
5124
|
+
"input",
|
|
5125
|
+
{
|
|
5126
|
+
type: "checkbox",
|
|
5127
|
+
checked: unmappedUsers.length > 0 && selectedUnmappedIds.length === unmappedUsers.length,
|
|
5128
|
+
onChange: (event) => setSelectedUnmappedIds(
|
|
5129
|
+
event.target.checked ? unmappedUsers.map((user) => String(getUserId(user))) : []
|
|
5130
|
+
)
|
|
5131
|
+
}
|
|
5132
|
+
),
|
|
5133
|
+
"Unmapped Users (",
|
|
5134
|
+
unmappedUsers.length,
|
|
5135
|
+
")"
|
|
5136
|
+
] }),
|
|
5137
|
+
/* @__PURE__ */ jsx24(
|
|
5138
|
+
"button",
|
|
5139
|
+
{
|
|
5140
|
+
type: "button",
|
|
5141
|
+
disabled: !selectedUnmappedIds.length || busyUserId !== null,
|
|
5142
|
+
onClick: () => mapUsers(),
|
|
5143
|
+
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",
|
|
5144
|
+
children: "Map Selected"
|
|
5145
|
+
}
|
|
5146
|
+
)
|
|
5081
5147
|
] }),
|
|
5082
5148
|
/* @__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
5149
|
]
|
|
@@ -5090,8 +5156,31 @@ function AddUserHierarchyNodeMappingModal({ isOpen, onClose }) {
|
|
|
5090
5156
|
style: { order: 1 },
|
|
5091
5157
|
children: [
|
|
5092
5158
|
/* @__PURE__ */ jsxs23("header", { className: "fc:flex fc:justify-between fc:bg-emerald-50 fc:px-4 fc:py-2.5", children: [
|
|
5093
|
-
/* @__PURE__ */
|
|
5094
|
-
|
|
5159
|
+
/* @__PURE__ */ jsxs23("label", { className: "fc:flex fc:items-center fc:gap-2 fc:text-xs fc:font-bold fc:text-emerald-800", children: [
|
|
5160
|
+
/* @__PURE__ */ jsx24(
|
|
5161
|
+
"input",
|
|
5162
|
+
{
|
|
5163
|
+
type: "checkbox",
|
|
5164
|
+
checked: mappedUsers.length > 0 && selectedMappedIds.length === mappedUsers.length,
|
|
5165
|
+
onChange: (event) => setSelectedMappedIds(
|
|
5166
|
+
event.target.checked ? mappedUsers.map((user) => String(getUserId(user))) : []
|
|
5167
|
+
)
|
|
5168
|
+
}
|
|
5169
|
+
),
|
|
5170
|
+
"Mapped Users (",
|
|
5171
|
+
mappedUsers.length,
|
|
5172
|
+
")"
|
|
5173
|
+
] }),
|
|
5174
|
+
/* @__PURE__ */ jsx24(
|
|
5175
|
+
"button",
|
|
5176
|
+
{
|
|
5177
|
+
type: "button",
|
|
5178
|
+
disabled: !selectedMappedIds.length || busyUserId !== null,
|
|
5179
|
+
onClick: () => unmapUsers(),
|
|
5180
|
+
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",
|
|
5181
|
+
children: "Unmap Selected"
|
|
5182
|
+
}
|
|
5183
|
+
)
|
|
5095
5184
|
] }),
|
|
5096
5185
|
/* @__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
5186
|
]
|
|
@@ -5207,7 +5296,7 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5207
5296
|
[name]: value
|
|
5208
5297
|
}));
|
|
5209
5298
|
};
|
|
5210
|
-
const
|
|
5299
|
+
const toApiDateTime4 = (value) => {
|
|
5211
5300
|
if (!value) return null;
|
|
5212
5301
|
if (typeof value === "string" && value.includes("T")) {
|
|
5213
5302
|
const parsed = new Date(value);
|
|
@@ -5232,8 +5321,8 @@ function EditUserHierarchyNodeMappingModal({
|
|
|
5232
5321
|
externalUserId: Number(selectedMapping.externalUserId),
|
|
5233
5322
|
workflowStepId: Number(formData.workflowStepId),
|
|
5234
5323
|
isPrimary: formData.isPrimary === "true",
|
|
5235
|
-
effectiveFrom:
|
|
5236
|
-
effectiveTo:
|
|
5324
|
+
effectiveFrom: toApiDateTime4(formData.effectiveFrom),
|
|
5325
|
+
effectiveTo: toApiDateTime4(formData.effectiveTo),
|
|
5237
5326
|
isActive: (_e = (_d = selectedMapping.isActive) != null ? _d : selectedMapping.status) != null ? _e : true,
|
|
5238
5327
|
updatedBy: selectedMapping.updatedBy || selectedMapping.createdBy || "System"
|
|
5239
5328
|
});
|
|
@@ -9850,7 +9939,7 @@ var formatDateForInput = (value) => {
|
|
|
9850
9939
|
const day = String(date.getUTCDate()).padStart(2, "0");
|
|
9851
9940
|
return `${year}-${month}-${day}`;
|
|
9852
9941
|
};
|
|
9853
|
-
var
|
|
9942
|
+
var toApiDateTime2 = (value) => {
|
|
9854
9943
|
if (!value) return null;
|
|
9855
9944
|
if (typeof value === "string" && value.includes("T")) {
|
|
9856
9945
|
const parsed = new Date(value);
|
|
@@ -9962,10 +10051,10 @@ function EditTaskInstanceModal({
|
|
|
9962
10051
|
),
|
|
9963
10052
|
assignedUserId: Number(formData.assignedUserId),
|
|
9964
10053
|
status: formData.status,
|
|
9965
|
-
dueDate:
|
|
10054
|
+
dueDate: toApiDateTime2(formData.dueDate),
|
|
9966
10055
|
slaStatus: formData.slaStatus,
|
|
9967
|
-
reminderSentOn:
|
|
9968
|
-
escalatedOn:
|
|
10056
|
+
reminderSentOn: toApiDateTime2(formData.reminderSentOn),
|
|
10057
|
+
escalatedOn: toApiDateTime2(formData.escalatedOn),
|
|
9969
10058
|
isActive: formData.isActive === "true",
|
|
9970
10059
|
updatedBy: "System"
|
|
9971
10060
|
};
|
|
@@ -10800,7 +10889,7 @@ var getTaskInstanceEndpoint2 = (action) => {
|
|
|
10800
10889
|
return TASK_INSTANCE_ENDPOINTS2[action];
|
|
10801
10890
|
}
|
|
10802
10891
|
};
|
|
10803
|
-
var
|
|
10892
|
+
var toApiDateTime3 = (value) => {
|
|
10804
10893
|
if (!value) return null;
|
|
10805
10894
|
if (typeof value === "string" && value.includes("T")) {
|
|
10806
10895
|
const parsed = new Date(value);
|
|
@@ -10867,10 +10956,10 @@ function AddTaskInstanceModal({
|
|
|
10867
10956
|
workflowStepId: Number(formData.workflowStepId),
|
|
10868
10957
|
assignedUserId: Number(formData.assignedUserId),
|
|
10869
10958
|
status: formData.status,
|
|
10870
|
-
dueDate:
|
|
10959
|
+
dueDate: toApiDateTime3(formData.dueDate),
|
|
10871
10960
|
slaStatus: formData.slaStatus,
|
|
10872
|
-
reminderSentOn:
|
|
10873
|
-
escalatedOn:
|
|
10961
|
+
reminderSentOn: toApiDateTime3(formData.reminderSentOn),
|
|
10962
|
+
escalatedOn: toApiDateTime3(formData.escalatedOn),
|
|
10874
10963
|
createdBy: formData.createdBy || "System"
|
|
10875
10964
|
};
|
|
10876
10965
|
setIsSubmitting(true);
|