Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
ISTE-22 Modification in Change city dropdown ( #785 )
Browse files Browse the repository at this point in the history
ISTE-22 Modification in Change city dropdown
  • Loading branch information
anilsingha-eGov authored Apr 30, 2024
2 parents acca060 + 76aad43 commit 6674f41
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`,
Expand All @@ -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") || {};

Expand All @@ -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) => {
Expand All @@ -69,7 +76,6 @@ const ChangeCity = (prop) => {
setSelectCityData(filteredArray);
}, [dropDownData, data?.MdmsRes]);

// if (isDropdown) {
return (
<div style={prop?.mobileView ? { color: "#767676" } : {}}>
<Dropdown
Expand All @@ -79,35 +85,11 @@ const ChangeCity = (prop) => {
selected={dropDownData}
optionKey={"label"}
select={handleChangeCity}
// freeze={true}
// noBorder={true}
optionCardStyles={{ overflow: "revert", display: "table" }}
// customSelector={
// <label className="cp">
// {prop?.t(`TENANT_TENANTS_${stringReplaceAll(Digit.SessionStorage.get("Employee.tenantId"), ".", "_")?.toUpperCase()}`)}
// </label>
// }
/>
</div>
);
// } else {
// return (
// <React.Fragment>
// <div style={{ marginBottom: "5px" }}>City</div>
// <div className="language-selector" style={{display: "flex", flexWrap: "wrap"}}>
// {selectCityData?.map((city, index) => (
// <div className="language-button-container" key={index}>
// <CustomButton
// selected={city.value === Digit.SessionStorage.get("Employee.tenantId")}
// text={city.label}
// onClick={() => handleChangeCity(city)}
// ></CustomButton>
// </div>
// ))}
// </div>
// </React.Fragment>
// );
// }

};

export default ChangeCity;
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const TopBar = ({
<div className={mobileView ? "right" : "flex-right right w-80 column-gap-15"} style={!loggedin ? { width: "80%" } : {}}>
<div className="left">
{!window.location.href.includes("employee/user/login") && !window.location.href.includes("employee/user/language-selection") && (
<ChangeCity dropdown={true} t={t} />
<ChangeCity dropdown={true} t={t} userDetails={userDetails}/>
)}
</div>
<div className="left">{showLanguageChange && <ChangeLanguage dropdown={true} />}</div>
Expand Down

0 comments on commit 6674f41

Please sign in to comment.