<!DOCTYPE html>

<html
    lang="en"
    class="light-style layout-menu-fixed"
    dir="ltr"
    data-theme="theme-default"
    data-assets-path="../assets/"
    data-template="vertical-menu-template-free">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>

    <title>@yield('title') - {{env('APP_NAME')}} Admin</title>
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <meta name="description" content="" />
    <link rel="icon" type="image/x-icon" href="{{asset('front/assets/img/favicon.png')}}">
    <link rel="preconnect" href="https://fonts.googleapis.com" />
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
    <link href="https://fonts.googleapis.com/css2?family=Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet"/>
    
    @if(request()->routeIs('admin.forumDetail'))
        <link rel="stylesheet" href="{{asset('front/assets/css/fancybox.min.css')}}"/>
        <link rel="stylesheet" href="{{asset('front/assets/css/style.css')}}"/>
        <link rel="stylesheet" href="{{asset('front/assets/css/custom.css')}}"/> 
    @endif
    <link rel="stylesheet" href="{{asset('admin/assets/vendor/fonts/boxicons.css')}}" />
    <link rel="stylesheet" href="{{asset('admin/assets/vendor/css/core.css')}}" class="template-customizer-core-css" />
    <link rel="stylesheet" href="{{asset('admin/assets/vendor/css/theme-default.css')}}" class="template-customizer-theme-css" />
    <link rel="stylesheet" href="{{asset('admin/assets/css/demo.css')}}" />
    <link rel="stylesheet" href="{{asset('admin/assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.css')}}" />
    <script src="{{asset('admin/assets/vendor/js/helpers.js')}}"></script>
    <script src="{{asset('admin/assets/js/config.js')}}"></script>
    <link href="{{asset('admin/libs/toastr/toastr.min.css')}}" rel="stylesheet">
    <link rel="stylesheet" href="{{asset('admin/assets/css/custom.css')}}" />
    {{-- <link rel="stylesheet" href="{{asset('admin/libs/ckeditor/custom.css')}}" /> --}}

    @livewireStyles
    @yield('css')
    <style>
        .listing-img{
            width: 30px;
            height: 30px;
            border-radius: 50%;
        }
    </style>
</head>
<body>
<!-- Layout wrapper -->
<div class="layout-wrapper layout-content-navbar">
    <div class="layout-container">
        <!-- Menu -->
        @include('admin.partials.sidebar')

        <div class="layout-page">
            <!-- Navbar -->

            <nav class="layout-navbar container-xxl navbar navbar-expand-xl navbar-detached align-items-center bg-navbar-theme" id="layout-navbar">

                <div class="navbar-nav-right d-flex align-items-center" id="navbar-collapse">
                    <ul class="navbar-nav flex-row align-items-center ms-auto">
                        
                        @livewire('admin.notifcation-component')
                        
                        <!-- User -->
                        <li class="nav-item navbar-dropdown dropdown-user dropdown">
                            <a class="nav-link dropdown-toggle hide-arrow" href="javascript:void(0);" data-bs-toggle="dropdown">
                                <div class="avatar avatar-online">
                                    <img src="{{asset('admin')}}/assets/img/avatars/1.png" alt class="w-px-40 h-auto rounded-circle" />
                                </div>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li>
                                    <a class="dropdown-item" href="#">
                                        <div class="d-flex">
                                            <div class="flex-shrink-0 me-3">
                                                <div class="avatar avatar-online">
                                                    <img src="{{asset('admin')}}/assets/img/avatars/1.png" alt class="w-px-40 h-auto rounded-circle" />
                                                </div>
                                            </div>
                                            <div class="flex-grow-1">
                                                <span class="fw-semibold d-block">{{auth()->user()->name}}</span>
                                                <small class="text-muted">Admin</small>
                                            </div>
                                        </div>
                                    </a>
                                </li>
                                <li>
                                    <div class="dropdown-divider"></div>
                                </li>
                                <li>
                                    <a class="dropdown-item" href="{{route('admin.changePassword')}}">
                                        <i class="bx bx-lock-alt me-2"></i>
                                        <span class="align-middle">Change Password</span>
                                    </a>
                                </li>
                                <li>
                                    <a class="dropdown-item" href="{{route('admin.setting')}}">
                                        <i class="bx bx-cog me-2"></i>
                                        <span class="align-middle">Settings</span>
                                    </a>
                                </li>
                                <li>
                                    <div class="dropdown-divider"></div>
                                </li>
                                <li>
                                    <a class="dropdown-item" href="{{url('logout')}}">
                                        <i class="bx bx-power-off me-2"></i>
                                        <span class="align-middle">Log Out</span>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <!--/ User -->
                    </ul>
                </div>
            </nav>
            <div class="content-wrapper">
                
                @yield('content')
                <!-- Footer -->
                <footer class="content-footer footer bg-footer-theme">
                    <div class="container-xxl d-flex flex-wrap justify-content-between py-2 flex-md-row flex-column">
                        <div class="mb-2 mb-md-0">

                        </div>

                    </div>
                </footer>
                <!-- / Footer -->

                <div class="content-backdrop fade"></div>
            </div>
        </div>
    </div>
