diff --git a/web/components/ui/Sidebar.vue b/web/components/ui/Sidebar.vue index 7e9e3dd..dbfc5dd 100644 --- a/web/components/ui/Sidebar.vue +++ b/web/components/ui/Sidebar.vue @@ -17,6 +17,7 @@ const showTaskEditModal = ref(false); const taskFormModalInput = ref>({}); const showDeleteModal = ref(false); const deleteContext = ref(); +const editContext = ref(); const date = defineModel('date', { required: true }) const tasks = defineModel('tasks', { required: true }) @@ -115,6 +116,7 @@ function deleteTask() { } function editTask(task: Task) { + editContext.value?.updateWithOtherTask(task) emits('editTask', task) } @@ -124,6 +126,7 @@ function openTaskFormModal(task: Partial) { } function openTaskEditModal(task: Task) { + editContext.value = task taskFormModalInput.value = task showTaskEditModal.value = true } @@ -215,5 +218,7 @@ function scheduleTask(task: Task) { - + + + diff --git a/web/components/ui/calendar/Calendar.vue b/web/components/ui/calendar/Calendar.vue index b2180c4..30f52be 100644 --- a/web/components/ui/calendar/Calendar.vue +++ b/web/components/ui/calendar/Calendar.vue @@ -18,6 +18,7 @@ const createModalOpened = ref(false) const editModalOpened = ref(false) const deleteModalOpened = ref(false) const editTaskModalOpened = ref(false) +const editTaskContext = ref() const taskFormModalInput = ref>({}) const deleteContext = ref<{ event: Event }>() @@ -143,6 +144,7 @@ function create(simple: SimpleEvent) { function openEditModal(event: Event) { if (event.task !== undefined) { taskFormModalInput.value = event.task + editTaskContext.value = event.task editTaskModalOpened.value = true } else { editInput.value = event.toSimple() @@ -159,6 +161,7 @@ function edit(simple: SimpleEvent) { function editTask(task: Task) { editTaskModalOpened.value = false + editTaskContext.value?.updateWithOtherTask(task) emits('edit-task', task) } diff --git a/web/utils/task.ts b/web/utils/task.ts index d56e097..7bed423 100644 --- a/web/utils/task.ts +++ b/web/utils/task.ts @@ -56,6 +56,15 @@ export class Task { this ) } + + updateWithOtherTask(otherTask: Task) { + this.title = otherTask.title + this.description = otherTask.description + this.done = otherTask.done + this.estimated_time = otherTask.estimated_time + this.due_date = otherTask.due_date + this.scheduled_at = otherTask.scheduled_at + } } export type SimpleTask = {