From 76aad439c09be4c145eb45817f742fbfa755300b Mon Sep 17 00:00:00 2001 From: chinmoy-eGov <115543497+chinmoy-eGov@users.noreply.github.com> Date: Tue, 30 Apr 2024 15:25:19 +0530 Subject: [PATCH] ISTE-22 Modification in Change city dropdown --- .../modules/core/src/components/ChangeCity.js | 40 +++++-------------- .../src/components/TopBarSideBar/TopBar.js | 2 +- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js index 122f6e506..a21e8d69c 100644 --- a/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js +++ b/frontend/micro-ui/web/micro-ui-internals/packages/modules/core/src/components/ChangeCity.js @@ -10,6 +10,8 @@ const stringReplaceAll = (str = "", searcher = "", replaceWith = "") => { return str; }; + + const ChangeCity = (prop) => { const [dropDownData, setDropDownData] = useState({ label: `TENANT_TENANTS_${stringReplaceAll(Digit.SessionStorage.get("Employee.tenantId"), ".", "_")?.toUpperCase()}`, @@ -21,6 +23,12 @@ const ChangeCity = (prop) => { const isDropdown = prop.dropdown || false; let selectedCities = []; + const uuids = [prop.userDetails?.info?.uuid]; + const { data: userData, isUserDataLoading } = Digit.Hooks.useUserSearch(Digit.ULBService.getStateId(), { uuid: uuids }, {}); + // setSelectedCity(userData?.data?.user[0]?.roles) + + + const { data: data = {}, isLoading } = Digit.Hooks.hrms.useHrmsMDMS(Digit.ULBService.getCurrentTenantId(), "egov-hrms", "HRMSRolesandDesignation") || {}; @@ -43,9 +51,8 @@ const ChangeCity = (prop) => { useEffect(() => { const userloggedValues = Digit.SessionStorage.get("citizen.userRequestObject"); - let teantsArray = [], - filteredArray = []; - userloggedValues?.info?.roles?.forEach((role) => teantsArray.push(role.tenantId)); + let teantsArray = [],filteredArray = []; + userData?.user[0].roles?.forEach((role) => teantsArray.push(role.tenantId)); let unique = teantsArray.filter((item, i, ar) => ar.indexOf(item) === i); unique?.forEach((uniCode) => { @@ -69,7 +76,6 @@ const ChangeCity = (prop) => { setSelectCityData(filteredArray); }, [dropDownData, data?.MdmsRes]); - // if (isDropdown) { return (