duplicate tasks
This commit is contained in:
5
public/icons/copy.svg
Normal file
5
public/icons/copy.svg
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copy" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#4d70cb" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
|
||||||
|
<path d="M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" />
|
||||||
|
<path d="M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" />
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 449 B |
@@ -31,6 +31,12 @@ export const router = createRouter({
|
|||||||
props: true,
|
props: true,
|
||||||
component: () => import('../views/task/EditTask.vue')
|
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',
|
path: '/task/:taskId/record',
|
||||||
name: 'record-view',
|
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,9 +14,9 @@ const task = taskStore.getTask(props.id)
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="edit-task">
|
<div class="edit-task">
|
||||||
<TaskForm v-if="task" :id="task.id" :initial-task="task" />
|
<div class="columns is-centered" v-if="isMessageDisplayed">
|
||||||
<task-not-found v-else />
|
<div class="column is-one-third">
|
||||||
<article v-if="isMessageDisplayed" class="message is-info">
|
<section class="message is-info">
|
||||||
<div class="message-header">
|
<div class="message-header">
|
||||||
<p>Info</p>
|
<p>Info</p>
|
||||||
<button
|
<button
|
||||||
@@ -25,7 +25,13 @@ const task = taskStore.getTask(props.id)
|
|||||||
@click="isMessageDisplayed = false"
|
@click="isMessageDisplayed = false"
|
||||||
></button>
|
></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="message-body">When editing a task, record will be reset.</div>
|
<div class="message-body">
|
||||||
</article>
|
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 />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -39,6 +39,17 @@ const deleteTask = () => {
|
|||||||
>
|
>
|
||||||
<img src="/icons/edit.svg" alt="edit task" />
|
<img src="/icons/edit.svg" alt="edit task" />
|
||||||
</router-link>
|
</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">
|
<button class="delete-task button is-light is-danger" @click="deleteTask">
|
||||||
<img src="/icons/trash.svg" alt="delete task" />
|
<img src="/icons/trash.svg" alt="delete task" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user