<?php
    $can = fn($perm) => isset($currentAdmin) ? $currentAdmin->hasPermission($perm) : true;
?>

<aside class="sidebar" id="sidebar">
    <div class="brand">
        <span class="brand-name">SEF Digital POS</span>
        <span class="live-dot"></span>
    </div>

    <nav class="nav">
        <?php if($can('dashboard')): ?>
            <div class="menu-group menu-group-dashboard">
                <a class="nav-item <?php echo e(request()->routeIs('admin.dashboard') ? 'active' : ''); ?>" href="<?php echo e(route('admin.dashboard')); ?>">
                    🏠 Dashboard
                </a>
            </div>
        <?php endif; ?>

        <?php if($can('products')): ?>
            <div class="menu-group menu-group-products">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.products.*','admin.barcodes.*','admin.categories.*','admin.brands.*','admin.sizes.*','admin.colors.*','admin.units.*') ? 'open' : ''); ?>" data-target="menu-products">
                    <span>Products</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.products.*','admin.barcodes.*','admin.categories.*','admin.brands.*','admin.sizes.*','admin.colors.*','admin.units.*') ? 'open' : ''); ?>" id="menu-products">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.products.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.products.create')); ?>">➕ Add Product</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.products.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.products.index')); ?>">📦 Products List</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.barcodes.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.barcodes.index')); ?>">🏷 Barcodes</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.categories.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.categories.index')); ?>">🗂 Categories</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.brands.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.brands.index')); ?>">🏷 Brands</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sizes.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sizes.index')); ?>">📏 Sizes</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.colors.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.colors.index')); ?>">🎨 Colors</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.units.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.units.index')); ?>">⚖️ Units</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('purchases')): ?>
            <div class="menu-group menu-group-purchase">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.suppliers.*','admin.purchases.*','admin.settings.integrations') ? 'open' : ''); ?>" data-target="menu-purchase">
                    <span>Purchase & Supplier</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.suppliers.*','admin.purchases.*','admin.settings.integrations') ? 'open' : ''); ?>" id="menu-purchase">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.suppliers.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.suppliers.index')); ?>">🚚 Suppliers</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.purchases.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.purchases.create')); ?>">🧾 Add Purchase</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.purchases.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.purchases.index')); ?>">📃 Purchase List</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.settings.integrations') ? 'active' : ''); ?>" href="<?php echo e(route('admin.settings.integrations')); ?>">🇧🇩 BD Integrations</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('sales')): ?>
            <div class="menu-group menu-group-sales">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.sales.*') ? 'open' : ''); ?>" data-target="menu-sales">
                    <span>Sell</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.sales.*') ? 'open' : ''); ?>" id="menu-sales">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sales.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sales.create')); ?>">🛒 Add Sale / POS</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sales.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sales.index')); ?>">🧮 All Sales</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sales.holds') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sales.holds')); ?>">⏸ Parked Sales</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sales.shifts') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sales.shifts')); ?>">🕒 Cashier Shift</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('returns')): ?>
            <div class="menu-group menu-group-returns">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.sale-returns.*','admin.supplier-returns.*') ? 'open' : ''); ?>" data-target="menu-returns">
                    <span>Returns</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.sale-returns.*','admin.supplier-returns.*') ? 'open' : ''); ?>" id="menu-returns">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sale-returns.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sale-returns.create')); ?>">↩️ Customer Return</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.sale-returns.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.sale-returns.index')); ?>">📄 Customer Returns</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.supplier-returns.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.supplier-returns.create')); ?>">↪️ Supplier Return</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.supplier-returns.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.supplier-returns.index')); ?>">📄 Supplier Returns</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('customers')): ?>
            <div class="menu-group menu-group-customers">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.customers.*') ? 'open' : ''); ?>" data-target="menu-customers">
                    <span>Customers</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.customers.*') ? 'open' : ''); ?>" id="menu-customers">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.customers.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.customers.create')); ?>">👤 Add Customer</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.customers.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.customers.index')); ?>">📋 Customer List</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('accounts')): ?>
            <div class="menu-group menu-group-accounts">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.accounts.*') ? 'open' : ''); ?>" data-target="menu-accounts">
                    <span>Accounts</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.accounts.*') ? 'open' : ''); ?>" id="menu-accounts">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.accounts.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.accounts.index')); ?>">💰 Accounts & Finance</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('inventory')): ?>
            <div class="menu-group menu-group-inventory">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.inventory.*') ? 'open' : ''); ?>" data-target="menu-inventory">
                    <span>Inventory</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.inventory.*') ? 'open' : ''); ?>" id="menu-inventory">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.inventory.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.inventory.index')); ?>">📦 Stock Overview</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.inventory.adjustments') ? 'active' : ''); ?>" href="<?php echo e(route('admin.inventory.adjustments')); ?>">🛠 Stock Adjustment</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.inventory.transfers') ? 'active' : ''); ?>" href="<?php echo e(route('admin.inventory.transfers')); ?>">🔁 Stock Transfer</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('reports')): ?>
            <div class="menu-group menu-group-reports">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.reports.*') ? 'open' : ''); ?>" data-target="menu-reports">
                    <span>Reports</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.reports.*') ? 'open' : ''); ?>" id="menu-reports">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.reports.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.reports.index')); ?>">📊 Advanced Reports</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('expenses')): ?>
            <div class="menu-group menu-group-expenses">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.expenses.*') ? 'open' : ''); ?>" data-target="menu-expenses">
                    <span>Expenses</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.expenses.*') ? 'open' : ''); ?>" id="menu-expenses">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.expenses.create') ? 'active' : ''); ?>" href="<?php echo e(route('admin.expenses.create')); ?>">✍️ Add Expense</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.expenses.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.expenses.index')); ?>">🧾 Expense List</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('users')): ?>
            <div class="menu-group menu-group-users">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.users.*') ? 'open' : ''); ?>" data-target="menu-users">
                    <span>Users & Roles</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.users.*') ? 'open' : ''); ?>" id="menu-users">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.users.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.users.index')); ?>">🔐 Manage Users</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('branches')): ?>
            <div class="menu-group menu-group-branches">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.branches.*') ? 'open' : ''); ?>" data-target="menu-branches">
                    <span>Branch / Franchise</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.branches.*') ? 'open' : ''); ?>" id="menu-branches">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.branches.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.branches.index')); ?>">🏢 Branch Setup</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.branches.stocks') ? 'active' : ''); ?>" href="<?php echo e(route('admin.branches.stocks')); ?>">📦 Branch Stock</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.branches.performance') ? 'active' : ''); ?>" href="<?php echo e(route('admin.branches.performance')); ?>">📈 Branch Performance</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('service')): ?>
            <div class="menu-group menu-group-service">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.service.*') ? 'open' : ''); ?>" data-target="menu-service">
                    <span>Service & Warranty</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.service.*') ? 'open' : ''); ?>" id="menu-service">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.service.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.service.index')); ?>">🛠 Service Center</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.service.warranty.check') ? 'active' : ''); ?>" href="<?php echo e(route('admin.service.warranty.check')); ?>">✅ Warranty Check</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('installments')): ?>
            <div class="menu-group menu-group-emi">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.installments.*') ? 'open' : ''); ?>" data-target="menu-emi">
                    <span>EMI</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.installments.*') ? 'open' : ''); ?>" id="menu-emi">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.installments.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.installments.index')); ?>">💳 Installment Plans</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.installments.defaulters') ? 'active' : ''); ?>" href="<?php echo e(route('admin.installments.defaulters')); ?>">⚠️ Defaulters</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('dealers')): ?>
            <div class="menu-group menu-group-dealers">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.dealers.*') ? 'open' : ''); ?>" data-target="menu-dealers">
                    <span>Dealer / Wholesale</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.dealers.*') ? 'open' : ''); ?>" id="menu-dealers">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.dealers.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.dealers.index')); ?>">🤝 Dealer Accounts</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('hr')): ?>
            <div class="menu-group menu-group-hr">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.staff.*') ? 'open' : ''); ?>" data-target="menu-hr">
                    <span>HR & Staff</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.staff.*') ? 'open' : ''); ?>" id="menu-hr">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.staff.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.staff.index')); ?>">👨‍💼 Staff</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.staff.attendance') ? 'active' : ''); ?>" href="<?php echo e(route('admin.staff.attendance')); ?>">🗓 Attendance</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.staff.salary') ? 'active' : ''); ?>" href="<?php echo e(route('admin.staff.salary')); ?>">💵 Salary & KPI</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('security')): ?>
            <div class="menu-group menu-group-security">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.security.*') ? 'open' : ''); ?>" data-target="menu-security">
                    <span>Security</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.security.*') ? 'open' : ''); ?>" id="menu-security">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.security.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.security.index')); ?>">🛡 Security & Audit</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('automation')): ?>
            <div class="menu-group menu-group-automation">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.automation.*') ? 'open' : ''); ?>" data-target="menu-automation">
                    <span>Automation</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.automation.*') ? 'open' : ''); ?>" id="menu-automation">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.automation.index') ? 'active' : ''); ?>" href="<?php echo e(route('admin.automation.index')); ?>">⚙️ Automation Center</a>
                </div>
            </div>
        <?php endif; ?>

        <?php if($can('settings')): ?>
            <div class="menu-group menu-group-settings">
                <button type="button" class="nav-sect menu-toggle <?php echo e(request()->routeIs('admin.settings.*') ? 'open' : ''); ?>" data-target="menu-settings">
                    <span>Settings</span>
                    <span class="menu-caret">▾</span>
                </button>
                <div class="menu-items <?php echo e(request()->routeIs('admin.settings.*') ? 'open' : ''); ?>" id="menu-settings">
                    <a class="nav-item <?php echo e(request()->routeIs('admin.settings.company') ? 'active' : ''); ?>" href="<?php echo e(route('admin.settings.company')); ?>">🏢 Company Profile</a>
                    <a class="nav-item <?php echo e(request()->routeIs('admin.settings.printer') ? 'active' : ''); ?>" href="<?php echo e(route('admin.settings.printer')); ?>">🖨 Print Settings</a>
                </div>
            </div>
        <?php endif; ?>
    </nav>

    <div class="nav-footer">© <?php echo e(date('Y')); ?> SEF Digital</div>
</aside><?php /**PATH /home/emdadtwa/erp.sef.it.com/resources/views/admin/partials/sidebar.blade.php ENDPATH**/ ?>