Renamed fields #267

This commit is contained in:
James Cole 2016-06-11 06:36:46 +02:00
parent b80d8cf774
commit 307e6a2337
3 changed files with 16 additions and 14 deletions

View File

@ -94,12 +94,14 @@ class Range
private function datePicker()
{
$current = Carbon::now()->formatLocalized('%B %Y');
$next = Carbon::now()->endOfMonth()->addDay()->formatLocalized('%B %Y');
$prev = Carbon::now()->startOfMonth()->subDay()->formatLocalized('%B %Y');
View::share('currentMonthName', $current);
View::share('previousMonthName', $prev);
View::share('nextMonthName', $next);
View::share('currentPeriodName', $current);
View::share('previousPeriodName', $prev);
View::share('nextPeriodName', $next);
}
}

View File

@ -6,14 +6,14 @@ $(function () {
$('.currency-option').click(currencySelect);
var ranges = {};
// range for the current month:
ranges[dateRangeConfig.currentMonth] = [moment().startOf('month'), moment().endOf('month')];
// range for the current period:
ranges[dateRangeConfig.currentPeriod] = [moment().startOf('month'), moment().endOf('month')];
// range for the previous month:
ranges[dateRangeConfig.previousMonth] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
// range for the previous period:
ranges[dateRangeConfig.previousPeriod] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')];
// range for the next month:
ranges[dateRangeConfig.nextMonth] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')];
// range for the next period:
ranges[dateRangeConfig.nextPeriod] = [moment().add(1, 'month').startOf('month'), moment().add(1, 'month').endOf('month')];
// range for everything:
ranges[dateRangeConfig.everything] = [dateRangeConfig.firstDate, moment()];
@ -48,10 +48,10 @@ $(function () {
label: label,
_token: token
}).done(function () {
console.log('Succesfully sent new date range.');
console.log('Succesfully sent new date range [' + start.format('YYYY-MM-DD') + '-' + end.format('YYYY-MM-DD') + '].');
window.location.reload(true);
}).fail(function () {
console.log('Could not send new date range.');
console.log('Could not send new date range [' + start.format('YYYY-MM-DD') + '-' + end.format('YYYY-MM-DD') + ']');
alert('Could not change date range');
});

View File

@ -172,9 +172,9 @@
linkTitle: "{{ Session.get('start').formatLocalized(monthAndDayFormat) }} - {{ Session.get('end').formatLocalized(monthAndDayFormat) }}",
URL: "{{ route('daterange') }}",
firstDate: moment("{{ Session.get('first').format('Y-m-d') }}"),
currentMonth: "{{ currentMonthName }}",
previousMonth: "{{ previousMonthName }}",
nextMonth: "{{ nextMonthName }}",
currentPeriod: "{{ currentPeriodName }}",
previousPeriod: "{{ previousPeriodName }}",
nextPeriod: "{{ nextPeriodName }}",
everything: '{{ 'everything'|_ }}',
customRangeLabel: '{{ 'customRange'|_ }}',
applyLabel: '{{ 'apply'|_ }}',