<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@yield('title', 'Admin') | Flo.do</title>

    <link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
    <link rel="stylesheet" href="{{ asset('css/app.css') }}">
    <link rel="stylesheet" href="{{ asset('css/simple-datatables.css') }}">
    <link rel="stylesheet" href="{{ asset('css/table-datatable.css') }}">

</head>

<body>
    <div id="app">
        <div id="sidebar">
            <div class="sidebar-wrapper active">
                <div class="sidebar-header position-relative">
                    <div class="d-flex justify-content-between align-items-center">
                        <div class="logo">
                            <img src="{{ asset('img/logo.png') }}" alt="Logo">
                        </div>
                    </div>
                </div>
                <div class="sidebar-menu">
                    <ul class="menu">
                        <li
                            class="sidebar-item {{ request()->is('admin/beranda', 'admin/beranda-pemilik') ? 'active' : '' }}">
                            <a href="{{ route('admin.beranda') }}" class='sidebar-link'>
                                <i class="bi bi-grid-fill"></i>
                                <span>Beranda</span>
                            </a>
                        </li>
                        <li class="sidebar-title">Kelola Pesanan</li>
                        <li class="sidebar-item {{ request()->is('admin/pesanan-buket*') ? 'active' : '' }}">
                            <a href="{{ route('admin.pesanan-buket.index') }}" class='sidebar-link'>
                                <i class="bi bi-flower1"></i>
                                <span>Pesanan Buket</span>
                            </a>
                        </li>
                        <li class="sidebar-item {{ request()->is('admin/pesanan-foto*') ? 'active' : '' }}">
                            <a href="{{ route('admin.pesanan-foto.index') }}" class='sidebar-link'>
                                <i class="bi bi-camera-fill"></i>
                                <span>Pesanan Foto</span>
                            </a>
                        </li>
                        <li class="sidebar-item {{ request()->is('admin/riwayat-pesanan') ? 'active' : '' }}">
                            <a href="{{ route('admin.riwayat') }}" class='sidebar-link'>
                                <i class="bi bi-clock-fill"></i>
                                <span>Riwayat Pesanan</span>
                            </a>
                        </li>
                        <li class="sidebar-title">Kelola Produk</li>
                        <li class="sidebar-item {{ request()->is('admin/produk-buket*') ? 'active' : '' }}">
                            <a href="{{ route('admin.produk-buket.index') }}" class='sidebar-link'>
                                <i class="bi bi-flower1"></i>
                                <span>Produk Buket</span>
                            </a>
                        </li>
                        <li class="sidebar-item {{ request()->is('admin/paket-foto*') ? 'active' : '' }}">
                            <a href="{{ route('admin.paket-foto.index') }}" class='sidebar-link'>
                                <i class="bi bi-camera-fill"></i>
                                <span>Paket Foto</span>
                            </a>
                        </li>
                        @if (Auth::user()->role == 'pemilik')
                            <li class="sidebar-item {{ request()->is('admin/kelola-admin*') ? 'active' : '' }}">
                                <a href="{{ route('admin.kelola-admin.index') }}" class='sidebar-link'>
                                    <i class="bi bi-people-fill"></i>
                                    <span>Kelola Admin</span>
                                </a>
                            </li>
                        @endif
                    </ul>
                </div>
            </div>
        </div>

        <div id="main">
            <header class="mb-3">
                <a href="#" class="burger-btn d-block d-xl-none">
                    <i class="bi bi-justify fs-3"></i>
                </a>
            </header>

            <div class="page-heading">
                <div class="d-flex justify-content-between align-items-center mb-4">

                    <h3 class="mb-0 page-title">@yield('title')</h3>
                    <div class="avatar avatar me-3 dropdown">
                        <a href="#" id="profileDropdown" data-bs-toggle="dropdown" aria-expanded="false"><img
                                src="{{ asset('img/ava.png') }}" alt="" srcset="">
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="profileDropdown"
                            style="min-width: 150px;">
                            <li class="dropdown-header text-center">
                                <h6 class="mb-0 text-dark">{{ Auth::user()->username ?? 'Admin' }}</h6>
                                <small class="text-muted">{{ ucfirst(Auth::user()->role ?? 'Administrator') }}</small>
                            </li>
                            <li>
                                <hr class="dropdown-divider mt-0">
                            </li>

                            <li>
                                <a class="dropdown-item" href="{{ route('admin.profil.index') }}"
                                    style="font-size: 0.9rem;">
                                    Profil Saya
                                </a>
                            </li>

                            <li>
                                <a class="dropdown-item text-danger" href="#"
                                    onclick="event.preventDefault(); document.getElementById('logout-form').submit();"
                                    style="font-size: 0.9rem;">
                                    Keluar
                                </a>

                                <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
                                    @csrf
                                </form>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>

            <div class="page-content">
                @yield('content')
            </div>

            <footer class="footer-full">
                <div class="footer clearfix mb-0 text-muted text-center">
                    <p class="mb-0">&copy; {{ \Carbon\Carbon::now()->year }} Flo.do All Right Reserved</p>
                </div>
            </footer>
        </div>
    </div>
    <script src="{{ asset('js/app.js') }}"></script>
    <script src="{{ asset('js/ex-simple-datatables.js') }}"></script>
    <script src="{{ asset('js/simple-datatables.js') }}"></script>

    {{-- MODAL TOOLTIP --}}
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
            var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) {
                return new bootstrap.Tooltip(tooltipTriggerEl)
            })
        }, false);
    </script>
    @stack('scripts')

</body>

</html>
