<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta id="csrfToken" name="csrf-token" content="{{ csrf_token() }}"/>
    <title>پنل مدیریت | {{$title ?? ''}}</title>
    {{--    font vazir--}}
    <link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazir-font@v29.1.0/dist/font-face.css" rel="stylesheet"
          type="text/css"/>
    <!-- Tell the browser to be responsive to screen width -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- Font Awesome -->

    <script src="https://use.fontawesome.com/943f545643.js"></script>
    {{--    <link rel="stylesheet" href="{{asset('adminPanel/plugins/font-awesome/css/font-awesome.min.css')}}">--}}
<!-- Ionicons -->
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">

    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="{{asset('adminPanel/dist/css/adminlte.min.css?ver=6')}}">
    {{--    ck editor--}}
    {{--    <link rel="stylesheet" href="{{asset('adminPanel/dist/css/adminlte.min.css')}}">--}}
<!-- bootstrap wysihtml5 - text editor -->
    <link rel="stylesheet" href="{{asset('adminPanel/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css')}}">

    <!-- Google Font: Source Sans Pro -->
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
    <!-- bootstrap rtl -->
    <link rel="stylesheet" href="{{asset('adminPanel/dist/css/bootstrap-rtl.min.css')}}">
    <!-- template rtl version -->
    {{$linkCss ?? ''}}
    <link rel="stylesheet" href="{{asset('adminPanel/dist/css/custom-style.css?ver=31')}}">
    {{--    <link rel="stylesheet" href="{{asset('adminPanel/dist/css/dropzone.min.css')}}">--}}
    <script src="{{asset('adminPanel/plugins/tefdgfh/ckeditor.js')}}"></script>

    @stack("admin-css")

</head>

<body class="hold-transition sidebar-mini">
<div class="wrapper admin-main-content">

    <!-- Navbar -->
    <nav class="main-header navbar navbar-expand bg-white navbar-light border-bottom">
        <!-- Left navbar links -->
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" data-widget="pushmenu" href="#"><i class="fa fa-bars"></i></a>
            </li>
        </ul>

        <!-- SEARCH FORM -->

        <!-- Right navbar links -->
        <ul class="navbar-nav mr-auto">
            <!-- Messages Dropdown Menu -->

            @if(auth()->user()->hasAnyPermission([\Mehrab\RolePermission\Models\Permission::PERMISSION_EXPERT,\Mehrab\RolePermission\Models\Permission::PERMISSION_ORDER_SERVICE_OPERATOR,\Mehrab\RolePermission\Models\Permission::PERMISSION_TEAM_LEADER]))
                <li class="nav-item dropdown">
                    <a class="nav-link" onclick="statusItemAvailable(event,'{{route('users.status_available')}}')"
                       href="{{route('users.status_available')}}" title="وضعیت حضور">
                    <span
                        class="badge {{auth()->user()->getStatusUser() == "در دسترس هستم" ? 'badge-success' : 'badge-warning'}}  navbar-badge p-2 d-flex align-items-center justify-content-between"
                        id="available_status" style="margin-top: -3px;right:-83px;min-width: 5rem">
                        <span class="" id="available_status_text">{{auth()->user()->getStatusUser()}}</span>
                        <i class="fa fa-refresh mr-2" aria-hidden="true"></i>
                    </span>
                    </a>
                </li>
            @endif
{{--            <li class="nav-item dropdown">--}}
{{--                <a class="nav-link" href="#">--}}
{{--                    <i class="fa fa-comments-o"></i>--}}
{{--                    <span class="badge badge-danger navbar-badge">{{session()->get('getUnreadMessage') ?? 0}}</span>--}}
{{--                </a>--}}
{{--            </li>--}}
            <li class="nav-item dropdown">
                <a class="nav-link" href="{{env("FRONT_URL")}}">
                    <i class="fa fa-home"></i>
                    <span class="badge badge-danger navbar-badge"></span>
                </a>
            </li>
            <!-- Notifications Dropdown Menu -->
        </ul>
    </nav>
    <!-- /.navbar -->

    <!-- Main Sidebar Container -->
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
        <!-- Brand Logo -->
        <a href="index3.html" class="brand-link">
            <span class="brand-text font-weight-light">داشبورد</span>
        </a>

        <!-- Sidebar -->
        <div class="sidebar" style="direction: ltr">
            <div style="direction: rtl">
                <!-- Sidebar user panel (optional) -->
                <div class="user-panel mt-3 pb-3 mb-3 d-flex align-items-center">
                    <div class="image ">
                        @if(auth()->user()->profile_pic_id)
                            <img src="{{auth()->user()->thumb()}}" class=" mr-3" style="width: 65px; height: 65px">
                        @else
                        <i class="fa fa-user-circle text-info fa-4x mr-3"></i>
                        @endif
                    </div>
                    <div class="info">
                        <a href="#" class="d-block">
                            {{auth()->user()->name ?? auth()->user()->mobile}}
                            <span class="small d-block">@lang(auth()->user()->role ?? '')</span>
                            @if(auth()->user()->hasPermissionTo(\Mehrab\RolePermission\Models\Permission::PERMISSION_EXPERT))
                                <span class="small d-block">@lang('موجودی : ' . auth()->user()->amount ?? '')</span>
                            @else
                                <span class="small d-block mt-1">@lang(auth()->user()->getRoleNames()->first())</span>
                            @endif
                        </a>
                    </div>
                </div>

                <!-- Sidebar Menu -->
                <nav class="mt-2">
                    <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu"
                        data-accordion="false">
                        <li class="nav-item has-treeview mr-1">
                            <a href="{{route("admin.dashboard")}}"
                               class="nav-link @if(request()->segment(2) == 'dashboard') active @endif">
                                <i class="fa fa-tachometer" aria-hidden="true"></i>
                                <p>
                                    داشبورد
                                </p>
                            </a>
                        </li>
                        @if(auth()->user()->hasAnyPermission([\Mehrab\RolePermission\Models\Permission::PERMISSION_ORDER_SERVICE_OPERATOR,\Mehrab\RolePermission\Models\Permission::PERMISSION_TEAM_LEADER,\Mehrab\RolePermission\Models\Permission::PERMISSION_EXPERT,\Mehrab\RolePermission\Models\Permission::PERMISSION_ACCESS_ALL_ORDER_SERVICE]))
                            <li class="nav-item has-treeview ">
                                <a href=""
                                   class="nav-link @if(request()->segment(2) == 'order_service') active @endif">
                                    <i class="fa fa-newspaper-o" aria-hidden="true"></i>
                                    <p>
                                        مدیریت سفارشات
                                        <i class="right fa fa-angle-left"></i>
                                    </p>
                                </a>
                                <ul class="nav nav-treeview">
                                    <li class="nav-item">
                                        <a href="{{route('order_service.index')}}" class="nav-link">
                                            <i class="fa fa-circle-o nav-icon"></i>
                                            <p>
                                                لیست سفارشات
                                            </p>
                                        </a>
                                    </li>
                                </ul>
                                <ul class="nav nav-treeview">
                                    <li class="nav-item">
                                        <a href="{{route('cancel_order_service.index')}}" class="nav-link">
                                            <i class="fa fa-circle-o nav-icon"></i>
                                            <p>
                                                سفارشات لغو شده
                                            </p>
                                        </a>
                                    </li>
                                </ul>
                            </li>
                        @endif
