<?php echo $__env->make('dashboard.include.header', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>;

  
  <div class="content-wrapper">
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">All Orders</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="/home">Home</a></li>
              <li class="breadcrumb-item active">All Orders</li>
            </ol>
          </div>
        </div>
      </div>
    </div>
   
    <section class="content">
      <div class="container-fluid">
      <form class="formFilter"  method="post">
          <?php echo e(csrf_field()); ?>

      <div class="card">
        <div class="card-body">
 
          <div class="row">
            <div class="col-md-3">
                <div class="form-group">
                <label>Date Range</label>
                <div class="input-group">
                    <div class="input-group-prepend">
                    <span class="input-group-text">
                        <i class="far fa-calendar-alt"></i>
                    </span>
                    </div>
                    <input type="text" class="form-control float-right" value="" id="reservation" name="daterange">
                </div>
                </div>
            </div>

            <div class="col-md-3">
            <div class="form-group">
                <label>Order Status</label>
                  <select class="select2" multiple="multiple" name="OrderStatus[]" id="OrderStatus" data-placeholder="Order Status" style="width: 100%;">
                        <option value="0">Pending</option>
                        <option value="1">1st Attempt</option>
                        <option value="2">2st Attempt</option>
                        <option value="3">3st Attempt</option>
                        <option value="4">Hold Orders</option>
                        <option value="7" >Return Order</option>
                        <option value="8" >Dispatched Orders</option>
                        <option value="9" >Money Received</option>
                        <option value="10">Cancel</option>
                        <option value="18">Delivered</option>
                        <option value="33">Paid to Reseller</option>
                        <option value="34">Return to Reseller</option>
                        <option value="35">Refund paid</option>
                        <option value="36">Refund Reseller</option>
                        <option value="37">Duplicate Orders</option>
                  </select>
                </div>
            </div>

          <div class="col-md-6">
            <div class="form-group">
                <label>Product Name</label>
                  <select class="select2" multiple="multiple" name="product[]" id="product" data-placeholder="Product Name" style="width: 100%;">
                    <?php $__currentLoopData = $pro; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $prodata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                      <option value="<?php echo e($prodata->id); ?>"><?php echo e($prodata->pro_name); ?></option>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
            </div>
          <div class="col-md-3">
            <div class="form-group">
                  <label>Phone Number</label>
                  <input type="text" placeholder="Phone Number"  value="" id="phone" name="phone" class="form-control">
              </div>
            </div>
            <div class="col-md-3">
            <div class="form-group">
                  <label>Invoice Number</label>
                  <input type="text" placeholder="Invoice Number"  value="" id="invoice" name="invoice" class="form-control">
              </div>
            </div>
          </div>
          

         </div>
      </div>
      </form>




      <div class="card">
        <div class="card-body">
          <div class="row">
            <div class="col-md-12">
                <table id="example12" data-page-length='500' class="table table-bordered" style="width:100%; font-size:13px;">
                    <thead>
                        <tr>
                            <th>#Invoice</th>
                            <th>#Order</th>
                            <th>Name</th>
                            <th>Address</th>
                            <th>Phone</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                </table>
            </div>
          </div>
          </div>
        </div>

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



  <?php echo $__env->make('dashboard.include.footer', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>;


  <script>

    $('#reservation').daterangepicker({
        locale: {
            format: 'YYYY/MM/DD'
        }
    });

  $(document).ready(function() {
        $('#ingredients').multiselect();
    });

     $('.select2').select2()

$('#reservation').change(function(){
    $('#example12').DataTable().ajax.reload();
});

$("#OrderStatus").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#product").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#DeliveryRider").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#PaymentMode").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#OrderSource").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#DeliveryPartner").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#page").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#productname").change(function () {
  $('#example12').DataTable().ajax.reload();
});
$("#returnauth").change(function () {
  $('#example12').DataTable().ajax.reload();
});



$('#invoice').on('input', function() { 
  $('#example12').DataTable().ajax.reload();
 });
 $('#phone').on('input', function() { 
  $('#example12').DataTable().ajax.reload();
 });


     $(document).ready(function() {
       $('#example12').DataTable({
      "responsive": true, "lengthChange": true, "autoWidth": false,"order": [[ 0, "asc" ]],
      "dom": 'Bfrtip',
      "buttons": ["copy", "csv", "excel", "pdf", "print"],
        "ajax": {   "url": '/resellerallorderfilter',
                    "type": 'POST',
                    "data": function ( d ) {
                    return $('.formFilter').serialize();
                    }
        },
        columns: [
            { data: 'id', name: 'id' },
            { data: 'reorderid', name: 'reorderid' },
            { data: 'name', name: 'name' },
            { data: 'address', name: 'address' },
            { data: 'phone', name: 'phone' },
            { data: 'status', 
              render: function(data) { 
                if(data==0) {
                  return '<span class="badge badge-warning">Check Order</span>' 
                }
                else if(data==1){
                  return '<span class="badge badge-info">Pending</span>'
                }
                else if(data==2){
                  return '<span class="badge badge-warning" >1st Attempt</span>'
                }
                else if(data==3){
                  return '<span class="badge badge-warning">2nd Attempt</span>'
                }
                else if(data==4){
                  return '<span class="badge badge-warning">3rd Attempt</span>'
                }
                else if(data==5){
                  return '<span class="badge badge-primary">Processing Order</span>  '
                }
                else if(data==6){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==7){
                  return '<span class="badge badge-danger">Return Order</span>'
                }
                else if(data==8){
                  return '<span class="badge badge-info">Dispatched Order</span>'
                }
                else if(data==9){
                  return '<span class="badge badge-secondary">Money Received</span>'
                }
                else if(data==10){
                  return '<span class="badge badge-danger">Cancel Order</span>'
                }
                else if(data==11){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==12){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==13){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==14){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==15){
                  return ' <span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==16){
                  return '<span class="badge badge-primary">Hold Order</span>'
                }
                else if(data==17){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==18){
                  return '<span class="badge badge-success">Delivered</span>'
                }
                else if(data==19){
                  return '<span class="badge badge-primary">Processing Order</span>'
                }
                else if(data==20){
                  return '<span class="badge badge-primary">Dropex Dispatched</span>'
                }
                else if(data==16){
                  return '<span class="badge badge-primary">Hold</span>'
                }
                else if(data==32){
                  return '<span class="badge badge-dark">Out Of Stock</span>'
                }
                else if(data==28){
                  return '<span class="badge badge-dark">Banned</span>'
                }
                else if(data==37){
                  return '<span class="badge badge-info">Duplicate Order</span>'
                }
                else if(data==30){
                  return '<span class="badge badge-warning">Remind Order</span>'
                }
                else if(data==33){
                  return '<span class="badge badge-success">Paid to Reseller</span>'
                }
                else if(data==34){
                  return '<span class="badge badge-danger">Return to Reseller</span>'
                }
                else if(data==35){
                  return '<span class="badge badge-warning">Refund Order</span>'
                }
                else if(data==36){
                  return '<span class="badge badge-warning">Refund to Reseller</span>'
                }
                },
              defaultContent: '<span class="badge badge-warning">Other</span>'
            },
            { data: 'action', name: 'action', orderable: false, searchable: false}
        ]
    });
});

// setInterval(function(){
//   $('#example12').DataTable().ajax.reload();
// }, 10000);



  </script>

  