<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>@yield('title')</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Ionicons -->
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- overlayScrollbars -->
  <link rel="stylesheet" href="{{ asset('css/app.css') }}">
  <link rel="stylesheet" href="{{ asset('css/font-awesome/css/fontawesome.css') }}">
  <!-- Google Font: Source Sans Pro -->




  <!--
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
   -->
  
  @yield('css')

    <script>
        window.APP = <?php echo json_encode([
            'currency_symbol' => config('settings.currency_symbol')
]) ?>
    </script>



<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js" integrity="sha256-+C0A5Ilqmu4QcSPxrlGpaZxJ04VjsRjKu+G82kl5UJk=" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.bootstrap3.min.css" integrity="sha256-ze/OEYGcFbPRmvCnrSeKbRTtjG4vGLHXgOqsyLFTRjg=" crossorigin="anonymous" />


<script>
  $(document).ready(function () {
      $('select').selectize({
          sortField: 'text'
      });
  });
</script>



</head>
  @if(Config::get('app.locale') == "ar")
<body class="hold-transition sidebar-mini" style="overflow-x: hidden; direction: rtl; text-align: right; font-size: 16px;">

@else
<body class="hold-transition sidebar-mini" style="overflow-x: hidden;">

@endif
  <!-- Site wrapper -->
  <div class="wrapper" style="">

    @include('layouts.partials.navbar')
    @include('layouts.partials.sidebar')
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper" style="margin-left: 0;">
      <!-- Content Header (Page header) -->
      <section class="content-header">


<br>
<section class="content-header" style="direction: rtl; text-align: center; margin-top: -30px; margin-bottom: 10px; ">
        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-2"> 
                    
                       <a href="#" style="color: red;" class="nav-link" onclick="document.getElementById('logout-form').submit()">
                        Exit
                        <i class="nav-icon fas fa-sign-out-alt" style="font-size: 26px; color: red;"></i>
                         
                        <form action="{{route('logout')}}" method="POST" id="logout-form">
                            @csrf
                        </form>
                    </a>


            </div>

              <div class="col-sm-1">

                       <a href="{{url('products/expired')}}" style="color: red;" class="nav-link">





<?php 



 $total_gasts = 9;
?>





<?php 

     $total_shakes = $total_shakes = 0;





?>




























<?php 
$products = \App\Models\OrderItem::where('expire_status','not_checked')
->where('expire_date','<>',NULL)
->get('expire_date');

$the_total = 0;

foreach($products as $r)
{

$expire_date = $r->expire_date;
$expire = strtotime($expire_date. ' - 3 months');
$today = strtotime("today midnight");


//$expire = date("d-m-Y",$expire);
//$today = date("d-m-Y".$today);


if($expire < $today){
     $the_total = $the_total + 1;
}


}

?>
  
  @if($the_total > 0 or $total_shakes > 0 or $total_gasts > 0)
   <span style="font-size: 11px;
background: red;
color: white;
border-radius: 50%;
padding: 2px 10px 2px 10px;
font-weight: bolder;
position: absolute;
top: 1px;
right: 25px; ">{{$the_total + $total_shakes + $total_gasts}}</span>
  @endif




                        <i class="nav-icon fas fa-bell" style="font-size: 26px; color: grey;"></i>

                        <form action="{{route('logout')}}" method="POST" id="logout-form">
                            @csrf
                        </form>
                    </a>
              </div>

            <div class="col-sm-7">
             <h1 style="color: #6cb2eb; font-weight: bolder;" onclick="show_cats();">
			 ISN Golbal System
			<br>   لادارة الأعمال والمحلات التجارية
				<br> 01101250732 - 01024808514
			 </h1> 
            <!--  <h1 style="color: #6cb2eb; font-weight: bolder;" onclick="show_cats();"> نظام البرق لادارة المحلات التجارية   </h1> -->
			  
            </div>

            <div class="col-sm-2">
                       <a href="{{url('/')}}" style="color: red;" class="nav-link" >
                                                Main

                        <i class="nav-icon fas fa-home" style="font-size: 26px; columns: red;"></i>
                     
                    </a>

            </div>

            <div class="col-sm-6 text-right">
                          </div><!-- /.col -->
          </div>
        </div><!-- /.container-fluid -->
      </section>

                          @if($the_total > 0)

                       <a href="{{url('products/expired')}}"  class="nav-link">
                           <center>
                              <div class="right badge badge-danger" 
                              style="font-size: 33px;
padding: 13px;
border-radius: 20px;">
                                تنبيه هام   : لديك منتجات   مدتها شارفت على الانتهاء
                               , الرجاء مراجعتها 
                              </div>
                            </center>

                          </a>

                            <br>
                            @endif









      <div class="row" style="">


        <div class="col-md-2">
          
          <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-cogs"></i></span>
<div class="info-box-content">

  @if(Config::get('app.locale') == "ar")

<span class="info-box-text"><a href="{{url('admin/categories')}}" style="font-weight: bolder;">
  الأقسام الرئيسية 
   </a></span>
<span class="info-box-number"><a href="{{url('admin/products')}}">
ادارة المنتجات
</a></span>

  @else
<span class="info-box-text">{{__('Products')}}</span>
<span class="info-box-number"><a href="{{url('admin/products')}}">Management</a></span>
  @endif

</div>

</div>
        </div>




                <div class="col-md-2">
          
          <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-list"></i></span>
<div class="info-box-content">

  @if(Config::get('app.locale') == "ar")

<span class="info-box-number"><a href="{{url('admin/banks')}}"> ادارة العمليات</a></span>

  @else 

<span class="info-box-text">{{__('Categories')}}</span>
<span class="info-box-number"><a href="{{url('admin/categories')}}">Management</a></span>



  @endif


</div>

</div>
        </div>



                <div class="col-md-2">
          
          <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-users"></i></span>
<div class="info-box-content">


  @if(Config::get('app.locale') == "ar")
<span class="info-box-text">
<a href="{{url('admin/orders_by_customers')}}" style="font-weight: bolder;">  طلبات الدليفري </a></span>
<span class="info-box-number"><a href="{{url('admin/customers')}}">ادارة العملاء</a></span>

  @else
<span class="info-box-text">
<a href="{{url('admin/orders_by_customers')}}" style="font-weight: bolder;">{{__('Customers')}}</a></span>
<span class="info-box-number"><a href="{{url('admin/customers')}}">Management</a></span>

  @endif



</div>

</div>
        </div>











                <div class="col-md-2">
          
          <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-users"></i></span>
<div class="info-box-content">


  @if(Config::get('app.locale') == "ar")

<span class="info-box-number"><a href="{{url('admin/orders_purchases')}}">المشتريات</a></span>
<span class="info-box-text">
<a href="{{url('admin/customers/purchases')}}" style="font-weight: bolder;">ادارة الموردين </a></span>

  @else
<span class="info-box-text">
<a href="{{url('admin/customers/orders_purchases')}}" style="font-weight: bolder;">{{__('Providers')}}</a></span>
<span class="info-box-number"><a href="{{url('admin/customers')}}">Management</a></span>

  @endif



</div>

</div>
        </div>














                <div class="col-md-2">
          
          <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-shopping-cart"></i></span>


@if(Config::get('app.locale') == "ar")
<div class="info-box-content">
<span class="info-box-text"><a href="{{url('admin/orders')}}" style="font-weight: bolder;">المبيعات والفواتير  </a></span>
<span class="info-box-text"><a href="{{url('admin/shifts/shifts')}}" style="font-weight: bolder;">  تقرير الورديات   </a></span>

<!--
<span class="info-box-number"><a href="{{url('admin/report_on_user')}}"> تقرير الموظفين  </a></span>
-->

</div>

@else
<div class="info-box-content">
<span class="info-box-text">{{__('Orders')}}</span>
<span class="info-box-number"><a href="{{url('admin/orders')}}">Management</a></span>
</div>

@endif



</div>

        
        </div>



                <div class="col-md-2">
          


          @if(Config::get('app.locale') == "ar")
 <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-money-check-alt"></i></span>
<div class="info-box-content">




<?php 
$last_shift = \App\shifts::orderby('id','desc')->first();
$shifts = \App\shifts::count();
?>

@if($shifts == 0)
	        <form action="{{ url('/admin/shift/begin') }}" method="POST">
            @method('POST')
            @csrf
            <button onclick="
			<?php
			if(NOW() < "2024-11-26 22:11:14") {
			?>
			alert('اضبط الزمن والتاريخ اولا واقفل وافتح النظام');
			return false;
			break;
			<?php } ?>
			return confirm(' بداية الوردية ؟ ');
			
			" style="border: 0px; color:black; cursor:pointer; background:none">
                <i class="fas fa-plus"></i>  بداية وردية   
            </button>
        </form>
