[Complete task modal] Added complete task modal

This commit is contained in:
Matej Glasnák committed 2022-12-13 00:07:20 +01:00
1 parent 1d1f1a1d14
commit a3beddf1e9
5 files changed
+123 -45

No files matched your search

@@ -0,0 +1,65 @@
<template>
<v-dialog v-model="show" max-width="650">
<v-card>
<div class="d-flex justify-space-between align-center">
<h1>Ste si istý, že chcete ukončiť <b>{{ task.title }}</b>?</h1>
<v-icon
@click.stop="show = false"
icon="mdi-close"
size="large"
></v-icon>
</div>
<v-card-actions class="mt-10 d-flex justify-start align-center">
<v-btn class="z-btn" variant="flat" @click="complete()">ÁNO</v-btn>
<v-btn class="ml-7 cancel-btn" @click.stop="show = false">ZRUŠIŤ</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
export default {
emits: ['close'],
props: {
visible: {
type: Boolean,
required: true
},
task: {
type: Object,
required: true
}
},
methods: {
async complete() {
try {
const task = {
...this.task,
is_finished: true
}
await this.$axios.post(`v1/tasks/${task.id}`, task)
this.show = false
} catch (error) {
this.$toast.error(error)
}
}
},
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
}
}
</script>
@@ -39,7 +39,6 @@ export default {
try {
await this.$axios.delete(`v1/tasks/${this.task.id}`)
this.show = false
this.$emit('confirmDelete', this.task.id)
} catch (error) {
this.$toast.error(error)
}