 <!-- Left Panel -->
@php
    use App\Models\SettingAkses;
    $setting_user = SettingAkses::where('id_user', Auth::user()->id)->get();
@endphp

@php
    $setting = array();   
@endphp
@foreach ($setting_user as $akses)
    @php
        $setting[$akses['menu']] = $akses['level'];   
    @endphp
@endforeach
    <aside id="left-panel" class="left-panel">
        <nav class="navbar navbar-expand-sm navbar-default">
            <div id="main-menu" class="main-menu collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="{{ Request::is('home') ? 'active' : '' }}">
                        <a href="{{ route('home') }}"><i class="menu-icon fa fa-laptop"></i>Dashboard </a>
                    </li>
                    @if (($setting['nomor_akun'] ?? 0) == 3 || ($setting['user'] ?? 0) == 3)
                        
                   
                        <li class="menu-item-has-children {{ Request::is('header_coa') || Request::is('auth') ? 'active' : '' }} dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="menu-icon fa fa-cogs"></i>Master</a>
                            <ul class="sub-menu children dropdown-menu">
                                @if (($setting['nomor_akun'] ?? 0) == 3)
                                    <li><i class="fas fa-list-ol"></i><a href="{{ route('header_coa.index') }}">Nomor Akun</a></li>
                                @endif
                                @if (($setting['user'] ?? 0) == 3)
                                    <li><i class="fa fa-user"></i> <a href="{{ route('auth.index') }}">User</a></li>
                                @endif
                                
                                
                            </ul>
                        </li>
                    @endif
                    @if (($setting['setting_user'] ?? 0) == 3)
                        <li class="{{ Request::is('setting_user') ? 'active' : '' }}">
                            <a href="{{ route('setting_user.index') }}"><i class="menu-icon fas fa-user-cog"></i>Setting Akses </a>
                        </li>
                    @endif
                    @if (($setting['pembelian'] ?? 0) == 3)
                        <li class="{{ Request::is('pembelian') ? 'active' : '' }}">
                            <a href="{{ route('pembelian.index') }}"><i class="menu-icon fas fa-shopping-cart"></i>Pembelian </a>
                        </li>
                    @endif
                    @if (($setting['penjualan'] ?? 0) == 3)
                        <li class="{{ Request::is('penjualan') ? 'active' : '' }}">
                            <a href="{{ route('penjualan.index') }}"><i class="menu-icon fas fa-money-bill-wave-alt"></i>Penjualan </a>
                        </li>
                    @endif
                    @if (($setting['penerimaan'] ?? 0) == 3)
                        <li class="{{ Request::is('penerimaan') ? 'active' : '' }}">
                            <a href="{{ route('penerimaan.index') }}"><i class="menu-icon fas fa-tasks"></i>Penerimaan </a>
                        </li>
                    @endif
                    @if (($setting['pengeluaran'] ?? 0) == 3)
                        <li class="{{ Request::is('pengeluaran') ? 'active' : '' }}">
                            <a href="{{ route('pengeluaran.index') }}"><i class="menu-icon fas fa-tasks"></i>Pengeluaran </a>
                        </li>
                    @endif
                    @if (($setting['jurnal_umum'] ?? 0) == 3)
                        <li class="{{ Request::is('jurnal_umum') ? 'active' : '' }}">
                            <a href="{{ route('jurnal_umum.index') }}"><i class="menu-icon fas fa-tasks"></i>Jurnal Umum</a>
                        </li>
                    @endif
                    @if (($setting['neraca_awal'] ?? 0) == 3)
                        <li class="{{ Request::is('neraca_awal') ? 'active' : '' }}">
                            <a href="{{ route('neraca_awal.index') }}"><i class="menu-icon fas fa-balance-scale"></i>Neraca Awal</a>
                        </li>
                    @endif
                    @if (($setting['neraca_saldo'] ?? 0) == 3)
                        <li class="{{ Request::is('neraca_saldo') ? 'active' : '' }}">
                            <a href="{{ route('neraca_saldo.index') }}"><i class="menu-icon fas fa-balance-scale"></i>Neraca Saldo</a>
                        </li>
                    @endif
                    @if (($setting['laba_rugi'] ?? 0) == 3 || ($setting['neraca'] ?? 0) == 3)
                        <li class="menu-item-has-children {{ Request::is('laba_rugi')? 'active' : '' }} dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <i class="menu-icon fas fa-clipboard-list"></i>Laporan</a>
                            <ul class="sub-menu children dropdown-menu">
                                @if (($setting['laba_rugi'] ?? 0) == 3)
                                    <li><i class="fas fa-balance-scale" style="margin-right:10px;"></i><a href="{{ route('laba_rugi.index') }}?month={{ date('Y-m') }}"> Laba Rugi</a></li>
                                @endif
                                @if (($setting['neraca'] ?? 0) == 3)
                                    <li><i class="fas fa-balance-scale" style="margin-right:10px;"></i><a href="{{ route('neraca.index') }}?month={{ date('Y-m') }}"> Neraca</a></li>
                                @endif
                                
                            </ul>
                        </li>
                    @endif
                    <li>
                        <a href="#" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                            <i class="menu-icon fas fa-sign-out-alt"></i> Log Out
                        </a>
                        <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                            @csrf
                        </form>
                    </li>
                    
                </ul>
                
            </div><!-- /.navbar-collapse -->
        </nav>
    </aside>
    <!-- /#left-panel -->