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

  
  <div class="content-wrapper" style="">
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1 class="m-0">Pending 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">Pending Orders<a href="/checkviewpending">!</a></li>
            </ol>
          </div>
        </div>
      </div>
    </div>
   
    <section class="content">
      <div class="container-fluid">

      <div class="card">
        <div class="card-body">
        <form method="post" id="formFilter" class="formFilter">
          <?php echo e(csrf_field()); ?>

          <div class="row">
            <div class="col-md-4">
              <div class="form-group">
                <label>Filter Orders by Page Name</label>
                <select class="form-control" name="page" id="page" style="width: 100%;" required>
                    <option value="" selected="selected" disabled>Select</option>
                    <option value="all" selected>All</option>
                    <?php $__currentLoopData = $page; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pagedata): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(Auth::user()->type=="super_admin"): ?>
                    <option value="<?php echo e($pagedata->id); ?>"><?php echo e($pagedata->pagename); ?></option>
                    <?php else: ?>
                      <?php if(Auth::user()->branch==$pagedata->branch): ?>
                        <option value="<?php echo e($pagedata->id); ?>"><?php echo e($pagedata->pagename); ?></option>
                      <?php endif; ?>
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </select>
            </div>
            </div>
          </div>
          </form>
        </div>
      </div>



      <div class="card">
        <div class="card-body">
          <div class="row">
            <div class="col-md-12">
                <table data-page-length='500' id="example12" class="table table-striped table-hover" style="width:100%; font-size:12px;">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th>Address</th>
                            <th>Phone</th>
                            <th>Products</th>
                            <th>COD</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>
    $('#page').change(function() {
      $('#example12').DataTable().ajax.reload();
    });

$(document).ready(function() {
  var table = $('#example12').DataTable({
        "ajax": {   "url": '/pendinglockajex',
                    "type": 'POST',
                    "data": function ( d ) {
                    return $('.formFilter').serialize();
                    }
        },
        columns: [
            { data: 'name', name: 'name' },
            { data: 'address', name: 'address'},
            { data: 'phone', name: 'phone'},
            { data: 'productname', name: 'productname' },
            { data: 'cod', name: 'cod'},
            { data: 'action', name: 'action', orderable: false, searchable: false}
        ],
        columnDefs: [
                      {
                          "targets": 5, // your case first column
                          "className": "text-center",
                          "width": "4%"
                    },
                    {
                          "targets": 4,
                          "className": "text-center",
                    },
                    {
                          "targets": 3,
                          "className": "text-left",
                          "color": "#00ff00",

                    }
                    ],
    });
} );


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


$(document).on('click', '.resetlockscreen', function (e) {
    e.preventDefault();
    var id = $(this).data('id');
    let ele = this;
    $.ajax({
        url: "<?php echo e(url('/resetlock')); ?>/"+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();
            toastr.success('Lock Order Reset successfully')
            $('#example12').DataTable().ajax.reload();
        },
        error: function (jqXHR, textStatus, errorThrown) {
            swal("Warning", "Unable to Process your request", "error");
        },
    });

});


</script>