</div>
<!-- Core JS -->
<!-- build:js assets/vendor/js/core.js -->
<script src="{{asset('admin')}}/assets/vendor/libs/jquery/jquery.js"></script>
<script src="{{asset('admin')}}/assets/vendor/libs/popper/popper.js"></script>
<script src="{{asset('admin')}}/assets/vendor/js/bootstrap.js"></script>
<script src="{{asset('admin')}}/assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
<script src="{{asset('admin/libs/toastr/toastr.min.js')}}"></script>
<script src="{{asset('front/assets/js/fancybox.min.js')}}"></script>
<script src="{{asset('admin/libs/ckeditor/ckeditor.js')}}"></script>
<script src="{{asset('admin')}}/assets/vendor/js/menu.js"></script>
<!-- endbuild -->

<!-- Main JS -->
<script src="{{asset('admin')}}/assets/js/main.js"></script>

<!-- Page JS -->
{{-- <script src="{{asset('admin')}}/assets/js/dashboards-analytics.js"></script> --}}
{{-- <script src="{{asset('admin')}}/assets/js/app-chat.js"></script> --}}

<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
@yield('script')
@livewireScripts

@if(Session::has('success'))
    <script type="text/javascript">
        toastr.success('{{ Session::get('success')}}');
    </script>
@endif
@if(Session::has('error'))
    <script type="text/javascript">
        toastr.error('{{ Session::get('error')}}');
    </script>
@endif

@include('push-notification', ['route' => route('admin.fcmToken')])

<script>
    
    $(document).ready(function() {
        $(".numberField").click(function() {
            var $input = $(this);
            var $inputVal = ($input.val() === '') ? 0 : $input.val();
            var count = parseFloat($inputVal);
            if (count < 0 || isNaN(count)) {
                count = 1;
            }
            $input.val(count.toFixed(2));
            return false;
        });
        $(".numberField").focusout(function() {
            var $input = $(this);
            var $inputVal = ($input.val() === '') ? 0 : $input.val();
            var count = parseFloat($inputVal);
            if (count < 0 || isNaN(count)) {
                count = 1;
            }
            $input.val(count.toFixed(2));
            return false;
        });
    });
    function fadeAlert() {
        setTimeout(function() {
            $('#alert').fadeOut('slow');
        }, 5000);
    }

    $(document).ready(function() {
        if ($('#alert').length) {
            fadeAlert();
        }
    });

    $("#close-chat-icon").click(function(){
            $(this).parents(".dropdown-menu").removeClass("show");
            $(this).parents(".dropdown").find("a[data-bs-toggle='dropdown']").removeClass("show");
            $(this).parents(".dropdown").find("a[data-bs-toggle='dropdown']").attr("aria-expanded", "false");
            
        })
</script>
</body>
</html>
