2019-12-20 14:57:41 +03:00
|
|
|
<button type="button" class="btn btn-sm btn-secondary btn-secondary">
|
2019-11-16 10:21:14 +03:00
|
|
|
<span><i class="fa fa-{{ $icon }}"></i> {{ $text }}</span>
|
2018-10-04 16:16:55 +03:00
|
|
|
<i class="fa fa-caret-down"></i>
|
|
|
|
{!! Form::hidden($name, null, []) !!}
|
|
|
|
</button>
|
2018-10-03 21:25:08 +03:00
|
|
|
|
2018-10-04 16:16:55 +03:00
|
|
|
@push('scripts')
|
2019-11-16 10:21:14 +03:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
|
|
|
$('.date-range-btn').daterangepicker(
|
|
|
|
{
|
|
|
|
ranges : {
|
|
|
|
'{{ trans("general.date_range.today") }}' : [moment(), moment()],
|
|
|
|
'{{ trans("general.date_range.yesterday") }}' : [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
|
|
'{{ trans("general.date_range.last_days", ["day" => "7"]) }}' : [moment().subtract(6, 'days'), moment()],
|
|
|
|
'{{ trans("general.date_range.last_days", ["day" => "30"]) }}': [moment().subtract(29, 'days'), moment()],
|
|
|
|
'{{ trans("general.date_range.this_month") }}' : [moment().startOf('month'), moment().endOf('month')],
|
|
|
|
'{{ trans("general.date_range.last_month") }}' : [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
|
|
},
|
|
|
|
startDate: moment().subtract(29, 'days'),
|
|
|
|
endDate : moment()
|
2018-10-03 21:25:08 +03:00
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
function (start, end) {
|
|
|
|
$('input[name={{ $name }}]').val(start.format('YYYY-MM-DD') + '_' + end.format('YYYY-MM-DD'));
|
2018-10-04 16:16:55 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
date_format = convertDateFormat('{{ setting('localisation.date_format') }}', ' ');
|
|
|
|
$('.date-range-btn span').html(start.format(date_format) + ' - ' + end.format(date_format));
|
|
|
|
}
|
|
|
|
);
|
2018-10-04 16:16:55 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
@if(request($name))
|
|
|
|
var setDate = '{{ request($name) }}';
|
|
|
|
var setDates = setDate.split('_');
|
2018-10-04 16:16:55 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
date_format = convertDateFormat('{{ setting('localisation.date_format') }}', ' ');
|
2018-10-04 16:16:55 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
start_date = moment(setDates[0], 'YYYY-MM-DD'); //new Date(setDates[0]);
|
|
|
|
finish_date = moment(setDates[1], 'YYYY-MM-DD'); //new Date(setDates[1]);
|
2018-10-04 16:16:55 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
$('.date-range-btn span').html(start_date.format(date_format) + ' - ' + finish_date.format(date_format));
|
|
|
|
@endif
|
|
|
|
});
|
|
|
|
</script>
|
2018-10-04 16:16:55 +03:00
|
|
|
@endpush
|