1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-05 18:52:44 +01:00

Datatables

This commit is contained in:
David Bomba 2019-08-05 05:59:28 +10:00
parent 9b1075539c
commit 9387072711
3 changed files with 24 additions and 5 deletions

View File

@ -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()) {

View File

@ -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);
}

View File

@ -24,7 +24,7 @@
<div id="top_right_buttons" class="pull-right">
<input id="table_filter" type="text" style="width:180px;background-color: white !important"
class="form-control pull-left" placeholder="Filter" value=""/>
class="form-control pull-left" placeholder="{{ trans('texts.filter')}}" value=""/>
</div>
<div class="animated fadeIn">
@ -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();
}
</script>
@endsection