From 94350f8a820b32352e7960b12eb5b315855fc684 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Thu, 7 Jul 2022 00:15:06 +0200 Subject: [PATCH] #152 - updated style and added icons --- .../Shared/Widgets/Calendar/DayComponent.vue | 32 ++++++++++--------- .../js/Shared/Widgets/VacationCalendar.vue | 20 ++++++++---- 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/resources/js/Shared/Widgets/Calendar/DayComponent.vue b/resources/js/Shared/Widgets/Calendar/DayComponent.vue index 9de95d7..8cc6fc7 100644 --- a/resources/js/Shared/Widgets/Calendar/DayComponent.vue +++ b/resources/js/Shared/Widgets/Calendar/DayComponent.vue @@ -13,7 +13,7 @@ } ], day.isHoliday && 'font-bold cursor-default', - (day.isVacation || day.isPendingVacation) && `border-b-4 border-dashed ${getVacationBorder(day)}` + (day.isPendingVacation) && `border-b-4 border-dashed ${day.getVacationType.border} md:border-blumilk-600` ]" > - +
+ + +
@@ -237,15 +235,21 @@ const customCalendar = { }, prepareDay(day) { const isCurrentMonth = isInCurrentMonth(day) - return { + const startDay = { date: day.toISODate(), + isVacation: isCurrentMonth && isVacation(day), + isPendingVacation: isCurrentMonth && isPendingVacation(day), + } + + return { + ...startDay, dayNumber: day.day, - isCurrentMonth: isCurrentMonth, + isCurrentMonth, isToday: isToday(day), isWeekend: isWeekend(day), isHoliday: isHoliday(day), - isVacation: isCurrentMonth && isVacation(day), - isPendingVacation: isCurrentMonth && isPendingVacation(day), + getVacationType: startDay.isVacation || startDay.isPendingVacation ? getVacationType(startDay) : undefined, + getVacationInfo: startDay.isVacation || startDay.isPendingVacation ? getVacationInfo(startDay) : undefined, } }, } @@ -365,6 +369,10 @@ function getVacationBorder(day) { return findType(getVacationInfo(day).type)?.border } +function getVacationType(day) { + return findType(getVacationInfo(day).type) +} + function getVacationInfo(day) { return day.isVacation ? props.approvedVacations[day.date] : props.pendingVacations[day.date] }