[napajanie modalov na BE]

This commit is contained in:
romankko2 committed 2023-01-26 21:11:53 +01:00
1 parent 26792a85a6
commit 4c8ee66cd6
34 files changed
+494 -396

No files matched your search

@@ -1,18 +1,18 @@
<template>
<v-dialog v-model="show" max-width="650">
<v-dialog v-model="visible" 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"
@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="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-btn class="ml-7 cancel-btn" @click.stop="visible = false">ZRUŠIŤ</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
@@ -22,31 +22,19 @@
export default {
emits: ['close'],
props: {
visible: {
type: Boolean,
required: true
},
task: {
type: Object,
required: true
data() {
return {
visible: false,
task: null
}
},
computed: {
show: {
get() {
return this.visible
},
set(value) {
if (!value) this.$emit('close')
}
},
},
methods: {
async showModal(task) {
this.task = task
this.visible = true
},
async complete() {
try {
const task = {
@@ -55,7 +43,7 @@ export default {
}
await this.$axios.post(`v1/tasks/${task.id}`, task)
this.show = false
this.visible = false
this.$emit('completeTask', task.id)
} catch (error) {
this.$toast.error(error)