Fix initial dates on task edit sidebar
This commit is contained in:
parent
301c23fa9a
commit
6258c59c18
1 changed files with 8 additions and 0 deletions
|
@ -199,6 +199,7 @@
|
||||||
watch: {
|
watch: {
|
||||||
task() {
|
task() {
|
||||||
this.taskEditTask = this.task
|
this.taskEditTask = this.task
|
||||||
|
this.initTaskFields()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -206,13 +207,20 @@
|
||||||
this.taskService = new TaskService()
|
this.taskService = new TaskService()
|
||||||
this.newTask = new TaskModel()
|
this.newTask = new TaskModel()
|
||||||
this.taskEditTask = this.task
|
this.taskEditTask = this.task
|
||||||
|
this.initTaskFields()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initTaskFields() {
|
||||||
|
this.taskEditTask.dueDate = +new Date(this.task.dueDate) === 0 ? null : this.task.dueDate
|
||||||
|
this.taskEditTask.startDate = +new Date(this.task.startDate) === 0 ? null : this.task.startDate
|
||||||
|
this.taskEditTask.endDate = +new Date(this.task.endDate) === 0 ? null : this.task.endDate
|
||||||
|
},
|
||||||
editTaskSubmit() {
|
editTaskSubmit() {
|
||||||
this.taskService.update(this.taskEditTask)
|
this.taskService.update(this.taskEditTask)
|
||||||
.then(r => {
|
.then(r => {
|
||||||
this.$set(this, 'taskEditTask', r)
|
this.$set(this, 'taskEditTask', r)
|
||||||
this.success({message: 'The task was successfully updated.'}, this)
|
this.success({message: 'The task was successfully updated.'}, this)
|
||||||
|
this.initTaskFields()
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
this.error(e, this)
|
this.error(e, this)
|
||||||
|
|
Loading…
Reference in a new issue