diff --git a/modules/zone/back/methods/zone/getEventsFiltered.js b/modules/zone/back/methods/zone/getEventsFiltered.js index 76a9e8fb3..aa3cd8b75 100644 --- a/modules/zone/back/methods/zone/getEventsFiltered.js +++ b/modules/zone/back/methods/zone/getEventsFiltered.js @@ -43,7 +43,7 @@ module.exports = Self => { ) ) ) - ORDER BY type='indefinitely',type='range',type='day';`; + ORDER BY type='indefinitely' DESC, type='range' DESC, type='day' DESC;`; const events = await Self.rawSql(query, [zoneFk, started, ended, started, ended, started, ended]); query = ` diff --git a/modules/zone/front/events/index.html b/modules/zone/front/events/index.html index d48b5f0d8..25ec2827f 100644 --- a/modules/zone/front/events/index.html +++ b/modules/zone/front/events/index.html @@ -1,5 +1,6 @@ diff --git a/modules/zone/front/events/index.js b/modules/zone/front/events/index.js index c9430474f..0df16a42a 100644 --- a/modules/zone/front/events/index.js +++ b/modules/zone/front/events/index.js @@ -22,15 +22,17 @@ class Controller extends Section { refresh() { this.$.data = null; - let params = { - zoneFk: 10, - started: new Date('2021-10-01'), - ended: new Date('2022-02-31') - }; + this.$.$applyAsync(() => { + const params = { + zoneFk: this.$params.id, + started: this.$.calendar.firstDay, + ended: this.$.calendar.lastDay + }; - this.$http.get(`Zones/getEventsFiltered`, {params}).then(res => { - let data = res.data; - this.$.data = data; + this.$http.get(`Zones/getEventsFiltered`, {params}).then(res => { + const data = res.data; + this.$.data = data; + }); }); }