A platform for community discussion. Free, open, simple.
UX: improves dates on reports export UI (#7971)
Joffrey JAFFEUXd8dfa87f2420
diff --git a/app/assets/javascripts/admin/components/admin-report.js.es6 b/app/assets/javascripts/admin/components/admin-report.js.es6index 402794763d4..37a8f2acc8f 100644--- a/app/assets/javascripts/admin/components/admin-report.js.es6+++ b/app/assets/javascripts/admin/components/admin-report.js.es6@@ -183,6 +183,32 @@ export default Ember.Component.extend({},actions: {+ onChangeEndDate(date) {+ const startDate = moment(this.startDate);+ const newEndDate = moment(date).endOf("day");++ if (newEndDate.isSameOrAfter(startDate)) {+ this.set("endDate", newEndDate.format("YYYY-MM-DD"));+ } else {+ this.set("endDate", startDate.endOf("day").format("YYYY-MM-DD"));+ }++ this.send("refreshReport");+ },++ onChangeStartDate(date) {+ const endDate = moment(this.endDate);+ const newStartDate = moment(date).startOf("day");++ if (newStartDate.isSameOrBefore(endDate)) {+ this.set("startDate", newStartDate.format("YYYY-MM-DD"));+ } else {+ this.set("startDate", endDate.startOf("day").format("YYYY-MM-DD"));+ }++ this.send("refreshReport");+ },+applyFilter(id, value) {let customFilters = this.get("filters.customFilters") || {};diff --git a/app/assets/javascripts/admin/templates/components/admin-report.hbs b/app/assets/javascripts/admin/templates/components/admin-report.hbsindex a23223d2bba..8d9729dc82b 100644--- a/app/assets/javascripts/admin/templates/components/admin-report.hbs+++ b/app/assets/javascripts/admin/templates/components/admin-report.hbs@@ -130,9 +130,7 @@</span><div class="input">- {{date-picker-past- value=startDate- defaultDate=startDate}}+ {{date-input date=startDate onChange=(action "onChangeStartDate")}}</div></div>@@ -142,9 +140,7 @@</span><div class="input">- {{date-picker-past- value=endDate- defaultDate=endDate}}+ {{date-input date=endDate onChange=(action "onChangeEndDate")}}</div></div>{{/if}}diff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 6bd65440826..63323facbc2 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -3155,8 +3155,8 @@ en:view_table: "table"view_graph: "graph"refresh_report: "Refresh Report"- start_date: "Start Date"- end_date: "End Date"+ start_date: "Start Date (UTC)"+ end_date: "End Date (UTC)"groups: "All groups"disabled: "This report is disabled"totals_for_sample: "Totals for sample"