@include('layouts.headpg')
@yield('css')

    <body data-sidebar="dark">

        <!-- Begin page -->
        <div id="layout-wrapper">

            <header id="page-topbar">
                <div class="navbar-header">
                    <div class="d-flex">
                        <!-- LOGO -->
                        <div class="navbar-brand-box">

                            <a href="{{ url('/dashboard') }}" class="logo logo-light">
                                <span class="logo-sm">
                                    <img src="{{ asset('theme/images/logo-sm.png') }}" alt="" height="22">
                                </span>
                                <span class="logo-lg">
                                    <img src="{{ asset('theme/images/logo-light.png') }}" alt="" height="44">
                                </span>
                            </a>
                        </div>

                        <button type="button" class="btn btn-sm px-3 font-size-24 header-item waves-effect" id="vertical-menu-btn">
                            <i class="mdi mdi-menu-open"></i>
                        </button>
                        <div class="dropdown d-none d-lg-inline-block">
                            <button type="button" class="btn header-item noti-icon waves-effect" data-bs-toggle="fullscreen">
                                <i class="mdi mdi-fullscreen"></i>
                            </button>
                        </div>
                    </div>

                    <div class="d-flex">
                        <!-- App Search-->

                        <div class="dropdown d-inline-block">
                            {{-- <div class="dropdown pt-3 d-inline-block"> --}}
                                <button type="button" class="btn header-item waves-effect" id="page-header-user-dropdown" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <b style="margin-right: 15px;">
                                {{ Auth::user()->name }}
                                </b>
                                    {{-- @php dd(Auth::user()->roles->first()); @endphp --}}
                                @if (Auth::user()->roles->first()->name == 'mahasiswa')
                                    <img src="{{ is_null(Auth::user()->rBiodata) ?  asset('theme/images/users/user-null.jpg') : (is_null(Auth::user()->rBiodata->noidentitas) ? asset('theme/images/users/user-null')  : 'https://siakadu.unesa.ac.id/photo/fotomhs/'.Auth::user()->rBiodata->noidentitas) }}.jpg" alt="Header Avatar" class="rounded-circle header-profile-user" >
                                @else
                                    <img src="{{ is_null(Auth::user()->rBiodata) ?  asset('theme/images/users/user-null.jpg') : (is_null(Auth::user()->rBiodata->noidentitas) ? asset('theme/images/users/user-null')  : 'https://siakadu.unesa.ac.id/photo/'.Auth::user()->rBiodata->noidentitas) }}.jpg" alt="Header Avatar" class="rounded-circle header-profile-user" >
                                @endif
                            </button>
                            <div class="dropdown-menu dropdown-menu-end">
                                <!-- item-->
                                {{-- <a class="dropdown-item" href="#"><i class="mdi mdi-account-circle font-size-17 align-middle me-1"></i> Profile</a> --}}
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item text-danger" href="{{ route('logout') }}" onclick="event.preventDefault();document.getElementById('logout-form').submit();"><i class="bx bx-power-off font-size-17 align-middle me-1 text-danger"></i> Logout</a>
                                <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                                    @csrf
                                </form>
                            </div>
                        </div>

                    </div>
                </div>
            </header>

            <!-- ========== Left Sidebar Start ========== -->
            @include('layouts.menu')

            <!-- ============================================================== -->
            <!-- Start right Content here -->
            <!-- ============================================================== -->
            <div class="main-content">

                <div class="page-content">
                    <div class="container-fluid">
                        @yield('contents')

                    </div> <!-- container-fluid -->
                </div>
                <!-- End Page-content -->

                <footer class="footer">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-12">
                                © <script>document.write(new Date().getFullYear())</script> SIM PMW<span class="d-none d-sm-inline-block"> - Crafted with <i class="mdi mdi-heart text-danger"></i> by PPTI.</span>
                            </div>
                        </div>
                    </div>
                </footer>

            </div>
            <!-- end main content-->

        </div>
        <!-- END layout-wrapper -->

    @include('layouts.inijs')

    <script>
        document.getElementById('vertical-menu-btn').addEventListener('click', function() {
            var icon = this.querySelector('i');
            icon.classList.toggle('mdi-flip-h');
        });
    </script>

    </body>
</html>
