Add creating new related tasks
This commit is contained in:
parent
e586c66095
commit
4408115f41
3 changed files with 49 additions and 26 deletions
|
@ -193,6 +193,7 @@
|
||||||
</h3>
|
</h3>
|
||||||
<related-tasks
|
<related-tasks
|
||||||
:task-i-d="taskID"
|
:task-i-d="taskID"
|
||||||
|
:list-id="task.listID"
|
||||||
:initial-related-tasks="task.related_tasks"
|
:initial-related-tasks="task.related_tasks"
|
||||||
:show-no-relations-notice="true"
|
:show-no-relations-notice="true"
|
||||||
ref="relatedTasks"
|
ref="relatedTasks"
|
||||||
|
|
|
@ -128,6 +128,7 @@
|
||||||
<related-tasks
|
<related-tasks
|
||||||
class="is-narrow"
|
class="is-narrow"
|
||||||
:task-i-d="task.id"
|
:task-i-d="task.id"
|
||||||
|
:list-id="task.listID"
|
||||||
:initial-related-tasks="task.related_tasks"
|
:initial-related-tasks="task.related_tasks"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
placeholder="Type search for a new task to add as related..."
|
placeholder="Type search for a new task to add as related..."
|
||||||
label="text"
|
label="text"
|
||||||
track-by="id"
|
track-by="id"
|
||||||
|
:taggable="true"
|
||||||
|
:showNoOptions="false"
|
||||||
|
@tag="createAndRelateTask"
|
||||||
|
tag-placeholder="Add this as new related task"
|
||||||
>
|
>
|
||||||
<template slot="clear" slot-scope="props">
|
<template slot="clear" slot-scope="props">
|
||||||
<div class="multiselect__clear"
|
<div class="multiselect__clear"
|
||||||
|
@ -57,7 +61,9 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<p v-if="showNoRelationsNotice && Object.keys(relatedTasks).length === 0" class="none">No task relations yet.</p>
|
<p v-if="showNoRelationsNotice && Object.keys(relatedTasks).length === 0" class="none">
|
||||||
|
No task relations yet.
|
||||||
|
</p>
|
||||||
|
|
||||||
<!-- Delete modal -->
|
<!-- Delete modal -->
|
||||||
<modal
|
<modal
|
||||||
|
@ -89,7 +95,7 @@
|
||||||
foundTasks: [],
|
foundTasks: [],
|
||||||
relationKinds: relationKinds,
|
relationKinds: relationKinds,
|
||||||
newTaskRelationTask: TaskModel,
|
newTaskRelationTask: TaskModel,
|
||||||
newTaskRelationKind: 'unset',
|
newTaskRelationKind: 'related',
|
||||||
taskRelationService: TaskRelationService,
|
taskRelationService: TaskRelationService,
|
||||||
showDeleteModal: false,
|
showDeleteModal: false,
|
||||||
relationToDelete: {},
|
relationToDelete: {},
|
||||||
|
@ -105,12 +111,17 @@
|
||||||
},
|
},
|
||||||
initialRelatedTasks: {
|
initialRelatedTasks: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => {
|
||||||
|
},
|
||||||
},
|
},
|
||||||
showNoRelationsNotice: {
|
showNoRelationsNotice: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
listId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.taskService = new TaskService()
|
this.taskService = new TaskService()
|
||||||
|
@ -187,7 +198,17 @@
|
||||||
this.showDeleteModal = false
|
this.showDeleteModal = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
createAndRelateTask(text) {
|
||||||
|
const newTask = new TaskModel({text: text, listID: this.listId})
|
||||||
|
this.taskService.create(newTask)
|
||||||
|
.then(r => {
|
||||||
|
this.newTaskRelationTask = r
|
||||||
|
this.addTaskRelation()
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
this.error(e, this)
|
||||||
|
})
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue