<?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="1">Pending</option>
                        <option value="2" >1st Attempt</option>
                        <option value="3" >2nd Attempt</option>
                        <option value="4" >3rd Attempt</option>
                        <option value="5" >Colombo Confirm</option>
                        <option value="6">Out Confirm </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="12" >Colombo Assign</option>
                        <option value="11">Out Assign</option>
                        <option value="13" >Pick</option>
                        <option value="15" >Packed</option>
                        <option value="16" >Phone Off</option>
                        <option value="17">He will call</option>
                        <option value="18">Delivered</option>
                        <option value="19">Dropex Confirm</option>
                        <option value="20">Dropex Dispatched</option>
                        <option value="26">Hold</option>
                        <option value="27">Reject</option>
                        <option value="28">Banned</option>
                  </select>
                </div>
            </div>
            <div class="col-md-3">
            <div class="form-group">
                  <label>Delivery Partner</label>
                  <select class="select2" multiple="multiple" name="DeliveryPartner[]" id="DeliveryPartner" data-placeholder="Delivery Partner" style="width: 100%;">
                            <?php $__currentLoopData = $del; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            
                            <option value="<?php echo e($data->id); ?>" ><?php echo e($data->deliveryname); ?></option>
                           
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
            </div>
            <div class="col-md-3">
                <div class="form-group">
                <label>Payment Mode</label>
                  <select class="select2" multiple="multiple" name="PaymentMode[]" id="PaymentMode" data-placeholder="Payment Mode" style="width: 100%;">
                    <option value="cash">Cash on delivery</option>
                    <option value="paid">Paid</option>
                  </select>
                </div>
            </div>
          </div>

          <div class="row">

            <div class="col-md-3">
            <div class="form-group">
                <label>Delivery Rider</label>
                  <select class="select2" multiple="multiple" name="DeliveryRider[]" id="DeliveryRider" data-placeholder="DeliveryRider" style="width: 100%;">
                            <?php $__currentLoopData = $delise; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($data->type=="Delivery_Guy"): ?>
                            <option value="<?php echo e($data->id); ?>"><?php echo e($data->name); ?></option>
                            <?php endif; ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                  </select>
                </div>
            </div>

            <div class="col-md-3">
            <div class="form-group">
                <label>Return/Delivered Status</label>
                  <select class="select2" multiple="multiple" name="returnauth[]" id="returnauth" data-placeholder="Return Status" style="width: 100%;">
                      <option value="0" >Not Delivered</option>
                      <option value="21" >Not Delivered</option>
                      <option value="22" >Unauthorized Return</option>
                      <option value="23" >Authorized Return</option>                                     
                  </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='100' class="table table-bordered" style="width:100%; font-size:13px;">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Address</th>
                            <th>Phone</th>
                            <th>Product Name</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();
});
$("#Branch").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({
        "ajax": {   "url": '/allordercustomertable',
                    "type": 'POST',
                    "data": function ( d ) {
                    return $('.formFilter').serialize();
                    }
        },
        columns: [
            { data: 'id', name: 'id' },
            { data: 'name', name: 'name' },
            { data: 'address', name: 'address' },
            { data: 'phone', name: 'phone' },
            // { data: 'branch', name: 'branch' },
            { data: 'productname', name: 'productname' },
            { 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">Colombo Confirm</span>  '
                }
                else if(data==6){
                  return '<span class="badge badge-primary">Out Confirm</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">Out Assigned</span>'
                }
                else if(data==12){
                  return '<span class="badge badge-primary">Colombo Assigned</span>'
                }
                else if(data==13){
                  return '<span class="badge badge-primary">Out Pick</span>'
                }
                else if(data==14){
                  return '<span class="badge badge-primary">Colombo Pick</span>'
                }
                else if(data==15){
                  return ' <span class="badge badge-primary">Packed</span>'
                }
                else if(data==16){
                  return '<span class="badge badge-primary">Phone Off</span>'
                }
                else if(data==17){
                  return '<span class="badge badge-primary">He will call</span>'
                }
                else if(data==18){
                  return '<span class="badge badge-success">Delivered</span>'
                }
                else if(data==19){
                  return '<span class="badge badge-primary">Dropex Confirm</span>'
                }
                else if(data==20){
                  return '<span class="badge badge-primary">Dropex Dispatched</span>'
                }
                else if(data==26){
                  return '<span class="badge badge-primary">Hold</span>'
                }
                else if(data==27){
                  return '<span class="badge badge-dark">Reject</span>'
                }
                else if(data==28){
                  return '<span class="badge badge-dark">Banned</span>'
                }
                else if(data==29){
                  return '<span class="badge badge-info">Incomplete Order</span>'
                }
                else if(data==30){
                  return '<span class="badge badge-warning">Remind Order</span>'
                }
                else if(data==31){
                  return '<span class="badge badge-warning">Out Of Stock</span>'
                }
                else if(data==32){
                  return '<span class="badge badge-warning">Paid to Reseller</span>'
                }
                else if(data==33){
                  return '<span class="badge badge-warning">Return to Reseller</span>'
                }
                else if(data==34){
                  return '<span class="badge badge-warning">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>'
                }
                else if(data==37){
                  return '<span class="badge badge-warning">Duplicate Order</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>

  