From b3ce8e59cb99f42b6db82ae5d8b39860728f3ccd Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Thu, 4 Apr 2024 16:17:56 -0400 Subject: [PATCH] Change the colour to Red. --- src/components/task/TaskEditComponent.vue | 45 ++++++++++++++--------- src/pages/ProfilePage.vue | 2 +- src/pages/task/NewTaskPage.vue | 2 +- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/src/components/task/TaskEditComponent.vue b/src/components/task/TaskEditComponent.vue index 82f5e2e..4e5e0a2 100644 --- a/src/components/task/TaskEditComponent.vue +++ b/src/components/task/TaskEditComponent.vue @@ -2,7 +2,7 @@ - +
@@ -78,7 +82,7 @@ @@ -116,7 +120,7 @@ ({ +const props = defineProps<{ taskId: string }>(); +const taskStore = useTaskStore(); + +const defaultTask = { description: '', due_date: date.formatDate(Date.now(), 'YYYY-MM-DD'), required_skills: [], @@ -166,9 +173,11 @@ const newTask = reactive({ status: 'ready', depends_on: [], boat: '', -}); +}; -const taskStore = useTaskStore(); +const { taskId } = props; +const targetTask = taskId && taskStore.tasks.find((t) => t.$id === taskId); +const modifiedTask = reactive(targetTask ? targetTask : defaultTask); taskStore.fetchSkillTags(); taskStore.fetchTaskTags(); @@ -230,7 +239,7 @@ function addTag(tag: string) { } // Method to update the model in ISO 8601 format const updateDateISO = (value: string) => { - newTask.due_date = date.formatDate(value, 'YYYY-MM-DD'); + modifiedTask.due_date = date.formatDate(value, 'YYYY-MM-DD'); }; const dateRule = (val: string) => { // Check if the date is valid using Quasar's date utils if needed @@ -240,14 +249,16 @@ const dateRule = (val: string) => { const router = useRouter(); async function onSubmit() { - console.log(newTask); + console.log(modifiedTask); try { // It would probably be more performant to store the tags as objects in the // form, and then extract the ID's before submitting. - newTask.required_skills = skillTagList.value.map((s) => s['$id']); - newTask.tags = taskTagList.value.map((s) => s['$id']); - newTask.depends_on = dependsList.value.map((d) => d['$id']) as string[]; - await taskStore.addTask(newTask); + modifiedTask.required_skills = skillTagList.value.map((s) => s['$id']); + modifiedTask.tags = taskTagList.value.map((s) => s['$id']); + modifiedTask.depends_on = dependsList.value.map( + (d) => d['$id'] + ) as string[]; + await taskStore.addTask(modifiedTask); console.log('Created Task'); router.go(-1); } catch (error) { diff --git a/src/pages/ProfilePage.vue b/src/pages/ProfilePage.vue index 1c7fe83..6ec4be5 100644 --- a/src/pages/ProfilePage.vue +++ b/src/pages/ProfilePage.vue @@ -31,7 +31,7 @@ Capri25 - Night diff --git a/src/pages/task/NewTaskPage.vue b/src/pages/task/NewTaskPage.vue index cb16a29..682ed14 100644 --- a/src/pages/task/NewTaskPage.vue +++ b/src/pages/task/NewTaskPage.vue @@ -2,7 +2,7 @@
- +