forked from upyog/UPYOG
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master-tqm-merge' into tqm-latest
- Loading branch information
Showing
117 changed files
with
1,871 additions
and
630 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
<head> | ||
<meta charset="utf-8"/> | ||
<link rel="icon" href="https://cdn.jsdelivr.net/npm/@egovernments/digit-ui-css/img/browser-icon.png"/> | ||
<link rel="stylesheet" href="https://unpkg.com/@upyog-niua/[email protected]/dist/index.css"/> | ||
|
||
<link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap" rel='stylesheet' type='text/css'> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<meta name="theme-color" content="#00bcd1"/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 37 additions & 7 deletions
44
frontend/micro-ui/web/micro-ui-internals/packages/libraries/src/hooks/useTenants.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,43 @@ | ||
import { useQuery } from "react-query"; | ||
|
||
const alphabeticalSortFunctionForTenantsBasedOnName = (firstEl, secondEl) =>{ | ||
if (firstEl.name.toUpperCase() < secondEl.name.toUpperCase() ) { | ||
return -1 | ||
// Sort function | ||
const alphabeticalSortFunctionForTenantsBasedOnName = (firstEl, secondEl) => { | ||
console.log("firstEl, secondEl", firstEl, secondEl); | ||
|
||
// Extract city names for comparison | ||
const firstCityName = firstEl.city.name.toUpperCase(); | ||
const secondCityName = secondEl.city.name.toUpperCase(); | ||
|
||
// Check if either of the cities is "PG" | ||
const isFirstCityPG = firstCityName === "PG"; | ||
const isSecondCityPG = secondCityName === "PG"; | ||
|
||
// If the first city is "PG", it should come after the second city | ||
if (isFirstCityPG && !isSecondCityPG) { | ||
return 1; // firstEl (PG) comes after secondEl | ||
} | ||
if (!isFirstCityPG && isSecondCityPG) { | ||
return -1; // secondEl (PG) comes after firstEl | ||
} | ||
|
||
// If both cities are not "PG", sort alphabetically by city name | ||
if (firstCityName < secondCityName) { | ||
return -1; // firstEl comes first | ||
} | ||
if (firstEl.name.toUpperCase() > secondEl.name.toUpperCase() ) { | ||
return 1 | ||
if (firstCityName > secondCityName) { | ||
return 1; // secondEl comes first | ||
} | ||
return 0 | ||
} | ||
|
||
// If both have the same city name, sort alphabetically by tenant name | ||
if (firstEl.name.toUpperCase() < secondEl.name.toUpperCase()) { | ||
return -1; | ||
} | ||
if (firstEl.name.toUpperCase() > secondEl.name.toUpperCase()) { | ||
return 1; | ||
} | ||
|
||
return 0; // They are equal | ||
}; | ||
|
||
|
||
export const useTenants = () => useQuery(["ALL_TENANTS"], () => Digit.SessionStorage.get("initData").tenants.sort(alphabeticalSortFunctionForTenantsBasedOnName)) |
Oops, something went wrong.