@endif


@if($last_shift)
    @if($last_shift->shift_end == null) <!-- This means the shift is open -->
        <!-- If shift is open, show Close Shift button -->

<span class="info-box-number"><a href="{{url('admin/pos')}}"> نافذة البيع </a></span>

    @else
		
	        <form action="{{ url('/admin/shift/begin') }}" method="POST">
            @method('POST')
            @csrf
            <button onclick="return confirm(' بداية الوردية ؟ ');" style="border: 0px; color:black; cursor:pointer; background:none">
                <i class="fas fa-plus"></i>  بداية وردية   
            </button>
        </form>
		
        <!-- If shift is closed, show Begin Shift button -->
    @endif
@endif






<span class="info-box-number"><a href="{{url('admin/expenses')}}"> المنصرفات </a></span>
</div>

</div>
          @else

 <div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-money-check-alt"></i></span>
<div class="info-box-content">
<span class="info-box-number"><a href="{{url('admin/pos')}}"> {{__('Sales')}} </a></span>
<span class="info-box-number"><a href="{{url('admin/expenses')}}">{{__('Expenses')}}</a></span>
</div>

</div>

      @endif
        
        </div>

  <div class="col-md-2" style="display: none;">
    
              @if(Config::get('app.locale') == "ar")

<div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-users"></i></span>
<div class="info-box-content">
<span class="info-box-text">مبيعات الموظفين</span>
<span class="info-box-number"><a href="{{url('admin/report_on_user')}}">تقرير الموظفين</a></span>
</div>

</div>
              @else      
<div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-users"></i></span>
<div class="info-box-content">
<span class="info-box-text">Users Reports</span>
<span class="info-box-number"><a href="{{url('admin/report_on_user')}}">Management</a></span>
</div>

</div>

        @endif

        
        </div>







  <div class="col-md-2" style="display: none;">
    
              @if(Config::get('app.locale') == "ar")

<div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-users"></i></span>
<div class="info-box-content">
<span class="info-box-text"> بنكك والكاش  </span>
<span class="info-box-number"><a href="{{url('admin/report_on_user')}}"> الرصيد  </a></span>
</div>

</div>
              @else      
<div class="info-box mb-3 bg-warning">
<span class="info-box-icon"><i class="fas fa-users"></i></span>
<div class="info-box-content">
<span class="info-box-text">Banks & Cash </span>
<span class="info-box-number"><a href="{{url('admin/report_on_user')}}">Balance</a></span>
</div>

</div>

        @endif

        
        </div>





      </div>




        <div class="container-fluid">
          <div class="row mb-2">
            <div class="col-sm-6">
              <h1>@yield('content-header')</h1>
            </div>
            <div class="col-sm-6 text-right">
              @yield('content-actions')
            </div><!-- /.col -->
          </div>
        </div><!-- /.container-fluid -->
      </section>

      <!-- Main content -->
      <section class="content">
        @include('layouts.partials.alert.success')
        @include('layouts.partials.alert.error')
        @yield('content')
      </section>

    </div>
    <!-- /.content-wrapper -->

    @include('layouts.partials.footer')

    <!-- Control Sidebar -->
    <aside class="control-sidebar control-sidebar-dark">
      <!-- Control sidebar content goes here -->
    </aside>
    <!-- /.control-sidebar -->
  </div>
  <!-- ./wrapper -->

  <script src="{{ asset('js/app.js') }}"></script>


