From 2a3e65ed5f1acee640bcd03c9bc332eefd6e303c Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Fri, 17 Jun 2022 12:55:05 +0200 Subject: [PATCH 01/18] #152 - calendar template added --- resources/js/Pages/Dashboard.vue | 2 + .../js/Shared/Widgets/VacationCalendar.vue | 148 ++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 resources/js/Shared/Widgets/VacationCalendar.vue diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index e633816..1188c6d 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -3,6 +3,7 @@
+
@@ -38,6 +39,7 @@ import HomeOfficeList from '@/Shared/Widgets/HomeOfficeList' import UpcomingHolidays from '@/Shared/Widgets/UpcomingHolidays' import UserVacationRequests from '@/Shared/Widgets/UserVacationRequests' import PendingVacationRequests from '@/Shared/Widgets/PendingVacationRequests' +import VacationCalendar from '@/Shared/Widgets/VacationCalendar' defineProps({ auth: Object, diff --git a/resources/js/Shared/Widgets/VacationCalendar.vue b/resources/js/Shared/Widgets/VacationCalendar.vue new file mode 100644 index 0000000..1ce49a1 --- /dev/null +++ b/resources/js/Shared/Widgets/VacationCalendar.vue @@ -0,0 +1,148 @@ + + + From dcc380842826299a73c5faebf848c80a41eea936 Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Fri, 17 Jun 2022 17:55:03 +0200 Subject: [PATCH 02/18] #152 - wip --- .../js/Shared/Widgets/VacationCalendar.vue | 273 +++++++++--------- 1 file changed, 136 insertions(+), 137 deletions(-) diff --git a/resources/js/Shared/Widgets/VacationCalendar.vue b/resources/js/Shared/Widgets/VacationCalendar.vue index 1ce49a1..f233601 100644 --- a/resources/js/Shared/Widgets/VacationCalendar.vue +++ b/resources/js/Shared/Widgets/VacationCalendar.vue @@ -1,148 +1,147 @@ + + From db874d439521d97db95b592445a2971ab55112aa Mon Sep 17 00:00:00 2001 From: Kamil Niemczycki Date: Tue, 21 Jun 2022 00:13:48 +0200 Subject: [PATCH 03/18] #152 - wip --- .../js/Shared/Widgets/VacationCalendar.vue | 135 ++++++++++++++---- 1 file changed, 110 insertions(+), 25 deletions(-) diff --git a/resources/js/Shared/Widgets/VacationCalendar.vue b/resources/js/Shared/Widgets/VacationCalendar.vue index f233601..1779ab8 100644 --- a/resources/js/Shared/Widgets/VacationCalendar.vue +++ b/resources/js/Shared/Widgets/VacationCalendar.vue @@ -4,6 +4,18 @@

Kalendarz

+
+ + + + +
- {{ viewMode }} view + {{ viewMode.name }}
+
+
+ Pn +
+
+ Wt +
+
+ Śr +
+
+ Cz +
+
+ Pt +
+
+ Sb +
+
+ Nd +
+
-
+
@@ -147,16 +142,23 @@ import { DateTime } from 'luxon' import useCurrentYearPeriodInfo from '@/Composables/yearPeriodInfo' import { useMonthInfo } from '@/Composables/monthInfo' import { viewModes, find as findViewMode } from '@/Shared/Widgets/Calendar/ViewModeOptions' +import DateComponent from '@/Shared/Widgets/Calendar/DateComponent' + +const props = defineProps({ + holidays: Object, +}) let days = ref([]) -const months = useMonthInfo().getMonths() + function getCurrentDate() { const { year, month, weekNumber } = DateTime.now() return { year, month, week: weekNumber } } -const selectedYear = useCurrentYearPeriodInfo().year.value const currentDate = getCurrentDate() +const months = useMonthInfo().getMonths() +const selectedYear = useCurrentYearPeriodInfo().year.value + const calendar = { viewMode: ref('week'), currents: reactive({ @@ -227,6 +229,7 @@ const customCalendar = { isCurrentMonth: isInCurrentMonth(day), isToday: isToday(day), isWeekend: isWeekend(day), + isHoliday: isHoliday(day), } }, } @@ -325,6 +328,14 @@ function isWeekend(date) { function isToday(date) { return date.toISODate() === DateTime.local().toISODate() } + +function isHoliday(date) { + return props.holidays[date.toISODate()] !== undefined +} + +function getHolidayDescription(day) { + return props.holidays[day.date] +}