fixed store order filder by date

This commit is contained in:
franknstayn
2019-11-13 16:25:28 +08:00
parent db0a359e56
commit 84f84f6288
2 changed files with 6 additions and 5 deletions

View File

@@ -47,7 +47,6 @@
<input type="text" name="max" class="form-control datepicker-reports" id="max" placeholder="Select Date" required autocomplete="off"/> <input type="text" name="max" class="form-control datepicker-reports" id="max" placeholder="Select Date" required autocomplete="off"/>
</div> </div>
</div> </div>
<!-- {{ var_dump($array_store_orders) }} -->
<div class="col-md-12"> <div class="col-md-12">
<table class="table table-bordered table-condensed nowrap" id="tbl_store_orders"> <table class="table table-bordered table-condensed nowrap" id="tbl_store_orders">
<thead> <thead>

View File

@@ -640,10 +640,10 @@
$( document ).ready(function() { $( document ).ready(function() {
$.fn.dataTable.ext.search.push( $.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) { function (settings, data, dataIndex) {
var min = $('#min').datepicker("getDate"); var min = $('#min').datepicker("getDate");
var max = $('#max').datepicker("getDate"); var max = $('#max').datepicker("getDate");
var startDate = new Date(data[4]); var startDate = new Date(data[9]);
if (min == null && max == null) { return true; } if (min == null && max == null) { return true; }
if (min == null && startDate <= max) { return true;} if (min == null && startDate <= max) { return true;}
if(max == null && startDate >= min) {return true;} if(max == null && startDate >= min) {return true;}
@@ -654,6 +654,7 @@
$("#min").datepicker({ onSelect: function () { table.draw(); }, changeMonth: true, changeYear: true }); $("#min").datepicker({ onSelect: function () { table.draw(); }, changeMonth: true, changeYear: true });
$("#max").datepicker({ onSelect: function () { table.draw(); }, changeMonth: true, changeYear: true }); $("#max").datepicker({ onSelect: function () { table.draw(); }, changeMonth: true, changeYear: true });
var table = $('#tbl_store_orders').DataTable({ var table = $('#tbl_store_orders').DataTable({
scrollX: true, scrollX: true,
dom: 'Bfrtip', dom: 'Bfrtip',
@@ -679,7 +680,8 @@
title : function() { title : function() {
return "ORDER REPORTS"; return "ORDER REPORTS";
} }
} }
//, //,
// { // {
// extend: 'pdf', // extend: 'pdf',
@@ -711,7 +713,7 @@
], ],
columnDefs: [ columnDefs: [
{ targets: 9, type: 'date', visible: false }, { targets: 9, type: 'date', visible: false },
{ targets: 19, type: 'date' } { targets: 9, type: 'date' }
], ],
}); });