Navigation System Tables¶
Menu Items (menu_items)¶
Purpose: Dynamic navigation menu structure
Use Case Example: Create menu hierarchy: Setup > Budgets > Version History, where each level can have different permissions and icons.
| Column | Type | Description |
|---|---|---|
| id | UUID | Unique identifier |
| parent_id | UUID | Parent menu item (for nesting) |
| menu_key | TEXT | Unique menu identifier (required) |
| name | TEXT | Display name |
| icon | TEXT | Icon name (lucide-react) |
| display_order | INTEGER | Display order |
| is_active | BOOLEAN | Whether item is shown |
| required_permission_key | TEXT | Simple permission check |
| required_feature_flag | TEXT | Project column name that must be true for item to appear (e.g., 'approvals_enabled'). NULL = always visible. |
| is_parent_active | BOOLEAN | Whether parent menu shows when selected |
| menu_type | TEXT | Menu type: main/sidebar/dropdown/quickaction/sana |
| notification_template_id | UUID | Notification template to trigger when menu item selected |
| description | TEXT | Optional description text for additional context |
| metadata | JSONB | Flexible field for additional properties (e.g., function_to_call) |
Feature Flags: Menu items can be conditionally displayed based on project-level feature flags using the required_feature_flag column. When set, the menu item will only appear if the corresponding project column is true. For example, required_feature_flag = 'approvals_enabled' means the menu item only appears when projects.approvals_enabled = true. This is checked in the v_user_accessible_menu_items view.
Default Menu Structure:
Web Application Menus (type: App):
- Home (/projects/{projectId}) - menu_key: projects.home
- Setup - menu_key: projects.setup - icon: FolderCog
- Approvals (/projects/{projectId}/setup/approvals) - menu_key: projects.setup.approvals - icon: SlidersHorizontal - requires: approval_configuration:view (display_order: 10)
- Budgets (/projects/{projectId}/setup/budgets) - menu_key: projects.setup.budgets - icon: Calculator - requires: budget:view (display_order: 20)
- Payment Methods (/projects/{projectId}/setup/payment-methods) - menu_key: projects.setup.payment-methods - icon: WalletCards - requires: payment:method:manage (display_order: 30)
- Users (/projects/{projectId}/setup/users) - menu_key: projects.setup.users - requires: user:view (display_order: 40)
- Production Phases (/projects/{projectId}/setup/production-phases) - menu_key: projects.setup.production-phases - icon: CalendarDays - requires: production_phase:manage (display_order: 15, media projects only)
- Integrations - menu_key: projects.setup.integrations - icon: Plug (display_order: 25)
- Configuration (/projects/{projectId}/setup/integrations/configuration) - menu_key: projects.setup.integrations.configuration - icon: Settings - requires: integration:manage (display_order: 10)
- Settings (/projects/{projectId}/settings) - menu_key: projects.settings - icon: Settings - requires: project:edit
- Management - menu_key: projects.management - icon: Settings
- Entities - menu_key: projects.management.entities - icon: Users - requires: project_relationship:view
- All (/projects/{projectId}/management/entities/all) - menu_key: projects.management.entities.all - requires: project_relationship:view (all project types)
- Crew (/projects/{projectId}/management/entities/crew) - menu_key: projects.management.entities.crew - requires: project_relationship:view (media and company_accounting project types)
- Cast (/projects/{projectId}/management/entities/cast) - menu_key: projects.management.entities.cast - requires: project_relationship:view (media projects only)
- Suppliers (/projects/{projectId}/management/entities/suppliers) - menu_key: projects.management.entities.suppliers - requires: project_relationship:view (all project types)
- Customers (/projects/{projectId}/management/entities/customers) - menu_key: projects.management.entities.customers - icon: Handshake - requires: project_relationship:view (all project types)
- Transactions - menu_key: projects.management.transactions - icon: Receipt - requires: transaction:view
- All (/projects/{projectId}/management/transactions/all) - menu_key: projects.management.transactions.all - icon: LayoutGrid - requires: transaction:view - categories: media_project, personal_accounting_project, company_accounting_project
- On Hold (/projects/{projectId}/management/transactions/on-hold) - menu_key: projects.management.transactions.on_hold - icon: CirclePause - requires: transaction:view - categories: media_project, personal_accounting_project, company_accounting_project
- Expense (/projects/{projectId}/management/transactions/expense) - menu_key: projects.management.transactions.expense - requires: transaction:view
- Invoice (/projects/{projectId}/management/transactions/invoice) - menu_key: projects.management.transactions.invoice - requires: transaction:view
- Payroll Invoice (/projects/{projectId}/management/transactions/payroll-invoice) - menu_key: projects.management.transactions.payroll_invoice - requires: transaction:view
- Reimbursement (/projects/{projectId}/management/transactions/reimbursement) - menu_key: projects.management.transactions.reimbursement - requires: transaction:view
- Others (/projects/{projectId}/management/transactions/others) - menu_key: projects.management.transactions.others - requires: transaction:view
- Approvals - menu_key: projects.management.approvals - icon: ClipboardCheck - requires: approval:view - feature_flag: approvals_enabled
- Pending (/projects/{projectId}/management/approvals/pending) - menu_key: projects.management.approvals.pending - icon: CircleDashed - requires: approval:view - feature_flag: approvals_enabled
- Queries (/projects/{projectId}/management/approvals/queries) - menu_key: projects.management.approvals.queries - icon: CircleHelp - requires: approval:view - feature_flag: approvals_enabled
- History (/projects/{projectId}/management/approvals/history) - menu_key: projects.management.approvals.history - icon: History - requires: approval:view - feature_flag: approvals_enabled
- Payments - menu_key: projects.management.payments - icon: HandCoins - requires: payment:view (media, personal_accounting, company_accounting project types)
- Scheduling (/projects/{projectId}/management/payments/scheduling) - menu_key: projects.management.payments.scheduling - icon: CalendarClock - requires: payment:schedule (media, personal_accounting, company_accounting project types)
- Process (/projects/{projectId}/management/payments/process) - menu_key: projects.management.payments.process - icon: CreditCard - requires: payment:process (media, personal_accounting, company_accounting project types)
- Paid (/projects/{projectId}/management/payments/paid) - menu_key: projects.management.payments.paid - icon: CircleCheck - requires: payment:view (media, personal_accounting, company_accounting project types)
- Reconciliations (/projects/{projectId}/management/payments/reconciliations) - menu_key: projects.management.payments.reconciliations - icon: FileSpreadsheet - requires: payment:reconciliations (media, personal_accounting, company_accounting project types)
- Budget - menu_key: projects.management.budget - icon: Banknote - requires: budget:actuals:view - feature_flag: has_current_budget
- Actuals (/projects/{projectId}/management/budget/actuals) - menu_key: projects.management.budget.actuals - icon: Gauge - requires: budget:actuals:view - feature_flag: has_current_budget
- Estimated Costs (/projects/{projectId}/management/budget/estimated-costs) - menu_key: projects.management.budget.estimated_costs - icon: FileSpreadsheet - requires: budget:estimated_costs:view - feature_flag: has_current_budget_with_estimated_costs
- Compliance Capture (/projects/{projectId}/management/compliance-capture) - menu_key: projects.management.compliance_capture - icon: FileCheck - requires: compliance:capture:view
- Reports (/projects/{projectId}/reports) - menu_key: projects.reports - icon: BarChart3 - requires: reporting:view
Sana WhatsApp Bot Menus (type: Sana):
Active:
- Submit Transactions - menu_key: sana.submit_transactions - requires: transaction:create - categories: media_project, personal_accounting_project, company_accounting_project
- Switch Project Engagement - menu_key: sana.switch_project_engagement - function: SwitchProjectEngagement - categories: media_project, personal_accounting_project, company_accounting_project
Inactive (hidden for MVP):
- Onboard Entities - menu_key: sana.onboard_people - requires: project_relationship:create
- Logging - menu_key: sana.logging - requires: time:track
- Start Logging for today - menu_key: sana.logging.start - function: StartLogging
- Stop Logging for today - menu_key: sana.logging.stop - function: StopLogging
- Financial Reporting - menu_key: sana.financial_reporting - requires: budget:view
- Supplier Invoicing - menu_key: sana.financial_reporting.supplier_invoicing
- Budget Used - menu_key: sana.financial_reporting.budget_used
- Invoice Finder - menu_key: sana.invoice_finder - requires: payment:view - function: PaymentTransactionFinder
Menu Item Categories (menu_item_categories)¶
Purpose: Many-to-many junction table linking menu items to categories with category-specific display order
Use Case Example: A "Budget" menu item can appear in multiple project categories but with different ordering (e.g., position 3 in "Film" but position 5 in "Television").
| Column | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| menu_item_id | UUID | FK to menu_items table |
| category_id | UUID | FK to categories table |
| display_order | INTEGER | Display order for this menu item within this specific category (allows different positions) |
| created_at | TIMESTAMPTZ | When the link was created |
Key Features:
- Primary Key:
id(UUID) - Unique Constraint:
(menu_item_id, category_id)- prevents duplicate category assignments - Cascade Delete: Removes links when menu item or category is deleted
- RLS Policies: Authenticated read-only. Junction table managed by service_role
- Indexed: Foreign keys and
(category_id, display_order)for sorting queries - Category-Specific Ordering: Same menu item can have different display orders in different categories