@mseva/digit-ui-module-ndc 1.0.41 → 1.0.42
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/index.js +340 -326
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +279 -265
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -921,275 +921,6 @@ function NDCDocument$1(_ref2) {
|
|
|
921
921
|
}))));
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
-
const ModalConfig = _ref => {
|
|
925
|
-
let {
|
|
926
|
-
t,
|
|
927
|
-
action,
|
|
928
|
-
approvers,
|
|
929
|
-
selectedApprover,
|
|
930
|
-
setSelectedApprover,
|
|
931
|
-
selectFile,
|
|
932
|
-
uploadedFile,
|
|
933
|
-
setUploadedFile,
|
|
934
|
-
assigneeLabel,
|
|
935
|
-
businessService
|
|
936
|
-
} = _ref;
|
|
937
|
-
let checkCondtions = true;
|
|
938
|
-
if ((action === null || action === void 0 ? void 0 : action.action) == "SENDBACKTOCITIZEN" || (action === null || action === void 0 ? void 0 : action.action) == "APPROVE" || (action === null || action === void 0 ? void 0 : action.action) == "REJECT" || (action === null || action === void 0 ? void 0 : action.action) == "SENDBACK") checkCondtions = false;
|
|
939
|
-
if (action.isTerminateState) checkCondtions = false;
|
|
940
|
-
console.log("action=====", action.action);
|
|
941
|
-
return {
|
|
942
|
-
label: {
|
|
943
|
-
heading: "",
|
|
944
|
-
submit: "" + (action === null || action === void 0 ? void 0 : action.action),
|
|
945
|
-
cancel: "WF_EMPLOYEE_NEWTL_CANCEL"
|
|
946
|
-
},
|
|
947
|
-
form: [{
|
|
948
|
-
body: [{
|
|
949
|
-
label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL") + " *",
|
|
950
|
-
placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"),
|
|
951
|
-
type: "dropdown",
|
|
952
|
-
populators: !checkCondtions ? null : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
953
|
-
option: approvers,
|
|
954
|
-
autoComplete: "off",
|
|
955
|
-
optionKey: "name",
|
|
956
|
-
id: "fieldInspector",
|
|
957
|
-
select: setSelectedApprover,
|
|
958
|
-
selected: selectedApprover
|
|
959
|
-
})
|
|
960
|
-
}, {
|
|
961
|
-
label: t("CS_COMMON_COMMENTS") + " *",
|
|
962
|
-
type: "textarea",
|
|
963
|
-
populators: {
|
|
964
|
-
name: "comments"
|
|
965
|
-
}
|
|
966
|
-
}, {
|
|
967
|
-
label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),
|
|
968
|
-
populators: /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
|
|
969
|
-
id: "workflow-doc",
|
|
970
|
-
onUpload: selectFile,
|
|
971
|
-
onDelete: () => {
|
|
972
|
-
setUploadedFile(null);
|
|
973
|
-
},
|
|
974
|
-
message: uploadedFile ? "1 " + t("ES_PT_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED")
|
|
975
|
-
})
|
|
976
|
-
}]
|
|
977
|
-
}]
|
|
978
|
-
};
|
|
979
|
-
};
|
|
980
|
-
|
|
981
|
-
const Heading = props => {
|
|
982
|
-
return /*#__PURE__*/React__default.createElement("h1", {
|
|
983
|
-
className: "heading-m"
|
|
984
|
-
}, props.label);
|
|
985
|
-
};
|
|
986
|
-
const Close = () => /*#__PURE__*/React__default.createElement("svg", {
|
|
987
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
988
|
-
viewBox: "0 0 24 24",
|
|
989
|
-
fill: "#FFFFFF"
|
|
990
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
991
|
-
d: "M0 0h24v24H0V0z",
|
|
992
|
-
fill: "none"
|
|
993
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
994
|
-
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
995
|
-
}));
|
|
996
|
-
const CloseBtn = props => {
|
|
997
|
-
return /*#__PURE__*/React__default.createElement("div", {
|
|
998
|
-
className: "icon-bg-secondary",
|
|
999
|
-
onClick: props.onClick
|
|
1000
|
-
}, /*#__PURE__*/React__default.createElement(Close, null));
|
|
1001
|
-
};
|
|
1002
|
-
const NDCModal = _ref => {
|
|
1003
|
-
var _action$state;
|
|
1004
|
-
let {
|
|
1005
|
-
t,
|
|
1006
|
-
action,
|
|
1007
|
-
tenantId,
|
|
1008
|
-
state,
|
|
1009
|
-
id,
|
|
1010
|
-
closeModal,
|
|
1011
|
-
submitAction,
|
|
1012
|
-
actionData,
|
|
1013
|
-
applicationDetails,
|
|
1014
|
-
applicationData,
|
|
1015
|
-
businessService,
|
|
1016
|
-
moduleCode,
|
|
1017
|
-
workflowDetails,
|
|
1018
|
-
showToast,
|
|
1019
|
-
closeToast,
|
|
1020
|
-
errors,
|
|
1021
|
-
showErrorToast,
|
|
1022
|
-
errorOne,
|
|
1023
|
-
closeToastOne,
|
|
1024
|
-
getEmployees
|
|
1025
|
-
} = _ref;
|
|
1026
|
-
const [config, setConfig] = React.useState({});
|
|
1027
|
-
const [defaultValues, setDefaultValues] = React.useState({});
|
|
1028
|
-
const [approvers, setApprovers] = React.useState([]);
|
|
1029
|
-
const [selectedApprover, setSelectedApprover] = React.useState({});
|
|
1030
|
-
const [file, setFile] = React.useState(null);
|
|
1031
|
-
const [uploadedFile, setUploadedFile] = React.useState(null);
|
|
1032
|
-
const [error, setError] = React.useState(null);
|
|
1033
|
-
const [financialYears, setFinancialYears] = React.useState([]);
|
|
1034
|
-
const [selectedFinancialYear, setSelectedFinancialYear] = React.useState(null);
|
|
1035
|
-
const checkRole = action === null || action === void 0 ? void 0 : (_action$state = action.state) === null || _action$state === void 0 ? void 0 : _action$state.actions;
|
|
1036
|
-
const allRoles = [...new Set(checkRole === null || checkRole === void 0 ? void 0 : checkRole.flatMap(a => a.roles))];
|
|
1037
|
-
const allRolesNew = [...new Set(getEmployees === null || getEmployees === void 0 ? void 0 : getEmployees.flatMap(a => a.roles))];
|
|
1038
|
-
console.log("getEmployees", getEmployees);
|
|
1039
|
-
console.log("allRoles", allRoles);
|
|
1040
|
-
console.log("allRolesNew", allRolesNew);
|
|
1041
|
-
const {
|
|
1042
|
-
data: approverData,
|
|
1043
|
-
isLoading: PTALoading
|
|
1044
|
-
} = Digit.Hooks.useEmployeeSearch(tenantId, {
|
|
1045
|
-
roles: allRolesNew === null || allRolesNew === void 0 ? void 0 : allRolesNew.map(role => ({
|
|
1046
|
-
code: role
|
|
1047
|
-
})),
|
|
1048
|
-
isActive: true
|
|
1049
|
-
}, {
|
|
1050
|
-
enabled: !(action !== null && action !== void 0 && action.isTerminateState)
|
|
1051
|
-
});
|
|
1052
|
-
const {
|
|
1053
|
-
isLoading: financialYearsLoading,
|
|
1054
|
-
data: financialYearsData
|
|
1055
|
-
} = Digit.Hooks.pt.useMDMS(tenantId, businessService, "FINANCIAL_YEARLS", {}, {
|
|
1056
|
-
details: {
|
|
1057
|
-
tenantId: Digit.ULBService.getStateId(),
|
|
1058
|
-
moduleDetails: [{
|
|
1059
|
-
moduleName: "egf-master",
|
|
1060
|
-
masterDetails: [{
|
|
1061
|
-
name: "FinancialYear",
|
|
1062
|
-
filter: "[?(@.module == 'TL')]"
|
|
1063
|
-
}]
|
|
1064
|
-
}]
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
React.useEffect(() => {
|
|
1068
|
-
if (financialYearsData && financialYearsData["egf-master"]) {
|
|
1069
|
-
var _financialYearsData$e;
|
|
1070
|
-
setFinancialYears((_financialYearsData$e = financialYearsData["egf-master"]) === null || _financialYearsData$e === void 0 ? void 0 : _financialYearsData$e["FinancialYear"]);
|
|
1071
|
-
}
|
|
1072
|
-
}, [financialYearsData]);
|
|
1073
|
-
const {
|
|
1074
|
-
data: EmployeeStatusData
|
|
1075
|
-
} = Digit.Hooks.useCustomMDMS(tenantId, "common-masters", [{
|
|
1076
|
-
name: "Department"
|
|
1077
|
-
}]);
|
|
1078
|
-
React.useEffect(() => {
|
|
1079
|
-
if (approverData && EmployeeStatusData) {
|
|
1080
|
-
var _approverData$Employe;
|
|
1081
|
-
const departments = EmployeeStatusData["common-masters"].Department;
|
|
1082
|
-
setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
|
|
1083
|
-
var _employee$assignments, _employee$assignments2, _employee$user;
|
|
1084
|
-
const deptCode = employee === null || employee === void 0 ? void 0 : (_employee$assignments = employee.assignments) === null || _employee$assignments === void 0 ? void 0 : (_employee$assignments2 = _employee$assignments[0]) === null || _employee$assignments2 === void 0 ? void 0 : _employee$assignments2.department;
|
|
1085
|
-
const matchedDept = departments === null || departments === void 0 ? void 0 : departments.find(d => (d === null || d === void 0 ? void 0 : d.code) === deptCode);
|
|
1086
|
-
return {
|
|
1087
|
-
uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
|
|
1088
|
-
name: (employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name) + " - " + (matchedDept === null || matchedDept === void 0 ? void 0 : matchedDept.name)
|
|
1089
|
-
};
|
|
1090
|
-
}));
|
|
1091
|
-
}
|
|
1092
|
-
}, [approverData]);
|
|
1093
|
-
function selectFile(e) {
|
|
1094
|
-
setFile(e.target.files[0]);
|
|
1095
|
-
}
|
|
1096
|
-
React.useEffect(() => {
|
|
1097
|
-
(function () {
|
|
1098
|
-
try {
|
|
1099
|
-
setError(null);
|
|
1100
|
-
const _temp3 = function () {
|
|
1101
|
-
if (file) {
|
|
1102
|
-
const _temp2 = function () {
|
|
1103
|
-
if (file.size >= 5242880) {
|
|
1104
|
-
setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
|
|
1105
|
-
} else {
|
|
1106
|
-
const _temp = _catch(function () {
|
|
1107
|
-
return Promise.resolve(Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId())).then(function (response) {
|
|
1108
|
-
var _response$data, _response$data$files;
|
|
1109
|
-
if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
|
|
1110
|
-
var _response$data2, _response$data2$files;
|
|
1111
|
-
setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
|
|
1112
|
-
} else {
|
|
1113
|
-
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
|
-
}, function () {
|
|
1117
|
-
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
1118
|
-
});
|
|
1119
|
-
if (_temp && _temp.then) return _temp.then(function () {});
|
|
1120
|
-
}
|
|
1121
|
-
}();
|
|
1122
|
-
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
1123
|
-
}
|
|
1124
|
-
}();
|
|
1125
|
-
return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
|
|
1126
|
-
} catch (e) {
|
|
1127
|
-
Promise.reject(e);
|
|
1128
|
-
}
|
|
1129
|
-
})();
|
|
1130
|
-
}, [file]);
|
|
1131
|
-
function submit(data) {
|
|
1132
|
-
applicationData = _extends({}, applicationData, {
|
|
1133
|
-
action: action === null || action === void 0 ? void 0 : action.action,
|
|
1134
|
-
comment: data === null || data === void 0 ? void 0 : data.comments,
|
|
1135
|
-
assignee: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid],
|
|
1136
|
-
wfDocuments: uploadedFile ? [{
|
|
1137
|
-
documentType: file === null || file === void 0 ? void 0 : file.type,
|
|
1138
|
-
documentUid: file === null || file === void 0 ? void 0 : file.name,
|
|
1139
|
-
fileStoreId: uploadedFile
|
|
1140
|
-
}] : null
|
|
1141
|
-
});
|
|
1142
|
-
submitAction({
|
|
1143
|
-
Licenses: [applicationData]
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
React.useEffect(() => {
|
|
1147
|
-
if (action) {
|
|
1148
|
-
setConfig(ModalConfig({
|
|
1149
|
-
t,
|
|
1150
|
-
action,
|
|
1151
|
-
approvers,
|
|
1152
|
-
selectedApprover,
|
|
1153
|
-
setSelectedApprover,
|
|
1154
|
-
selectFile,
|
|
1155
|
-
uploadedFile,
|
|
1156
|
-
setUploadedFile,
|
|
1157
|
-
businessService
|
|
1158
|
-
}));
|
|
1159
|
-
}
|
|
1160
|
-
}, [action, approvers, financialYears, selectedFinancialYear, uploadedFile]);
|
|
1161
|
-
return action && config.form ? /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
|
|
1162
|
-
headerBarMain: /*#__PURE__*/React__default.createElement(Heading, {
|
|
1163
|
-
label: t(config.label.heading)
|
|
1164
|
-
}),
|
|
1165
|
-
headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn, {
|
|
1166
|
-
onClick: closeModal
|
|
1167
|
-
}),
|
|
1168
|
-
actionCancelLabel: t(config.label.cancel),
|
|
1169
|
-
actionCancelOnSubmit: closeModal,
|
|
1170
|
-
actionSaveLabel: t(config.label.submit),
|
|
1171
|
-
actionSaveOnSubmit: () => {},
|
|
1172
|
-
formId: "modal-action"
|
|
1173
|
-
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
|
|
1174
|
-
config: config.form,
|
|
1175
|
-
noBoxShadow: true,
|
|
1176
|
-
inline: true,
|
|
1177
|
-
childrenAtTheBottom: true,
|
|
1178
|
-
onSubmit: submit,
|
|
1179
|
-
defaultValues: defaultValues,
|
|
1180
|
-
formId: "modal-action"
|
|
1181
|
-
}), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
1182
|
-
error: showToast.key === "error" ? true : false,
|
|
1183
|
-
label: errors,
|
|
1184
|
-
onClose: closeToast
|
|
1185
|
-
}), showErrorToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
1186
|
-
error: true,
|
|
1187
|
-
label: errorOne,
|
|
1188
|
-
isDleteBtn: true,
|
|
1189
|
-
onClose: closeToastOne
|
|
1190
|
-
})) : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Loader, null);
|
|
1191
|
-
};
|
|
1192
|
-
|
|
1193
924
|
var b = "function" === typeof Symbol && Symbol.for,
|
|
1194
925
|
c = b ? Symbol.for("react.element") : 60103,
|
|
1195
926
|
d = b ? Symbol.for("react.portal") : 60106,
|
|
@@ -2062,60 +1793,332 @@ var factoryWithThrowingShims = function () {
|
|
|
2062
1793
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
2063
1794
|
return ReactPropTypes;
|
|
2064
1795
|
};
|
|
2065
|
-
|
|
2066
|
-
var propTypes = createCommonjsModule(function (module) {
|
|
2067
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
2068
|
-
var ReactIs = reactIs;
|
|
2069
|
-
var throwOnDirectAccess = true;
|
|
2070
|
-
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
2071
|
-
} else {
|
|
2072
|
-
module.exports = factoryWithThrowingShims();
|
|
2073
|
-
}
|
|
2074
|
-
});
|
|
2075
|
-
|
|
2076
|
-
const Loader = _ref => {
|
|
1796
|
+
|
|
1797
|
+
var propTypes = createCommonjsModule(function (module) {
|
|
1798
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1799
|
+
var ReactIs = reactIs;
|
|
1800
|
+
var throwOnDirectAccess = true;
|
|
1801
|
+
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1802
|
+
} else {
|
|
1803
|
+
module.exports = factoryWithThrowingShims();
|
|
1804
|
+
}
|
|
1805
|
+
});
|
|
1806
|
+
|
|
1807
|
+
const Loader = _ref => {
|
|
1808
|
+
let {
|
|
1809
|
+
page = false
|
|
1810
|
+
} = _ref;
|
|
1811
|
+
const baseStyle = {
|
|
1812
|
+
display: "flex",
|
|
1813
|
+
justifyContent: "center",
|
|
1814
|
+
alignItems: "center"
|
|
1815
|
+
};
|
|
1816
|
+
const pageStyle = _extends({}, baseStyle, {
|
|
1817
|
+
position: "fixed",
|
|
1818
|
+
top: 0,
|
|
1819
|
+
left: 0,
|
|
1820
|
+
width: "100vw",
|
|
1821
|
+
height: "100vh",
|
|
1822
|
+
background: "rgba(255,255,255,0.6)",
|
|
1823
|
+
backdropFilter: "blur(4px)",
|
|
1824
|
+
zIndex: 9999
|
|
1825
|
+
});
|
|
1826
|
+
const moduleStyle = _extends({}, baseStyle, {
|
|
1827
|
+
minHeight: "100px",
|
|
1828
|
+
width: "100%",
|
|
1829
|
+
position: "relative"
|
|
1830
|
+
});
|
|
1831
|
+
const spinnerStyle = {
|
|
1832
|
+
width: "64px",
|
|
1833
|
+
height: "64px",
|
|
1834
|
+
border: "8px solid #1976d2",
|
|
1835
|
+
borderTop: "8px solid transparent",
|
|
1836
|
+
borderRadius: "50%",
|
|
1837
|
+
animation: "spin 1.2s linear infinite"
|
|
1838
|
+
};
|
|
1839
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1840
|
+
style: page ? pageStyle : moduleStyle
|
|
1841
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
1842
|
+
style: spinnerStyle
|
|
1843
|
+
}), /*#__PURE__*/React__default.createElement("style", null, "\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "));
|
|
1844
|
+
};
|
|
1845
|
+
Loader.propTypes = {
|
|
1846
|
+
page: propTypes.bool
|
|
1847
|
+
};
|
|
1848
|
+
Loader.defaultProps = {
|
|
1849
|
+
page: false
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
const ModalConfig = _ref => {
|
|
1853
|
+
let {
|
|
1854
|
+
t,
|
|
1855
|
+
action,
|
|
1856
|
+
approvers,
|
|
1857
|
+
selectedApprover,
|
|
1858
|
+
setSelectedApprover,
|
|
1859
|
+
selectFile,
|
|
1860
|
+
uploadedFile,
|
|
1861
|
+
setUploadedFile,
|
|
1862
|
+
assigneeLabel,
|
|
1863
|
+
businessService
|
|
1864
|
+
} = _ref;
|
|
1865
|
+
let checkCondtions = true;
|
|
1866
|
+
if ((action === null || action === void 0 ? void 0 : action.action) == "SENDBACKTOCITIZEN" || (action === null || action === void 0 ? void 0 : action.action) == "APPROVE" || (action === null || action === void 0 ? void 0 : action.action) == "REJECT" || (action === null || action === void 0 ? void 0 : action.action) == "SENDBACK") checkCondtions = false;
|
|
1867
|
+
if (action.isTerminateState) checkCondtions = false;
|
|
1868
|
+
console.log("action=====", action.action);
|
|
1869
|
+
return {
|
|
1870
|
+
label: {
|
|
1871
|
+
heading: "",
|
|
1872
|
+
submit: "" + (action === null || action === void 0 ? void 0 : action.action),
|
|
1873
|
+
cancel: "WF_EMPLOYEE_NEWTL_CANCEL"
|
|
1874
|
+
},
|
|
1875
|
+
form: [{
|
|
1876
|
+
body: [{
|
|
1877
|
+
label: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_LABEL") + " *",
|
|
1878
|
+
placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"),
|
|
1879
|
+
type: "dropdown",
|
|
1880
|
+
populators: !checkCondtions ? null : /*#__PURE__*/React__default.createElement(digitUiReactComponents.Dropdown, {
|
|
1881
|
+
option: approvers,
|
|
1882
|
+
autoComplete: "off",
|
|
1883
|
+
optionKey: "name",
|
|
1884
|
+
id: "fieldInspector",
|
|
1885
|
+
select: setSelectedApprover,
|
|
1886
|
+
selected: selectedApprover
|
|
1887
|
+
})
|
|
1888
|
+
}, {
|
|
1889
|
+
label: t("CS_COMMON_COMMENTS") + " *",
|
|
1890
|
+
type: "textarea",
|
|
1891
|
+
populators: {
|
|
1892
|
+
name: "comments"
|
|
1893
|
+
}
|
|
1894
|
+
}, {
|
|
1895
|
+
label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),
|
|
1896
|
+
populators: /*#__PURE__*/React__default.createElement(digitUiReactComponents.UploadFile, {
|
|
1897
|
+
id: "workflow-doc",
|
|
1898
|
+
onUpload: selectFile,
|
|
1899
|
+
onDelete: () => {
|
|
1900
|
+
setUploadedFile(null);
|
|
1901
|
+
},
|
|
1902
|
+
message: uploadedFile ? "1 " + t("ES_PT_ACTION_FILEUPLOADED") : t("CS_ACTION_NO_FILEUPLOADED")
|
|
1903
|
+
})
|
|
1904
|
+
}]
|
|
1905
|
+
}]
|
|
1906
|
+
};
|
|
1907
|
+
};
|
|
1908
|
+
|
|
1909
|
+
const Heading = props => {
|
|
1910
|
+
return /*#__PURE__*/React__default.createElement("h1", {
|
|
1911
|
+
className: "heading-m"
|
|
1912
|
+
}, props.label);
|
|
1913
|
+
};
|
|
1914
|
+
const Close = () => /*#__PURE__*/React__default.createElement("svg", {
|
|
1915
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1916
|
+
viewBox: "0 0 24 24",
|
|
1917
|
+
fill: "#FFFFFF"
|
|
1918
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
1919
|
+
d: "M0 0h24v24H0V0z",
|
|
1920
|
+
fill: "none"
|
|
1921
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
1922
|
+
d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"
|
|
1923
|
+
}));
|
|
1924
|
+
const CloseBtn = props => {
|
|
1925
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1926
|
+
className: "icon-bg-secondary",
|
|
1927
|
+
onClick: props.onClick
|
|
1928
|
+
}, /*#__PURE__*/React__default.createElement(Close, null));
|
|
1929
|
+
};
|
|
1930
|
+
const NDCModal = _ref => {
|
|
1931
|
+
var _action$state;
|
|
2077
1932
|
let {
|
|
2078
|
-
|
|
1933
|
+
t,
|
|
1934
|
+
action,
|
|
1935
|
+
tenantId,
|
|
1936
|
+
state,
|
|
1937
|
+
id,
|
|
1938
|
+
closeModal,
|
|
1939
|
+
submitAction,
|
|
1940
|
+
actionData,
|
|
1941
|
+
applicationDetails,
|
|
1942
|
+
applicationData,
|
|
1943
|
+
businessService,
|
|
1944
|
+
moduleCode,
|
|
1945
|
+
workflowDetails,
|
|
1946
|
+
showToast,
|
|
1947
|
+
closeToast,
|
|
1948
|
+
errors,
|
|
1949
|
+
showErrorToast,
|
|
1950
|
+
errorOne,
|
|
1951
|
+
closeToastOne,
|
|
1952
|
+
getEmployees
|
|
2079
1953
|
} = _ref;
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
const
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
1954
|
+
const [config, setConfig] = React.useState({});
|
|
1955
|
+
const [defaultValues, setDefaultValues] = React.useState({});
|
|
1956
|
+
const [approvers, setApprovers] = React.useState([]);
|
|
1957
|
+
const [selectedApprover, setSelectedApprover] = React.useState({});
|
|
1958
|
+
const [file, setFile] = React.useState(null);
|
|
1959
|
+
const [uploadedFile, setUploadedFile] = React.useState(null);
|
|
1960
|
+
const [error, setError] = React.useState(null);
|
|
1961
|
+
const [financialYears, setFinancialYears] = React.useState([]);
|
|
1962
|
+
const [selectedFinancialYear, setSelectedFinancialYear] = React.useState(null);
|
|
1963
|
+
const checkRole = action === null || action === void 0 ? void 0 : (_action$state = action.state) === null || _action$state === void 0 ? void 0 : _action$state.actions;
|
|
1964
|
+
const allRoles = [...new Set(checkRole === null || checkRole === void 0 ? void 0 : checkRole.flatMap(a => a.roles))];
|
|
1965
|
+
const allRolesNew = [...new Set(getEmployees === null || getEmployees === void 0 ? void 0 : getEmployees.flatMap(a => a.roles))];
|
|
1966
|
+
console.log("getEmployees", getEmployees);
|
|
1967
|
+
console.log("allRoles", allRoles);
|
|
1968
|
+
console.log("allRolesNew", allRolesNew);
|
|
1969
|
+
const {
|
|
1970
|
+
data: approverData,
|
|
1971
|
+
isLoading: PTALoading
|
|
1972
|
+
} = Digit.Hooks.useEmployeeSearch(tenantId, {
|
|
1973
|
+
roles: allRolesNew === null || allRolesNew === void 0 ? void 0 : allRolesNew.map(role => ({
|
|
1974
|
+
code: role
|
|
1975
|
+
})),
|
|
1976
|
+
isActive: true
|
|
1977
|
+
}, {
|
|
1978
|
+
enabled: !(action !== null && action !== void 0 && action.isTerminateState)
|
|
2094
1979
|
});
|
|
2095
|
-
const
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
1980
|
+
const {
|
|
1981
|
+
isLoading: financialYearsLoading,
|
|
1982
|
+
data: financialYearsData
|
|
1983
|
+
} = Digit.Hooks.pt.useMDMS(tenantId, businessService, "FINANCIAL_YEARLS", {}, {
|
|
1984
|
+
details: {
|
|
1985
|
+
tenantId: Digit.ULBService.getStateId(),
|
|
1986
|
+
moduleDetails: [{
|
|
1987
|
+
moduleName: "egf-master",
|
|
1988
|
+
masterDetails: [{
|
|
1989
|
+
name: "FinancialYear",
|
|
1990
|
+
filter: "[?(@.module == 'TL')]"
|
|
1991
|
+
}]
|
|
1992
|
+
}]
|
|
1993
|
+
}
|
|
2099
1994
|
});
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
1995
|
+
React.useEffect(() => {
|
|
1996
|
+
if (financialYearsData && financialYearsData["egf-master"]) {
|
|
1997
|
+
var _financialYearsData$e;
|
|
1998
|
+
setFinancialYears((_financialYearsData$e = financialYearsData["egf-master"]) === null || _financialYearsData$e === void 0 ? void 0 : _financialYearsData$e["FinancialYear"]);
|
|
1999
|
+
}
|
|
2000
|
+
}, [financialYearsData]);
|
|
2001
|
+
const {
|
|
2002
|
+
data: EmployeeStatusData
|
|
2003
|
+
} = Digit.Hooks.useCustomMDMS(tenantId, "common-masters", [{
|
|
2004
|
+
name: "Department"
|
|
2005
|
+
}]);
|
|
2006
|
+
React.useEffect(() => {
|
|
2007
|
+
if (approverData && EmployeeStatusData) {
|
|
2008
|
+
var _approverData$Employe;
|
|
2009
|
+
const departments = EmployeeStatusData["common-masters"].Department;
|
|
2010
|
+
setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
|
|
2011
|
+
var _employee$assignments, _employee$assignments2, _employee$user;
|
|
2012
|
+
const deptCode = employee === null || employee === void 0 ? void 0 : (_employee$assignments = employee.assignments) === null || _employee$assignments === void 0 ? void 0 : (_employee$assignments2 = _employee$assignments[0]) === null || _employee$assignments2 === void 0 ? void 0 : _employee$assignments2.department;
|
|
2013
|
+
const matchedDept = departments === null || departments === void 0 ? void 0 : departments.find(d => (d === null || d === void 0 ? void 0 : d.code) === deptCode);
|
|
2014
|
+
return {
|
|
2015
|
+
uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
|
|
2016
|
+
name: (employee === null || employee === void 0 ? void 0 : (_employee$user = employee.user) === null || _employee$user === void 0 ? void 0 : _employee$user.name) + " - " + (matchedDept === null || matchedDept === void 0 ? void 0 : matchedDept.name)
|
|
2017
|
+
};
|
|
2018
|
+
}));
|
|
2019
|
+
}
|
|
2020
|
+
}, [approverData]);
|
|
2021
|
+
function selectFile(e) {
|
|
2022
|
+
setFile(e.target.files[0]);
|
|
2023
|
+
}
|
|
2024
|
+
React.useEffect(() => {
|
|
2025
|
+
(function () {
|
|
2026
|
+
try {
|
|
2027
|
+
setError(null);
|
|
2028
|
+
const _temp3 = function () {
|
|
2029
|
+
if (file) {
|
|
2030
|
+
const _temp2 = function () {
|
|
2031
|
+
if (file.size >= 5242880) {
|
|
2032
|
+
setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
|
|
2033
|
+
} else {
|
|
2034
|
+
const _temp = _catch(function () {
|
|
2035
|
+
return Promise.resolve(Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId())).then(function (response) {
|
|
2036
|
+
var _response$data, _response$data$files;
|
|
2037
|
+
if ((response === null || response === void 0 ? void 0 : (_response$data = response.data) === null || _response$data === void 0 ? void 0 : (_response$data$files = _response$data.files) === null || _response$data$files === void 0 ? void 0 : _response$data$files.length) > 0) {
|
|
2038
|
+
var _response$data2, _response$data2$files;
|
|
2039
|
+
setUploadedFile(response === null || response === void 0 ? void 0 : (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : (_response$data2$files = _response$data2.files[0]) === null || _response$data2$files === void 0 ? void 0 : _response$data2$files.fileStoreId);
|
|
2040
|
+
} else {
|
|
2041
|
+
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
}, function () {
|
|
2045
|
+
setError(t("CS_FILE_UPLOAD_ERROR"));
|
|
2046
|
+
});
|
|
2047
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
2048
|
+
}
|
|
2049
|
+
}();
|
|
2050
|
+
if (_temp2 && _temp2.then) return _temp2.then(function () {});
|
|
2051
|
+
}
|
|
2052
|
+
}();
|
|
2053
|
+
return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
|
|
2054
|
+
} catch (e) {
|
|
2055
|
+
Promise.reject(e);
|
|
2056
|
+
}
|
|
2057
|
+
})();
|
|
2058
|
+
}, [file]);
|
|
2059
|
+
function submit(data) {
|
|
2060
|
+
applicationData = _extends({}, applicationData, {
|
|
2061
|
+
action: action === null || action === void 0 ? void 0 : action.action,
|
|
2062
|
+
comment: data === null || data === void 0 ? void 0 : data.comments,
|
|
2063
|
+
assignee: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid],
|
|
2064
|
+
wfDocuments: uploadedFile ? [{
|
|
2065
|
+
documentType: file === null || file === void 0 ? void 0 : file.type,
|
|
2066
|
+
documentUid: file === null || file === void 0 ? void 0 : file.name,
|
|
2067
|
+
fileStoreId: uploadedFile
|
|
2068
|
+
}] : null
|
|
2069
|
+
});
|
|
2070
|
+
submitAction({
|
|
2071
|
+
Licenses: [applicationData]
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
React.useEffect(() => {
|
|
2075
|
+
if (action) {
|
|
2076
|
+
setConfig(ModalConfig({
|
|
2077
|
+
t,
|
|
2078
|
+
action,
|
|
2079
|
+
approvers,
|
|
2080
|
+
selectedApprover,
|
|
2081
|
+
setSelectedApprover,
|
|
2082
|
+
selectFile,
|
|
2083
|
+
uploadedFile,
|
|
2084
|
+
setUploadedFile,
|
|
2085
|
+
businessService
|
|
2086
|
+
}));
|
|
2087
|
+
}
|
|
2088
|
+
}, [action, approvers, financialYears, selectedFinancialYear, uploadedFile]);
|
|
2089
|
+
if (!action || !config.form) return null;
|
|
2090
|
+
return /*#__PURE__*/React__default.createElement(digitUiReactComponents.Modal, {
|
|
2091
|
+
headerBarMain: /*#__PURE__*/React__default.createElement(Heading, {
|
|
2092
|
+
label: t(config.label.heading)
|
|
2093
|
+
}),
|
|
2094
|
+
headerBarEnd: /*#__PURE__*/React__default.createElement(CloseBtn, {
|
|
2095
|
+
onClick: closeModal
|
|
2096
|
+
}),
|
|
2097
|
+
actionCancelLabel: t(config.label.cancel),
|
|
2098
|
+
actionCancelOnSubmit: closeModal,
|
|
2099
|
+
actionSaveLabel: t(config.label.submit),
|
|
2100
|
+
actionSaveOnSubmit: () => {},
|
|
2101
|
+
formId: "modal-action"
|
|
2102
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.FormComposer, {
|
|
2103
|
+
config: config.form,
|
|
2104
|
+
noBoxShadow: true,
|
|
2105
|
+
inline: true,
|
|
2106
|
+
childrenAtTheBottom: true,
|
|
2107
|
+
onSubmit: submit,
|
|
2108
|
+
defaultValues: defaultValues,
|
|
2109
|
+
formId: "modal-action"
|
|
2110
|
+
}), showToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
2111
|
+
error: showToast.key === "error" ? true : false,
|
|
2112
|
+
label: errors,
|
|
2113
|
+
onClose: closeToast
|
|
2114
|
+
}), showErrorToast && /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
2115
|
+
error: true,
|
|
2116
|
+
label: errorOne,
|
|
2117
|
+
isDleteBtn: true,
|
|
2118
|
+
onClose: closeToastOne
|
|
2119
|
+
}), PTALoading && /*#__PURE__*/React__default.createElement(Loader, {
|
|
2120
|
+
page: true
|
|
2121
|
+
}));
|
|
2119
2122
|
};
|
|
2120
2123
|
|
|
2121
2124
|
const getTimelineCaptions = (checkpoint, index, arr, t) => {
|
|
@@ -2172,6 +2175,7 @@ const ApplicationOverview = () => {
|
|
|
2172
2175
|
t
|
|
2173
2176
|
} = reactI18next.useTranslation();
|
|
2174
2177
|
const history = reactRouterDom.useHistory();
|
|
2178
|
+
const toastRef = React.useRef(null);
|
|
2175
2179
|
const tenantId = window.localStorage.getItem("Employee.tenant-id");
|
|
2176
2180
|
const state = tenantId === null || tenantId === void 0 ? void 0 : tenantId.split(".")[0];
|
|
2177
2181
|
const [showToast, setShowToast] = React.useState(null);
|
|
@@ -2479,12 +2483,20 @@ const ApplicationOverview = () => {
|
|
|
2479
2483
|
enabled: getPropertyId ? true : false,
|
|
2480
2484
|
privacy: Digit.Utils.getPrivacyObject()
|
|
2481
2485
|
});
|
|
2482
|
-
if (isLoading || isDetailsLoading || checkLoading) {
|
|
2483
|
-
return /*#__PURE__*/React__default.createElement(Loader, {
|
|
2484
|
-
page: true
|
|
2485
|
-
});
|
|
2486
|
-
}
|
|
2487
2486
|
console.log("applicationDetails", applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A5 = applicationDetails.Applications) === null || _applicationDetails$A5 === void 0 ? void 0 : (_applicationDetails$A6 = _applicationDetails$A5[0]) === null || _applicationDetails$A6 === void 0 ? void 0 : _applicationDetails$A6.NdcDetails);
|
|
2487
|
+
React.useEffect(() => {
|
|
2488
|
+
const handleClickOutside = event => {
|
|
2489
|
+
if (toastRef.current && !toastRef.current.contains(event.target)) {
|
|
2490
|
+
setShowToast(null);
|
|
2491
|
+
}
|
|
2492
|
+
};
|
|
2493
|
+
if (showToast) {
|
|
2494
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2495
|
+
}
|
|
2496
|
+
return () => {
|
|
2497
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2498
|
+
};
|
|
2499
|
+
}, [showToast]);
|
|
2488
2500
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
2489
2501
|
className: "employee-main-application-details"
|
|
2490
2502
|
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Card, null, /*#__PURE__*/React__default.createElement(digitUiReactComponents.CardSubHeader, null, t("NDC_APPLICATION_DETAILS_OVERVIEW")), /*#__PURE__*/React__default.createElement(digitUiReactComponents.StatusTable, null, (displayData === null || displayData === void 0 ? void 0 : displayData.applicantData) && ((_Object$entries = Object.entries(displayData === null || displayData === void 0 ? void 0 : displayData.applicantData)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(_ref2 => {
|
|
@@ -2649,12 +2661,14 @@ const ApplicationOverview = () => {
|
|
|
2649
2661
|
showErrorToast: showErrorToast,
|
|
2650
2662
|
errorOne: errorOne,
|
|
2651
2663
|
closeToastOne: closeToastOne
|
|
2652
|
-
}) : null, showToast && /*#__PURE__*/React__default.createElement(
|
|
2664
|
+
}) : null, showToast && /*#__PURE__*/React__default.createElement("div", {
|
|
2665
|
+
ref: toastRef
|
|
2666
|
+
}, /*#__PURE__*/React__default.createElement(digitUiReactComponents.Toast, {
|
|
2653
2667
|
error: error,
|
|
2654
2668
|
label: getLable,
|
|
2655
2669
|
isDleteBtn: true,
|
|
2656
2670
|
onClose: closeToast
|
|
2657
|
-
}), getLoader && /*#__PURE__*/React__default.createElement(Loader, {
|
|
2671
|
+
})), (isLoading || isDetailsLoading || checkLoading || getLoader) && /*#__PURE__*/React__default.createElement(Loader, {
|
|
2658
2672
|
page: true
|
|
2659
2673
|
}));
|
|
2660
2674
|
};
|