<script>
  $(function () {
    /* ChartJS
     * -------
     * Here we will create a few charts using ChartJS
     */

    //--------------
    //- AREA CHART -
    //--------------

    // Get context with jQuery - using jQuery's .get() method.
    var areaChartCanvas = $('#areaChart').get(0).getContext('2d')

    var areaChartData = {
      labels  : ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
      datasets: [
        {
          label               : 'Digital Goods',
          backgroundColor     : 'rgba(60,141,188,0.9)',
          borderColor         : 'rgba(60,141,188,0.8)',
          pointRadius          : false,
          pointColor          : '#3b8bba',
          pointStrokeColor    : 'rgba(60,141,188,1)',
          pointHighlightFill  : '#fff',
          pointHighlightStroke: 'rgba(60,141,188,1)',
          data                : [28, 48, 40, 19, 86, 27, 90]
        },
        {
          label               : 'Electronics',
          backgroundColor     : 'rgba(210, 214, 222, 1)',
          borderColor         : 'rgba(210, 214, 222, 1)',
          pointRadius         : false,
          pointColor          : 'rgba(210, 214, 222, 1)',
          pointStrokeColor    : '#c1c7d1',
          pointHighlightFill  : '#fff',
          pointHighlightStroke: 'rgba(220,220,220,1)',
          data                : [65, 59, 80, 81, 56, 55, 40]
        },
      ]
    }

    var areaChartOptions = {
      maintainAspectRatio : false,
      responsive : true,
      legend: {
        display: false
      },
      scales: {
        xAxes: [{
          gridLines : {
            display : false,
          }
        }],
        yAxes: [{
          gridLines : {
            display : false,
          }
        }]
      }
    }

    // This will get the first returned node in the jQuery collection.
    new Chart(areaChartCanvas, {
      type: 'line',
      data: areaChartData,
      options: areaChartOptions
    })

    //-------------
    //- LINE CHART -
    //--------------
    var lineChartCanvas = $('#lineChart').get(0).getContext('2d')
    var lineChartOptions = $.extend(true, {}, areaChartOptions)
    var lineChartData = $.extend(true, {}, areaChartData)
    lineChartData.datasets[0].fill = false;
    lineChartData.datasets[1].fill = false;
    lineChartOptions.datasetFill = false

    var lineChart = new Chart(lineChartCanvas, {
      type: 'line',
      data: lineChartData,
      options: lineChartOptions
    })

    //-------------
    //- DONUT CHART -
    //-------------
    // Get context with jQuery - using jQuery's .get() method.
    var donutChartCanvas = $('#donutChart').get(0).getContext('2d')
    var donutData        = {
      labels: [
          'Chrome',
          'IE',
          'FireFox',
          'Safari',
          'Opera',
          'Navigator',
      ],
      datasets: [
        {
          data: [700,500,400,600,300,100],
          backgroundColor : ['#f56954', '#00a65a', '#f39c12', '#00c0ef', '#3c8dbc', '#d2d6de'],
        }
      ]
    }
    var donutOptions     = {
      maintainAspectRatio : false,
      responsive : true,
    }
    //Create pie or douhnut chart
    // You can switch between pie and douhnut using the method below.
    new Chart(donutChartCanvas, {
      type: 'doughnut',
      data: donutData,
      options: donutOptions
    })

    //-------------
    //- PIE CHART -
    //-------------
    // Get context with jQuery - using jQuery's .get() method.
    var pieChartCanvas = $('#pieChart').get(0).getContext('2d')
    var pieData        = donutData;
    var pieOptions     = {
      maintainAspectRatio : false,
      responsive : true,
    }
    //Create pie or douhnut chart
    // You can switch between pie and douhnut using the method below.
    new Chart(pieChartCanvas, {
      type: 'pie',
      data: pieData,
      options: pieOptions
    })

    //-------------
    //- BAR CHART -
    //-------------
    var barChartCanvas = $('#barChart').get(0).getContext('2d')
    var barChartData = $.extend(true, {}, areaChartData)
    var temp0 = areaChartData.datasets[0]
    var temp1 = areaChartData.datasets[1]
    barChartData.datasets[0] = temp1
    barChartData.datasets[1] = temp0

    var barChartOptions = {
      responsive              : true,
      maintainAspectRatio     : false,
      datasetFill             : false
    }

    new Chart(barChartCanvas, {
      type: 'bar',
      data: barChartData,
      options: barChartOptions
    })

    //---------------------
    //- STACKED BAR CHART -
    //---------------------
    var stackedBarChartCanvas = $('#stackedBarChart').get(0).getContext('2d')
    var stackedBarChartData = $.extend(true, {}, barChartData)

    var stackedBarChartOptions = {
      responsive              : true,
      maintainAspectRatio     : false,
      scales: {
        xAxes: [{
          stacked: true,
        }],
        yAxes: [{
          stacked: true
        }]
      }
    }

    new Chart(stackedBarChartCanvas, {
      type: 'bar',
      data: stackedBarChartData,
      options: stackedBarChartOptions
    })
  })
</script>



<script src="{{URL::to('/')}}/plugins/chart.js/Chart.min.js"></script>

<script src="{{URL::to('/')}}/dist/js/adminlte.min.js?v=3.2.0"></script>

<script src="{{URL::to('/')}}/dist/js/demo.js"></script>

  @yield('js')
</body>

</html>
