<div x-data="{ open: {{ request()->routeIs('assets.*') ? 'true' : 'false' }} }" class="mb-1">
    @permission('assets.view')
    <button @click="open = !open" class="group flex items-center p-3 py-2 text-base font-medium rounded-md
        {{ request()->routeIs('assets.*') ? 'bg-red-100 text-red-800' : 'text-gray-700 hover:bg-red-50 hover:text-red-800' }}">
        <svg xmlns="http://www.w3.org/2000/svg" class="ml-3 flex-shrink-0 h-6 w-6 
            {{ request()->routeIs('assets.*') ? 'text-red-700' : 'text-gray-500 group-hover:text-red-700' }}" 
            fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" 
                d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z" />
        </svg>
        <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Assets Management', __('Assets Management')) }}</span>
        <svg :class="{'rotate-180': open, 'rotate-0': !open}" class="mr-auto h-5 w-5 transform transition-transform duration-200" 
            xxmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
            <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
        </svg>
    </button>
    <div x-show="open" x-transition class="pr-4 mr-4 border-r border-gray-200">
        @permission('asset_categories.view')
        <a href="{{ route('assets.categories.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.categories.*') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.categories.*') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Asset Categories', __('Asset Categories')) }}</span>
        </a>
        @endpermission

        @permission('assets.view')
        <a href="{{ route('assets.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.index') || request()->routeIs('assets.show') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.index') || request()->routeIs('assets.show') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Assets List', __('Assets List')) }}</span>
        </a>
        @endpermission

        @permission('assets.create')
        <a href="{{ route('assets.create') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.create') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.create') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Add New Asset', __('Add New Asset')) }}</span>
        </a>
        @endpermission

        @permission('asset_depreciations.view')
        <a href="{{ route('assets.depreciations.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.depreciations.*') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.depreciations.*') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Asset Depreciations', __('Asset Depreciations')) }}</span>
        </a>
        @endpermission

        @permission('asset_maintenance.view')
        <a href="{{ route('assets.maintenance.list') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.maintenance.*') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.maintenance.*') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Asset Maintenance', __('Asset Maintenance')) }}</span>
        </a>
        @endpermission

        @permission('asset_disposals.view')
        <a href="{{ route('assets.disposals.index') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.disposals.*') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.disposals.*') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Asset Disposals', __('Asset Disposals')) }}</span>
        </a>
        @endpermission

        @permission('reports.view')
        <a href="{{ route('assets.reports.asset-list') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('assets.reports.*') ? 'text-red-800' : 'text-gray-700 hover:text-red-800' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('assets.reports.*') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Assets Reports', __('Assets Reports')) }}</span>
        </a>
        @endpermission
    </div>
    @endpermission
</div>
