diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json index da24f2e5748..38894b9192c 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@cyntler/react-doc-viewer": "1.10.3", - "@egovernments/digit-ui-components":"0.0.2-beta.54", + "@egovernments/digit-ui-components": "0.0.2-beta.54", "@egovernments/digit-ui-react-components": "1.8.10", "@rjsf/core": "5.10.0", "@rjsf/utils": "5.10.0", diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js index 984c4acce66..e3d5613b0f1 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js @@ -429,4 +429,4 @@ const TimelineComponent = ({ campaignId, resourceId }) => { ); }; -export default TimelineComponent; \ No newline at end of file +export default TimelineComponent; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js index 96444f3ee28..eb15f34a159 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/BoundaryRelationCreate.js @@ -129,7 +129,7 @@ const BoundaryRelationCreate = () => { const pollForTemplateGeneration = async () => { const pollInterval = 2000; // Poll every 2 seconds - const maxRetries = 50; // Maximum number of retries + const maxRetries = 200; // Maximum number of retries let retries = 0; return new Promise((resolve, reject) => { @@ -199,7 +199,7 @@ const BoundaryRelationCreate = () => { const pollForStatusCompletion = async (id, typeOfData) => { const pollInterval = 2000; - const maxRetries = 100; + const maxRetries = 200; let retries = 0; let pollTimer = null; let timeoutTimer = null; diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js index ae6ba6637ed..dc1a7df23a2 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/ViewHierarchy.js @@ -6,6 +6,9 @@ import { Svgicon } from "../../utils/Svgicon"; import { useHistory } from "react-router-dom"; import { useLocation } from "react-router-dom"; import MapView from "../../components/MapView"; +import * as XLSX from "xlsx"; +import { CONSOLE_MDMS_MODULENAME } from "../../Module"; + const ViewHierarchy = () => { const { t } = useTranslation(); const location = useLocation(); @@ -31,6 +34,9 @@ const ViewHierarchy = () => { const [disable, setDisable] = useState(false); const [disableFile, setDisableFile] = useState(false); const [dataCreationGoing, setDataCreationGoing] = useState(false); + const [noOfRows, setNoOfRows] = useState(100); + + const { data: baseTimeOut } = Digit.Hooks.useCustomMDMS(tenantId, CONSOLE_MDMS_MODULENAME, [{ name: "baseTimeOut" }]); const callSearch = async(hierarchy) =>{ const res = await Digit.CustomService.getResponse({ @@ -133,16 +139,33 @@ const ViewHierarchy = () => { let fileDataTemp = {}; fileDataTemp.fileName = file?.name - const response = await Digit.UploadServices.Filestorage(module, file, tenantId); - fileDataTemp.fileStoreId = response?.data?.[0]?.fileStoreId; - let fileStoreIdTemp = response?.data?.files?.[0]?.fileStoreId; - setFileStoreId(response?.data?.files?.[0]?.fileStoreId); - const { data: { fileStoreIds: fileUrlTemp } = {} } = await Digit.UploadServices.Filefetch([fileStoreIdTemp], tenantId); - fileDataTemp.url = fileUrlTemp?.[0]?.url; + const reader = new FileReader(); + reader.onload = async (event) => { + const data = new Uint8Array(event.target.result); + const workbook = XLSX.read(data, { type: "array" }); - setFileUrl(fileDataTemp?.url); - setFileData(fileDataTemp); - }; + // Assume the first sheet + const sheetName = workbook.SheetNames[0]; + const sheet = workbook.Sheets[sheetName]; + + // Convert sheet to JSON and count rows + const rows = XLSX.utils.sheet_to_json(sheet); + + // After parsing locally, upload to API + const response = await Digit.UploadServices.Filestorage(module, file, tenantId); + fileDataTemp.fileStoreId = response?.data?.[0]?.fileStoreId; + let fileStoreIdTemp = response?.data?.files?.[0]?.fileStoreId; + setFileStoreId(response?.data?.files?.[0]?.fileStoreId); + const { data: { fileStoreIds: fileUrlTemp } = {} } = await Digit.UploadServices.Filefetch([fileStoreIdTemp], tenantId); + fileDataTemp.url = fileUrlTemp?.[0]?.url; + + setFileUrl(fileDataTemp?.url); + setFileData(fileDataTemp); + }; + + reader.readAsArrayBuffer(file); // Read the file as an array buffer + + }; const callCreateDataApi = async () => { setDisable(true); @@ -274,9 +297,12 @@ const ViewHierarchy = () => { // }; const pollForStatusCompletion = async (id, typeOfData) => { - const pollInterval = 2000; // Poll every 1 second - const maxRetries = 100; // Maximum number of retries + // const pollInterval = 2000; // Poll every 1 second + const maxRetries = 20; // Maximum number of retries let retries = 0; + const baseDelay = baseTimeOut?.["HCM-ADMIN-CONSOLE"]?.baseTimeOut?.[0]?.baseTimeOut; + const maxTime = baseTimeOut?.["HCM-ADMIN-CONSOLE"]?.baseTimeOut?.[0]?.maxTime; + const pollInterval = Math.max(baseDelay * noOfRows , maxTime); return new Promise((resolve, reject) => { const poll = async () => { diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js index 8a6ae8dabff..1d6e324f9b9 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/FormulaConfigWrapper.js @@ -532,7 +532,7 @@ const FormulaConfigWrapper = ({ onSelect, props: customProps }) => {
{t(`FORMULA_VEHICLE_DESCRIPTION`)}
:{t(`FORMULA_CONFIGURATION_DESCRIPTION`)}
} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js index fa5c3964bfe..c78586c090d 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/Hypothesis.js @@ -322,6 +322,31 @@ const Hypothesis = ({ category, assumptions: initialAssumptions, setShowToast, a variation={"primary"} label={t("YES")} onClick={() => { + //here if assumption name is not given then show a toast message and return + if(!selectedDeletedAssumption){ + setShowToast({ + key: "error", + label: t("PLS_SELECT_ASSUMPTION"), + transitionTime: 3000, + style:{ + zIndex:1000000 + } + }); + return; + } + + if(selectedDeletedAssumption?.code === "NEW_ASSUMPTION" && !selectedDeletedAssumption?.name){ + setShowToast({ + key: "error", + label: t("PLS_ENTER_ASSUMPTION_NAME"), + transitionTime: 3000, + style:{ + zIndex:1000000 + } + }); + return; + } + //If no issues then go ahead and add assumption addNewAssumption(); }} />, diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/HypothesisWrapper.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/HypothesisWrapper.js index b123e34cd96..2dae5361c23 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/HypothesisWrapper.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/HypothesisWrapper.js @@ -440,6 +440,7 @@ const HypothesisWrapper = ({ onSelect, props: customProps }) => { setShowToast(false); }} isDleteBtn={true} + style={showToast.style ? showToast.style : {}} /> )} diff --git a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js index 221ea984cb4..d63ac2cf43b 100644 --- a/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js +++ b/health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/index.js @@ -23,9 +23,6 @@ import FacilityCatchmentMapping from "./FacilityCatchmentMapping"; import PlanInbox from "./PlanInbox"; import MapViewComponent from "../../components/MapViewComponent"; - - - // const bredCrumbStyle = { maxWidth: "min-content" }; const ProjectBreadCrumb = ({ location }) => { const { t } = useTranslation(); @@ -38,8 +35,9 @@ const ProjectBreadCrumb = ({ location }) => { { internalLink: `/${window?.contextPath}/employee/microplan/user-management`, content: t("USER_MANAGEMENT"), - show: Digit.Utils.locale.getTransformedLocale(location.pathname.split("/").pop()) === "UPLOAD_USER" || Digit.Utils.locale.getTransformedLocale(location.pathname.split("/").pop()) === "USER_DOWNLOAD" - + show: + Digit.Utils.locale.getTransformedLocale(location.pathname.split("/").pop()) === "UPLOAD_USER" || + Digit.Utils.locale.getTransformedLocale(location.pathname.split("/").pop()) === "USER_DOWNLOAD", }, { internalLink: `/${window?.contextPath}/employee`, @@ -73,14 +71,13 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier } return () => { if (window.location.pathname !== `/${window.contextPath}/employee/microplan/setup-microplan`) { - window.Digit.SessionStorage.del("MICROPLAN_DATA"); - window.Digit.SessionStorage.del("HYPOTHESIS_DATA"); - window.Digit.SessionStorage.del("FORMULA_DATA"); + window.Digit.SessionStorage.del("MICROPLAN_DATA"); + window.Digit.SessionStorage.del("HYPOTHESIS_DATA"); + window.Digit.SessionStorage.del("FORMULA_DATA"); } }; }, []); - const { isLoading: isLoadingMdmsMicroplanData, data: MicroplanMdmsData } = Digit.Hooks.useCustomMDMS( Digit.ULBService.getCurrentTenantId(), "hcm-microplanning", @@ -102,7 +99,7 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier { name: "facilityType" }, { name: "facilityStatus" }, { name: "VehicleDetails" }, - { name: "ContextPathForUser" } + { name: "ContextPathForUser" }, ], { cacheTime: Infinity, @@ -113,7 +110,7 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier ...data?.["hcm-microplanning"], }, }); - } + }, }, { schemaCode: "BASE_MASTER_DATA" } //mdmsv2 ); @@ -121,10 +118,7 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier const { isLoading: isLoadingMdmsAdditionalData, data: AdditionalMdmsData } = Digit.Hooks.useCustomMDMS( Digit.ULBService.getCurrentTenantId(), "HCM-ADMIN-CONSOLE", - [ - { name: "hierarchyConfig" }, - - ], + [{ name: "hierarchyConfig" }], { cacheTime: Infinity, select: (data) => { @@ -159,9 +153,8 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier // ], // ...data?.["HCM-ADMIN-CONSOLE"], // }, - // }); - } + }, }, { schemaCode: "ADDITIONAL_MASTER_DATA" } //mdmsv2 ); @@ -186,7 +179,7 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier state: { boundaryHierarchy: data?.BoundaryHierarchy?.[0]?.boundaryHierarchy, hierarchyType: BOUNDARY_HIERARCHY_TYPE, - lowestHierarchy + lowestHierarchy, }, }); return data?.BoundaryHierarchy?.[0]; @@ -195,24 +188,24 @@ const App = ({ path, stateCode, userType, tenants, BOUNDARY_HIERARCHY_TYPE, hier }; const { data: hierarchyDefinition, isLoading: isBoundaryHierarchyLoading } = Digit.Hooks.useCustomAPIHook(reqCriteria); - - if (isLoadingMdmsMicroplanData || isLoadingMdmsAdditionalData || isBoundaryHierarchyLoading) { - return