From 9e19a6352913959a85eb55b3182940a5d2d1b563 Mon Sep 17 00:00:00 2001 From: Hari-egov Date: Fri, 11 Oct 2024 12:34:05 +0530 Subject: [PATCH 1/7] ISTE-135 FIX --- .../reports/monthly_ledger_report.dart | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart index 90f3f5c02..03a6bf054 100644 --- a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart @@ -89,21 +89,24 @@ class _MonthlyLedgerReportState extends State SizedBox( width: 10, ), - TextButton.icon( - onPressed: () { - if (reportProvider.selectedBillPeriod == null) { - Notifiers.getToastMessage( - context, - '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', - 'ERROR'); - } else { - reportProvider.getMonthlyLedgerReport( - download: true); - } - }, - icon: Icon(Icons.download_sharp), - label: Text(ApplicationLocalizations.of(context) - .translate(i18.common.CORE_DOWNLOAD))), + Opacity( + opacity: 0, + child: TextButton.icon( + onPressed: () { + // if (reportProvider.selectedBillPeriod == null) { + // Notifiers.getToastMessage( + // context, + // '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', + // 'ERROR'); + // } else { + // reportProvider.getMonthlyLedgerReport( + // download: true); + // } + }, + icon: Icon(Icons.download_sharp), + label: Text(ApplicationLocalizations.of(context) + .translate(i18.common.CORE_DOWNLOAD))), + ), ], ), ], From 4c4d55dcfce9e45780b439f9f7dc45dfe915e485 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 14 Oct 2024 11:29:40 +0530 Subject: [PATCH 2/7] Added localisation link --- .../modules/hrms/src/components/hrmscard.js | 15 +- .../modules/hrms/src/pages/Response.js | 24 +- .../src/Customisations/UICustomizations.js | 436 ++++++++++++------ 3 files changed, 314 insertions(+), 161 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js index 0525b7087..f9c008caa 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js @@ -41,6 +41,11 @@ const HRMSCard = () => { link: `${window?.location?.origin}/workbench-ui/employee/workbench/mdms-search-v2?moduleName=tenant&masterName=tenants`, category: t("HR_EDIT_MASTER"), }, + { + label: t("WORK_BENCH_URL_LOCALISATION"), + link: `${window?.location?.origin}/workbench-ui/employee/workbench/localisation-search`, + category: t("HR_EDIT_MASTER"), + }, ] : []; @@ -88,11 +93,11 @@ const HRMSCard = () => { category: t("SEARCH_USER_HEADER"), }, - { - label: t("HR_STATE_ REPORTS"), - link: `/${window?.contextPath}/employee/hrms/dashboard?moduleName=dashboard&pageName=state`, - category: t("HR_DASHBOARD_HEADER"), - }, + { + label: t("HR_STATE_ REPORTS"), + link: `/${window?.contextPath}/employee/hrms/dashboard?moduleName=dashboard&pageName=state`, + category: t("HR_DASHBOARD_HEADER"), + }, { label: t("HR_RATE_DASHBOARD"), link: `/${window?.contextPath}/employee/hrms/dashboard?moduleName=dashboard&pageName=rate-master`, diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js index 7b55756e9..e4fcf80b7 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/Response.js @@ -22,7 +22,7 @@ const BannerPicker = (props) => { return ( @@ -40,17 +40,17 @@ const Response = (props) => { const mutation = state.key === "UPDATE" ? Digit.Hooks.hrms.useHRMSUpdate(tenantId) : Digit.Hooks.hrms.useHRMSCreate(tenantId); const employeeCreateSession = Digit.Hooks.useSessionStorage("NEW_EMPLOYEE_CREATE", {}); - const [sessionFormData,setSessionFormData, clearSessionFormData] = employeeCreateSession; + const [sessionFormData, setSessionFormData, clearSessionFormData] = employeeCreateSession; // remove session form data if user navigates away from the estimate create screen - useEffect(()=>{ + useEffect(() => { if (!window.location.href.includes("/hrms/create") && sessionFormData && Object.keys(sessionFormData) != 0) { - clearSessionFormData(); + clearSessionFormData(); } -},[location]); + }, [location]); const onError = (error, variables) => { - setErrorInfo(error?.response?.data?.Errors[0]?.code || 'ERROR'); + setErrorInfo(error?.response?.data?.Errors[0]?.code || "ERROR"); setMutationHappened(true); }; @@ -62,7 +62,7 @@ const Response = (props) => { const onSuccess = () => { setMutationHappened(true); }; - if (!mutationHappened ) { + if (!mutationHappened) { if (state.key === "UPDATE") { mutation.mutate( { @@ -83,20 +83,20 @@ const Response = (props) => { const DisplayText = (action, isSuccess, isEmployee, t) => { if (!isSuccess) { - return mutation?.error?.response?.data?.Errors[0].code||errorInfo; + return mutation?.error?.response?.data?.Errors[0].code || "ERROR"; } else { Digit.SessionStorage.set("isupdate", Math.floor(100000 + Math.random() * 900000)); - return state.key === "CREATE"?"HRMS_CREATE_EMPLOYEE_INFO" :""; + return state.key === "CREATE" ? "HRMS_CREATE_EMPLOYEE_INFO" : ""; } }; - if (mutation.isLoading || (mutation.isIdle && !mutationHappened)) { + if (mutation.isLoading || (mutation.isIdle && !mutationHappened)) { return ; } return ( { {t(DisplayText(state.action, mutation.isSuccess || !!successData, props.parentRoute.includes("employee"), t), t)} - + diff --git a/frontend/micro-ui/web/src/Customisations/UICustomizations.js b/frontend/micro-ui/web/src/Customisations/UICustomizations.js index 042175868..c76ac89b3 100644 --- a/frontend/micro-ui/web/src/Customisations/UICustomizations.js +++ b/frontend/micro-ui/web/src/Customisations/UICustomizations.js @@ -6,11 +6,8 @@ import _ from "lodash"; // these functions will act as middlewares var Digit = window.Digit || {}; - - const businessServiceMap = { - - "muster roll": "MR" + "muster roll": "MR", }; const inboxModuleNameMap = { @@ -20,7 +17,6 @@ const inboxModuleNameMap = { export const UICustomizations = { businessServiceMap, updatePayload: (applicationDetails, data, action, businessService) => { - if (businessService === businessServiceMap.estimate) { const workflow = { comment: data.comments, @@ -96,7 +92,7 @@ export const UICustomizations = { workflow, }; } - if(businessService === businessServiceMap?.["works.purchase"]){ + if (businessService === businessServiceMap?.["works.purchase"]) { const workflow = { comment: data.comments, documents: data?.documents?.map((document) => { @@ -117,35 +113,41 @@ export const UICustomizations = { }); const additionalFieldsToSet = { - projectId:applicationDetails.additionalDetails.projectId, - invoiceDate:applicationDetails.billDate, - invoiceNumber:applicationDetails.referenceId.split('_')?.[1], - contractNumber:applicationDetails.referenceId.split('_')?.[0], - documents:applicationDetails.additionalDetails.documents - } + projectId: applicationDetails.additionalDetails.projectId, + invoiceDate: applicationDetails.billDate, + invoiceNumber: applicationDetails.referenceId.split("_")?.[1], + contractNumber: applicationDetails.referenceId.split("_")?.[0], + documents: applicationDetails.additionalDetails.documents, + }; return { - bill: {...applicationDetails,...additionalFieldsToSet}, + bill: { ...applicationDetails, ...additionalFieldsToSet }, workflow, }; } }, - enableModalSubmit:(businessService,action,setModalSubmit,data)=>{ - if(businessService === businessServiceMap?.["muster roll"] && action.action==="APPROVE"){ - setModalSubmit(data?.acceptTerms) + enableModalSubmit: (businessService, action, setModalSubmit, data) => { + if ( + businessService === businessServiceMap?.["muster roll"] && + action.action === "APPROVE" + ) { + setModalSubmit(data?.acceptTerms); } }, enableHrmsSearch: (businessService, action) => { if (businessService === businessServiceMap.estimate) { - return action.action.includes("TECHNICALSANCTION") || action.action.includes("VERIFYANDFORWARD"); + return ( + action.action.includes("TECHNICALSANCTION") || + action.action.includes("VERIFYANDFORWARD") + ); } if (businessService === businessServiceMap.contract) { return action.action.includes("VERIFY_AND_FORWARD"); } - if (businessService === businessServiceMap?.["muster roll"]) { + if (businessService === businessServiceMap?.["muster roll"]) { return action.action.includes("VERIFY"); } - if(businessService === businessServiceMap?.["works.purchase"]){ - return action.action.includes("VERIFY_AND_FORWARD") + if (businessService === businessServiceMap?.["works.purchase"]) { + return action.action.includes("VERIFY_AND_FORWARD"); } return false; }, @@ -156,17 +158,13 @@ export const UICustomizations = { return businessServiceMap?.contract; } else if (moduleCode?.includes("muster roll")) { return businessServiceMap?.["muster roll"]; - } - else if (moduleCode?.includes("works.purchase")) { + } else if (moduleCode?.includes("works.purchase")) { return businessServiceMap?.["works.purchase"]; - } - else if (moduleCode?.includes("works.wages")) { + } else if (moduleCode?.includes("works.wages")) { return businessServiceMap?.["works.wages"]; - } - else if (moduleCode?.includes("works.supervision")) { + } else if (moduleCode?.includes("works.supervision")) { return businessServiceMap?.["works.supervision"]; - } - else { + } else { return businessServiceMap; } }, @@ -184,31 +182,43 @@ export const UICustomizations = { AttendanceInboxConfig: { preProcess: (data) => { - //set tenantId data.body.inbox.tenantId = Digit.ULBService.getCurrentTenantId(); - data.body.inbox.processSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + data.body.inbox.processSearchCriteria.tenantId = + Digit.ULBService.getCurrentTenantId(); - const musterRollNumber = data?.body?.inbox?.moduleSearchCriteria?.musterRollNumber?.trim(); - if(musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber + const musterRollNumber = + data?.body?.inbox?.moduleSearchCriteria?.musterRollNumber?.trim(); + if (musterRollNumber) + data.body.inbox.moduleSearchCriteria.musterRollNumber = + musterRollNumber; - const attendanceRegisterName = data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); - if(attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName + const attendanceRegisterName = + data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); + if (attendanceRegisterName) + data.body.inbox.moduleSearchCriteria.attendanceRegisterName = + attendanceRegisterName; // deleting them for now(assignee-> need clarity from pintu,ward-> static for now,not implemented BE side) const assignee = _.clone(data.body.inbox.moduleSearchCriteria.assignee); delete data.body.inbox.moduleSearchCriteria.assignee; if (assignee?.code === "ASSIGNED_TO_ME") { - data.body.inbox.moduleSearchCriteria.assignee = Digit.UserService.getUser().info.uuid; + data.body.inbox.moduleSearchCriteria.assignee = + Digit.UserService.getUser().info.uuid; } //cloning locality and workflow states to format them // let locality = _.clone(data.body.inbox.moduleSearchCriteria.locality ? data.body.inbox.moduleSearchCriteria.locality : []); - - let selectedOrg = _.clone(data.body.inbox.moduleSearchCriteria.orgId ? data.body.inbox.moduleSearchCriteria.orgId : null); + + let selectedOrg = _.clone( + data.body.inbox.moduleSearchCriteria.orgId + ? data.body.inbox.moduleSearchCriteria.orgId + : null + ); delete data.body.inbox.moduleSearchCriteria.orgId; - if(selectedOrg) { - data.body.inbox.moduleSearchCriteria.orgId = selectedOrg?.[0]?.applicationNumber; + if (selectedOrg) { + data.body.inbox.moduleSearchCriteria.orgId = + selectedOrg?.[0]?.applicationNumber; } // let selectedWard = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : null); @@ -217,8 +227,16 @@ export const UICustomizations = { // data.body.inbox.moduleSearchCriteria.ward = selectedWard?.[0]?.code; // } - let states = _.clone(data.body.inbox.moduleSearchCriteria.state ? data.body.inbox.moduleSearchCriteria.state : []); - let ward = _.clone(data.body.inbox.moduleSearchCriteria.ward ? data.body.inbox.moduleSearchCriteria.ward : []); + let states = _.clone( + data.body.inbox.moduleSearchCriteria.state + ? data.body.inbox.moduleSearchCriteria.state + : [] + ); + let ward = _.clone( + data.body.inbox.moduleSearchCriteria.ward + ? data.body.inbox.moduleSearchCriteria.ward + : [] + ); // delete data.body.inbox.moduleSearchCriteria.locality; delete data.body.inbox.moduleSearchCriteria.state; delete data.body.inbox.moduleSearchCriteria.ward; @@ -226,30 +244,43 @@ export const UICustomizations = { // locality = locality?.map((row) => row?.code); states = Object.keys(states)?.filter((key) => states[key]); ward = ward?.map((row) => row?.code); - - + // //adding formatted data to these keys // if (locality.length > 0) data.body.inbox.moduleSearchCriteria.locality = locality; - if (states.length > 0) data.body.inbox.moduleSearchCriteria.status = states; + if (states.length > 0) + data.body.inbox.moduleSearchCriteria.status = states; if (ward.length > 0) data.body.inbox.moduleSearchCriteria.ward = ward; - const projectType = _.clone(data.body.inbox.moduleSearchCriteria.projectType ? data.body.inbox.moduleSearchCriteria.projectType : {}); - if (projectType?.code) data.body.inbox.moduleSearchCriteria.projectType = projectType.code; + const projectType = _.clone( + data.body.inbox.moduleSearchCriteria.projectType + ? data.body.inbox.moduleSearchCriteria.projectType + : {} + ); + if (projectType?.code) + data.body.inbox.moduleSearchCriteria.projectType = projectType.code; //adding tenantId to moduleSearchCriteria - data.body.inbox.moduleSearchCriteria.tenantId = Digit.ULBService.getCurrentTenantId(); + data.body.inbox.moduleSearchCriteria.tenantId = + Digit.ULBService.getCurrentTenantId(); - //setting limit and offset becoz somehow they are not getting set in muster inbox - data.body.inbox .limit = data.state.tableForm.limit - data.body.inbox.offset = data.state.tableForm.offset - delete data.state + //setting limit and offset becoz somehow they are not getting set in muster inbox + data.body.inbox.limit = data.state.tableForm.limit; + data.body.inbox.offset = data.state.tableForm.offset; + delete data.state; return data; }, postProcess: (responseArray, uiConfig) => { const statusOptions = responseArray?.statusMap ?.filter((item) => item.applicationstatus) - ?.map((item) => ({ code: item.applicationstatus, i18nKey: `COMMON_MASTERS_${item.applicationstatus}` })); + ?.map((item) => ({ + code: item.applicationstatus, + i18nKey: `COMMON_MASTERS_${item.applicationstatus}`, + })); if (uiConfig?.type === "filter") { - let fieldConfig = uiConfig?.fields?.filter((item) => item.type === "dropdown" && item.populators.name === "musterRollStatus"); + let fieldConfig = uiConfig?.fields?.filter( + (item) => + item.type === "dropdown" && + item.populators.name === "musterRollStatus" + ); if (fieldConfig.length) { fieldConfig[0].populators.options = statusOptions; } @@ -260,15 +291,26 @@ export const UICustomizations = { return ( - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + {String( + value + ? column.translate + ? t(column.prefix ? `${column.prefix}${value}` : value) + : value + : t("ES_COMMON_NA") + )} ); } if (key === "ATM_ATTENDANCE_WEEK") { - const week = `${Digit.DateUtils.ConvertTimestampToDate(value?.startDate, "dd/MM/yyyy")}-${Digit.DateUtils.ConvertTimestampToDate( + const week = `${Digit.DateUtils.ConvertTimestampToDate( + value?.startDate, + "dd/MM/yyyy" + )}-${Digit.DateUtils.ConvertTimestampToDate( value?.endDate, "dd/MM/yyyy" )}`; @@ -277,8 +319,14 @@ export const UICustomizations = { if (key === "ATM_NO_OF_INDIVIDUALS") { return
{value?.length}
; } - if(key === "ATM_AMOUNT_IN_RS"){ - return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; + if (key === "ATM_AMOUNT_IN_RS") { + return ( + + {value + ? Digit.Utils.dss.formatterWithoutRound(value, "number") + : t("ES_COMMON_NA")} + + ); } if (key === "ATM_SLA") { return parseInt(value) > 0 ? ( @@ -288,10 +336,10 @@ export const UICustomizations = { ); } if (key === "COMMON_WORKFLOW_STATES") { - return {t(`WF_MUSTOR_${value}`)} + return {t(`WF_MUSTOR_${value}`)}; } //added this in case we change the key and not updated here , it'll throw that nothing was returned from cell error if that case is not handled here. To prevent that error putting this default - return {t(`CASE_NOT_HANDLED`)} + return {t(`CASE_NOT_HANDLED`)}; }, MobileDetailsOnClick: (row, tenantId) => { let link; @@ -309,9 +357,9 @@ export const UICustomizations = { body: { SearchCriteria: { tenantId: tenantId, - functions : { - type : "CBO" - } + functions: { + type: "CBO", + }, }, }, config: { @@ -323,17 +371,23 @@ export const UICustomizations = { }; }, }, - SearchWageSeekerConfig: { + SearchWageSeekerConfig: { customValidationCheck: (data) => { //checking both to and from date are present const { createdFrom, createdTo } = data; - if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) + if ( + (createdFrom === "" && createdTo !== "") || + (createdFrom !== "" && createdTo === "") + ) return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; }, preProcess: (data) => { - data.params = { ...data.params, tenantId: Digit.ULBService.getCurrentTenantId() }; + data.params = { + ...data.params, + tenantId: Digit.ULBService.getCurrentTenantId(), + }; let requestBody = { ...data.body.Individual }; const pathConfig = { @@ -347,7 +401,7 @@ export const UICustomizations = { wardCode: "wardCode[0].code", socialCategory: "socialCategory.code", }; - const textConfig = ["name", "individualId"] + const textConfig = ["name", "individualId"]; let Individual = Object.keys(requestBody) .map((key) => { if (selectConfig[key]) { @@ -355,7 +409,7 @@ export const UICustomizations = { } else if (typeof requestBody[key] == "object") { requestBody[key] = requestBody[key]?.code; } else if (textConfig?.includes(key)) { - requestBody[key] = requestBody[key]?.trim() + requestBody[key] = requestBody[key]?.trim(); } return key; }) @@ -364,7 +418,14 @@ export const UICustomizations = { if (pathConfig[curr]) { _.set(acc, pathConfig[curr], requestBody[curr]); } else if (dateConfig[curr] && dateConfig[curr]?.includes("day")) { - _.set(acc, curr, Digit.Utils.date.convertDateToEpoch(requestBody[curr], dateConfig[curr])); + _.set( + acc, + curr, + Digit.Utils.date.convertDateToEpoch( + requestBody[curr], + dateConfig[curr] + ) + ); } else { _.set(acc, curr, requestBody[curr]); } @@ -382,28 +443,56 @@ export const UICustomizations = { case "MASTERS_WAGESEEKER_ID": return ( - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + {String( + value + ? column.translate + ? t(column.prefix ? `${column.prefix}${value}` : value) + : value + : t("ES_COMMON_NA") + )} ); case "MASTERS_SOCIAL_CATEGORY": - return value ? {String(t(`MASTERS_${value}`))} : t("ES_COMMON_NA"); + return value ? ( + + {String(t(`MASTERS_${value}`))} + + ) : ( + t("ES_COMMON_NA") + ); case "CORE_COMMON_PROFILE_CITY": - return value ? {String(t(Digit.Utils.locale.getCityLocale(value)))} : t("ES_COMMON_NA"); + return value ? ( + + {String(t(Digit.Utils.locale.getCityLocale(value)))} + + ) : ( + t("ES_COMMON_NA") + ); case "MASTERS_WARD": return value ? ( - {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + + {String( + t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)) + )} + ) : ( t("ES_COMMON_NA") ); case "MASTERS_LOCALITY": return value ? ( - {String(t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)))} + + {String( + t(Digit.Utils.locale.getMohallaLocale(value, row?.tenantId)) + )} + ) : ( t("ES_COMMON_NA") ); @@ -421,32 +510,36 @@ export const UICustomizations = { }, additionalValidations: (type, data, keys) => { if (type === "date") { - return data[keys.start] && data[keys.end] ? () => new Date(data[keys.start]).getTime() <= new Date(data[keys.end]).getTime() : true; + return data[keys.start] && data[keys.end] + ? () => + new Date(data[keys.start]).getTime() <= + new Date(data[keys.end]).getTime() + : true; } - } + }, }, - OpenPaymentSearch:{ + OpenPaymentSearch: { preProcess: (data, additionalDetails) => { - //we need to get three things -> consumerCode,businessService,tenantId // businessService and tenantId can be either in queryParams or in form - let {consumerCode,businessService,tenantId} = data?.state?.searchForm || {}; - businessService = businessService?.code - tenantId = tenantId?.[0]?.code - if(!businessService){ - businessService = additionalDetails?.queryParams?.businessService + let { consumerCode, businessService, tenantId } = + data?.state?.searchForm || {}; + businessService = businessService?.code; + tenantId = tenantId?.[0]?.code; + if (!businessService) { + businessService = additionalDetails?.queryParams?.businessService; } - if(!tenantId){ - tenantId = additionalDetails?.queryParams?.tenantId + if (!tenantId) { + tenantId = additionalDetails?.queryParams?.tenantId; } const finalParams = { // consumerCode, tenantId, businessService, - connectionNumber:consumerCode, - isOpenPaymentSearch:true - } - data.params = finalParams + connectionNumber: consumerCode, + isOpenPaymentSearch: true, + }; + data.params = finalParams; // data.params.textSearch = finalParams.consumerCode // const tenantId = Digit.ULBService.getCurrentTenantId(); // data.body = { RequestInfo: data.body.RequestInfo }; @@ -472,75 +565,129 @@ export const UICustomizations = { delete data.body.custom; delete data.body.pagination; data.options = { - userService:false, - auth:false - } + userService: false, + auth: false, + }; // delete data.body.inbox; // delete data.params; return data; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - switch (key) { case "OP_CONS_CODE": - return - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - - + return ( + + + {String( + value + ? column.translate + ? t(column.prefix ? `${column.prefix}${value}` : value) + : value + : t("ES_COMMON_NA") + )} + + + ); + case "OP_APPLICATION_TYPE": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_APPLICATION_TYPE_${value}`)) : t("ES_COMMON_NA")} -
- + return ( +
+ {value + ? t( + Digit.Utils.locale.getTransformedLocale( + `OP_APPLICATION_TYPE_${value}` + ) + ) + : t("ES_COMMON_NA")} +
+ ); + case "OP_APPLICATION_STATUS": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_APPLICATION_STATUS_${value}`)) : t("ES_COMMON_NA")} -
+ return ( +
+ {value + ? t( + Digit.Utils.locale.getTransformedLocale( + `OP_APPLICATION_STATUS_${value}` + ) + ) + : t("ES_COMMON_NA")} +
+ ); case "OP_CONNECTION_TYPE": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_CONNECTION_TYPE_${value}`)) : t("ES_COMMON_NA")} -
+ return ( +
+ {value + ? t( + Digit.Utils.locale.getTransformedLocale( + `OP_CONNECTION_TYPE_${value}` + ) + ) + : t("ES_COMMON_NA")} +
+ ); case "OP_METER_INSTALLATION_DATE": - return
- {value ? Digit.DateUtils.ConvertEpochToDate(value) : t("ES_COMMON_NA")} -
+ return ( +
+ {value + ? Digit.DateUtils.ConvertEpochToDate(value) + : t("ES_COMMON_NA")} +
+ ); case "OP_METER_READING_DATE": - return
- {value ? Digit.DateUtils.ConvertEpochToDate(value) : t("ES_COMMON_NA")} -
+ return ( +
+ {value + ? Digit.DateUtils.ConvertEpochToDate(value) + : t("ES_COMMON_NA")} +
+ ); case "OP_PROPERTY_TYPE": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_PROPERTY_TYPE_${value}`)) : t("ES_COMMON_NA")} -
+ return ( +
+ {value + ? t( + Digit.Utils.locale.getTransformedLocale( + `OP_PROPERTY_TYPE_${value}` + ) + ) + : t("ES_COMMON_NA")} +
+ ); case "OP_PAYER_NAME": - return
- {value ? anonymizeHalfString(value) : t("ES_COMMON_NA")} -
- - + return ( +
{value ? anonymizeHalfString(value) : t("ES_COMMON_NA")}
+ ); + default: - return {t("ES_COMMON_DEFAULT_NA")} + return {t("ES_COMMON_DEFAULT_NA")}; } if (key === "OP_BILL_DATE") { return Digit.DateUtils.ConvertEpochToDate(value); } - if(key === "OP_BILL_TOTAL_AMT"){ - return {`₹ ${value}`} + if (key === "OP_BILL_TOTAL_AMT") { + return {`₹ ${value}`}; } - if(key === "OP_CONS_CODE") { - return + if (key === "OP_CONS_CODE") { + return ( + - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + {String( + value + ? column.translate + ? t(column.prefix ? `${column.prefix}${value}` : value) + : value + : t("ES_COMMON_NA") + )} - + + ); } }, populateReqCriteria: () => { @@ -566,29 +713,30 @@ export const UICustomizations = { config: { enabled: true, select: (data) => { - const result = data?.MdmsRes?.tenant?.tenants?.filter(row => row?.divisionCode && row?.divisionName)?.map(row => { - return { - ...row, - updatedCode:`${row.divisionName} - ${row?.name}` - } - }); + const result = data?.MdmsRes?.tenant?.tenants + ?.filter((row) => row?.divisionCode && row?.divisionName) + ?.map((row) => { + return { + ...row, + updatedCode: `${row?.divisionName} - ${t(row?.code)}`, + }; + }); return result; }, }, }; }, customValidationCheck: (data) => { - //checking both to and from date are present const { consumerCode } = data; - if(!consumerCode) return false; - if(consumerCode.length < 10 || consumerCode.length > 25){ + if (!consumerCode) return false; + if (consumerCode.length < 10 || consumerCode.length > 25) { return { warning: true, label: "ES_COMMON_ENTER_VALID_CONSUMER_CODE" }; } // if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) // return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; - } - } + }, + }, }; From 5039a28ef1a09e080b44de8e644962f36d589081 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 14 Oct 2024 12:09:13 +0530 Subject: [PATCH 3/7] Update hrmscard.js added comment --- .../packages/modules/hrms/src/components/hrmscard.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js index f9c008caa..63fa5fd65 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/hrmscard.js @@ -32,7 +32,8 @@ const HRMSCard = () => { }, ] : []; - + + // only for state admin const moduleForSomeSTATEUser = STATE_ADMIN && MDMS_ADMIN ? [ From e2b81e46b49e7764b0586b90cac0c37031cc6535 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 14 Oct 2024 12:28:51 +0530 Subject: [PATCH 4/7] Solved numeric code problem --- .../payment/src/configs/UICustomizations.js | 120 ++++++++---------- 1 file changed, 54 insertions(+), 66 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js index 07d9858ff..e587b01b3 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js @@ -22,28 +22,27 @@ function anonymizeHalfString(input) { } export const UICustomizations = { - OpenPaymentSearch:{ + OpenPaymentSearch: { preProcess: (data, additionalDetails) => { - //we need to get three things -> consumerCode,businessService,tenantId // businessService and tenantId can be either in queryParams or in form - let {consumerCode,businessService,tenantId} = data?.state?.searchForm || {}; - businessService = businessService?.code - tenantId = tenantId?.[0]?.code - if(!businessService){ - businessService = additionalDetails?.queryParams?.businessService + let { consumerCode, businessService, tenantId } = data?.state?.searchForm || {}; + businessService = businessService?.code; + tenantId = tenantId?.[0]?.code; + if (!businessService) { + businessService = additionalDetails?.queryParams?.businessService; } - if(!tenantId){ - tenantId = additionalDetails?.queryParams?.tenantId + if (!tenantId) { + tenantId = additionalDetails?.queryParams?.tenantId; } const finalParams = { // consumerCode, tenantId, businessService, - connectionNumber:consumerCode, - isOpenPaymentSearch:true - } - data.params = finalParams + connectionNumber: consumerCode, + isOpenPaymentSearch: true, + }; + data.params = finalParams; // data.params.textSearch = finalParams.consumerCode // const tenantId = Digit.ULBService.getCurrentTenantId(); // data.body = { RequestInfo: data.body.RequestInfo }; @@ -69,9 +68,9 @@ export const UICustomizations = { delete data.body.custom; delete data.body.pagination; data.options = { - userService:false, - auth:false - } + userService: false, + auth: false, + }; // delete data.body.inbox; // delete data.params; return data; @@ -85,67 +84,55 @@ export const UICustomizations = { return link; }, additionalCustomizations: (row, key, column, value, t, searchResult) => { - switch (key) { case "OP_CONS_CODE": - return - - {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - - - + return ( + + + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} + + + ); + case "OP_APPLICATION_TYPE": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_APPLICATION_TYPE_${value}`)) : t("ES_COMMON_NA")} -
- + return
{value ? t(Digit.Utils.locale.getTransformedLocale(`OP_APPLICATION_TYPE_${value}`)) : t("ES_COMMON_NA")}
; + case "OP_APPLICATION_STATUS": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_APPLICATION_STATUS_${value}`)) : t("ES_COMMON_NA")} -
+ return
{value ? t(Digit.Utils.locale.getTransformedLocale(`OP_APPLICATION_STATUS_${value}`)) : t("ES_COMMON_NA")}
; case "OP_CONNECTION_TYPE": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_CONNECTION_TYPE_${value}`)) : t("ES_COMMON_NA")} -
+ return
{value ? t(Digit.Utils.locale.getTransformedLocale(`OP_CONNECTION_TYPE_${value}`)) : t("ES_COMMON_NA")}
; case "OP_METER_INSTALLATION_DATE": - return
- {value ? Digit.DateUtils.ConvertEpochToDate(value) : t("ES_COMMON_NA")} -
+ return
{value ? Digit.DateUtils.ConvertEpochToDate(value) : t("ES_COMMON_NA")}
; case "OP_METER_READING_DATE": - return
- {value ? Digit.DateUtils.ConvertEpochToDate(value) : t("ES_COMMON_NA")} -
+ return
{value ? Digit.DateUtils.ConvertEpochToDate(value) : t("ES_COMMON_NA")}
; case "OP_PROPERTY_TYPE": - return
- { value ? t(Digit.Utils.locale.getTransformedLocale(`OP_PROPERTY_TYPE_${value}`)) : t("ES_COMMON_NA")} -
+ return
{value ? t(Digit.Utils.locale.getTransformedLocale(`OP_PROPERTY_TYPE_${value}`)) : t("ES_COMMON_NA")}
; case "OP_PAYER_NAME": - return
- {value ? anonymizeHalfString(value) : t("ES_COMMON_NA")} -
- - + return
{value ? anonymizeHalfString(value) : t("ES_COMMON_NA")}
; + default: - return {t("ES_COMMON_DEFAULT_NA")} + return {t("ES_COMMON_DEFAULT_NA")}; } if (key === "OP_BILL_DATE") { return Digit.DateUtils.ConvertEpochToDate(value); } - if(key === "OP_BILL_TOTAL_AMT"){ - return {`₹ ${value}`} + if (key === "OP_BILL_TOTAL_AMT") { + return {`₹ ${value}`}; } - if(key === "OP_CONS_CODE") { - return + if (key === "OP_CONS_CODE") { + return ( + {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} - + + ); } }, populateReqCriteria: () => { @@ -171,12 +158,14 @@ export const UICustomizations = { config: { enabled: true, select: (data) => { - const result = data?.MdmsRes?.tenant?.tenants?.filter(row => row?.divisionCode && row?.divisionName)?.map(row => { - return { - ...row, - updatedCode:`${row.divisionName} - ${row?.name}` - } - }); + const result = data?.MdmsRes?.tenant?.tenants + ?.filter((row) => row?.divisionCode && row?.divisionName) + ?.map((row) => { + return { + ...row, + updatedCode: `${row?.divisionName} - ${t(row?.code)}`, + }; + }); result.sort((a, b) => { const nameA = (a.divisionName || "").toLowerCase().trim(); const nameB = (b?.divisionName || "").toLowerCase().trim(); @@ -188,17 +177,16 @@ export const UICustomizations = { }; }, customValidationCheck: (data) => { - //checking both to and from date are present const { consumerCode } = data; - if(!consumerCode) return false; - if(consumerCode.length < 10 || consumerCode.length > 25){ + if (!consumerCode) return false; + if (consumerCode.length < 10 || consumerCode.length > 25) { return { warning: true, label: "ES_COMMON_ENTER_VALID_CONSUMER_CODE" }; } // if ((createdFrom === "" && createdTo !== "") || (createdFrom !== "" && createdTo === "")) // return { warning: true, label: "ES_COMMON_ENTER_DATE_RANGE" }; return false; - } - } + }, + }, }; From 3f2cc278f565855fd611cefa2bc2e8c7fd58d004 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 14 Oct 2024 12:56:56 +0530 Subject: [PATCH 5/7] Solved Localisation problem --- .../packages/modules/payment/src/configs/UICustomizations.js | 3 +++ frontend/micro-ui/web/src/Customisations/UICustomizations.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js index e587b01b3..350e5ed31 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/payment/src/configs/UICustomizations.js @@ -1,6 +1,7 @@ import { Link, useHistory } from "react-router-dom"; import _ from "lodash"; import React from "react"; +import { useTranslation } from "react-i18next"; function anonymizeHalfString(input) { // Initialize an empty string to store the anonymized output @@ -136,6 +137,8 @@ export const UICustomizations = { } }, populateReqCriteria: () => { + const { t } = useTranslation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); return { url: "/mdms-v2/v1/_search", diff --git a/frontend/micro-ui/web/src/Customisations/UICustomizations.js b/frontend/micro-ui/web/src/Customisations/UICustomizations.js index c76ac89b3..afcc1e003 100644 --- a/frontend/micro-ui/web/src/Customisations/UICustomizations.js +++ b/frontend/micro-ui/web/src/Customisations/UICustomizations.js @@ -1,5 +1,6 @@ import { Link } from "react-router-dom"; import _ from "lodash"; +import { useTranslation } from "react-i18next"; //create functions here based on module name set in mdms(eg->SearchProjectConfig) //how to call these -> Digit?.Customizations?.[masterName]?.[moduleName] @@ -691,6 +692,8 @@ export const UICustomizations = { } }, populateReqCriteria: () => { + const { t } = useTranslation(); + const tenantId = Digit.ULBService.getCurrentTenantId(); return { url: "/mdms-v2/v1/_search", From 5af662d1dd36a8d49f213e1227b281b1815a0f1c Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 14 Oct 2024 13:30:45 +0530 Subject: [PATCH 6/7] Update monthly_ledger_report.dart --- .../reports/monthly_ledger_report.dart | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart index 03a6bf054..a0633bf5b 100644 --- a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart @@ -89,24 +89,21 @@ class _MonthlyLedgerReportState extends State SizedBox( width: 10, ), - Opacity( - opacity: 0, - child: TextButton.icon( - onPressed: () { - // if (reportProvider.selectedBillPeriod == null) { - // Notifiers.getToastMessage( - // context, - // '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', - // 'ERROR'); - // } else { - // reportProvider.getMonthlyLedgerReport( - // download: true); - // } - }, - icon: Icon(Icons.download_sharp), - label: Text(ApplicationLocalizations.of(context) - .translate(i18.common.CORE_DOWNLOAD))), - ), + TextButton.icon( + onPressed: () { + if (reportProvider.selectedBillPeriod == null) { + Notifiers.getToastMessage( + context, + '${ApplicationLocalizations.of(context).translate(i18.common.SELECT_BILLING_CYCLE)}', + 'ERROR'); + } else { + reportProvider.getMonthlyLedgerReport( + download: true); + } + }, + icon: Icon(Icons.download_sharp), + label: Text(ApplicationLocalizations.of(context) + .translate(i18.common.CORE_DOWNLOAD))), ], ), ], From a56eb8601ae24b6fbcbf1a83bba8e4fd95bf477a Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 14 Oct 2024 13:31:37 +0530 Subject: [PATCH 7/7] Update monthly_ledger_report.dart --- .../mgramseva/lib/screeens/reports/monthly_ledger_report.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart index a0633bf5b..90f3f5c02 100644 --- a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart @@ -89,7 +89,7 @@ class _MonthlyLedgerReportState extends State SizedBox( width: 10, ), - TextButton.icon( + TextButton.icon( onPressed: () { if (reportProvider.selectedBillPeriod == null) { Notifiers.getToastMessage(