<?php
    $payrollCompanyId = auth()->user()->company_id;
    $usePayrollModule = \App\Models\Setting::get($payrollCompanyId, 'use_payroll_module', '0') === '1';
    $canViewPayroll = auth()->user()->hasPermission('payroll', 'view');
    $canViewEmployees = auth()->user()->hasPermission('masters', 'view');

    $payrollMenuItems = [];
    if ($canViewEmployees) {
        $payrollMenuItems[] = ['route' => 'masters.employees.index', 'pattern' => 'masters.employees.*', 'icon' => 'bi-people', 'label' => 'Employees'];
    }
    if ($canViewPayroll) {
        $payrollMenuItems = array_merge($payrollMenuItems, [
            ['route' => 'payroll.departments.index', 'pattern' => 'payroll.departments.*', 'icon' => 'bi-diagram-3', 'label' => 'Departments'],
            ['route' => 'payroll.designations.index', 'pattern' => 'payroll.designations.*', 'icon' => 'bi-person-badge', 'label' => 'Designations'],
            ['route' => 'payroll.projects.index', 'pattern' => 'payroll.projects.*', 'icon' => 'bi-kanban', 'label' => 'Projects'],
            ['route' => 'payroll.branches.index', 'pattern' => 'payroll.branches.*', 'icon' => 'bi-building', 'label' => 'Branches'],
            ['route' => 'payroll.salary-components.index', 'pattern' => 'payroll.salary-components.*', 'icon' => 'bi-cash-coin', 'label' => 'Salary Components'],
            ['route' => 'payroll.payroll-sheet.index', 'pattern' => 'payroll.payroll-sheet.*', 'icon' => 'bi-table', 'label' => 'Payroll Sheet'],
            ['route' => 'payroll.journal.index', 'pattern' => 'payroll.journal.*', 'icon' => 'bi-journal-text', 'label' => 'Payroll Journal'],
            ['route' => 'payroll.pay-slip.index', 'pattern' => 'payroll.pay-slip.*', 'icon' => 'bi-receipt', 'label' => 'Pay Slip'],
            ['route' => 'payroll.bank-transfer-letter.index', 'pattern' => 'payroll.bank-transfer-letter.*', 'icon' => 'bi-envelope-paper', 'label' => 'Bank Transfer Letter'],
        ]);
    }
?>

<?php if($usePayrollModule): ?>
    <?php if(($variant ?? 'sidebar') === 'dropdown'): ?>
        <?php $__currentLoopData = $payrollMenuItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <li>
            <a class="dropdown-item <?php echo e(request()->routeIs($item['pattern']) ? 'active' : ''); ?>" href="<?php echo e(route($item['route'])); ?>">
                <i class="bi <?php echo e($item['icon']); ?> me-2"></i><?php echo e($item['label']); ?>

            </a>
        </li>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    <?php else: ?>
        <?php $__currentLoopData = $payrollMenuItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <a href="<?php echo e(route($item['route'])); ?>"
           class="nav-item-link <?php echo e(request()->routeIs($item['pattern']) ? 'active' : ''); ?>">
            <i class="bi <?php echo e($item['icon']); ?>"></i><span><?php echo e($item['label']); ?></span>
        </a>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
    <?php endif; ?>
<?php endif; ?>
<?php /**PATH /home/duiclick/public_html/test.duiclick.com/resources/views/partials/payroll-menu-items.blade.php ENDPATH**/ ?>