mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 14:32:18 +00:00
update(LvPlan router) manages the route changes in the Calendar component instead of the LvPlan
This commit is contained in:
@@ -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*/`
|
||||
<div ref="container" class="fhc-calendar card h-100" :class="sizeClass">
|
||||
<component :is="'calendar-' + mode" @updateMode="mode = $event" @change:range="$emit('change:range',$event)"
|
||||
@input="handleInput" @change:offset="$emit('change:offset', $event)">
|
||||
@input="handleInput" @change:offset="handleChangeOffset">
|
||||
<template #calendarDownloads>
|
||||
<slot name="calendarDownloads" ></slot>
|
||||
</template>
|
||||
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user