<?php echo View::make('/../include/header'); ?>

<header>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>

<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/css/select2.min.css" rel="stylesheet" />
<link href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.7/js/select2.min.js"></script>

</header>
<body>

<section id="main-content">
    <section id="container">
        <section class="wrapper">
            <div class="row mt">
                <div class="col-lg-12">
                <h4>Dashboard <i class="fa fa-angle-right"></i> All Orders</h4>
                </div>
            </div>

            <table id="example" class="table table-striped table-bordered" style="width:100%">
        <thead>
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Address</th>
                <th>Phone</th>
                <th>Track</th>
                <th>Status</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
        @foreach($item as $data)
            <tr>
                <td>{{$data->id}}</td>
                <td>{{$data->name}}</td>
                <td>{{$data->address}}</td>
                <td>{{$data->phone}}</td>
                <td>{{$data->tracking}}</td>
                <td>
                @if($data->status =='0')   
                <span class="label label-warning label-mini">Pending</span>
                @elseif($data->status =='1')   
                <span class="label label-primary label-mini">To Delivery</span>
                @elseif($data->status =='2')               
                <span  class="label label-success label-mini">Complete</span>
                @elseif($data->status =='3')                
                <span  class="label label-info label-mini">Return Order</span>
                @elseif($data->status =='4')               
                <span class="label label-danger label-mini">Cansel</span>
                @elseif($data->status =='5')            
                <span  class="label label-danger label-mini">Not Answer</span>                  
                @elseif($data->status =='6')                
                <span  class="label label-danger label-mini">After Delivery</span>
                @endif
                </td>
                <td class="text-center">                            
                    <a class="btn btn-danger btn-xs" data-id="{{$data->id}}"  href=""><i class="fa fa-trash-o "></i></a>
                    <a data-id="{{$data->id}}" class="btn btn-primary btn-xs" href="viwedetails/{{$data->id}}">View</a>
                </td>
                
            </tr>
        @endforeach 
        </tbody>
        <tfoot>
            <tr>
                <th>Id</th>
                <th>Name</th>
                <th>Address</th>
                <th>Phone</th>
                <th>Track</th>
                <th>Status</th>
                <th>Action</th>
            </tr>
        </tfoot>
    </table>

        </section>
    </section> 
</section>
   

 

<footer class="site-footer">
      <div class="text-center">
        <p>
          &copy; Copyrights <strong>Dashio</strong>. All Rights Reserved
        </p>
        <div class="credits">
          <!--
            You are NOT allowed to delete the credit link to TemplateMag with free version.
            You can delete the credit link only if you bought the pro version.
            Buy the pro version with working PHP/AJAX contact form: https://templatemag.com/dashio-bootstrap-admin-template/
            Licensing information: https://templatemag.com/license/
          -->
          Created with Dashio template by <a href="https://templatemag.com/">TemplateMag</a>
        </div>
        <a href="index.html#" class="go-top">
          <i class="fa fa-angle-up"></i>
          </a>
      </div>
    </footer>

<style>
    .site-footer {

    /* position: fixed; */
   left: 0;
   z-index: -1;
   bottom: 0;
   width: 100%;
}
</style>
    <!--footer end-->
  </section>
<script>
$(document).ready(function() {
    $('#example').DataTable();
} );
</script>

<script>
$(document).on('click', '.btn-danger', function (e) {
    e.preventDefault();
    var id = $(this).data('id');
    let ele = this;
    console.log(id);

                swal({
                title: "Are you sure?",
                text: "Are you Sure to Remove Order Item",
                icon: "warning",
                showCancelButton: true,
    confirmButtonColor: '#3085d6',
    cancelButtonColor: '#d33',
    confirmButtonText: 'Yes, delete it!',
                dangerMode: true,
            }).then(function(isConfirm) {
                
                if (isConfirm.value===true) {

                        $.ajax({
                            url: "{{url('/deletecustomer')}}/"+id ,
                            method: "POST",
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                            },
                            cache: false,
                            contentType: false,
                            processData: false,
                            dataType: 'JSON',
                            data:{
                                "id":id
                            },
                            success: function (result, code, ex) {
                                swal("Done!", "It was successfully deleted!", "success");
                                $(ele).closest('tr').hide();
                                // $("#here").load(location.href + " #here");
                            },
                            error: function (jqXHR, textStatus, errorThrown) {
                                swal("Warning", "Unable to Process your request", "error");
                            },
                        });

                } else {
                    swal("Cancelled", "No Customer Removed", "error");
                }
            })
});
</script>


  <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
  <script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
  <script src="{{ asset('dash/lib/bootstrap/js/bootstrap.min.js') }}"></script>
  <script class="include" type="text/javascript" src="{{ asset('dash/lib/jquery.dcjqaccordion.2.7.js') }}"></script>
  <script src="{{ asset('dash/lib/jquery.scrollTo.min.js') }}"></script>
  <script src="{{ asset('dash/lib/jquery.nicescroll.js') }}" type="text/javascript"></script>
  <script src="{{ asset('dash/lib/jquery.sparkline.js') }}"></script>

<!--sweet alert-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/7.29.2/sweetalert2.all.js"></script>

  <!--common script for all pages-->
  <script src="{{ asset('dash/lib/common-scripts.js') }}"></script>
  <script type="text/javascript" src="{{ asset('dash/lib/gritter/js/jquery.gritter.js') }}"></script>
  <script type="{{ asset('dash/text/javascript" src="lib/gritter-conf.js') }}"></script>
  <!--script for this page-->
  <script src="{{ asset('dash/lib/sparkline-chart.js') }}"></script>
  <script src="{{ asset('dash/lib/zabuto_calendar.js') }}"></script>

</body>

</html>
