@php // Mirrors the same permission strings the Policies already enforce // (see app/Policies/*.php and database/migrations/..._seed_roles_and_permissions.php) // — a link only appears if the current user could actually get past // the controller's Gate::authorize()/FormRequest::authorize() for it. // 'enabled' still drives the "Soon" badge for genuinely unbuilt // features; 'visible' is the new permission gate and, unlike // 'enabled', hides the item entirely rather than greying it out. $company = auth()->user()->company; $canFleet = auth()->user()->can('fleet.view'); $canInventory = auth()->user()->can('inventory.view'); $canSettings = auth()->user()->can('settings.manage'); $canUsers = auth()->user()->can('users.manage'); $navItems = [ ['label' => 'Dashboard', 'route' => 'dashboard', 'active' => 'dashboard', 'enabled' => true, 'visible' => true, 'icon' => 'home'], ['label' => 'Vehicles', 'route' => 'vehicles.index', 'active' => 'vehicles.*', 'enabled' => true, 'visible' => $canFleet, 'icon' => 'truck'], ['label' => 'Drivers', 'route' => 'drivers.index', 'active' => 'drivers.*', 'enabled' => true, 'visible' => $canFleet, 'icon' => 'user'], ['label' => 'Customers', 'route' => 'customers.index', 'active' => 'customers.*', 'enabled' => true, 'visible' => $canFleet, 'icon' => 'customers'], ['label' => 'Documents', 'route' => 'documents.index', 'active' => 'documents.*', 'enabled' => true, 'visible' => $canFleet, 'icon' => 'document'], ['label' => 'Routes', 'route' => 'routes.index', 'active' => 'routes.*', 'enabled' => true, 'visible' => $canFleet && $company->hasModule(\App\Enums\Module::Routes), 'icon' => 'route'], ['label' => 'Trips', 'route' => 'trips.index', 'active' => 'trips.*', 'enabled' => true, 'visible' => $canFleet && $company->hasModule(\App\Enums\Module::Trips), 'icon' => 'map'], ['label' => 'Fuel', 'route' => 'fuel.index', 'active' => 'fuel.*', 'enabled' => true, 'visible' => $canFleet && $company->hasModule(\App\Enums\Module::Fuel), 'icon' => 'fuel'], ['label' => 'Challans', 'route' => 'challans.index', 'active' => 'challans.*', 'enabled' => true, 'visible' => $canFleet, 'icon' => 'ticket'], [ 'label' => 'Stock In / Out', 'route' => 'stock-entry.index', 'active' => ['stock-entry.*', 'parts.*', 'suppliers.*', 'mechanics.*', 'maintenance.*', 'stock-in.*', 'stock-movements.*', 'inventory.*'], 'enabled' => true, 'visible' => $canInventory, 'icon' => 'wrench', ], ['label' => 'Reports', 'route' => 'reports.index', 'active' => 'reports.*', 'enabled' => true, 'visible' => $canFleet || $canInventory, 'icon' => 'chart'], [ 'label' => 'Import Data', 'icon' => 'upload', 'visible' => $canFleet || $canInventory, 'children' => array_values(array_filter([ $canFleet ? ['label' => 'Fleet Data (Vehicles, Drivers, Documents, Trips)', 'route' => 'fleet.import.index', 'active' => 'fleet.import.*'] : null, $canInventory ? ['label' => 'Inventory Data (Parts, Stock)', 'route' => 'inventory.import.index', 'active' => 'inventory.import.*'] : null, ])), ], ['label' => 'Company Settings', 'route' => 'company-settings.edit', 'active' => 'company-settings.*', 'enabled' => true, 'visible' => $canSettings || $canUsers, 'icon' => 'settings'], ['label' => 'Settings', 'route' => 'profile.edit', 'active' => 'profile.*', 'enabled' => true, 'visible' => true, 'icon' => 'settings'], ]; $navItems = array_values(array_filter($navItems, fn (array $item) => $item['visible'])); @endphp
@if ($company->logo_path) {{ $company->brandName() }} @else {{ mb_substr($company->brandName(), 0, 1) }} @endif {{ $company->brandName() }}