feat: update user role routing
This commit is contained in:
parent
38c5b513ff
commit
008c8e61a8
|
|
@ -10,7 +10,6 @@ import { getCookiesDecrypt, setCookiesEncrypt } from "@/lib/utils";
|
||||||
|
|
||||||
// Navigation configuration based on user roles
|
// Navigation configuration based on user roles
|
||||||
export const NAVIGATION_CONFIG: NavigationConfig[] = [
|
export const NAVIGATION_CONFIG: NavigationConfig[] = [
|
||||||
{ roleId: 18, path: "/in/dashboard/executive-data", label: "Executive Data Dashboard" },
|
|
||||||
{ roleId: 2, path: "/in/dashboard/executive", label: "Executive Dashboard" },
|
{ roleId: 2, path: "/in/dashboard/executive", label: "Executive Dashboard" },
|
||||||
{ roleId: 3, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 3, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 4, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 4, path: "/in/dashboard", label: "Dashboard" },
|
||||||
|
|
@ -18,6 +17,10 @@ export const NAVIGATION_CONFIG: NavigationConfig[] = [
|
||||||
{ roleId: 10, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 10, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 11, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 11, path: "/in/dashboard", label: "Dashboard" },
|
||||||
{ roleId: 12, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 12, path: "/in/dashboard", label: "Dashboard" },
|
||||||
|
{ roleId: 13, path: "/in/dashboard", label: "Dashboard" },
|
||||||
|
{ roleId: 14, path: "/in/dashboard", label: "Dashboard" },
|
||||||
|
{ roleId: 15, path: "/in/dashboard", label: "Dashboard" },
|
||||||
|
{ roleId: 18, path: "/in/dashboard/executive-data", label: "Executive Data Dashboard" },
|
||||||
{ roleId: 19, path: "/in/dashboard", label: "Dashboard" },
|
{ roleId: 19, path: "/in/dashboard", label: "Dashboard" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -102,6 +105,8 @@ export const isSpecialLevel = (userLevelId: number, parentLevelId?: number): boo
|
||||||
export const getNavigationPath = (roleId: number, userLevelId?: number, parentLevelId?: number): string => {
|
export const getNavigationPath = (roleId: number, userLevelId?: number, parentLevelId?: number): string => {
|
||||||
const config = NAVIGATION_CONFIG.find(nav => nav.roleId === roleId);
|
const config = NAVIGATION_CONFIG.find(nav => nav.roleId === roleId);
|
||||||
|
|
||||||
|
console.log("Navigation Config : ", config);
|
||||||
|
|
||||||
if (config) {
|
if (config) {
|
||||||
// Special handling for role 2 with specific level conditions
|
// Special handling for role 2 with specific level conditions
|
||||||
if (roleId === 2 && userLevelId && parentLevelId && isSpecialLevel(userLevelId, parentLevelId)) {
|
if (roleId === 2 && userLevelId && parentLevelId && isSpecialLevel(userLevelId, parentLevelId)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue