fix(kanban): move task to done bucket when it was marked done from the task detail view
This commit is contained in:
parent
3566b889be
commit
ed5feee33a
@ -130,7 +130,8 @@
|
|||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
v-tooltip="buckets.length <= 1 ? $t('project.kanban.deleteLast') : ''"
|
v-tooltip="buckets.length <= 1 ? $t('project.kanban.deleteLast') : ''"
|
||||||
:class="{'is-disabled': buckets.length <= 1, 'has-text-danger': true}"
|
class="has-text-danger"
|
||||||
|
:class="{'is-disabled': buckets.length <= 1}"
|
||||||
icon-class="has-text-danger"
|
icon-class="has-text-danger"
|
||||||
icon="trash-alt"
|
icon="trash-alt"
|
||||||
@click.stop="() => deleteBucketModal(bucket.id)"
|
@click.stop="() => deleteBucketModal(bucket.id)"
|
||||||
@ -520,9 +521,7 @@ async function updateTaskPosition(e) {
|
|||||||
}))
|
}))
|
||||||
newTask.done = updatedTaskBucket.taskDone
|
newTask.done = updatedTaskBucket.taskDone
|
||||||
if (updatedTaskBucket.bucketId !== newTask.bucketId) {
|
if (updatedTaskBucket.bucketId !== newTask.bucketId) {
|
||||||
kanbanStore.removeTaskInBucket(newTask)
|
kanbanStore.moveTaskToBucket(newTask, updatedTaskBucket.bucketId)
|
||||||
newTask.bucketId = updatedTaskBucket.bucketId
|
|
||||||
kanbanStore.addTaskToBucket(newTask)
|
|
||||||
}
|
}
|
||||||
kanbanStore.setTaskInBucket(newTask)
|
kanbanStore.setTaskInBucket(newTask)
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,12 @@ export const useKanbanStore = defineStore('kanban', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function moveTaskToBucket(task: ITask, bucketId: IBucket['id']) {
|
||||||
|
removeTaskInBucket(task)
|
||||||
|
task.bucketId = bucketId
|
||||||
|
addTaskToBucket(task)
|
||||||
|
}
|
||||||
|
|
||||||
function addTaskToBucket(task: ITask) {
|
function addTaskToBucket(task: ITask) {
|
||||||
const bucketIndex = findIndexById(buckets.value, task.bucketId)
|
const bucketIndex = findIndexById(buckets.value, task.bucketId)
|
||||||
const oldBucket = buckets.value[bucketIndex]
|
const oldBucket = buckets.value[bucketIndex]
|
||||||
@ -330,6 +336,7 @@ export const useKanbanStore = defineStore('kanban', () => {
|
|||||||
setTaskInBucket,
|
setTaskInBucket,
|
||||||
addTaskToBucket,
|
addTaskToBucket,
|
||||||
removeTaskInBucket,
|
removeTaskInBucket,
|
||||||
|
moveTaskToBucket,
|
||||||
loadBucketsForProject,
|
loadBucketsForProject,
|
||||||
loadNextTasksForBucket,
|
loadNextTasksForBucket,
|
||||||
createBucket,
|
createBucket,
|
||||||
|
@ -625,6 +625,7 @@ import {scrollIntoView} from '@/helpers/scrollIntoView'
|
|||||||
import {useAttachmentStore} from '@/stores/attachments'
|
import {useAttachmentStore} from '@/stores/attachments'
|
||||||
import {useTaskStore} from '@/stores/tasks'
|
import {useTaskStore} from '@/stores/tasks'
|
||||||
import {useKanbanStore} from '@/stores/kanban'
|
import {useKanbanStore} from '@/stores/kanban'
|
||||||
|
import {useBaseStore} from '@/stores/base'
|
||||||
|
|
||||||
import {useTitle} from '@/composables/useTitle'
|
import {useTitle} from '@/composables/useTitle'
|
||||||
|
|
||||||
@ -650,6 +651,7 @@ const router = useRouter()
|
|||||||
const {t} = useI18n({useScope: 'global'})
|
const {t} = useI18n({useScope: 'global'})
|
||||||
|
|
||||||
const projectStore = useProjectStore()
|
const projectStore = useProjectStore()
|
||||||
|
const baseStore = useBaseStore()
|
||||||
const attachmentStore = useAttachmentStore()
|
const attachmentStore = useAttachmentStore()
|
||||||
const taskStore = useTaskStore()
|
const taskStore = useTaskStore()
|
||||||
const kanbanStore = useKanbanStore()
|
const kanbanStore = useKanbanStore()
|
||||||
@ -872,7 +874,7 @@ async function deleteTask() {
|
|||||||
router.push({name: 'project.index', params: {projectId: task.value.projectId}})
|
router.push({name: 'project.index', params: {projectId: task.value.projectId}})
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleTaskDone() {
|
async function toggleTaskDone() {
|
||||||
const newTask = {
|
const newTask = {
|
||||||
...task.value,
|
...task.value,
|
||||||
done: !task.value.done,
|
done: !task.value.done,
|
||||||
@ -882,10 +884,18 @@ function toggleTaskDone() {
|
|||||||
playPopSound()
|
playPopSound()
|
||||||
}
|
}
|
||||||
|
|
||||||
saveTask(
|
await saveTask(
|
||||||
newTask,
|
newTask,
|
||||||
toggleTaskDone,
|
toggleTaskDone,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(task.value.done) {
|
||||||
|
baseStore.currentProject?.views.forEach(v => {
|
||||||
|
if (v.doneBucketId !== 0) {
|
||||||
|
kanbanStore.moveTaskToBucket(task.value, v.doneBucketId)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeProject(project: IProject) {
|
async function changeProject(project: IProject) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user