From 0cfb1528e53daeca175b61087d4a62281bc12af6 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Tue, 24 Sep 2024 17:20:23 +0530 Subject: [PATCH 01/14] Solved Villages numeric value problem --- .../example/src/UICustomizations.js | 218 ++++++++---------- .../hrms/src/components/SearchUserForm.js | 7 +- 2 files changed, 105 insertions(+), 120 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 981a9b5e1..9c69ef687 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 @@ -1,12 +1,12 @@ 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] // these functions will act as middlewares var Digit = window.Digit || {}; - function anonymizeHalfString(input) { // Initialize an empty string to store the anonymized output let anonymized = ""; @@ -26,8 +26,7 @@ function anonymizeHalfString(input) { } const businessServiceMap = { - - "muster roll": "MR" + "muster roll": "MR", }; const inboxModuleNameMap = { @@ -37,7 +36,6 @@ const inboxModuleNameMap = { export const UICustomizations = { businessServiceMap, updatePayload: (applicationDetails, data, action, businessService) => { - if (businessService === businessServiceMap.estimate) { const workflow = { comment: data.comments, @@ -88,6 +86,7 @@ export const UICustomizations = { workflow, }; } + if (businessService === businessServiceMap?.["muster roll"]) { const workflow = { comment: data?.comments, @@ -113,7 +112,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) => { @@ -134,21 +133,21 @@ 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) => { @@ -158,11 +157,11 @@ export const UICustomizations = { 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; }, @@ -173,17 +172,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; } }, @@ -201,16 +196,15 @@ export const UICustomizations = { AttendanceInboxConfig: { preProcess: (data) => { - //set tenantId data.body.inbox.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 + if (musterRollNumber) data.body.inbox.moduleSearchCriteria.musterRollNumber = musterRollNumber; const attendanceRegisterName = data?.body?.inbox?.moduleSearchCriteria?.attendanceRegisterName?.trim(); - if(attendanceRegisterName) data.body.inbox.moduleSearchCriteria.attendanceRegisterName = attendanceRegisterName + 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); @@ -221,11 +215,11 @@ export const UICustomizations = { //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); @@ -243,11 +237,10 @@ 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; @@ -255,10 +248,10 @@ export const UICustomizations = { //adding tenantId to moduleSearchCriteria 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) => { @@ -277,7 +270,9 @@ export const UICustomizations = { return ( {String(value ? (column.translate ? t(column.prefix ? `${column.prefix}${value}` : value) : value) : t("ES_COMMON_NA"))} @@ -294,7 +289,7 @@ export const UICustomizations = { if (key === "ATM_NO_OF_INDIVIDUALS") { return
{value?.length}
; } - if(key === "ATM_AMOUNT_IN_RS"){ + if (key === "ATM_AMOUNT_IN_RS") { return {value ? Digit.Utils.dss.formatterWithoutRound(value, "number") : t("ES_COMMON_NA")}; } if (key === "ATM_SLA") { @@ -305,10 +300,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; @@ -326,9 +321,9 @@ export const UICustomizations = { body: { SearchCriteria: { tenantId: tenantId, - functions : { - type : "CBO" - } + functions: { + type: "CBO", + }, }, }, config: { @@ -340,7 +335,7 @@ export const UICustomizations = { }; }, }, - SearchWageSeekerConfig: { + SearchWageSeekerConfig: { customValidationCheck: (data) => { //checking both to and from date are present const { createdFrom, createdTo } = data; @@ -364,7 +359,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]) { @@ -372,7 +367,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; }) @@ -400,7 +395,7 @@ 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"))} ); @@ -440,30 +435,29 @@ export const UICustomizations = { if (type === "date") { 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 }; @@ -489,78 +483,67 @@ 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"))} - + + ); } }, populateReqCriteria: () => { + const { t } = useTranslation(); const tenantId = Digit.ULBService.getCurrentTenantId(); return { url: "/mdms-v2/v1/_search", @@ -583,29 +566,28 @@ export const UICustomizations = { config: { enabled: true, select: (data) => { - const result = data?.MdmsRes?.tenant?.tenants?.filter( - (row) => row?.divisionCode && row?.divisionName - )?.map((row) => ({ - ...row, - updatedCode: `${row.divisionName} - ${row?.name}`, - })); + const result = data?.MdmsRes?.tenant?.tenants + ?.filter((row) => row?.divisionCode && row?.divisionName) + ?.map((row) => ({ + ...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; - } - } + }, + }, }; diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js index 7f47e97f1..0680af504 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js @@ -92,7 +92,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles { level: "subDivisionCode", value: 4, optionsKey: "subDivisionName", isMandatory: false }, { level: "sectionCode", value: 5, optionsKey: "sectionName", isMandatory: false }, // { "level": "schemeCode", "value": 6,"optionsKey":"schemeName" }, - { level: "code", value: 7, optionsKey: "name", isMandatory: false }, + { level: "code", value: 7, optionsKey: "code", isMandatory: false }, ]); const [tree, setTree] = useState(null); const [rolesOptions, setRolesOptions] = useState(null); @@ -161,7 +161,10 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles data?.MdmsRes?.["ws-services-masters"]?.["WSServiceRoles"]?.filter( (row) => !excludeCodes.includes(row?.code) && - (row?.name === "Secretary" || row?.name === "Sarpanch" || row?.name === "Revenue Collector" || !DIV_ADMIN && row?.name === "DIVISION ADMIN") + (row?.name === "Secretary" || + row?.name === "Sarpanch" || + row?.name === "Revenue Collector" || + (!DIV_ADMIN && row?.name === "DIVISION ADMIN")) ) ); //updating to state roles as requested From 4a745bd540a730cce2db8c5c725d819c07ad5184 Mon Sep 17 00:00:00 2001 From: Hari-egov <168806306+Hari-egov@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:08:56 +0530 Subject: [PATCH 02/14] Update package.json --- frontend/micro-ui/web/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/micro-ui/web/package.json b/frontend/micro-ui/web/package.json index bcaba2048..7b6689e40 100644 --- a/frontend/micro-ui/web/package.json +++ b/frontend/micro-ui/web/package.json @@ -9,7 +9,6 @@ }, "workspaces": [ "micro-ui-internals/packages/libraries", - "micro-ui-internals/packages/css", "micro-ui-internals/packages/react-components", "micro-ui-internals/packages/modules/*" ], @@ -18,7 +17,6 @@ "@egovernments/digit-ui-libraries": "1.5.7", "@egovernments/digit-ui-module-dss": "1.5.34", "@egovernments/digit-ui-module-core": "1.5.46", - "@egovernments/digit-ui-css": "1.5.54", "@egovernments/digit-ui-module-hrms": "1.5.27", "@egovernments/digit-ui-module-pgr": "1.7.0", "@egovernments/digit-ui-module-engagement": "1.5.20", From 7367e97ea635f1620f4330e97ece90bcd914e71f Mon Sep 17 00:00:00 2001 From: Hari-egov <168806306+Hari-egov@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:09:21 +0530 Subject: [PATCH 03/14] Update App.js --- frontend/micro-ui/web/src/App.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/micro-ui/web/src/App.js b/frontend/micro-ui/web/src/App.js index e30eddafd..bddc5ca2f 100644 --- a/frontend/micro-ui/web/src/App.js +++ b/frontend/micro-ui/web/src/App.js @@ -10,7 +10,6 @@ import { initPGRComponents, PGRReducers, } from "@egovernments/digit-ui-module-pgr"; -import "@egovernments/digit-ui-css/dist/index.css"; window.contextPath = window?.globalConfigs?.getConfig("CONTEXT_PATH"); From 40853310c68f0efa2c99de7efe025f6ea7bf4a50 Mon Sep 17 00:00:00 2001 From: Hari-egov <168806306+Hari-egov@users.noreply.github.com> Date: Wed, 25 Sep 2024 16:09:47 +0530 Subject: [PATCH 04/14] Update package.json --- frontend/micro-ui/web/micro-ui-internals/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/package.json b/frontend/micro-ui/web/micro-ui-internals/package.json index f273694bb..6ea0dee6e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/package.json +++ b/frontend/micro-ui/web/micro-ui-internals/package.json @@ -5,7 +5,6 @@ "workspaces": [ "packages/libraries", "example", - "packages/css", "packages/react-components", "packages/modules/*" ], @@ -30,7 +29,6 @@ "dev:core": "cd packages/modules/core && yarn start", "dev:example": "cd example && yarn start", "build": "run-p build:**", - "build:css": "cd packages/css && yarn build:prod", "build:libraries": "cd packages/libraries && yarn build", "build:components": "cd packages/react-components && yarn build", "build:pgr": "cd packages/modules/pgr && yarn build", From e33456c0e48024cb5522a92a67351e9683353679 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 30 Sep 2024 15:33:29 +0530 Subject: [PATCH 05/14] Merged ISTE-411 into ISTE-463 --- .../hrms/src/components/SearchUserForm.js | 299 +++++++++++------- 1 file changed, 188 insertions(+), 111 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js index 0680af504..fb8e7830f 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js @@ -82,7 +82,7 @@ function buildTree(data, hierarchy) { return tree; } -const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles, employeeData }) => { +const SearchUserForm = React.memo(({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles, employeeData }) => { const { t } = useTranslation(); const [showToast, setShowToast] = useState(null); const [hierarchy, setHierarchy] = useState([ @@ -94,10 +94,18 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles // { "level": "schemeCode", "value": 6,"optionsKey":"schemeName" }, { level: "code", value: 7, optionsKey: "code", isMandatory: false }, ]); + + const [divisionHierarchy, setDivisionHierarchy] = useState([ + { level: "subDivisionCode", value: 4, optionsKey: "subDivisionName", isMandatory: false }, + { level: "sectionCode", value: 5, optionsKey: "sectionName", isMandatory: false }, + { level: "code", value: 7, optionsKey: "name", isMandatory: false }, + ]); const [tree, setTree] = useState(null); const [rolesOptions, setRolesOptions] = useState(null); const [isShowAllClicked, setIsShowAllClicked] = useState(false); + const divisionAdmin = Digit.UserService.hasAccess(["DIV_ADMIN"]); + // const [zones,setZones] = useState([]) // const [circles,setCircles] = useState([]) // const [divisions,setDivisions] = useState([]) @@ -106,6 +114,60 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles // const [schemes,setSchemes] = useState([]) // const [codes,setCodes] = useState([]) + const { + register, + handleSubmit, + setValue, + getValues, + reset, + watch, + trigger, + control, + formState, + errors, + setError, + clearErrors, + unregister, + } = useForm({ + defaultValues: { + zoneCode: "", + circleCode: "", + divisionCode: "", + subDivisionCode: "", + sectionCode: "", + code: "", + roles: [], + }, + }); + + const formData = watch(); + + const clearSearch = () => { + reset({ + zoneCode: "", + circleCode: "", + divisionCode: "", + subDivisionCode: "", + sectionCode: "", + code: "", + roles: [], + }); + setUniqueRoles(null); + setUniqueTenants(null); + + // dispatch({ + // type: uiConfig?.type === "filter"?"clearFilterForm" :"clearSearchForm", + // state: { ...uiConfig?.defaultValues } + // //need to pass form with empty strings + // }) + //here reset tableForm as well + // dispatch({ + // type: "tableForm", + // state: { limit:10,offset:0 } + // //need to pass form with empty strings + // }) + }; + const requestCriteria = { url: "/mdms-v2/v1/_search", params: { tenantId: Digit.ULBService.getStateId() }, @@ -155,115 +217,83 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles const filteredResult = filterKeys(result, requiredKeys); const resultInTree = buildTree(filteredResult, hierarchy); const excludeCodes = ["HRMS_ADMIN", "LOC_ADMIN", "MDMS_ADMIN", "EMPLOYEE", "SYSTEM"]; - const DIV_ADMIN = Digit.UserService.hasAccess(["DIV_ADMIN"]); - setRolesOptions( - data?.MdmsRes?.["ws-services-masters"]?.["WSServiceRoles"]?.filter( + const roles = data?.MdmsRes?.["ws-services-masters"]?.["WSServiceRoles"] + ?.filter( (row) => !excludeCodes.includes(row?.code) && - (row?.name === "Secretary" || - row?.name === "Sarpanch" || - row?.name === "Revenue Collector" || - (!DIV_ADMIN && row?.name === "DIVISION ADMIN")) + (row?.name === "Secretary" || row?.name === "Sarpanch" || row?.name === "Revenue Collector" || row?.name === "DIVISION ADMIN") ) - ); - //updating to state roles as requested - // setRolesOptions([ - // // { - // // code: "", - // // name: "Select All", - // // description: "", - // // }, - // { - // code: "EMPLOYEE", - // name: "EMPLOYEE", - // labelKey: "ACCESSCONTROL_ROLES_ROLES_EMPLOYEE", - // }, - // { - // code: "DIV_ADMIN", - // name: "DIVISION ADMIN", - // labelKey: "ACCESSCONTROL_ROLES_ROLES_DIV_ADMIN", - // }, - // { - // code: "HRMS_ADMIN", - // name: "HRMS_ADMIN", - // labelKey: "ACCESSCONTROL_ROLES_ROLES_HRMS_ADMIN", - // }, - // { - // code: "MDMS_ADMIN", - // name: "MDMS Admin", - // description: "Mdms admin", - // }, - - // ]) + ?.map((role) => ({ + ...role, + i18text: "ACCESSCONTROL_ROLES_ROLES_" + role?.code, + })); + setRolesOptions(roles); setTree(resultInTree); return result; }, }, }; - const { isLoading, data, revalidate, isFetching, error } = Digit.Hooks.useCustomAPIHook(requestCriteria); - - const { - register, - handleSubmit, - setValue, - getValues, - reset, - watch, - trigger, - control, - formState, - errors, - setError, - clearErrors, - unregister, - } = useForm({ - defaultValues: { - zoneCode: "", - circleCode: "", - divisionCode: "", - subDivisionCode: "", - sectionCode: "", - code: "", - roles: [], + const requestCriteria2 = { + url: "/mdms-v2/v1/_search", + params: { tenantId: Digit.ULBService.getStateId() }, + body: { + MdmsCriteria: { + tenantId: Digit.ULBService.getStateId(), + moduleDetails: [ + { + moduleName: "tenant", + masterDetails: [ + { + name: "tenants", + filter: `[?(@.code == '${Digit.ULBService.getCurrentTenantId()}')]`, + }, + ], + }, + ], + }, }, - }); - - const formData = watch(); - - const clearSearch = () => { - reset({ - zoneCode: "", - circleCode: "", - divisionCode: "", - subDivisionCode: "", - sectionCode: "", - code: "", - roles: [], - }); - setUniqueRoles(null); - setUniqueTenants(null); + changeQueryName: "userData", + config: { + cacheTime: Infinity, + select: (data) => { + const requiredKeys = [ + "code", + "name", + "zoneCode", + "zoneName", + "circleCode", + "circleName", + "divisionCode", + "divisionName", + "subDivisionCode", + "subDivisionName", + "sectionCode", + "sectionName", + "schemeCode", + "schemeName", + ]; + const result = data?.MdmsRes?.tenant?.tenants; + formData.zoneCode = result[0]; + formData.circleCode = result[0]; + formData.divisionCode = result[0]; - // dispatch({ - // type: uiConfig?.type === "filter"?"clearFilterForm" :"clearSearchForm", - // state: { ...uiConfig?.defaultValues } - // //need to pass form with empty strings - // }) - //here reset tableForm as well - // dispatch({ - // type: "tableForm", - // state: { limit:10,offset:0 } - // //need to pass form with empty strings - // }) + const filteredResult = filterKeys(result, requiredKeys); + return result; + }, + }, }; + const { isLoading, data, revalidate, isFetching, error } = Digit.Hooks.useCustomAPIHook(requestCriteria); + const { data: userData } = Digit.Hooks.useCustomAPIHook(requestCriteria2); + useEffect(() => { if (isShowAllClicked && employeeData) { jsonToExcel(employeeData, "employees.xlsx"); setIsShowAllClicked(false); } - }, [employeeData]); + }, [employeeData, uniqueTenants]); function jsonToExcel(employeeData, fileName) { const employees = employeeData.map((employee) => ({ @@ -289,18 +319,44 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles } const showAllData = () => { - clearSearch(); + // clearSearch(); + if (divisionAdmin) setRequiredOptions(formData); setIsShowAllClicked(true); - const listOfUniqueTenants = getUniqueLeafCodes(tree); + //here apply a logic to compute the subtree based on the hierarchy selected + const levels = hierarchy.map(({ level }) => level); + + //compute current level + let maxSelectedLevel = levels[0]; + + levels.forEach((level) => { + if (formData[level]) { + maxSelectedLevel = level; + } else { + return; + } + }); + + const levelIndex = levels.indexOf(maxSelectedLevel); + let currentLevel = tree; + + for (let i = 0; i <= levelIndex; i++) { + const code = formData?.[levels[i]]?.[levels[i]]; + if (!code || !currentLevel[code]) break; + currentLevel = currentLevel[code]; + } + //this is the list of tenants under the current subtree + const listOfUniqueTenants = getUniqueLeafCodes(currentLevel); setUniqueTenants(() => listOfUniqueTenants); setUniqueRoles(() => rolesOptions?.filter((row) => row.code)?.map((role) => role.code)); }; + const onSubmit = (data) => { //assuming atleast one hierarchy is entered - + if (divisionAdmin) setRequiredOptions(data); if (Object.keys(data).length === 0 || Object.values(data).every((value) => !value)) { //toast message + console.log("pakda gaya"); setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); return; @@ -316,6 +372,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles }); if (areMandatoryFieldsNotFilled) { + console.log("I got it"); setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); return; @@ -323,6 +380,8 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles //checking roles if (data?.roles?.length === 0 || !data?.roles) { + console.log("I got it:roles"); + setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); return; @@ -330,6 +389,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles //here apply a logic to compute the subtree based on the hierarchy selected const levels = hierarchy.map(({ level }) => level); + //compute current level let maxSelectedLevel = levels[0]; levels.forEach((level) => { @@ -341,8 +401,8 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles }); const levelIndex = levels.indexOf(maxSelectedLevel); - let currentLevel = tree; + for (let i = 0; i <= levelIndex; i++) { const code = data?.[levels[i]]?.[levels[i]]; if (!code || !currentLevel[code]) return []; @@ -354,23 +414,42 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles setUniqueTenants(() => listOfUniqueTenants); setUniqueRoles(() => data?.roles?.filter((row) => row.code)?.map((role) => role.code)); }; + const [divisionTree, setDivisionTree] = useState(null); + + useEffect(() => { + if (userData) { + const zoneC = userData[0].zoneCode; + const circleC = userData[0].circleCode; + const divisionC = userData[0].divisionCode; + + if (tree && tree[zoneC] && tree[zoneC][circleC]) { + console.log(tree[zoneC][circleC][divisionC]); + setDivisionTree(tree[zoneC][circleC][divisionC]); + } + } + }, [userData, tree]); + + const setRequiredOptions = (formData) => { + formData.zoneCode = userData[0]; + formData.circleCode = userData[0]; + formData.divisionCode = userData[0]; + }; const optionsForHierarchy = (level, value) => { if (!tree) return []; + if (divisionAdmin && !divisionTree) return []; - const levels = hierarchy.map(({ level }) => level); + const levels = divisionAdmin ? divisionHierarchy.map(({ level }) => level) : hierarchy.map(({ level }) => level); const levelIndex = levels.indexOf(level); - - //zoneCode(1st level(highest parent)) - if (levelIndex === -1 || levelIndex === 0) return tree.options; - - let currentLevel = tree; + if (levelIndex === -1 || levelIndex === 0) return divisionAdmin ? divisionTree.options : tree.options; + let currentLevel = divisionAdmin ? divisionTree : tree; for (let i = 0; i < levelIndex; i++) { const code = formData[levels[i]]?.[levels[i]]; if (!code || !currentLevel[code]) return []; currentLevel = currentLevel[code]; } - return currentLevel.options || []; + if (divisionAdmin) setRequiredOptions(formData); + return currentLevel?.options || []; }; const closeToast = () => { @@ -378,7 +457,7 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles }; const renderHierarchyFields = useMemo(() => { - return hierarchy.map(({ level, optionsKey, isMandatory, ...rest }, idx) => ( + return (divisionAdmin ? divisionHierarchy : hierarchy).map(({ level, optionsKey, isMandatory, ...rest }, idx) => ( {`${t(Digit.Utils.locale.getTransformedLocale(`HR_SU_${level}`))} ${ isMandatory ? "*" : "" @@ -394,7 +473,11 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles select={(e) => { props.onChange(e); //clear all child levels - const childLevels = hierarchy.slice(hierarchy.findIndex((h) => h.level === level) + 1); + // const childLevels = hierarchy.slice(hierarchy.findIndex((h) => h.level === level) + 1); + // childLevels.forEach((child) => setValue(child.level, "")); + const childLevels = (divisionAdmin ? divisionHierarchy : hierarchy).slice( + (divisionAdmin ? divisionHierarchy : hierarchy).findIndex((h) => h.level === level) + 1 + ); childLevels.forEach((child) => setValue(child.level, "")); }} selected={props.value} @@ -416,12 +499,6 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles )); }, [formData]); - useEffect(() => { - rolesOptions?.forEach((option) => { - option.i18text = "ACCESSCONTROL_ROLES_ROLES_" + option?.code; - }); - }, [rolesOptions]); - if (isLoading || !setTree) { return ; } @@ -506,6 +583,6 @@ const SearchUserForm = ({ uniqueTenants, setUniqueTenants, roles, setUniqueRoles )} ); -}; +}); export default SearchUserForm; From a81412e860d4c3397db1ab48421546adbdba09c1 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 11:44:07 +0530 Subject: [PATCH 06/14] Resolved division duplicacy issue --- .../src/components/pageComponents/jurisdiction.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index af19a5905..b9cea937e 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -150,19 +150,20 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { } return res; }); + if (isEdit && STATE_ADMIN) { - let divisionData = []; + let divisionDataSet = new Set(); if (isEdit && jurisdictionData.length > 0) { - jurisdictionData?.map((jurisdiction) => { - if (jurisdiction?.divisionBoundary && jurisdiction?.divisionBoundary?.length > 0 && divisionData.length === 0) { - divisionData.push(jurisdiction); - } else if (divisionData.length > 0) { - if (divisionData[divisionData.length - 1]?.division?.code !== jurisdiction?.division?.code) { - divisionData.push(jurisdiction); + jurisdictionData?.forEach((jurisdiction) => { + if (jurisdiction?.divisionBoundary && jurisdiction?.divisionBoundary?.length > 0) { + // If divisionData set doesn't already have this division, add it + if (!Array.from(divisionDataSet).some((item) => item.division?.code === jurisdiction?.division?.code)) { + divisionDataSet.add(jurisdiction); } } }); } + let divisionData = Array.from(divisionDataSet); let finalData = []; divisionData && From dd42ad930756db6c2671c648b0809632cb33cb74 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 13:58:55 +0530 Subject: [PATCH 07/14] Resolved mutilple divisions issue --- .../hrms/src/pages/EditEmployee/EditForm.js | 52 ++++++++++++------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js index 6ab654305..bdf76dee2 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/EditEmployee/EditForm.js @@ -53,7 +53,6 @@ const EditForm = ({ tenantId, data }) => { } }, [mobileNumber]); - let defaultValues = { tenantId: tenantId, employeeStatus: "EMPLOYED", @@ -73,10 +72,9 @@ const EditForm = ({ tenantId, data }) => { }, SelectUserTypeAndDesignation: { department: data?.assignments[0]?.department, - designation: data?.assignments[0]?.designation + designation: data?.assignments[0]?.designation, }, - SelectDateofBirthEmployment: { dob: convertEpochToDate(data?.user?.dob) }, Jurisdictions: data?.jurisdictions?.map((ele, index) => { let obj = { @@ -118,7 +116,6 @@ const EditForm = ({ tenantId, data }) => { return validEmail && name.match(Digit.Utils.getPattern("Name")); }; - function hasUniqueTenantIds(items) { // Create a Set to efficiently store unique tenantIds const uniqueTenantIds = new Set(); @@ -137,6 +134,18 @@ const EditForm = ({ tenantId, data }) => { return true; } + function hasUniqueDivisions(items) { + const uniqueDivisions = new Set(); + for (const item of items) { + const divisionCode = item?.division?.code; + if (divisionCode && uniqueDivisions.has(divisionCode)) { + return false; + } + uniqueDivisions.add(divisionCode); + } + return true; + } + const onFormValueChange = (setValue = true, formData) => { let isValid = false; if (formData?.SelectEmployeePhoneNumber?.mobileNumber) { @@ -153,10 +162,13 @@ const EditForm = ({ tenantId, data }) => { } else { if (!STATE_ADMIN) { key?.roles?.length > 0 && setcheck(true); - if (formData?.SelectUserTypeAndDesignation[0] && formData?.SelectUserTypeAndDesignation[0]?.department != undefined && formData?.SelectUserTypeAndDesignation[0]?.designation != undefined) { + if ( + formData?.SelectUserTypeAndDesignation[0] && + formData?.SelectUserTypeAndDesignation[0]?.department != undefined && + formData?.SelectUserTypeAndDesignation[0]?.designation != undefined + ) { isValid = true; - } - else { + } else { isValid = false; } } else if (STATE_ADMIN) { @@ -168,17 +180,20 @@ const EditForm = ({ tenantId, data }) => { if ( formData?.SelectEmployeeGender?.gender.code && - formData?.SelectEmployeeName?.employeeName && - formData?.SelectEmployeePhoneNumber?.mobileNumber && - STATE_ADMIN ? - (formData?.Jurisdictions?.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0)) - : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) - && - isValid && - checkfield && - phonecheck && - checkMailNameNum(formData) && - hasUniqueTenantIds(formData?.Jurisdictions) + formData?.SelectEmployeeName?.employeeName && + formData?.SelectEmployeePhoneNumber?.mobileNumber && + STATE_ADMIN + ? formData?.Jurisdictions?.length && + !formData?.Jurisdictions.some((juris) => juris?.division == undefined || juris?.divisionBoundary?.length === 0) && + hasUniqueDivisions(formData?.Jurisdictions) + : formData?.Jurisdictions?.length && + formData?.Jurisdictions.length && + !formData?.Jurisdictions.some((juris) => juris?.roles?.length === 0) && + isValid && + checkfield && + phonecheck && + checkMailNameNum(formData) && + hasUniqueTenantIds(formData?.Jurisdictions) ) { setSubmitValve(true); } else { @@ -309,7 +324,6 @@ const EditForm = ({ tenantId, data }) => { dataAssignments[0].department = input.SelectUserTypeAndDesignation[0]?.department?.code; dataAssignments[0].designation = input.SelectUserTypeAndDesignation[0]?.designation?.code; - requestdata.assignments = input?.Assignments ? input?.Assignments : dataAssignments; requestdata.dateOfAppointment = Date.parse(input?.SelectDateofEmployment?.dateOfAppointment); requestdata.code = input?.SelectEmployeeId?.code ? input?.SelectEmployeeId?.code : data?.code; From fe9a5b48468b29f4834b727004c29a62d383ddff Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 14:05:43 +0530 Subject: [PATCH 08/14] Resolved remaining issues --- .../modules/hrms/src/pages/createEmployee.js | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js index b72018d4d..dd46add42 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/pages/createEmployee.js @@ -103,6 +103,18 @@ const CreateEmployee = () => { return true; } + function hasUniqueDivisions(items) { + const uniqueDivisions = new Set(); + for (const item of items) { + const divisionCode = item?.division?.code; + if (divisionCode && uniqueDivisions.has(divisionCode)) { + return false; + } + uniqueDivisions.add(divisionCode); + } + return true; + } + const onFormValueChange = (setValue = true, formData) => { let isValid = false; if (!_.isEqual(sessionFormData, formData)) { @@ -120,10 +132,13 @@ const CreateEmployee = () => { break; } else { if (!STATE_ADMIN) { - if (formData?.SelectUserTypeAndDesignation[0] && formData?.SelectUserTypeAndDesignation[0]?.department != undefined && formData?.SelectUserTypeAndDesignation[0]?.designation != undefined) { + if ( + formData?.SelectUserTypeAndDesignation[0] && + formData?.SelectUserTypeAndDesignation[0]?.department != undefined && + formData?.SelectUserTypeAndDesignation[0]?.designation != undefined + ) { isValid = true; - } - else { + } else { isValid = false; } @@ -142,26 +157,23 @@ const CreateEmployee = () => { // , "formData"); console.log(isValid, "isValid"); - if ( - - formData?.SelectEmployeeGender?.gender.code && - formData?.SelectEmployeeName?.employeeName && - formData?.SelectEmployeePhoneNumber?.mobileNumber && - formData?.Jurisdictions?.length && - STATE_ADMIN ? - (formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.division == undefined || juris?.divisionBoundary?.length === 0)) - - : formData?.Jurisdictions?.length && formData?.Jurisdictions.length && !formData?.Jurisdictions.some(juris => juris?.roles?.length === 0) && - - isValid && - - checkfield && - phonecheck && - checkMailNameNum(formData) && - hasUniqueTenantIds(formData?.Jurisdictions) - + formData?.SelectEmployeeName?.employeeName && + formData?.SelectEmployeePhoneNumber?.mobileNumber && + formData?.Jurisdictions?.length && + STATE_ADMIN + ? formData?.Jurisdictions.length && + hasUniqueDivisions(formData?.Jurisdictions) && + !formData?.Jurisdictions.some((juris) => juris?.division == undefined || juris?.divisionBoundary?.length === 0) + : formData?.Jurisdictions?.length && + formData?.Jurisdictions.length && + !formData?.Jurisdictions.some((juris) => juris?.roles?.length === 0) && + isValid && + checkfield && + phonecheck && + checkMailNameNum(formData) && + hasUniqueTenantIds(formData?.Jurisdictions) ) { setSubmitValve(true); } else { @@ -174,7 +186,6 @@ const CreateEmployee = () => { }; const onSubmit = (data) => { - if (!STATE_ADMIN && data.Jurisdictions?.filter((juris) => juris.tenantId == tenantId).length == 0) { setShowToast({ key: true, label: "ERR_BASE_TENANT_MANDATORY" }); closeToast(); @@ -299,8 +310,7 @@ const CreateEmployee = () => { { fromDate: new Date().getTime(), isCurrentAssignment: hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.isCurrentAssignment, - department: !STATE_ADMIN ? data?.SelectUserTypeAndDesignation[0]?.department?.code : - hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.department, + department: !STATE_ADMIN ? data?.SelectUserTypeAndDesignation[0]?.department?.code : hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.department, designation: STATE_ADMIN ? hrmsData?.["egov-hrms"]?.HRMSConfig[0]?.designation?.filter((x) => x?.isStateUser)[0]?.code : data?.SelectUserTypeAndDesignation[0]?.designation?.code, From 2d2370a38a8867916e1a13f1d7337c385081550d Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 14:13:39 +0530 Subject: [PATCH 09/14] Update monthly_ledger_report.dart --- .../reports/monthly_ledger_report.dart | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart index af8b88891..cb57c9fc2 100644 --- a/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart +++ b/frontend/mgramseva/lib/screeens/reports/monthly_ledger_report.dart @@ -93,15 +93,15 @@ class _MonthlyLedgerReportState extends State 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); - // } + 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) From 3b7fe4d7f7e16b0b6807f83e79d84f2a81c48a3e Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 14:16:03 +0530 Subject: [PATCH 10/14] 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 cb57c9fc2..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 424582da74f2c38c614a9c3e83df875d500a94f5 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 14:16:49 +0530 Subject: [PATCH 11/14] 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( From 1ccd22359c029547e179b452ee9982acce061659 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Fri, 4 Oct 2024 14:19:53 +0530 Subject: [PATCH 12/14] Update build-config.yml --- build/build-config.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/build/build-config.yml b/build/build-config.yml index 1fe41be89..707b37779 100644 --- a/build/build-config.yml +++ b/build/build-config.yml @@ -98,14 +98,6 @@ config: dockerfile: "build/maven/Dockerfile" - work-dir: "core-services/boundary-service/src/main/resources/db" image-name: "boundary-service-db" - - - name: "builds/mGramSeva/utilities/egov-bff" - build: - - work-dir: "utilities/boundary-bulk-bff" - image-name: "boundary-bulk-bff" - - work-dir: "utilities/boundary-bulk-bff/migration" - image-name: "boundary-bulk-bff-db" - - name: "builds/mGramSeva/core-services/user-otp" build: - work-dir: "core-services/user-otp" From 6fdeef73360f0e5eaa5425a82f4e471413ee0f6b Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Mon, 7 Oct 2024 12:09:50 +0530 Subject: [PATCH 13/14] Update SearchUserForm.js --- .../packages/modules/hrms/src/components/SearchUserForm.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js index fb8e7830f..2eca8baf4 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/SearchUserForm.js @@ -356,7 +356,6 @@ const SearchUserForm = React.memo(({ uniqueTenants, setUniqueTenants, roles, set if (divisionAdmin) setRequiredOptions(data); if (Object.keys(data).length === 0 || Object.values(data).every((value) => !value)) { //toast message - console.log("pakda gaya"); setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); return; @@ -372,7 +371,6 @@ const SearchUserForm = React.memo(({ uniqueTenants, setUniqueTenants, roles, set }); if (areMandatoryFieldsNotFilled) { - console.log("I got it"); setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); return; @@ -380,7 +378,6 @@ const SearchUserForm = React.memo(({ uniqueTenants, setUniqueTenants, roles, set //checking roles if (data?.roles?.length === 0 || !data?.roles) { - console.log("I got it:roles"); setShowToast({ warning: true, label: t("ES_COMMON_MIN_SEARCH_CRITERIA_MSG") }); setTimeout(closeToast, 5000); @@ -423,7 +420,6 @@ const SearchUserForm = React.memo(({ uniqueTenants, setUniqueTenants, roles, set const divisionC = userData[0].divisionCode; if (tree && tree[zoneC] && tree[zoneC][circleC]) { - console.log(tree[zoneC][circleC][divisionC]); setDivisionTree(tree[zoneC][circleC][divisionC]); } } From 10d97808e062c72a783720ae51701f9376d412c1 Mon Sep 17 00:00:00 2001 From: mukund-egov Date: Tue, 8 Oct 2024 11:12:21 +0530 Subject: [PATCH 14/14] Solved two Khanna Issue --- .../modules/hrms/src/components/pageComponents/jurisdiction.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index af19a5905..5f14662b8 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -87,7 +87,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { }, []); const uniqueDivisions = divisions?.reduce((unique, obj) => { - const isDuplicate = unique.some((item) => item.id === obj.id && item.name === obj.name); + const isDuplicate = unique.some((item) => item.id === obj.id && item.code === obj.code); if (!isDuplicate) { unique.push(obj); }