mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 17:54:35 -04:00
Datatables
This commit is contained in:
parent
9b1075539c
commit
9387072711
@ -40,7 +40,7 @@ class InvoiceController extends Controller
|
|||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function index(InvoiceFilters $filters, Builder $builder)
|
public function index(InvoiceFilters $filters, Builder $builder)
|
||||||
{
|
{Log::error(request());
|
||||||
$invoices = Invoice::filter($filters);
|
$invoices = Invoice::filter($filters);
|
||||||
|
|
||||||
if (request()->ajax()) {
|
if (request()->ajax()) {
|
||||||
|
@ -49,7 +49,7 @@ class QueryLogging
|
|||||||
$time = $timeEnd - $timeStart;
|
$time = $timeEnd - $timeStart;
|
||||||
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time);
|
||||||
|
|
||||||
if($count > 16)
|
// if($count > 16)
|
||||||
Log::info($queries);
|
Log::info($queries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
<div id="top_right_buttons" class="pull-right">
|
<div id="top_right_buttons" class="pull-right">
|
||||||
|
|
||||||
<input id="table_filter" type="text" style="width:180px;background-color: white !important"
|
<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>
|
||||||
|
|
||||||
<div class="animated fadeIn">
|
<div class="animated fadeIn">
|
||||||
@ -57,9 +57,13 @@ var data;
|
|||||||
/*status filter variable - comma separated*/
|
/*status filter variable - comma separated*/
|
||||||
var client_statuses;
|
var client_statuses;
|
||||||
|
|
||||||
|
var table_filter;
|
||||||
|
|
||||||
|
var data_table;
|
||||||
|
|
||||||
$(function() {
|
$(function() {
|
||||||
|
|
||||||
$('#datatable').DataTable({
|
data_table = $('#datatable').DataTable({
|
||||||
processing: true,
|
processing: true,
|
||||||
serverSide: true,
|
serverSide: true,
|
||||||
searching: false,
|
searching: false,
|
||||||
@ -76,6 +80,8 @@ $(function() {
|
|||||||
url: '{!! route('client.invoices.index') !!}',
|
url: '{!! route('client.invoices.index') !!}',
|
||||||
data: function(data) {
|
data: function(data) {
|
||||||
data.client_status = client_statuses;
|
data.client_status = client_statuses;
|
||||||
|
// data.filter = table_filter;
|
||||||
|
data.search.value = table_filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -104,6 +110,8 @@ $(function() {
|
|||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var searchTimeout = false;
|
||||||
|
|
||||||
$('.pay_invoices').attr("disabled", true);
|
$('.pay_invoices').attr("disabled", true);
|
||||||
$('.download_invoices').attr("disabled", true);
|
$('.download_invoices').attr("disabled", true);
|
||||||
|
|
||||||
@ -116,7 +124,12 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#table_filter').on('keyup', function(){
|
$('#table_filter').on('keyup', function(){
|
||||||
alert('filter');
|
if (searchTimeout) {
|
||||||
|
window.clearTimeout(searchTimeout);
|
||||||
|
}
|
||||||
|
searchTimeout = setTimeout(function() {
|
||||||
|
filterTable();
|
||||||
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.select_all').change(function() {
|
$('.select_all').change(function() {
|
||||||
@ -133,6 +146,12 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function filterTable() {
|
||||||
|
|
||||||
|
table_filter = $('#table_filter').val();
|
||||||
|
data_table.ajax.reload();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user