@mseva/digit-ui-module-ndc 1.0.40 → 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.
@@ -813,262 +813,6 @@ function NDCDocument$1({
813
813
  }))));
814
814
  }
815
815
 
816
- const ModalConfig = ({
817
- t,
818
- action,
819
- approvers,
820
- selectedApprover,
821
- setSelectedApprover,
822
- selectFile,
823
- uploadedFile,
824
- setUploadedFile,
825
- assigneeLabel,
826
- businessService
827
- }) => {
828
- let checkCondtions = true;
829
- 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;
830
- if (action.isTerminateState) checkCondtions = false;
831
- console.log("action=====", action.action);
832
- return {
833
- label: {
834
- heading: ``,
835
- submit: `${action === null || action === void 0 ? void 0 : action.action}`,
836
- cancel: "WF_EMPLOYEE_NEWTL_CANCEL"
837
- },
838
- form: [{
839
- body: [{
840
- label: !checkCondtions ? null : `${t("WF_ASSIGNEE_NAME_LABEL")} *`,
841
- placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"),
842
- type: "dropdown",
843
- populators: !checkCondtions ? null : /*#__PURE__*/React.createElement(Dropdown, {
844
- option: approvers,
845
- autoComplete: "off",
846
- optionKey: "name",
847
- id: "fieldInspector",
848
- select: setSelectedApprover,
849
- selected: selectedApprover
850
- })
851
- }, {
852
- label: `${t("CS_COMMON_COMMENTS")} *`,
853
- type: "textarea",
854
- populators: {
855
- name: "comments"
856
- }
857
- }, {
858
- label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),
859
- populators: /*#__PURE__*/React.createElement(UploadFile, {
860
- id: "workflow-doc",
861
- onUpload: selectFile,
862
- onDelete: () => {
863
- setUploadedFile(null);
864
- },
865
- message: uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)
866
- })
867
- }]
868
- }]
869
- };
870
- };
871
-
872
- const Heading = props => {
873
- return /*#__PURE__*/React.createElement("h1", {
874
- className: "heading-m"
875
- }, props.label);
876
- };
877
- const Close = () => /*#__PURE__*/React.createElement("svg", {
878
- xmlns: "http://www.w3.org/2000/svg",
879
- viewBox: "0 0 24 24",
880
- fill: "#FFFFFF"
881
- }, /*#__PURE__*/React.createElement("path", {
882
- d: "M0 0h24v24H0V0z",
883
- fill: "none"
884
- }), /*#__PURE__*/React.createElement("path", {
885
- 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"
886
- }));
887
- const CloseBtn = props => {
888
- return /*#__PURE__*/React.createElement("div", {
889
- className: "icon-bg-secondary",
890
- onClick: props.onClick
891
- }, /*#__PURE__*/React.createElement(Close, null));
892
- };
893
- const NDCModal = ({
894
- t,
895
- action,
896
- tenantId,
897
- state,
898
- id,
899
- closeModal,
900
- submitAction,
901
- actionData,
902
- applicationDetails,
903
- applicationData,
904
- businessService,
905
- moduleCode,
906
- workflowDetails,
907
- showToast,
908
- closeToast,
909
- errors,
910
- showErrorToast,
911
- errorOne,
912
- closeToastOne,
913
- getEmployees
914
- }) => {
915
- var _action$state;
916
- const [config, setConfig] = useState({});
917
- const [defaultValues, setDefaultValues] = useState({});
918
- const [approvers, setApprovers] = useState([]);
919
- const [selectedApprover, setSelectedApprover] = useState({});
920
- const [file, setFile] = useState(null);
921
- const [uploadedFile, setUploadedFile] = useState(null);
922
- const [error, setError] = useState(null);
923
- const [financialYears, setFinancialYears] = useState([]);
924
- const [selectedFinancialYear, setSelectedFinancialYear] = useState(null);
925
- const checkRole = action === null || action === void 0 ? void 0 : (_action$state = action.state) === null || _action$state === void 0 ? void 0 : _action$state.actions;
926
- const allRoles = [...new Set(checkRole === null || checkRole === void 0 ? void 0 : checkRole.flatMap(a => a.roles))];
927
- const allRolesNew = [...new Set(getEmployees === null || getEmployees === void 0 ? void 0 : getEmployees.flatMap(a => a.roles))];
928
- console.log("getEmployees", getEmployees);
929
- console.log("allRoles", allRoles);
930
- console.log("allRolesNew", allRolesNew);
931
- const {
932
- data: approverData,
933
- isLoading: PTALoading
934
- } = Digit.Hooks.useEmployeeSearch(tenantId, {
935
- roles: allRolesNew === null || allRolesNew === void 0 ? void 0 : allRolesNew.map(role => ({
936
- code: role
937
- })),
938
- isActive: true
939
- }, {
940
- enabled: !(action !== null && action !== void 0 && action.isTerminateState)
941
- });
942
- const {
943
- isLoading: financialYearsLoading,
944
- data: financialYearsData
945
- } = Digit.Hooks.pt.useMDMS(tenantId, businessService, "FINANCIAL_YEARLS", {}, {
946
- details: {
947
- tenantId: Digit.ULBService.getStateId(),
948
- moduleDetails: [{
949
- moduleName: "egf-master",
950
- masterDetails: [{
951
- name: "FinancialYear",
952
- filter: "[?(@.module == 'TL')]"
953
- }]
954
- }]
955
- }
956
- });
957
- useEffect(() => {
958
- if (financialYearsData && financialYearsData["egf-master"]) {
959
- var _financialYearsData$e;
960
- setFinancialYears((_financialYearsData$e = financialYearsData["egf-master"]) === null || _financialYearsData$e === void 0 ? void 0 : _financialYearsData$e["FinancialYear"]);
961
- }
962
- }, [financialYearsData]);
963
- const {
964
- data: EmployeeStatusData
965
- } = Digit.Hooks.useCustomMDMS(tenantId, "common-masters", [{
966
- name: "Department"
967
- }]);
968
- useEffect(() => {
969
- if (approverData && EmployeeStatusData) {
970
- var _approverData$Employe;
971
- const departments = EmployeeStatusData["common-masters"].Department;
972
- setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
973
- var _employee$assignments, _employee$assignments2, _employee$user;
974
- 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;
975
- const matchedDept = departments === null || departments === void 0 ? void 0 : departments.find(d => (d === null || d === void 0 ? void 0 : d.code) === deptCode);
976
- return {
977
- uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
978
- 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}`
979
- };
980
- }));
981
- }
982
- }, [approverData]);
983
- function selectFile(e) {
984
- setFile(e.target.files[0]);
985
- }
986
- useEffect(() => {
987
- (async () => {
988
- setError(null);
989
- if (file) {
990
- if (file.size >= 5242880) {
991
- setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
992
- } else {
993
- try {
994
- var _response$data, _response$data$files;
995
- const response = await Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId());
996
- 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) {
997
- var _response$data2, _response$data2$files;
998
- 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);
999
- } else {
1000
- setError(t("CS_FILE_UPLOAD_ERROR"));
1001
- }
1002
- } catch (err) {
1003
- setError(t("CS_FILE_UPLOAD_ERROR"));
1004
- }
1005
- }
1006
- }
1007
- })();
1008
- }, [file]);
1009
- function submit(data) {
1010
- applicationData = {
1011
- ...applicationData,
1012
- action: action === null || action === void 0 ? void 0 : action.action,
1013
- comment: data === null || data === void 0 ? void 0 : data.comments,
1014
- assignee: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid],
1015
- wfDocuments: uploadedFile ? [{
1016
- documentType: file === null || file === void 0 ? void 0 : file.type,
1017
- documentUid: file === null || file === void 0 ? void 0 : file.name,
1018
- fileStoreId: uploadedFile
1019
- }] : null
1020
- };
1021
- submitAction({
1022
- Licenses: [applicationData]
1023
- });
1024
- }
1025
- useEffect(() => {
1026
- if (action) {
1027
- setConfig(ModalConfig({
1028
- t,
1029
- action,
1030
- approvers,
1031
- selectedApprover,
1032
- setSelectedApprover,
1033
- selectFile,
1034
- uploadedFile,
1035
- setUploadedFile,
1036
- businessService
1037
- }));
1038
- }
1039
- }, [action, approvers, financialYears, selectedFinancialYear, uploadedFile]);
1040
- return action && config.form ? /*#__PURE__*/React.createElement(Modal, {
1041
- headerBarMain: /*#__PURE__*/React.createElement(Heading, {
1042
- label: t(config.label.heading)
1043
- }),
1044
- headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn, {
1045
- onClick: closeModal
1046
- }),
1047
- actionCancelLabel: t(config.label.cancel),
1048
- actionCancelOnSubmit: closeModal,
1049
- actionSaveLabel: t(config.label.submit),
1050
- actionSaveOnSubmit: () => {},
1051
- formId: "modal-action"
1052
- }, /*#__PURE__*/React.createElement(FormComposer, {
1053
- config: config.form,
1054
- noBoxShadow: true,
1055
- inline: true,
1056
- childrenAtTheBottom: true,
1057
- onSubmit: submit,
1058
- defaultValues: defaultValues,
1059
- formId: "modal-action"
1060
- }), showToast && /*#__PURE__*/React.createElement(Toast, {
1061
- error: showToast.key === "error" ? true : false,
1062
- label: errors,
1063
- onClose: closeToast
1064
- }), showErrorToast && /*#__PURE__*/React.createElement(Toast, {
1065
- error: true,
1066
- label: errorOne,
1067
- isDleteBtn: true,
1068
- onClose: closeToastOne
1069
- })) : /*#__PURE__*/React.createElement(Loader$1, null);
1070
- };
1071
-
1072
816
  var b = "function" === typeof Symbol && Symbol.for,
1073
817
  c = b ? Symbol.for("react.element") : 60103,
1074
818
  d = b ? Symbol.for("react.portal") : 60106,
@@ -2003,8 +1747,267 @@ Loader.defaultProps = {
2003
1747
  page: false
2004
1748
  };
2005
1749
 
2006
- const getTimelineCaptions = (checkpoint, index, arr, t) => {
2007
- var _checkpoint$auditDeta, _checkpoint$assigner, _checkpoint$assigner2, _checkpoint$assigner3, _thumbnailsToShow$thu;
1750
+ const ModalConfig = ({
1751
+ t,
1752
+ action,
1753
+ approvers,
1754
+ selectedApprover,
1755
+ setSelectedApprover,
1756
+ selectFile,
1757
+ uploadedFile,
1758
+ setUploadedFile,
1759
+ assigneeLabel,
1760
+ businessService
1761
+ }) => {
1762
+ let checkCondtions = true;
1763
+ 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;
1764
+ if (action.isTerminateState) checkCondtions = false;
1765
+ console.log("action=====", action.action);
1766
+ return {
1767
+ label: {
1768
+ heading: ``,
1769
+ submit: `${action === null || action === void 0 ? void 0 : action.action}`,
1770
+ cancel: "WF_EMPLOYEE_NEWTL_CANCEL"
1771
+ },
1772
+ form: [{
1773
+ body: [{
1774
+ label: !checkCondtions ? null : `${t("WF_ASSIGNEE_NAME_LABEL")} *`,
1775
+ placeholder: !checkCondtions ? null : t("WF_ASSIGNEE_NAME_PLACEHOLDER"),
1776
+ type: "dropdown",
1777
+ populators: !checkCondtions ? null : /*#__PURE__*/React.createElement(Dropdown, {
1778
+ option: approvers,
1779
+ autoComplete: "off",
1780
+ optionKey: "name",
1781
+ id: "fieldInspector",
1782
+ select: setSelectedApprover,
1783
+ selected: selectedApprover
1784
+ })
1785
+ }, {
1786
+ label: `${t("CS_COMMON_COMMENTS")} *`,
1787
+ type: "textarea",
1788
+ populators: {
1789
+ name: "comments"
1790
+ }
1791
+ }, {
1792
+ label: t("TL_APPROVAL_CHECKLIST_BUTTON_UP_FILE"),
1793
+ populators: /*#__PURE__*/React.createElement(UploadFile, {
1794
+ id: "workflow-doc",
1795
+ onUpload: selectFile,
1796
+ onDelete: () => {
1797
+ setUploadedFile(null);
1798
+ },
1799
+ message: uploadedFile ? `1 ${t(`ES_PT_ACTION_FILEUPLOADED`)}` : t(`CS_ACTION_NO_FILEUPLOADED`)
1800
+ })
1801
+ }]
1802
+ }]
1803
+ };
1804
+ };
1805
+
1806
+ const Heading = props => {
1807
+ return /*#__PURE__*/React.createElement("h1", {
1808
+ className: "heading-m"
1809
+ }, props.label);
1810
+ };
1811
+ const Close = () => /*#__PURE__*/React.createElement("svg", {
1812
+ xmlns: "http://www.w3.org/2000/svg",
1813
+ viewBox: "0 0 24 24",
1814
+ fill: "#FFFFFF"
1815
+ }, /*#__PURE__*/React.createElement("path", {
1816
+ d: "M0 0h24v24H0V0z",
1817
+ fill: "none"
1818
+ }), /*#__PURE__*/React.createElement("path", {
1819
+ 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"
1820
+ }));
1821
+ const CloseBtn = props => {
1822
+ return /*#__PURE__*/React.createElement("div", {
1823
+ className: "icon-bg-secondary",
1824
+ onClick: props.onClick
1825
+ }, /*#__PURE__*/React.createElement(Close, null));
1826
+ };
1827
+ const NDCModal = ({
1828
+ t,
1829
+ action,
1830
+ tenantId,
1831
+ state,
1832
+ id,
1833
+ closeModal,
1834
+ submitAction,
1835
+ actionData,
1836
+ applicationDetails,
1837
+ applicationData,
1838
+ businessService,
1839
+ moduleCode,
1840
+ workflowDetails,
1841
+ showToast,
1842
+ closeToast,
1843
+ errors,
1844
+ showErrorToast,
1845
+ errorOne,
1846
+ closeToastOne,
1847
+ getEmployees
1848
+ }) => {
1849
+ var _action$state;
1850
+ const [config, setConfig] = useState({});
1851
+ const [defaultValues, setDefaultValues] = useState({});
1852
+ const [approvers, setApprovers] = useState([]);
1853
+ const [selectedApprover, setSelectedApprover] = useState({});
1854
+ const [file, setFile] = useState(null);
1855
+ const [uploadedFile, setUploadedFile] = useState(null);
1856
+ const [error, setError] = useState(null);
1857
+ const [financialYears, setFinancialYears] = useState([]);
1858
+ const [selectedFinancialYear, setSelectedFinancialYear] = useState(null);
1859
+ const checkRole = action === null || action === void 0 ? void 0 : (_action$state = action.state) === null || _action$state === void 0 ? void 0 : _action$state.actions;
1860
+ const allRoles = [...new Set(checkRole === null || checkRole === void 0 ? void 0 : checkRole.flatMap(a => a.roles))];
1861
+ const allRolesNew = [...new Set(getEmployees === null || getEmployees === void 0 ? void 0 : getEmployees.flatMap(a => a.roles))];
1862
+ console.log("getEmployees", getEmployees);
1863
+ console.log("allRoles", allRoles);
1864
+ console.log("allRolesNew", allRolesNew);
1865
+ const {
1866
+ data: approverData,
1867
+ isLoading: PTALoading
1868
+ } = Digit.Hooks.useEmployeeSearch(tenantId, {
1869
+ roles: allRolesNew === null || allRolesNew === void 0 ? void 0 : allRolesNew.map(role => ({
1870
+ code: role
1871
+ })),
1872
+ isActive: true
1873
+ }, {
1874
+ enabled: !(action !== null && action !== void 0 && action.isTerminateState)
1875
+ });
1876
+ const {
1877
+ isLoading: financialYearsLoading,
1878
+ data: financialYearsData
1879
+ } = Digit.Hooks.pt.useMDMS(tenantId, businessService, "FINANCIAL_YEARLS", {}, {
1880
+ details: {
1881
+ tenantId: Digit.ULBService.getStateId(),
1882
+ moduleDetails: [{
1883
+ moduleName: "egf-master",
1884
+ masterDetails: [{
1885
+ name: "FinancialYear",
1886
+ filter: "[?(@.module == 'TL')]"
1887
+ }]
1888
+ }]
1889
+ }
1890
+ });
1891
+ useEffect(() => {
1892
+ if (financialYearsData && financialYearsData["egf-master"]) {
1893
+ var _financialYearsData$e;
1894
+ setFinancialYears((_financialYearsData$e = financialYearsData["egf-master"]) === null || _financialYearsData$e === void 0 ? void 0 : _financialYearsData$e["FinancialYear"]);
1895
+ }
1896
+ }, [financialYearsData]);
1897
+ const {
1898
+ data: EmployeeStatusData
1899
+ } = Digit.Hooks.useCustomMDMS(tenantId, "common-masters", [{
1900
+ name: "Department"
1901
+ }]);
1902
+ useEffect(() => {
1903
+ if (approverData && EmployeeStatusData) {
1904
+ var _approverData$Employe;
1905
+ const departments = EmployeeStatusData["common-masters"].Department;
1906
+ setApprovers(approverData === null || approverData === void 0 ? void 0 : (_approverData$Employe = approverData.Employees) === null || _approverData$Employe === void 0 ? void 0 : _approverData$Employe.map(employee => {
1907
+ var _employee$assignments, _employee$assignments2, _employee$user;
1908
+ 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;
1909
+ const matchedDept = departments === null || departments === void 0 ? void 0 : departments.find(d => (d === null || d === void 0 ? void 0 : d.code) === deptCode);
1910
+ return {
1911
+ uuid: employee === null || employee === void 0 ? void 0 : employee.uuid,
1912
+ 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}`
1913
+ };
1914
+ }));
1915
+ }
1916
+ }, [approverData]);
1917
+ function selectFile(e) {
1918
+ setFile(e.target.files[0]);
1919
+ }
1920
+ useEffect(() => {
1921
+ (async () => {
1922
+ setError(null);
1923
+ if (file) {
1924
+ if (file.size >= 5242880) {
1925
+ setError(t("CS_MAXIMUM_UPLOAD_SIZE_EXCEEDED"));
1926
+ } else {
1927
+ try {
1928
+ var _response$data, _response$data$files;
1929
+ const response = await Digit.UploadServices.Filestorage("PT", file, Digit.ULBService.getStateId());
1930
+ 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) {
1931
+ var _response$data2, _response$data2$files;
1932
+ 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);
1933
+ } else {
1934
+ setError(t("CS_FILE_UPLOAD_ERROR"));
1935
+ }
1936
+ } catch (err) {
1937
+ setError(t("CS_FILE_UPLOAD_ERROR"));
1938
+ }
1939
+ }
1940
+ }
1941
+ })();
1942
+ }, [file]);
1943
+ function submit(data) {
1944
+ applicationData = {
1945
+ ...applicationData,
1946
+ action: action === null || action === void 0 ? void 0 : action.action,
1947
+ comment: data === null || data === void 0 ? void 0 : data.comments,
1948
+ assignee: !(selectedApprover !== null && selectedApprover !== void 0 && selectedApprover.uuid) ? null : [selectedApprover === null || selectedApprover === void 0 ? void 0 : selectedApprover.uuid],
1949
+ wfDocuments: uploadedFile ? [{
1950
+ documentType: file === null || file === void 0 ? void 0 : file.type,
1951
+ documentUid: file === null || file === void 0 ? void 0 : file.name,
1952
+ fileStoreId: uploadedFile
1953
+ }] : null
1954
+ };
1955
+ submitAction({
1956
+ Licenses: [applicationData]
1957
+ });
1958
+ }
1959
+ useEffect(() => {
1960
+ if (action) {
1961
+ setConfig(ModalConfig({
1962
+ t,
1963
+ action,
1964
+ approvers,
1965
+ selectedApprover,
1966
+ setSelectedApprover,
1967
+ selectFile,
1968
+ uploadedFile,
1969
+ setUploadedFile,
1970
+ businessService
1971
+ }));
1972
+ }
1973
+ }, [action, approvers, financialYears, selectedFinancialYear, uploadedFile]);
1974
+ if (!action || !config.form) return null;
1975
+ return /*#__PURE__*/React.createElement(Modal, {
1976
+ headerBarMain: /*#__PURE__*/React.createElement(Heading, {
1977
+ label: t(config.label.heading)
1978
+ }),
1979
+ headerBarEnd: /*#__PURE__*/React.createElement(CloseBtn, {
1980
+ onClick: closeModal
1981
+ }),
1982
+ actionCancelLabel: t(config.label.cancel),
1983
+ actionCancelOnSubmit: closeModal,
1984
+ actionSaveLabel: t(config.label.submit),
1985
+ actionSaveOnSubmit: () => {},
1986
+ formId: "modal-action"
1987
+ }, /*#__PURE__*/React.createElement(FormComposer, {
1988
+ config: config.form,
1989
+ noBoxShadow: true,
1990
+ inline: true,
1991
+ childrenAtTheBottom: true,
1992
+ onSubmit: submit,
1993
+ defaultValues: defaultValues,
1994
+ formId: "modal-action"
1995
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
1996
+ error: showToast.key === "error" ? true : false,
1997
+ label: errors,
1998
+ onClose: closeToast
1999
+ }), showErrorToast && /*#__PURE__*/React.createElement(Toast, {
2000
+ error: true,
2001
+ label: errorOne,
2002
+ isDleteBtn: true,
2003
+ onClose: closeToastOne
2004
+ }), PTALoading && /*#__PURE__*/React.createElement(Loader, {
2005
+ page: true
2006
+ }));
2007
+ };
2008
+
2009
+ const getTimelineCaptions = (checkpoint, index, arr, t) => {
2010
+ var _checkpoint$auditDeta, _checkpoint$assigner, _checkpoint$assigner2, _checkpoint$assigner3, _thumbnailsToShow$thu;
2008
2011
  const {
2009
2012
  wfComment: comment,
2010
2013
  thumbnailsToShow,
@@ -2057,10 +2060,12 @@ const ApplicationOverview = () => {
2057
2060
  t
2058
2061
  } = useTranslation();
2059
2062
  const history = useHistory();
2063
+ const toastRef = useRef(null);
2060
2064
  const tenantId = window.localStorage.getItem("Employee.tenant-id");
2061
2065
  const state = tenantId === null || tenantId === void 0 ? void 0 : tenantId.split(".")[0];
2062
2066
  const [showToast, setShowToast] = useState(null);
2063
2067
  const [error, setError] = useState(null);
2068
+ const [getLable, setLable] = useState(false);
2064
2069
  const {
2065
2070
  control,
2066
2071
  handleSubmit,
@@ -2247,9 +2252,11 @@ const ApplicationOverview = () => {
2247
2252
  console.log("filterRoles====???", filterRoles);
2248
2253
  console.log("action test", action === null || action === void 0 ? void 0 : action.action);
2249
2254
  const checkactionApp = (action === null || action === void 0 ? void 0 : action.action) == "APPROVE";
2250
- if (filterRoles && checkactionApp) {
2255
+ console.log("filterRoles && checkactionApp", filterRoles && checkactionApp, checkactionApp, filterRoles);
2256
+ if (hasDuePending && checkactionApp) {
2251
2257
  console.log("alwasy coming appprve");
2252
- setError("You Can Not Approve This Application, Because It Has Pending Dues. Please Send It To Required Department");
2258
+ setLable("You Can Not Approve This Application, Because It Has Pending Dues. Please Send It To Required Department");
2259
+ setError(true);
2253
2260
  setShowToast(true);
2254
2261
  return;
2255
2262
  }
@@ -2313,11 +2320,9 @@ const ApplicationOverview = () => {
2313
2320
  tenantId,
2314
2321
  details: finalPayload
2315
2322
  });
2316
- setShowToast({
2317
- key: "success",
2318
- message: "Successfully updated the status"
2319
- });
2320
- setError("Successfully updated the status");
2323
+ setLable("Successfully updated the status");
2324
+ setError(false);
2325
+ setShowToast(true);
2321
2326
  workflowDetails.revalidate();
2322
2327
  setTimeout(() => {
2323
2328
  history.push("/digit-ui/employee/ndc/inbox");
@@ -2359,12 +2364,20 @@ const ApplicationOverview = () => {
2359
2364
  enabled: getPropertyId ? true : false,
2360
2365
  privacy: Digit.Utils.getPrivacyObject()
2361
2366
  });
2362
- if (isLoading || isDetailsLoading || checkLoading) {
2363
- return /*#__PURE__*/React.createElement(Loader, {
2364
- page: true
2365
- });
2366
- }
2367
2367
  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);
2368
+ useEffect(() => {
2369
+ const handleClickOutside = event => {
2370
+ if (toastRef.current && !toastRef.current.contains(event.target)) {
2371
+ setShowToast(null);
2372
+ }
2373
+ };
2374
+ if (showToast) {
2375
+ document.addEventListener("mousedown", handleClickOutside);
2376
+ }
2377
+ return () => {
2378
+ document.removeEventListener("mousedown", handleClickOutside);
2379
+ };
2380
+ }, [showToast]);
2368
2381
  return /*#__PURE__*/React.createElement("div", {
2369
2382
  className: "employee-main-application-details"
2370
2383
  }, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(CardSubHeader, null, t("NDC_APPLICATION_DETAILS_OVERVIEW")), /*#__PURE__*/React.createElement(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(([key, value]) => /*#__PURE__*/React.createElement(Row, {
@@ -2527,12 +2540,14 @@ const ApplicationOverview = () => {
2527
2540
  showErrorToast: showErrorToast,
2528
2541
  errorOne: errorOne,
2529
2542
  closeToastOne: closeToastOne
2530
- }) : null, showToast && /*#__PURE__*/React.createElement(Toast, {
2531
- error: true,
2532
- label: error,
2543
+ }) : null, showToast && /*#__PURE__*/React.createElement("div", {
2544
+ ref: toastRef
2545
+ }, /*#__PURE__*/React.createElement(Toast, {
2546
+ error: error,
2547
+ label: getLable,
2533
2548
  isDleteBtn: true,
2534
2549
  onClose: closeToast
2535
- }), getLoader && /*#__PURE__*/React.createElement(Loader, {
2550
+ })), (isLoading || isDetailsLoading || checkLoading || getLoader) && /*#__PURE__*/React.createElement(Loader, {
2536
2551
  page: true
2537
2552
  }));
2538
2553
  };