diff --git a/src/pages/Worker/Card/WorkerCalendarFilter.vue b/src/pages/Worker/Card/WorkerCalendarFilter.vue index f8c1b2167..41c5bb41c 100644 --- a/src/pages/Worker/Card/WorkerCalendarFilter.vue +++ b/src/pages/Worker/Card/WorkerCalendarFilter.vue @@ -157,13 +157,7 @@ const onAbsencesFetched = (data) => { console.log('events:: ', events); }; -watch(selectedYear, () => { - refreshData(); -}); - -watch(selectedBusinessFk, () => { - refreshData(); -}); +watch([selectedYear, selectedBusinessFk], () => refreshData()); defineExpose({ refreshData, diff --git a/src/pages/Worker/Card/WorkerCalendarItem.vue b/src/pages/Worker/Card/WorkerCalendarItem.vue index 79c47063c..9fe02e8cd 100644 --- a/src/pages/Worker/Card/WorkerCalendarItem.vue +++ b/src/pages/Worker/Card/WorkerCalendarItem.vue @@ -45,8 +45,9 @@ const { locale } = useI18n(); const calendarRef = ref(null); const weekdayStore = useWeekdayStore(); -const selectedDate = ref(null); +const selectedDate = ref(); const calendarEventDates = []; +const today = ref(date.formatDate(Date.vnNew(), 'YYYY-MM-DD')); const updateSelectedDate = (year) => { const _date = new Date(year, props.month - 1, 1); @@ -99,13 +100,13 @@ const handleDateSelected = (date) => { }; const getEventByTimestamp = ({ year, month, day }) => { - const stamp = date.formatDate(new Date(year, month - 1, day), 'x'); + const stamp = new Date(year, month - 1, day).getTime(); return props.events[stamp] || null; }; const getEventAttrs = (timestamp) => { const event = getEventByTimestamp(timestamp); - if (!event) return ''; + if (!event) return {}; const { name, color } = event; return { @@ -142,6 +143,7 @@ watch(props.year, (newValue) => { :weekdays="[1, 2, 3, 4, 5, 6, 0]" :disabled-weekdays="[0, 6]" :locale="locale" + :now="today" mini-mode >