@if(auth()->user()->hasAnyPermission([\Mehrab\RolePermission\Models\Permission::PERMISSION_TEAM_LEADER]))
   <li class="nav-item has-treeview ">
       <a href=""
          class="nav-link @if(request()->segment(2) == 'payments') active @endif">
           <i class="fa fa-credit-card" aria-hidden="true"></i>
           <p>
               مدیریت پرداخت ها
               <i class="right fa fa-angle-left"></i>
           </p>
       </a>
       <ul class="nav nav-treeview">

           @can(\Mehrab\RolePermission\Models\Permission::PERMISSION_MANAGE_PAYMENT)
               <li class="nav-item">
                   <a href="{{route('payment.index')}}" class="nav-link">
                       <i class="fa fa-circle-o nav-icon"></i>
                       <p>
                           لیست پرداخت ها
                       </p>
                   </a>
               </li>
               <li class="nav-item">
                   <a href="{{route('payment.info')}}" class="nav-link">
                       <i class="fa fa-circle-o nav-icon"></i>
                       <p>
                           آمار پرداخت ها
                       </p>
                   </a>
               </li>
               <li class="nav-item">
                   <a href="{{route('settlement.index')}}" class="nav-link">
                       <i class="fa fa-circle-o nav-icon"></i>
                       <p>
                           لیست تسویه
                       </p>
                   </a>
               </li>

           @endcan
           @if(auth()->user()->hasAnyPermission([\Mehrab\RolePermission\Models\Permission::PERMISSION_EXPERT,\Mehrab\RolePermission\Models\Permission::PERMISSION_TEAM_LEADER]))
               <li class="nav-item">
                   <a href="{{route('settlement.create')}}" class="nav-link">
                       <i class="fa fa-circle-o nav-icon"></i>
                       <p>
                           درخواست تسویه
                       </p>
                   </a>
               </li>
           @endcan
       </ul>
   </li>
@endif

