<!-- التقارير -->
<div x-data="{ open: {{ request()->routeIs('reports.*', 'inventory.reports.*', 'hr.*report*', 'payroll-reports.*', 'treasury.reports.*', 'attendance.report', 'reports.purchase.*') ? 'true' : 'false' }} }" class="mb-1">
    <button @click="open = !open" class="group flex items-center p-3 py-2 text-base font-medium rounded-md
        {{ request()->routeIs('reports.*', 'inventory.reports.*', 'hr.*report*', 'payroll-reports.*', 'treasury.reports.*', 'attendance.report', 'reports.purchase.*') ? 'bg-red-100 text-red-800' : 'text-gray-700 hover:bg-red-50 hover:text-red-800' }}">
        <svg xxmlns="http://www.w3.org/2000/svg" class="ml-3 flex-shrink-0 h-6 w-6 
            {{ request()->routeIs('reports.*', 'inventory.reports.*', 'hr.*report*', 'payroll-reports.*', 'treasury.reports.*', 'attendance.report', 'reports.purchase.*') ? '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 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
        </svg>
        <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Reports System', __('Reports System')) }}</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">
        
        <!-- تقارير المشتريات -->
        <div class="mt-3 mb-2">
            <h3 class="p-3 text-s font-semibold text-gray-500 uppercase tracking-wider">{{ \App\Helpers\TranslationHelper::transFromDatabase('Purchasing Reports', __('Purchasing Reports')) }}</h3>
        </div>

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

        <!-- تقارير المبيعات -->
        <div class="mt-3 mb-2">
            <h3 class="p-3 text-s font-semibold text-gray-500 uppercase tracking-wider">{{ \App\Helpers\TranslationHelper::transFromDatabase('Sales Reports', __('Sales Reports')) }}</h3>
        </div>

        @permission('customer-invoices.view')
        <a href="{{ route('reports.sales') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('reports.sales') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('reports.sales') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('All Sales', __('All Sales')) }}</span>
        </a>
        <a href="{{ route('reports.sales.aging') }}" class="group flex items-center p-3 py-2 text-sm font-medium rounded-md
            {{ request()->routeIs('reports.sales.aging') ? 'text-red-800 bg-red-100' : 'text-gray-700 hover:text-red-800 hover:bg-red-50' }}">
            <span class="ml-2 w-1 h-1 rounded-full {{ request()->routeIs('reports.sales.aging') ? 'bg-red-600' : 'bg-gray-500' }}"></span>
            <span>{{ \App\Helpers\TranslationHelper::transFromDatabase('Debt Aging Report', __('Debt Aging Report')) }}</span>
        </a>
        @endpermission

        <!-- تقارير المحاسبة والحسابات -->
        <div class="mt-3 mb-2">
            <h3 class="p-3 text-s font-semibold text-gray-500 uppercase tracking-wider">{{ \App\Helpers\TranslationHelper::transFromDatabase('Accounting Reports', __('Accounting Reports')) }}</h3>
        </div>

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

        <!-- تقارير المخزون -->
        <div class="mt-3 mb-2">
            <h3 class="p-3 text-s font-semibold text-gray-500 uppercase tracking-wider">{{ \App\Helpers\TranslationHelper::transFromDatabase('Inventory Reports', __('Inventory Reports')) }}</h3>
        </div>

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

        <!-- تقارير شؤون الموظفين -->
        <div class="mt-3 mb-2">
            <h3 class="p-3 text-s font-semibold text-gray-500 uppercase tracking-wider">{{ \App\Helpers\TranslationHelper::transFromDatabase('HR Reports', __('HR Reports')) }}</h3>
        </div>

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

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

        <!-- تقارير الخزينة -->
        <div class="mt-3 mb-2">
            <h3 class="p-3 text-s font-semibold text-gray-500 uppercase tracking-wider">{{ \App\Helpers\TranslationHelper::transFromDatabase('Treasury Reports', __('Treasury Reports')) }}</h3>
        </div>

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

    </div>
</div>
