[Task] Delete fix

This commit is contained in:
Matej Glasnák committed 2023-02-22 16:44:20 +01:00
1 parent 388466db98
commit ef6369714b
35 files changed
+93 -79

No files matched your search

@@ -10,7 +10,7 @@
</v-col>
<v-col cols="7">
<v-sheet class="py-3">
<p class="task-badge px-4 py-2 rounded-pill">
<p class="task-badge px-4 py-2 rounded-pill hover" @click="openMastertask()" :style="{backgroundColor: color}">
{{ name }}
</p>
</v-sheet>
@@ -20,10 +20,29 @@
<script>
export default {
emits: ['close-modal'],
props: {
name: {
type: String,
required: true
},
id: {
type: Number,
required: true
},
color: {
type: String,
required: true
}
},
methods: {
openMastertask() {
this.$emit('close-modal')
this.$events.emit('show-master-task-modal', {masterTask: {id: this.id}, editMode: false})
}
}
}
@@ -117,7 +117,7 @@ export default {
async _update(task) {
try {
const { subtask } = await this.$axios.put_auth(`v1/subtasks/${task.id}`, task)
this.$store.commit('tm/update_subtask', subtask)
this.closeModal()
this.$events.emit('on-subtask-edited', subtask)
} catch (error) {
@@ -1,5 +1,5 @@
<template>
<A-mastertask-name :name="task.master_task.name" />
<A-mastertask-name :name="task.master_task?.name || task.master_task" :id="task.master_task.id" :color="task.master_task.color" @close-modal="$emit('close-modal')" />
<A-mastertask-status :status="task.is_finished" />
<A-task-timeblocks :timeblocks="task.timeblocks" :task="task" />
<A-task-assigned-employee :employee="task.employee" />
@@ -22,6 +22,8 @@ import ATaskDescription from './_components/a-task-description.vue'
import ZFiles from '@/plugins/tm@modal/_components/z-files.vue'
export default {
emits: ['close-modal'],
components: {
ZFiles,
AMastertaskName,
@@ -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.subtask.is_finished ? 'dokončiť' : 'otvoriť' }} task, z masterTasku <b>{{ subtask?.master_task }}</b>?</h1>
<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"
@@ -42,7 +42,7 @@ export default {
async deleteTask() {
try {
await this.$axios.delete(`v1/subtasks/${this.task.id}`)
await this.$axios.delete_auth(`v1/subtasks/${this.task.id}`)
this.$store.commit('tm/delete_subtask', this.task)
this.$emit('on-task-deleted', this.task)
@@ -34,17 +34,18 @@
<div class="d-flex justify-space-between align-center modal-header border-bottom pb-4">
<h1>{{ task.title }}</h1>
<div class="d-flex justify-start">
<img class="icon" :src="require('@/plugins/tm@overview/_img/pencil-icon.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
<img class="icon trash" :src="require('@/plugins/tm@overview/_img/trash-icon.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)" />
<img class="icon" :src="require('@/plugins/app/_img/icons/pencil.svg')" alt="pencil-icon" @click.stop="editMode = !editMode" />
<img class="icon trash" :src="require('@/plugins/app/_img/icons/bin.svg')" alt="trash-icon" @click.stop="openDeleteTaskModal(task)" />
</div>
</div>
<v-card-actions class="d-flex flex-column modal-content">
<div class="w-100">
<Z-task-readonly-info :task="task" />
<Z-task-readonly-info :task="task" @close-modal="closeModal" />
<div class="d-flex justify-start align-center mt-8">
<v-btn class="done-btn" @click.stop="task.is_finished = 1; save()">Dokončené</v-btn>
<v-btn class="done-btn" v-if="!task.is_finished" @click.stop="showCompleteTaskModal()">Dokončiť</v-btn>
<v-btn class="button secondary" v-else @click.stop="showCompleteTaskModal()">Znovu otvoriť</v-btn>
<v-btn class="button secondary" @click="save()">Uložiť zmeny</v-btn>
</div>
</div>
@@ -214,6 +215,10 @@ export default {
this.$events.emit("show-delete-task-modal", { task })
},
showCompleteTaskModal() {
this.$events.emit('show-complete-task-modal', { subtask: this.task })
},
filesUploaded(files) {
this.task.files = files
},