task-d5.5.1
This commit is contained in:
@@ -1,211 +1,184 @@
|
||||
import { NavGroup } from "@/types";
|
||||
|
||||
/**
|
||||
* Navigation configuration with RBAC support
|
||||
*
|
||||
* This configuration is used for both the sidebar navigation and Cmd+K bar.
|
||||
* Items are organized into groups, each rendered with a SidebarGroupLabel.
|
||||
*
|
||||
* RBAC Access Control:
|
||||
* Each navigation item can have an `access` property that controls visibility
|
||||
* based on permissions, plans, features, roles, and organization context.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* 1. Require organization:
|
||||
* access: { requireOrg: true }
|
||||
*
|
||||
* 2. Require specific permission:
|
||||
* access: { requireOrg: true, permission: 'org:teams:manage' }
|
||||
*
|
||||
* 3. Require specific plan:
|
||||
* access: { plan: 'pro' }
|
||||
*
|
||||
* 4. Require specific feature:
|
||||
* access: { feature: 'premium_access' }
|
||||
*
|
||||
* 5. Require specific role:
|
||||
* access: { role: 'admin' }
|
||||
*
|
||||
* 6. Multiple conditions (all must be true):
|
||||
* access: { requireOrg: true, permission: 'org:teams:manage', plan: 'pro' }
|
||||
*
|
||||
* Note: The `visible` function is deprecated but still supported for backward compatibility.
|
||||
* Use the `access` property for new items.
|
||||
*/
|
||||
export const navGroups: NavGroup[] = [
|
||||
{
|
||||
label: "Overview",
|
||||
items: [
|
||||
{
|
||||
title: "Dashboard Overview",
|
||||
url: "/dashboard",
|
||||
icon: "dashboard",
|
||||
isActive: false,
|
||||
shortcut: ["d", "d"],
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: "Workspaces",
|
||||
url: "/dashboard/workspaces",
|
||||
icon: "workspace",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { systemRole: "super_admin" },
|
||||
},
|
||||
{
|
||||
title: "Teams",
|
||||
url: "/dashboard/workspaces/team",
|
||||
icon: "teams",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.quotation.read" },
|
||||
},
|
||||
{
|
||||
title: "Users",
|
||||
url: "/dashboard/users",
|
||||
icon: "teams",
|
||||
shortcut: ["u", "u"],
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "users:manage" },
|
||||
},
|
||||
{
|
||||
title: "Kanban",
|
||||
url: "/dashboard/kanban",
|
||||
icon: "kanban",
|
||||
shortcut: ["k", "k"],
|
||||
isActive: false,
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "CRM",
|
||||
items: [
|
||||
{
|
||||
title: "Dashboard",
|
||||
url: "/dashboard/crm",
|
||||
icon: "dashboard",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.dashboard.read" },
|
||||
},
|
||||
{
|
||||
title: "ลูกค้า",
|
||||
url: "/dashboard/crm/customers",
|
||||
icon: "teams",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.customer.read" },
|
||||
},
|
||||
{
|
||||
title: "ลีด",
|
||||
url: "/dashboard/crm/leads",
|
||||
icon: "forms",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.lead.read" },
|
||||
},
|
||||
{
|
||||
title: "โอกาสขาย",
|
||||
url: "/dashboard/crm/enquiries",
|
||||
icon: "forms",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.enquiry.read" },
|
||||
},
|
||||
{
|
||||
title: "ใบเสนอราคา",
|
||||
url: "/dashboard/crm/quotations",
|
||||
icon: "post",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, role: "admin" },
|
||||
},
|
||||
{
|
||||
title: "อนุมัติเอกสาร",
|
||||
url: "/dashboard/crm/approvals",
|
||||
icon: "checks",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.approval.read" },
|
||||
},
|
||||
{
|
||||
title: "Reports",
|
||||
url: "/dashboard/crm/reports",
|
||||
icon: "dashboard",
|
||||
isActive: false,
|
||||
items: [
|
||||
{
|
||||
title: "Pipeline Suite",
|
||||
url: "/dashboard/crm/reports/pipeline",
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
{
|
||||
title: "Lead Aging",
|
||||
url: "/dashboard/crm/reports/lead-aging",
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
{
|
||||
title: "Enquiry Aging",
|
||||
url: "/dashboard/crm/reports/enquiry-aging",
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
],
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
{
|
||||
title: "ตั้งค่า CRM",
|
||||
url: "/dashboard/crm/settings/master-options",
|
||||
icon: "settings",
|
||||
isActive: false,
|
||||
access: { requireOrg: true, permission: "crm.user_role_assignment.read" },
|
||||
items: [
|
||||
{
|
||||
title: "Roles & Permissions",
|
||||
url: "/dashboard/crm/settings/roles",
|
||||
access: { requireOrg: true, permission: "crm.role.read" },
|
||||
},
|
||||
{
|
||||
title: "User Role Assignments",
|
||||
url: "/dashboard/crm/settings/user-role-assignments",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.user_role_assignment.read",
|
||||
/** * Navigation configuration with RBAC support * * This configuration is used for both the sidebar navigation and Cmd+K bar. * Items are organized into groups, each rendered with a SidebarGroupLabel. * * RBAC Access Control: * Each navigation item can have an `access` property that controls visibility * based on permissions, plans, features, roles, and organization context. * * Examples: * * 1. Require organization: * access: { requireOrg: true } * * 2. Require specific permission: * access: { requireOrg: true, permission: 'org:teams:manage' } * * 3. Require specific plan: * access: { plan: 'pro' } * * 4. Require specific feature: * access: { feature: 'premium_access' } * * 5. Require specific role: * access: { role: 'admin' } * * 6. Multiple conditions (all must be true): * access: { requireOrg: true, permission: 'org:teams:manage', plan: 'pro' } * * Note: The `visible` function is deprecated but still supported for backward compatibility. * Use the `access` property for new items. */ export const navGroups: NavGroup[] =
|
||||
[
|
||||
{
|
||||
label: "Overview",
|
||||
items: [
|
||||
{
|
||||
title: "Dashboard Overview",
|
||||
url: "/dashboard",
|
||||
icon: "dashboard",
|
||||
isActive: false,
|
||||
shortcut: ["d", "d"],
|
||||
items: [],
|
||||
},
|
||||
{
|
||||
title: "Workspaces",
|
||||
url: "/dashboard/workspaces",
|
||||
icon: "workspace",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { systemRole: "super_admin" },
|
||||
},
|
||||
{
|
||||
title: "Teams",
|
||||
url: "/dashboard/workspaces/team",
|
||||
icon: "teams",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.quotation.read" },
|
||||
},
|
||||
{
|
||||
title: "Users",
|
||||
url: "/dashboard/users",
|
||||
icon: "teams",
|
||||
shortcut: ["u", "u"],
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "users:manage" },
|
||||
},
|
||||
{
|
||||
title: "Kanban",
|
||||
url: "/dashboard/kanban",
|
||||
icon: "kanban",
|
||||
shortcut: ["k", "k"],
|
||||
isActive: false,
|
||||
items: [],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "CRM",
|
||||
items: [
|
||||
{
|
||||
title: "Dashboard",
|
||||
url: "/dashboard/crm",
|
||||
icon: "dashboard",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.dashboard.read" },
|
||||
},
|
||||
{
|
||||
title: "ลูกค้า",
|
||||
url: "/dashboard/crm/customers",
|
||||
icon: "teams",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.customer.read" },
|
||||
},
|
||||
{
|
||||
title: "ลีด",
|
||||
url: "/dashboard/crm/leads",
|
||||
icon: "forms",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.lead.read" },
|
||||
},
|
||||
{
|
||||
title: "โอกาสขาย",
|
||||
url: "/dashboard/crm/opportunities",
|
||||
icon: "forms",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.opportunity.read" },
|
||||
},
|
||||
{
|
||||
title: "ใบเสนอราคา",
|
||||
url: "/dashboard/crm/quotations",
|
||||
icon: "post",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, role: "admin" },
|
||||
},
|
||||
{
|
||||
title: "อนุมัติเอกสาร",
|
||||
url: "/dashboard/crm/approvals",
|
||||
icon: "checks",
|
||||
isActive: false,
|
||||
items: [],
|
||||
access: { requireOrg: true, permission: "crm.approval.read" },
|
||||
},
|
||||
{
|
||||
title: "Reports",
|
||||
url: "/dashboard/crm/reports",
|
||||
icon: "dashboard",
|
||||
isActive: false,
|
||||
items: [
|
||||
{
|
||||
title: "Pipeline Suite",
|
||||
url: "/dashboard/crm/reports/pipeline",
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Master Options",
|
||||
url: "/dashboard/crm/settings/master-options",
|
||||
access: { requireOrg: true, permission: "crm.master_option.read" },
|
||||
},
|
||||
{
|
||||
title: "Document Sequences",
|
||||
url: "/dashboard/crm/settings/document-sequences",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.document_sequence.read",
|
||||
{
|
||||
title: "Lead Aging",
|
||||
url: "/dashboard/crm/reports/lead-aging",
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Approval Workflows",
|
||||
url: "/dashboard/crm/settings/approval-workflows",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.approval.workflow.read",
|
||||
{
|
||||
title: "Opportunity Aging",
|
||||
url: "/dashboard/crm/reports/opportunity-aging",
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
],
|
||||
access: { requireOrg: true, permission: "crm.report.read" },
|
||||
},
|
||||
{
|
||||
title: "ตั้งค่า CRM",
|
||||
url: "/dashboard/crm/settings/master-options",
|
||||
icon: "settings",
|
||||
isActive: false,
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.user_role_assignment.read",
|
||||
},
|
||||
{
|
||||
title: "Templates",
|
||||
url: "/dashboard/crm/settings/templates",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.document_template.read",
|
||||
items: [
|
||||
{
|
||||
title: "Roles & Permissions",
|
||||
url: "/dashboard/crm/settings/roles",
|
||||
access: { requireOrg: true, permission: "crm.role.read" },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
{
|
||||
title: "User Role Assignments",
|
||||
url: "/dashboard/crm/settings/user-role-assignments",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.user_role_assignment.read",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Master Options",
|
||||
url: "/dashboard/crm/settings/master-options",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.master_option.read",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Document Sequences",
|
||||
url: "/dashboard/crm/settings/document-sequences",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.document_sequence.read",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Approval Workflows",
|
||||
url: "/dashboard/crm/settings/approval-workflows",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.approval.workflow.read",
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Templates",
|
||||
url: "/dashboard/crm/settings/templates",
|
||||
access: {
|
||||
requireOrg: true,
|
||||
permission: "crm.document_template.read",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user