mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
52 lines
1.3 KiB
Vue
52 lines
1.3 KiB
Vue
<template>
|
|
<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.subtask.is_finished ? 'znovu otvoriť' : 'dokončiť' }} task, z masterTasku <b>{{ subtask?.master_task?.name || subtask.master_task }}</b>?</h1>
|
|
<v-icon
|
|
@click.stop="visible = false"
|
|
icon="mdi-close"
|
|
size="large"
|
|
></v-icon>
|
|
</div>
|
|
<v-card-actions class="mt-10 d-flex justify-start align-center">
|
|
<v-btn class="button primary half" variant="flat" @click="complete()">ÁNO</v-btn>
|
|
<v-btn class="button primary half outline" @click.stop="visible = false">ZRUŠIŤ</v-btn>
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
emits: ['close', 'on-subtask-edited'],
|
|
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
subtask: null
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
async showModal({ subtask }) {
|
|
this.subtask = subtask
|
|
this.visible = true
|
|
},
|
|
|
|
async complete() {
|
|
try {
|
|
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.$store.commit('tm/update_subtask', subtask)
|
|
this.$emit('on-subtask-edited', subtask)
|
|
} catch (error) {
|
|
this.$toast.error(error)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script> |