diff --git a/app/Http/Controllers/ClientPortal/InvoiceController.php b/app/Http/Controllers/ClientPortal/InvoiceController.php index 66bba88820ef..efc68e61cdaa 100644 --- a/app/Http/Controllers/ClientPortal/InvoiceController.php +++ b/app/Http/Controllers/ClientPortal/InvoiceController.php @@ -40,7 +40,7 @@ class InvoiceController extends Controller * @return \Illuminate\Http\Response */ public function index(InvoiceFilters $filters, Builder $builder) - { + {Log::error(request()); $invoices = Invoice::filter($filters); if (request()->ajax()) { diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index 7e62b3452457..fc0ba7af6ddd 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -49,7 +49,7 @@ class QueryLogging $time = $timeEnd - $timeStart; Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time); - if($count > 16) + // if($count > 16) Log::info($queries); } diff --git a/resources/views/portal/default/invoices/index.blade.php b/resources/views/portal/default/invoices/index.blade.php index fdf05e47ddc6..8fb54e7e0385 100644 --- a/resources/views/portal/default/invoices/index.blade.php +++ b/resources/views/portal/default/invoices/index.blade.php @@ -24,7 +24,7 @@
+ class="form-control pull-left" placeholder="{{ trans('texts.filter')}}" value=""/>
@@ -57,9 +57,13 @@ var data; /*status filter variable - comma separated*/ var client_statuses; +var table_filter; + +var data_table; + $(function() { - $('#datatable').DataTable({ + data_table = $('#datatable').DataTable({ processing: true, serverSide: true, searching: false, @@ -76,6 +80,8 @@ $(function() { url: '{!! route('client.invoices.index') !!}', data: function(data) { data.client_status = client_statuses; + // data.filter = table_filter; + data.search.value = table_filter; } }, @@ -104,6 +110,8 @@ $(function() { $(document).ready(function() { + var searchTimeout = false; + $('.pay_invoices').attr("disabled", true); $('.download_invoices').attr("disabled", true); @@ -116,7 +124,12 @@ $(document).ready(function() { }); $('#table_filter').on('keyup', function(){ - alert('filter'); + if (searchTimeout) { + window.clearTimeout(searchTimeout); + } + searchTimeout = setTimeout(function() { + filterTable(); + }, 500); }); $('.select_all').change(function() { @@ -133,6 +146,12 @@ $(document).ready(function() { }); + +function filterTable() { + + table_filter = $('#table_filter').val(); + data_table.ajax.reload(); +} @endsection