<header class="main-nav">

    <div class="sidebar-user text-center">
        <a class="setting-primary" href="javascript:void(0)"><i data-feather="settings"></i></a><img class="img-90 rounded-circle"
            src="
            @if (isset(DB::table('perpus_sekolah')->select('logo_gambar')->where('id',session()->get('idPSekolah'))->first()->logo_gambar))
                {{ asset('upload/logo_gambar') }}/{{ DB::table('perpus_sekolah')->select('logo_gambar')->where('id',session()->get('idPSekolah'))->first()->logo_gambar ?? '' }}
            @else
                {{ asset('assets/images/dashboard/1.png') }}
            @endif
            
        " alt="" />
        
        <a href="{{ url('') }}"> <h6 class="mt-3 f-14 f-w-600">{{ session()->get('username') }}</h6></a>
        <p class="mb-0 font-roboto">
            @if (session()->get('role') == 1)
                Admin
            @elseif (session()->get('role') == 2)
                {{ DB::table('perpus_sekolah')->select('nama')->where('id',session()->get('idPSekolah'))->first()->nama }} <br>
                @php
                    $sekolah = \App\Models\Perpus\SekolahModel::with('periode')->where('id', session()->get('idPSekolah'))->first();
                    echo $sekolah ? $sekolah->periode->nama_periode : '-';
                @endphp 
                <br>
                Admin Sekolah
            @elseif (session()->get('role') == 3)
                {{ DB::table('perpus_sekolah')->select('nama')->where('id',session()->get('idPSekolah'))->first()->nama }} <br>
                Konselor Sekolah
            @endif
        </p>
    </div>
    <nav>
        <div class="main-navbar">
            <div id="mainnav">
                <ul class="nav-menu custom-scrollbar">
                    <li class="back-btn">
                        <div class="mobile-back text-end"><span>Back</span><i class="fa fa-angle-right ps-2" aria-hidden="true"></i></div>
                    </li>

                    @if (session()->get('role') == 1)
                        @includeIf('layouts.admin.partials.sidebar.sidebar_admin')
                    @elseif (session()->get('role') == 2)
                        @includeIf('layouts.admin.partials.sidebar.sidebar_sekolah')
                    @elseif (session()->get('role') == 3)
                        @includeIf('layouts.admin.partials.sidebar.sidebar_konselor')
                    @endif
                    
                </ul>
            </div>
        </div>
    </nav>
</header>