From 1c8eeb11e5b553aee0e8dec1835c6a2e7b25f32c Mon Sep 17 00:00:00 2001 From: Lokendra Tyagi Date: Tue, 29 Oct 2024 15:43:53 +0530 Subject: [PATCH 1/3] updated localization --- .../works-pdf/src/routes/paymentTracker.js | 87 +++++++++---------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/utilities/works-pdf/src/routes/paymentTracker.js b/utilities/works-pdf/src/routes/paymentTracker.js index 6458701229..7b4b745591 100644 --- a/utilities/works-pdf/src/routes/paymentTracker.js +++ b/utilities/works-pdf/src/routes/paymentTracker.js @@ -27,47 +27,47 @@ function getCurrentDate() { return formattedDate; } -// async function getStateCityLocalizaitons(request, tenantId) { -// let localizationMaps = {}; -// let lang = getLanguageFromRequest(request); -// let modules = [getStateLocalizationModule(tenantId),getCityLocalizationModule(tenantId)].join(","); -// let localRequest = {} -// localRequest["RequestInfo"] = request["RequestInfo"]; -// let localizations = await search_localization(localRequest, lang, modules, tenantId); -// if (localizations?.data?.messages?.length) { -// localizations.data.messages.forEach(localObj => { -// localizationMaps[localObj.code] = localObj.message; -// }); -// } -// return localizationMaps; -// } +async function getStateCityLocalizaitons(request, tenantId) { + let localizationMaps = {}; + let lang = getLanguageFromRequest(request); + let modules = [getStateLocalizationModule(tenantId),getCityLocalizationModule(tenantId)].join(","); + let localRequest = {} + localRequest["RequestInfo"] = request["RequestInfo"]; + let localizations = await search_localization(localRequest, lang, modules, tenantId); + if (localizations?.data?.messages?.length) { + localizations.data.messages.forEach(localObj => { + localizationMaps[localObj.code] = localObj.message; + }); + } + return localizationMaps; +} -// function updateLocalization(projects, localizationMaps, tenantId) { -// projects = projects.map((project) => { -// if (project?.address?.latitude != null && project?.address?.latitude != 0 && project?.address?.longitude != null && project?.address?.longitude != 0) { -// project.address.pdfLatlong = `${project.address.latitude}, ${project.address.longitude}`; -// } else { -// project.address.pdfLatlong = null; -// } -// if (project?.address?.city) { -// project.address.city = project.address.city.toUpperCase(); -// cityKey = "TENANT_TENANTS_" + project.address.city.split(".").join("_"); -// project.address.city = getLocalizationByKey(cityKey, localizationMaps); -// } -// if (project?.additionalDetails?.locality) { -// let localityKey = getCityLocalizationPrefix(tenantId); -// localityKey = localityKey + "_ADMIN_" + project.additionalDetails.locality; -// project.additionalDetails.locality = getLocalizationByKey(localityKey, localizationMaps); -// } -// if (project?.address?.boundary) { -// let boundaryKey = getCityLocalizationPrefix(tenantId); -// boundaryKey = boundaryKey + "_ADMIN_" + project.address.boundary; -// project.address.boundary = getLocalizationByKey(boundaryKey, localizationMaps); -// } -// return project; -// }) -// return projects; -// } +function updateLocalization(projects, localizationMaps, tenantId) { + projects = projects.map((project) => { + if (project?.address?.latitude != null && project?.address?.latitude != 0 && project?.address?.longitude != null && project?.address?.longitude != 0) { + project.address.pdfLatlong = `${project.address.latitude}, ${project.address.longitude}`; + } else { + project.address.pdfLatlong = null; + } + if (project?.address?.city) { + project.address.city = project.address.city.toUpperCase(); + cityKey = "TENANT_TENANTS_" + project.address.city.split(".").join("_"); + project.address.city = getLocalizationByKey(cityKey, localizationMaps); + } + if (project?.additionalDetails?.locality) { + let localityKey = getCityLocalizationPrefix(tenantId); + localityKey = localityKey + "_ADMIN_" + project.additionalDetails.locality; + project.additionalDetails.locality = getLocalizationByKey(localityKey, localizationMaps); + } + if (project?.address?.boundary) { + let boundaryKey = getCityLocalizationPrefix(tenantId); + boundaryKey = boundaryKey + "_ADMIN_" + project.address.boundary; + project.address.boundary = getLocalizationByKey(boundaryKey, localizationMaps); + } + return project; + }) + return projects; +} router.post( "/payment-tracker", @@ -199,15 +199,12 @@ router.post( var project = resProject.data; - project.Project[0].address.city = project.Project[0].address.city - .replace("od.", "") // Remove the "od." prefix - .replace(/^\w/, c => c.toUpperCase()); // Capitalize the first letter if (project && project.Project && project.Project.length > 0) { var pdfResponse; var pdfkey = config.pdf.paymentTracker_template; - // let localizationMap = await getStateCityLocalizaitons(requestinfo, tenantId); - // project.Project = updateLocalization(project.Project, localizationMap, tenantId); + let localizationMap = await getStateCityLocalizaitons(requestinfo, tenantId); + project.Project = updateLocalization(project.Project, localizationMap, tenantId); // Adding project as Projects because it's updating on create_pdf project["Projects"] = project.Project; project["Projects"][0]["date"] = getCurrentDate(); From 8e069fe3799e048cbbac9c3bca6251cc6cf6f80e Mon Sep 17 00:00:00 2001 From: Lokendra Tyagi Date: Tue, 29 Oct 2024 17:08:11 +0530 Subject: [PATCH 2/3] fixed terms and conditions filter --- utilities/works-pdf/src/routes/workOrder.js | 30 +++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/utilities/works-pdf/src/routes/workOrder.js b/utilities/works-pdf/src/routes/workOrder.js index 43081cfe67..07da0cc2ac 100644 --- a/utilities/works-pdf/src/routes/workOrder.js +++ b/utilities/works-pdf/src/routes/workOrder.js @@ -203,24 +203,26 @@ router.post( let termAndConditions = []; if (contract.contracts[0].executingAuthority == 'IA') { - let tnClength = mdmsData[0].termsAndConditions.length; - - for (i = 0; i < tnClength; i++) { - var termsKey = mdmsData[0].termsAndConditions[i].disclaimer; - var tnc = getLocalizationByKey(termsKey, localizationMaps); - termAndConditions.push(tnc.replace('{nameoftheulb}', tenantIdForTnC)); - + let iaItem = mdmsData.find(item => item.code === 'IA'); + if(iaItem){ + let tnClength = iaItem.termsAndConditions.length; + for (i = 0; i < tnClength; i++) { + var termsKey = iaItem.termsAndConditions[i].disclaimer; + var tnc = getLocalizationByKey(termsKey, localizationMaps); + termAndConditions.push(tnc.replace('{nameoftheulb}', tenantIdForTnC)); + } } } if (contract.contracts[0].executingAuthority == 'IP') { - let tnClength = mdmsData[1].termsAndConditions.length; - - for (i = 0; i < tnClength; i++) { - let termsKey = mdmsData[1].termsAndConditions[i].disclaimer; - let tnc = getLocalizationByKey(termsKey, localizationMaps); - termAndConditions.push(tnc.replace('{nameoftheulb}', tenantIdForTnC)); - + let ipItem = mdmsData.find(item => item.code === 'IP'); + if(ipItem){ + let tnClength = ipItem.termsAndConditions.length; + for (i = 0; i < tnClength; i++) { + var termsKey = ipItem.termsAndConditions[i].disclaimer; + var tnc = getLocalizationByKey(termsKey, localizationMaps); + termAndConditions.push(tnc.replace('{nameoftheulb}', tenantIdForTnC)); + } } } let newTC = []; From 2924b49e6cef96bff83183bf34bc70e78e06af57 Mon Sep 17 00:00:00 2001 From: Tulika-eGov Date: Tue, 29 Oct 2024 17:49:18 +0530 Subject: [PATCH 3/3] UCEM-765 : updated and removed the documents and comments from pb --- .../example/src/UICustomizations.js | 20 +++++++++---------- .../src/Customisations/UICustomizations.js | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js index cfb0438ce7..5ca5bdd048 100644 --- a/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/example/src/UICustomizations.js @@ -117,16 +117,16 @@ export const UICustomizations = { } if(businessService === businessServiceMap?.["works.purchase"]){ const workflow = { - comment: data.comments, - documents: data?.documents?.map((document) => { - return { - documentType: action?.action + " DOC", - fileName: document?.[1]?.file?.name, - fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, - documentUid: document?.[1]?.fileStoreId?.fileStoreId, - tenantId: document?.[1]?.fileStoreId?.tenantId, - }; - }), + comments: data.comments, + // documents: data?.documents?.map((document) => { + // return { + // documentType: action?.action + " DOC", + // fileName: document?.[1]?.file?.name, + // fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + // documentUid: document?.[1]?.fileStoreId?.fileStoreId, + // tenantId: document?.[1]?.fileStoreId?.tenantId, + // }; + // }), assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, action: action.action, }; diff --git a/frontend/micro-ui/web/src/Customisations/UICustomizations.js b/frontend/micro-ui/web/src/Customisations/UICustomizations.js index dfb2797280..34863d5607 100644 --- a/frontend/micro-ui/web/src/Customisations/UICustomizations.js +++ b/frontend/micro-ui/web/src/Customisations/UICustomizations.js @@ -117,16 +117,16 @@ export const UICustomizations = { } if(businessService === businessServiceMap?.["works.purchase"]){ const workflow = { - comment: data.comments, - documents: data?.documents?.map((document) => { - return { - documentType: action?.action + " DOC", - fileName: document?.[1]?.file?.name, - fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, - documentUid: document?.[1]?.fileStoreId?.fileStoreId, - tenantId: document?.[1]?.fileStoreId?.tenantId, - }; - }), + comments: data.comments, + // documents: data?.documents?.map((document) => { + // return { + // documentType: action?.action + " DOC", + // fileName: document?.[1]?.file?.name, + // fileStoreId: document?.[1]?.fileStoreId?.fileStoreId, + // documentUid: document?.[1]?.fileStoreId?.fileStoreId, + // tenantId: document?.[1]?.fileStoreId?.tenantId, + // }; + // }), assignees: data?.assignees?.uuid ? [data?.assignees?.uuid] : null, action: action.action, };