@foreach(config("AdminSidebar") as $configItem)
       @if(!array_key_exists("permission",$configItem)
        ||  auth()->user()->hasPermissionTo($configItem["permission"])
        || auth()->user()->hasPermissionTo(\Mamad\RolePermissions\Models\Permission::PERMISSION_SUPER_ADMIN)
        )
           @php($active_li_class="")

           @if(str_contains(url()->full(),$configItem["link"]) || url()->full()==$configItem["link"])

                 @php($active_li_class="menu-open")
           @endif
           @if(!empty($configItem["children"]))
                                        @foreach($configItem["children"] as $children)
                                            @if(str_contains(url()->full(),$children["link"]))
                                                @php($active_li_class="menu-open")
                                            @endif
                                        @endforeach
          @endif
           <li class="nav-item has-treeview {{ $active_li_class }} ">
               <a href="{{ $configItem["link"] }}" class="nav-link {{ $active_li_class ? 'active' : '' }}">
                   <i class="fa {{  $configItem["icon"] }}" aria-hidden="true"></i>
                   <p>
                       {{  $configItem["name"] }}
                       <i class="right fa fa-angle-left"></i>
                   </p>
               </a>
               @if(!empty($configItem["children"]))

                   <ul class="nav nav-treeview">
                       @foreach($configItem["children"] as $children)
                           <li class="nav-item ">
                               <a href="{{ $children["link"] }}" class="nav-link @if(url()->full()==$children["link"]) children-active @endif" >
                                   <i class="fa fa-circle-o nav-icon"></i>
                                   <p>{{ $children["name"] }}</p>
                               </a>
                           </li>
                       @endforeach
                   </ul>
               @endif
           </li>
       @endif
   @endforeach

                        <li class="nav-item ">

                            <form  method="post" action="{{route('auth.logout')}}" id="logoutForm">
                                @csrf
                                <button type="submit" style="background: transparent;border: 0;cursor: pointer;    color: #c2c7d0;" class="nav-link " >
                                    <span class="ml-1" ><i class="fa fa-sign-out"></i></span>

                                    خروج از حساب</button>

                            </form>
                        </li>

</ul>
</nav>
<!-- /.sidebar-menu -->
</div>
</div>
<!-- /.sidebar -->
</aside>
<div class="content-wrapper">
@foreach ($errors->all() as $error)
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ $error }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
   <span
       aria-hidden="true">&times;</span>
</button>
</div>
@endforeach
@if(session()->get("custom-error"))
@foreach (session()->get("custom-error") as $error)
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ $error }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
   <span
       aria-hidden="true">&times;</span>
</button>
</div>
@endforeach
@endif

@if (session('success'))
<div class="alert alert-success alert-dismissible fade show"
role="alert">                        {{ session('success') }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
</div>                @endif
<!-- Content Header (Page header) -->
<!-- /.content-header -->

<!-- Main content -->
<section class="content">
{{$main ?? ''}}
</section>
</div>
</div>
{{--modal Btn--}}
{{--@include('partials.modalLaravelStatus')--}}
<!-- jQuery -->
{{--loding section ajax--}}
<div class="loader_ajax d-none"></div>
@includeIf("admin.partials.media_frame")

</body>

<script src="{{asset('adminPanel/plugins/jquery/jquery.min.js')}}"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.14.0/Sortable.min.js" integrity="sha512-zYXldzJsDrNKV+odAwFYiDXV2Cy37cwizT+NkuiPGsa9X1dOz04eHvUWVuxaJ299GvcJT31ug2zO4itXBjFx4w==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="{{asset('adminPanel/dist/js/mamad.js')}}"></script>

<!-- Bootstrap 4 -->
<script src="{{asset('adminPanel/plugins/bootstrap/js/bootstrap.bundle.min.js')}}"></script>
<script src="{{asset('adminPanel/plugins/chartjs-old/Chart.js')}}"></script>
<!-- AdminLTE App -->
<script src="{{asset('adminPanel/dist/js/adminlte.js')}}"></script>
<!-- AdminLTE dashboard demo (This is only for demo purposes) -->
<script src="{{asset('adminPanel/dist/js/sweetalert2.js')}}"></script>
<script src="{{asset('adminPanel/dist/js/styles.js')}}"></script>
<script src="{{asset('adminPanel/dist/js/pages/dashboard.js')}}"></script>
<script src="{{asset('adminPanel/dist/js/dropzone.min.js')}}"></script>
{{$linkScript ?? ''}}
<script src="{{asset('adminPanel/dist/js/ajaxAdmin.js?ver=7')}}"></script>
{{--<script src="{{asset('/js/app.js')}}"></script>--}}
@stack("admin-scripts")
@if(session()->get("toast_message"))
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.css" />
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-toast-plugin/1.3.2/jquery.toast.min.js"></script>
    <script>
        jQuery.toast({
            text : '{{session()->get("toast_message")}}',
            showHideTransition : 'slide',  // It can be plain, fade or slide
            heading: '{{session()->get("toast_heading")}}',
            icon: '{{session()->get("toast_type")}}',
            loader: true,        // Change it to false to disable loader
            loaderBg: "#90e084",
            textAlign: 'right',
            hideAfter : 5000,
        })
    </script>

@endif
<script>
{{ $script ?? '' }}


jQuery(document).ajaxStart(function () {
jQuery('.loader_ajax').toggleClass('d-none')
jQuery("#btnClose").trigger('click');
});
$(document).ajaxComplete(function () {
jQuery('.loader_ajax').toggleClass('d-none')
});

function logout(event) {
event.preventDefault();
document.getElementById('logoutForm').submit();
}
</script>
</html>
