From 5bc1601379b3bcdb226c35a1ef3e2bbe4cead7d6 Mon Sep 17 00:00:00 2001 From: mayar osama Date: Tue, 26 Mar 2024 13:53:32 +0200 Subject: [PATCH] attempting fixing update vacation --- client/src/components/CalenderComponent.vue | 37 ++++++++++++-------- client/src/components/cards/vacationCard.vue | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/client/src/components/CalenderComponent.vue b/client/src/components/CalenderComponent.vue index 0cf1275e..78d46461 100644 --- a/client/src/components/CalenderComponent.vue +++ b/client/src/components/CalenderComponent.vue @@ -368,23 +368,30 @@ async function updateVacationStatus(data: string) { } async function updateVacation(vacation: Api.Vacation) { - console.log("Vacation: ", vacation); - vacations.value = vacations.value.filter((vacation) => vacation.id !== selectedEvent.value?.id) - if (cached_users.has(vacation.applying_user.id)) { - vacation.applying_user = cached_users.get(vacation.applying_user.id) - } else { - const user = await $api.users.getuser(vacation.applying_user.id, { - disableNotify: true - }) - cached_users.set(vacation.applying_user.id, user) - vacation.applying_user = user - } - - vacation.isUpdated = true - vacations.value.push(vacation) - closeDialog(CalendarEventSelection.Vacation) + const user = await $api.users.getuser(vacation.applying_user, { disableNotify: true }) + // vacation.applying_user = user + // vacation.isUpdated = true + // vacations.value.push(vacation) + // closeDialog(CalendarEventSelection.Vacation) + + // if (cached_users.has(vacation.applying_user)) { + // vacation.applying_user = cached_users.get(vacation.applying_user.id) + // console.log(vacation.applying_user) + // } + + // else { + // const user = await $api.users.getuser(vacation.applying_user, { + // disableNotify: true + // }) + // cached_users.set(vacation.applying_user.id, user) + // vacation.applying_user = user + // } + + // vacation.isUpdated = true + // vacations.value.push(vacation) + // closeDialog(CalendarEventSelection.Vacation) } async function deleteVacation() { diff --git a/client/src/components/cards/vacationCard.vue b/client/src/components/cards/vacationCard.vue index 405785ee..15955b02 100644 --- a/client/src/components/cards/vacationCard.vue +++ b/client/src/components/cards/vacationCard.vue @@ -17,7 +17,7 @@ - Update + Update Delete