Date Filter filter form partial
This commit is contained in:
parent
0a616a0480
commit
f5e773da60
@ -66,6 +66,10 @@ class FormServiceProvider extends ServiceProvider
|
||||
Form::component('recurring', 'partials.form.recurring', [
|
||||
'page', 'model' => null,
|
||||
]);
|
||||
|
||||
Form::component('dateRange', 'partials.form.date_range', [
|
||||
'name', 'text', 'icon', 'attributes' => ['required' => 'required'], 'value' => null, 'col' => 'col-md-6',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@
|
||||
{!! Form::text('search', request('search'), ['class' => 'form-control input-filter input-sm', 'placeholder' => trans('general.search_placeholder')]) !!}
|
||||
{!! Form::select('customer', $customers, request('customer'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::select('status', $status, request('status'), ['class' => 'form-control input-filter input-sm']) !!}
|
||||
{!! Form::dateRange('order_number', trans('invoices.order_number'), 'shopping-cart', []) !!}
|
||||
{!! Form::button('<span class="fa fa-filter"></span> ' . trans('general.filter'), ['type' => 'submit', 'class' => 'btn btn-sm btn-default btn-filter']) !!}
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
|
30
resources/views/partials/form/date_range.blade.php
Normal file
30
resources/views/partials/form/date_range.blade.php
Normal file
@ -0,0 +1,30 @@
|
||||
<div class="input-group">
|
||||
<button type="button" class="btn btn-default pull-right" id="daterange-btn">
|
||||
<span>
|
||||
<i class="fa fa-calendar"></i> Date range picker
|
||||
</span>
|
||||
<i class="fa fa-caret-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$('#daterange-btn').daterangepicker(
|
||||
{
|
||||
ranges : {
|
||||
'Today' : [moment(), moment()],
|
||||
'Yesterday' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days' : [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month' : [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
},
|
||||
startDate: moment().subtract(29, 'days'),
|
||||
endDate : moment()
|
||||
},
|
||||
function (start, end) {
|
||||
$('#daterange-btn span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'))
|
||||
}
|
||||
)
|
||||
})
|
||||
</script>
|
Loading…
x
Reference in New Issue
Block a user