diff --git a/public/js/components/Calendar/Calendar.js b/public/js/components/Calendar/Calendar.js index 0f53d5c04..92b1cf999 100644 --- a/public/js/components/Calendar/Calendar.js +++ b/public/js/components/Calendar/Calendar.js @@ -202,6 +202,28 @@ export default { }, }, methods: { + handleChangeOffset(offset){ + + let date = new Date( + this.focusDate.y, + this.focusDate.m, + this.focusDate.d + ); + + date = date.getFullYear() + "-" + + String(date.getMonth() + 1).padStart(2, "0") + "-" + + String(date.getDate()).padStart(2, "0"); + + + this.$router.push({ + name: "LvPlan", + params: { + mode: this.mode[0].toUpperCase() + this.mode.slice(1), + focus_date: date, + lv_id: this.$route.params.lv_id || null + } + }) + }, setMode(mode) { this.mode = mode }, @@ -253,7 +275,7 @@ export default { template: /*html*/`
+ @input="handleInput" @change:offset="handleChangeOffset"> diff --git a/public/js/components/Cis/LvPlan/LvPlan.js b/public/js/components/Cis/LvPlan/LvPlan.js index a0b93062a..08c022182 100644 --- a/public/js/components/Cis/LvPlan/LvPlan.js +++ b/public/js/components/Cis/LvPlan/LvPlan.js @@ -178,26 +178,6 @@ const LvPlan = { this.currentDay = day; }, - handleOffset: function(offset) { - this.currentDay = new Date( - this.currentDay.getFullYear() + offset.y, - this.currentDay.getMonth() + offset.m, - this.currentDay.getDate() + offset.d - ) - - const date = this.currentDay.getFullYear() + "-" + - String(this.currentDay.getMonth() + 1).padStart(2, "0") + "-" + - String(this.currentDay.getDate()).padStart(2, "0"); - - this.$router.push({ - name: "LvPlan", - params: { - mode: this.calendarMode[0].toUpperCase() + this.calendarMode.slice(1), - focus_date: date, - lv_id: this.propsViewData?.lv_id || null - } - }) - }, handleChangeMode(mode) { let m = mode[0].toUpperCase() + mode.slice(1) if(m === this.calendarMode) return; // TODO(chris): check for date and lv_id too!