@php
    $faCompanyId = auth()->user()->company_id;
    $useFixedAssetsModule = \App\Models\Setting::get($faCompanyId, 'use_fixed_assets_module', '0') === '1';
    $canViewFixedAssets = auth()->user()->hasPermission('fixed_assets', 'view');

    $fixedAssetsMenuItems = [];
    if ($canViewFixedAssets) {
        $fixedAssetsMenuItems = [
            ['route' => 'fixed-assets.register.index', 'pattern' => 'fixed-assets.register.*', 'icon' => 'bi-building', 'label' => 'Asset Register'],
            ['route' => 'fixed-assets.categories.index', 'pattern' => 'fixed-assets.categories.*', 'icon' => 'bi-tags', 'label' => 'Asset Categories'],
            ['route' => 'fixed-assets.depreciation.index', 'pattern' => 'fixed-assets.depreciation.*', 'icon' => 'bi-graph-down-arrow', 'label' => 'Depreciation'],
        ];
    }
@endphp

@if($useFixedAssetsModule)
    @if(($variant ?? 'sidebar') === 'dropdown')
        @foreach($fixedAssetsMenuItems as $item)
        <li>
            <a class="dropdown-item {{ request()->routeIs($item['pattern']) ? 'active' : '' }}" href="{{ route($item['route']) }}">
                <i class="bi {{ $item['icon'] }} me-2"></i>{{ $item['label'] }}
            </a>
        </li>
        @endforeach
    @else
        @foreach($fixedAssetsMenuItems as $item)
        <a href="{{ route($item['route']) }}"
           class="nav-item-link {{ request()->routeIs($item['pattern']) ? 'active' : '' }}">
            <i class="bi {{ $item['icon'] }}"></i><span>{{ $item['label'] }}</span>
        </a>
        @endforeach
    @endif
@endif
