$this->viewData->chart_heading = __('Détails :period', ['period' => $this->viewData->period_map[$this->viewData->period]['periodic']]);
$this->viewData->report_timespan = '';
+
// Which mode are we in?
- if (isset($dates['start_date']) && isset($dates['end_date'])) { // Custom date range
+ if (isset($this->viewData->dates['start_date']) && isset($this->viewData->dates['end_date'])) { // Custom date range
$this->viewData->mode = 'range';
- $this->viewData->start_date = $dates['start_date'];
- $this->viewData->end_date = $dates['end_date'];
+ $this->viewData->start_date = $this->viewData->dates['start_date'];
+ $this->viewData->end_date = $this->viewData->dates['end_date'];
$date_range = "{$this->viewData->start_date},{$this->viewData->end_date}";
// Human-friendly representation of the time span
'parts' => 3, // How many levels of detail to go into (ie. years, months, days, hours, etc)
'join' => true, // Join string with natural language separators for the locale
]);
- } elseif (!empty($dates['start_year']) && !empty($dates['start_month'])) { // Month view
+ } elseif (!empty($this->viewData->dates['start_year']) && !empty($this->viewData->dates['start_month'])) { // Month view
$this->viewData->mode = 'month';
- $month = $dates['start_month'];
- $year = $dates['start_year'];
+ $month = $this->viewData->dates['start_month'];
+ $year = $this->viewData->dates['start_year'];
$last_day_of_month = cal_days_in_month(CAL_GREGORIAN, $month, $year);
$this->viewData->start_date = "{$year}-{$month}-01";
$date_range = "{$this->viewData->start_date},{$year}-{$month}-{$last_day_of_month}";
$this->viewData->end_date = ($month == date('m') && $year == date('Y')) ? date('Y-m-d') : "{$year}-{$month}-{$last_day_of_month}";
$this->viewData->chart_heading .= '<span class="heading-subtitle">' . Carbon::parse($this->viewData->start_date)->isoFormat('MMMM YYYY') . '</span>';
- } elseif (!empty($dates['start_year'])) { // Year view
+ } elseif (!empty($this->viewData->dates['start_year'])) { // Year view
$this->viewData->mode = 'year';
- $year = $dates['start_year'];
+ $year = $this->viewData->dates['start_year'];
$this->viewData->start_date = "{$year}-01-01";
$date_range = "{$this->viewData->start_date},{$year}-12-31"; // Full range of specified year (guarantees a full chart, even if it's early in the current year)
$this->viewData->end_date = $year == date('Y') ? date('Y-m-d') : "{$year}-12-31"; // If it's the current year, don't count future dates
});
@endif
+ let baseURL = '{!! route('stats', compact('fluidbook_id', 'hash') + ['date' => '--range--', 'period_override' => $period]) !!}';
+
let creationDate = moment('{{ $fluidbook->created_at->isoFormat('YYYY-MM-DD') }}');
let now = moment();
"alwaysShowCalendars": true,
}, function (start, end) {
$('[data-daterangepicker] span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
+ window.location = baseURL.replace('--range--', start.format('YYYY-MM-DD') + "," + end.format('YYYY-MM-DD'));
});
{{--============================================================================================================--}}