diff --git a/src/modules/timesheets/components/shift-list.vue b/src/modules/timesheets/components/shift-list.vue index 672ea88..7d71c75 100644 --- a/src/modules/timesheets/components/shift-list.vue +++ b/src/modules/timesheets/components/shift-list.vue @@ -6,18 +6,19 @@ import ShiftListDateWidget from 'src/modules/timesheets/components/shift-list-date-widget.vue'; import { date, useQuasar } from 'quasar'; - import { ref, computed, watch } from 'vue'; + import { ref, computed, watch, onMounted } from 'vue'; import { useUiStore } from 'src/stores/ui-store'; import { useTimesheetStore } from 'src/stores/timesheet-store'; import { Shift } from 'src/modules/timesheets/models/shift.models'; import { useTimesheetApi } from 'src/modules/timesheets/composables/use-timesheet-api'; import type { TimesheetDay } from 'src/modules/timesheets/models/timesheet.models'; + import { useI18n } from 'vue-i18n'; const CURRENT_DATE_STRING = new Date().toISOString().slice(0, 10); - const HOLIDAYS: string[] = ['2026-01-01', '2025-11-26'] const { extractDate } = date; + const { locale } = useI18n(); const q = useQuasar(); const ui_store = useUiStore(); @@ -59,11 +60,26 @@ return iso_date_string === CURRENT_DATE_STRING ? 'currentDayComponent' : ''; }; + const getHolidayName = (date: string) => { + const holiday = timesheet_store.federal_holidays.find(holiday => holiday.date === date); + if (!holiday) return; + + if (locale.value === 'fr-FR') + return holiday.nameFr; + + else if (locale.value === 'en-CA') + return holiday.nameEn; + }; + + onMounted(async () => { + await timesheet_store.getCurrentFederalHolidays(); + }); + watch(currentDayComponentWatcher, () => { if (currentDayComponent.value && q.platform.is.mobile) { emit('onCurrentDayComponentFound', currentDayComponent.value[0]) } - }) + });