mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
[Tasks] WIP
This commit is contained in:
1 parent
e34386b179
commit
c69f022423
15 files changed
+335
-307
No files matched your search
@@ -2,7 +2,7 @@
|
||||
<v-dialog v-model="visible" max-width="750">
|
||||
<v-card>
|
||||
<div class="d-flex justify-space-between align-center">
|
||||
<h1>Ste si istý, že chcete {{ this.task?.id ? 'ukončiť' : 'obnoviť' }} task, z masterTasku <b>{{ task.master_task }}</b>?</h1>
|
||||
<h1>Ste si istý, že chcete {{ this.subtask.is_finished ? 'dokončiť' : 'otvoriť' }} task, z masterTasku <b>{{ subtask?.master_task }}</b>?</h1>
|
||||
<v-icon
|
||||
@click.stop="visible = false"
|
||||
icon="mdi-close"
|
||||
@@ -19,27 +19,30 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
emits: ['close', 'task-completed'],
|
||||
emits: ['close', 'on-subtask-edited'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
task: null
|
||||
subtask: null
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
async showModal(task) {
|
||||
this.task = task
|
||||
async showModal({ subtask }) {
|
||||
this.subtask = subtask
|
||||
this.visible = true
|
||||
},
|
||||
|
||||
async complete() {
|
||||
try {
|
||||
const task = {...this.task, is_finished: true}
|
||||
await this.$axios.patch_auth(`v1/subtasks/${this.task.id}`, task)
|
||||
const tempSubtask = {...this.subtask, is_finished: !this.subtask.is_finished}
|
||||
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${tempSubtask.id}`, tempSubtask)
|
||||
|
||||
this.visible = false
|
||||
this.$emit('task-completed', task)
|
||||
|
||||
this.$store.commit('tm/update_subtask', subtask)
|
||||
this.$emit('on-subtask-edited', subtask)
|
||||
} catch (error) {
|
||||
this.$toast.error(error)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user