duplicate tasks
This commit is contained in:
@@ -31,6 +31,12 @@ export const router = createRouter({
|
||||
props: true,
|
||||
component: () => import('../views/task/EditTask.vue')
|
||||
},
|
||||
{
|
||||
path: '/task/:id/duplicate',
|
||||
name: 'duplicate-task',
|
||||
props: true,
|
||||
component: () => import('../views/task/DuplicateTask.vue')
|
||||
},
|
||||
{
|
||||
path: '/task/:taskId/record',
|
||||
name: 'record-view',
|
||||
|
||||
20
src/views/task/DuplicateTask.vue
Normal file
20
src/views/task/DuplicateTask.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import TaskForm from '@/modules/task/components/TaskForm.vue'
|
||||
import TaskNotFound from '@/modules/task/components/TaskNotFound.vue'
|
||||
import { useTaskStore } from '@/modules/task/stores/useTask.store'
|
||||
import { createUuid } from '@/shared/create-uuid'
|
||||
|
||||
const props = defineProps<{ id: string }>()
|
||||
const taskStore = useTaskStore()
|
||||
|
||||
const newId = createUuid()
|
||||
|
||||
const task = taskStore.getTask(props.id)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="edit-task">
|
||||
<TaskForm v-if="task" :id="newId" :initial-task="task" />
|
||||
<task-not-found v-else />
|
||||
</div>
|
||||
</template>
|
||||
@@ -14,18 +14,24 @@ const task = taskStore.getTask(props.id)
|
||||
|
||||
<template>
|
||||
<div class="edit-task">
|
||||
<div class="columns is-centered" v-if="isMessageDisplayed">
|
||||
<div class="column is-one-third">
|
||||
<section class="message is-info">
|
||||
<div class="message-header">
|
||||
<p>Info</p>
|
||||
<button
|
||||
class="delete"
|
||||
aria-label="delete"
|
||||
@click="isMessageDisplayed = false"
|
||||
></button>
|
||||
</div>
|
||||
<div class="message-body">
|
||||
When editing a task, record will be reset.
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<TaskForm v-if="task" :id="task.id" :initial-task="task" />
|
||||
<task-not-found v-else />
|
||||
<article v-if="isMessageDisplayed" class="message is-info">
|
||||
<div class="message-header">
|
||||
<p>Info</p>
|
||||
<button
|
||||
class="delete"
|
||||
aria-label="delete"
|
||||
@click="isMessageDisplayed = false"
|
||||
></button>
|
||||
</div>
|
||||
<div class="message-body">When editing a task, record will be reset.</div>
|
||||
</article>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -39,6 +39,17 @@ const deleteTask = () => {
|
||||
>
|
||||
<img src="/icons/edit.svg" alt="edit task" />
|
||||
</router-link>
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'duplicate-task',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
}"
|
||||
class="button"
|
||||
>
|
||||
<img src="/icons/copy.svg" alt="duplicate task" />
|
||||
</router-link>
|
||||
<button class="delete-task button is-light is-danger" @click="deleteTask">
|
||||
<img src="/icons/trash.svg" alt="delete task" />
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user