# Permission-aware navigation

Date: 2026-10-19
Status: implemented in the primary ERP development installation.

## Sidebar organization
- Workspace: Overview.
- Products & Catalogs: Product Master, Product Categories, Sales Catalogs, Import Products.
- Organization & Locations: Company & Branches, Company Setup, Warehouses.
- People & Security: Employee Accounts, Teams & Groups, Departments, Roles & Permissions, Recent Activity, Audit History.
- Planned Modules: collapsed section for the existing workspace placeholder pages, explicitly marked Planned.
- Existing authorized favorites are preserved.

Dynamic product/catalog detail and edit URLs remain accessible from their parent lists, not one sidebar entry per record.
Authentication, activation and logout are not operational sidebar pages.

## Authorization
Navigation definitions are centralized in app/Support/Navigation.php.
Items use the same permission predicates as their destination controllers.
No user permissions or assignments were changed.
Company selection is available to signed-in users and filters memberships on its page.
The import link requires company-wide products.import.
Audit History requires company-wide audit.view or access.manage.
Administration tabs require company-wide access.manage.
Warehouses use warehouse-view scope or warehouse-management permission.
Empty groups are omitted.
Direct endpoint checks remain enforced independently of link visibility.

## Interaction
Active link tracks page paths and access-tab URL fragments.
Sidebar access links switch the corresponding tab without requiring a full reload.
Clicking a tab also updates the active sidebar link.
Mobile navigation closes after a destination is selected.
Command search now uses the same authorized navigation definitions.

## Verification
38 tests / 225 assertions pass using SQLite in memory.
Tests verify all owner links resolve successfully, unprivileged links are omitted,
auditor-only navigation, company-scoped import, revocation and cross-company role isolation.
Authenticated browser checks: sidebar to Employees to Teams, tab to Roles, and command search to Audit History.
Mobile 390x844: menu opens, selecting Employee Accounts closes it, correct tab/link active.
Document width remained 390px. Default viewport restored afterward.
No relevant browser errors/warnings observed.
No migrations or database writes required for this change.

## Backup
/home/snyt/backups/snyt-erp/2026-10-19-p0/before-sidebar-navigation.tar.gz
