Bugfixing

This commit is contained in:
Matej Glasnák committed 2023-02-16 07:52:29 +01:00
1 parent 718432b82a
commit 1ef4bbd437
5 files changed
+28 -16

No files matched your search

@@ -116,8 +116,6 @@ export default {
async deleteTimeblock({ id }) {
const task = JSON.parse(JSON.stringify(this.task))
task.timeblocks = task.timeblocks.filter(timeblock => timeblock.id != id)
console.log(task.timeblocks)
console.log(id)
this._update(task)
},
+11 -8
View File
@@ -69,6 +69,7 @@ import ZAutocomplete from "@/plugins/tm@_components/z-autocomplete.vue"
import ZTaskReadonlyInfo from "./_components/z-task-readonly-info.vue"
import { mapGetters } from "vuex"
import moment from "moment"
export default {
emits: ["close", "refresh"],
@@ -144,12 +145,11 @@ export default {
this.$nextTick(() => this.v$.$reset())
try {
if (task?.id) {
const fetchedTask = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
this.task = this._enrichTask(fetchedTask)
const subtask = await this.$axios.get_auth_data(`v1/subtasks/${task.id}`)
this.task = this._enrichTask(subtask)
} else {
this.task = { master_task: masterTask }
this.task = { master_task: masterTask, timeblocks: [{start: tmUtils.formatDateTimeForBackend(moment()), end: tmUtils.formatDateTimeForBackend(moment())}] }
this.masterTaskIdSelect = masterTask.id
}
@@ -164,17 +164,19 @@ export default {
},
async save() {
if (!(await this.v$.$validate())) return console.log(this.v$)
if (!(await this.v$.$validate()))
return
this.task.description = this.$refs["description"].getHTML()
try {
if (this.task?.id) {
await this.$axios.put_auth_data(`v1/subtasks/${this.task.id}`, this.task)
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${this.task.id}`, this.task)
this.$store.commit('tm/update_subtask', subtask)
} else {
const { subtask } = await this.$axios.post_auth(`v1/mastertasks/${this.task.master_task.id}/subtasks`, this.task)
console.log(subtask)
this.task.id = subtask.id
this.$store.commit('tm/update_subtask', subtask)
}
this.$events.emit("on-task-edited", this.task)
@@ -219,7 +221,7 @@ export default {
_enrichTask(task) {
task.master_task = this.mastertasks.find((masterTask) => masterTask.id == task.master_task_id)
task.employee = this.enrichedEmployees.find((employee) => employee.id == task.employee_id)
this.masterTaskIdSelect = task.master_task.id
this.masterTaskIdSelect = task.master_task?.id
return task
}
@@ -241,6 +243,7 @@ export default {
editMode() {
this.$nextTick(() => {
console.log(this.task.description)
this.$refs["description"]?.setHTML(this.task.description || "")
})
}