diff --git a/management/reporting/ui/charting.js b/management/reporting/ui/charting.js index 98618f95..0c1500e4 100644 --- a/management/reporting/ui/charting.js +++ b/management/reporting/ui/charting.js @@ -207,6 +207,15 @@ class DateRange { return DateRange.wtd().map(d => DateFormatter.ymd(d)); } + static lastXdays(n) { + var s = new Date(); + s.setTime(s.getTime() - (n * 24 * 60 * 60 * 1000)); + return [ s, new Date() ]; + } + static lastXdays_as_ymd(n) { + return DateRange.lastXdays(n).map(d => DateFormatter.ymd(d)); + } + static rangeFromType(type) { if (type == 'wtd') return DateRange.wtd(); @@ -214,6 +223,10 @@ class DateRange { return DateRange.mtd(); else if (type == 'ytd') return DateRange.ytd(); + else if (type == 'last30days') + return DateRange.lastXdays(30); + else if (type == 'last7days') + return DateRange.lastXdays(7) return null; } }; diff --git a/management/reporting/ui/date-range-picker.js b/management/reporting/ui/date-range-picker.js index 9fd1f918..b5081979 100644 --- a/management/reporting/ui/date-range-picker.js +++ b/management/reporting/ui/date-range-picker.js @@ -12,7 +12,7 @@ Vue.component('date-range-picker', { data: function() { var range_type = null; var range = null; - var default_range_type = 'mtd'; + var default_range_type = 'last30days'; const recall_id_prefix = 'date-range-picker/'; var v = null; @@ -59,6 +59,8 @@ Vue.component('date-range-picker', { range: range, range_type: range_type, options: [ + { value:'last7days', text:'Last 7 days' }, + { value:'last30days', text:'Last 30 days' }, { value:'wtd', text:'Week-to-date' }, { value:'mtd', text:'Month-to-date' }, { value:'ytd', text:'Year-to-date' }, @@ -151,7 +153,11 @@ Vue.component('date-range-picker', { range_type_change: function(evt) { // ui select callback - if (this.range_type == 'wtd') + if (this.range_type == 'last7days') + this.range = DateRange.lastXdays_as_ymd(7); + else if (this.range_type == 'last30days') + this.range = DateRange.lastXdays_as_ymd(30); + else if (this.range_type == 'wtd') this.range = DateRange.wtd_as_ymd(); else if (this.range_type == 'mtd') this.range = DateRange.mtd_as_ymd(); diff --git a/management/reporting/ui/page-reports-main.html b/management/reporting/ui/page-reports-main.html index f2f16560..a2cbca51 100644 --- a/management/reporting/ui/page-reports-main.html +++ b/management/reporting/ui/page-reports-main.html @@ -11,7 +11,7 @@
- +
diff --git a/management/reporting/ui/panel-user-activity.html b/management/reporting/ui/panel-user-activity.html index ed509234..5aa272da 100644 --- a/management/reporting/ui/panel-user-activity.html +++ b/management/reporting/ui/panel-user-activity.html @@ -61,8 +61,8 @@