diff --git a/micro-ui/web/micro-ui-internals/example/src/setupProxy.js b/micro-ui/web/micro-ui-internals/example/src/setupProxy.js index cf3a6f7c26c..f6790e09930 100644 --- a/micro-ui/web/micro-ui-internals/example/src/setupProxy.js +++ b/micro-ui/web/micro-ui-internals/example/src/setupProxy.js @@ -25,6 +25,7 @@ module.exports = function (app) { "/mdms-v2", "/egov-idgen", "/egov-location", + "/boundary-service", "/localization", "/egov-workflow-v2", "/pgr-services", diff --git a/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useLocation.js b/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useLocation.js index 0e5cfa320e5..f2ddf18b8f4 100644 --- a/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useLocation.js +++ b/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useLocation.js @@ -1,12 +1,12 @@ import { useQuery } from 'react-query'; import { LocationService } from "../services/elements/Location"; -const useLocation = (tenantId, locationType, config = {}) => { +const useLocation = (tenantId, locationType, config = {},includeChildren,includeParents) => { switch(locationType) { case 'Locality': return useQuery(["LOCALITY_DETAILS", tenantId ], () => LocationService.getLocalities(tenantId), config); case 'Ward': - return useQuery(["WARD_DETAILS", tenantId ], () => LocationService.getWards(tenantId), config); + return useQuery(["WARD_DETAILS", tenantId], () => LocationService.getWards(tenantId,includeChildren,includeParents), config); default: break } diff --git a/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js b/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js index 474f4a5fc17..72a74114334 100644 --- a/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js +++ b/micro-ui/web/micro-ui-internals/packages/libraries/src/services/atoms/urls.js @@ -1,5 +1,8 @@ const mdmsV1Path = window?.globalConfigs?.getConfig("MDMS_V1_CONTEXT_PATH") || "egov-mdms-service"; const mdmsV2Path = window?.globalConfigs?.getConfig("MDMS_V2_CONTEXT_PATH") || "mdms-v2"; +const boundarySearchPath = window?.globalConfigs?.getConfig("BOUNDARY_CONTEXT") || "boundary-service/boundary-relationships/_search?"; +const hierarchyType = window?.globalConfigs?.getConfig("HIERARCHY_TYPE") || "hierarchyType=ADMIN"; + const Urls = { MDMS_V2:`/${mdmsV2Path}/v1/_search`, MDMS: `/${mdmsV1Path}/v1/_search`, @@ -7,9 +10,9 @@ const Urls = { WorkFlowProcessSearch: `/egov-workflow-v2/egov-wf/process/_search`, localization: `/localization/messages/v1/_search`, location: { - localities: `/egov-location/location/v11/boundarys/_search?hierarchyTypeCode=ADMIN&boundaryType=Locality`, - wards: `/egov-location/location/v11/boundarys/_search?hierarchyTypeCode=ADMIN&boundaryType=Ward`, - revenue_localities: `/egov-location/location/v11/boundarys/_search?hierarchyTypeCode=REVENUE&boundaryType=Locality`, + localities: `/${boundarySearchPath}includeChildren=true&${hierarchyType}&boundaryType=locality`, + wards: `/${boundarySearchPath}includeChildren=true&${hierarchyType}&boundaryType=Ward&includeParents=true`, + revenue_localities: `/boundary-service/boundary-relationships/_search?hierarchyType=REVENUE&boundaryType=locality`, }, pgr_search: `/pgr-services/v2/request/_search`, diff --git a/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localities.js b/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localities.js index 0ef16e7acaf..bf82dc8dafe 100644 --- a/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localities.js +++ b/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localities.js @@ -1,7 +1,7 @@ import { LocalizationService } from "./Localization/service"; const ADMIN_CODE = ({ tenantId, hierarchyType }) => { - return tenantId.replace(".", "_").toUpperCase() + "_" + hierarchyType.code; + return tenantId.replace(".", "_").toUpperCase() + "_" + hierarchyType; }; const getI18nKeys = (localitiesWithLocalizationKeys) => { diff --git a/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Location.js b/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Location.js index 02634225055..ef8ad8d5a91 100644 --- a/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Location.js +++ b/micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Location.js @@ -19,11 +19,11 @@ export const LocationService = { }); return response; }, - getWards: (tenantId) => { + getWards: (tenantId,includeChildren,includeParents) => { return ServiceRequest({ serviceName: "getWards", url: Urls.location.wards, - params: { tenantId: tenantId }, + params: { tenantId: tenantId,includeChildren: includeChildren, includeParents}, useCache: true, }); } diff --git a/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js b/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js index 51e8f662617..ecc5bff757f 100644 --- a/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js +++ b/micro-ui/web/micro-ui-internals/packages/modules/hrms/src/components/pageComponents/jurisdiction.js @@ -112,8 +112,22 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { let boundaryTypeoption = []; const [focusIndex, setFocusIndex] = useState(-1); + const { isBoundaryServiceLoading, data: hierarchyOptions } = Digit.Hooks.useLocation( + tenantId, + "Ward", + { + select: (data) => { + return data; + }, + }, + true + ); + function gethierarchylistdata() { - return data?.MdmsRes?.["egov-location"]["TenantBoundary"].map((ele) => ele.hierarchyType); + return hierarchyOptions?.TenantBoundary?.map((ele) => ({ + code: ele.hierarchyType, + name: ele.hierarchyType + })); } function getboundarydata() { @@ -124,7 +138,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { return data?.MdmsRes?.["ACCESSCONTROL-ROLES"].roles.map(role => { return { code: role.code, name: role?.name ? role?.name : " " , labelKey: 'ACCESSCONTROL_ROLES_ROLES_' + role.code } }); } - if (isLoading) { + if (isLoading || isBoundaryServiceLoading) { return ; } return ( @@ -148,6 +162,7 @@ const Jurisdictions = ({ t, config, onSelect, userType, formData }) => { getboundarydata={getboundarydata} getroledata={getroledata} handleRemoveUnit={handleRemoveUnit} + hierarchyOptions={hierarchyOptions} /> ))}