fix [P-51]: добавлены праздники к dare-picker
This commit is contained in:
1 parent
c073b4422f
commit
b56f5e3a27
2 files changed
+106
-7
No files matched your search
@@ -18,7 +18,7 @@
|
||||
<template v-for="(file, index) in localNewFiles" :key="getFileKey(file, index)">
|
||||
<v-chip
|
||||
class="file-chip"
|
||||
color="teal-darken-3"
|
||||
color="grey-darken-1"
|
||||
size="small"
|
||||
label
|
||||
closable
|
||||
@@ -68,7 +68,8 @@
|
||||
v-for="file in existingFiles"
|
||||
:key="file.id"
|
||||
class="me-2 mb-1 "
|
||||
color="grey-darken-1"
|
||||
color="teal-darken-3"
|
||||
|
||||
label
|
||||
@click:close="removeExistingFile(file.id)"
|
||||
>
|
||||
@@ -418,12 +419,12 @@ export default {
|
||||
|
||||
.download-icon:hover {
|
||||
opacity: 1;
|
||||
color: #5e6061;
|
||||
color: #024e45;
|
||||
}
|
||||
|
||||
.close-icon:hover {
|
||||
opacity: 1;
|
||||
color: #383a3a;
|
||||
color: #024e45 ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
import { useCalendarStore } from '@/store/calendarStore';
|
||||
import { useAccountStore } from '@/store/AccountStore';
|
||||
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
|
||||
import { onMounted, watch } from 'vue';
|
||||
import { onMounted, watch, ref, nextTick } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
export default {
|
||||
@@ -68,7 +68,6 @@ export default {
|
||||
setup() {
|
||||
const calendarStore = useCalendarStore();
|
||||
const accountStore = useAccountStore();
|
||||
// const calendarForMy = ref([]);
|
||||
|
||||
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
|
||||
|
||||
@@ -76,6 +75,7 @@ export default {
|
||||
|
||||
const handleDateClick = (date) => {
|
||||
calendarStore.setSelectedDateFromPicker(date);
|
||||
setTimeout(updateCalendarDays, 200);
|
||||
};
|
||||
|
||||
const openEventDialog = () => {
|
||||
@@ -88,6 +88,9 @@ export default {
|
||||
|
||||
onMounted(() => {
|
||||
loadCalendars();
|
||||
|
||||
updateCalendarDays();
|
||||
setInterval(updateCalendarDays, 500);
|
||||
});
|
||||
|
||||
// Реакция на изменения пользователя
|
||||
@@ -97,6 +100,82 @@ export default {
|
||||
}
|
||||
});
|
||||
|
||||
// Функция для добавления классов дням
|
||||
const updateCalendarDays = () => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
const dayButtons = document.querySelectorAll('.minCal .v-date-picker-month__day-btn');
|
||||
|
||||
dayButtons.forEach((button) => {
|
||||
// Ищем дату в разных возможных атрибутах
|
||||
const ariaLabel = button.getAttribute('aria-label');
|
||||
|
||||
if (ariaLabel) {
|
||||
try {
|
||||
// Парсим дату из aria-label "воскресенье, 28 сентября 2025 г."
|
||||
|
||||
const dayDate = parseDateFromAriaLabel(ariaLabel);
|
||||
if (dayDate) {
|
||||
const dayInfo = calendarStore.isNonWorkingDay(dayDate);
|
||||
|
||||
// Очищаем предыдущие классы
|
||||
button.classList.remove('weekend-day', 'holiday-day');
|
||||
|
||||
// Добавляем классы по условию
|
||||
if (dayInfo?.isWeekendForStyling) {
|
||||
button.classList.add('weekend-day');
|
||||
}
|
||||
if (dayInfo?.isHoliday) {
|
||||
button.classList.add('holiday-day');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error processing day:', error);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
});
|
||||
};
|
||||
|
||||
const parseDateFromAriaLabel = (ariaLabel) => {
|
||||
try {
|
||||
// Убираем день недели и запятую, оставляем "28 сентября 2025 г."
|
||||
const datePart = ariaLabel.replace(/^[^,]+,?\s*/, '');
|
||||
|
||||
// Заменяем русские названия месяцев на английские
|
||||
const monthMap = {
|
||||
января: 'January',
|
||||
февраля: 'February',
|
||||
марта: 'March',
|
||||
апреля: 'April',
|
||||
мая: 'May',
|
||||
июня: 'June',
|
||||
июля: 'July',
|
||||
августа: 'August',
|
||||
сентября: 'September',
|
||||
октября: 'October',
|
||||
ноября: 'November',
|
||||
декабря: 'December',
|
||||
};
|
||||
|
||||
let englishDateStr = datePart;
|
||||
for (const [ru, en] of Object.entries(monthMap)) {
|
||||
englishDateStr = englishDateStr.replace(ru, en);
|
||||
}
|
||||
|
||||
// Убираем " г." в конце
|
||||
englishDateStr = englishDateStr.replace(' г.', '');
|
||||
|
||||
const dayDate = new Date(englishDateStr);
|
||||
|
||||
return isNaN(dayDate.getTime()) ? null : dayDate;
|
||||
} catch (error) {
|
||||
console.error('Parse error:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
accountStore,
|
||||
user,
|
||||
@@ -106,6 +185,7 @@ export default {
|
||||
openEventDialog,
|
||||
loadCalendars,
|
||||
handleDateClick,
|
||||
updateCalendarDays,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -113,7 +193,7 @@ export default {
|
||||
<style scoped>
|
||||
/* .minCal:deep(.v-date-picker-month__days) {
|
||||
display: grid !important;
|
||||
grid-template-columns: repeat(7, 36px) !important;
|
||||
grid-template-columns: repeat(7, 40px) !important;
|
||||
gap: 3px !important;
|
||||
width: 250px !important;
|
||||
justify-content: center !important;
|
||||
@@ -138,4 +218,22 @@ export default {
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
/* СТИЛИ ДЛЯ ВЫХОДНЫХ И ПРАЗДНИКОВ */
|
||||
|
||||
.minCal:deep(.weekend-day .v-btn__content) {
|
||||
color: #666 !important;
|
||||
}
|
||||
|
||||
.minCal:deep(.holiday-day .v-btn__content) {
|
||||
color: #ff4444 !important;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.minCal:deep(.weekend-day.holiday-day) {
|
||||
background-color: #ffe0e0 !important;
|
||||
}
|
||||
|
||||
.minCal:deep(.weekend-day.holiday-day .v-btn__content) {
|
||||
color: #cc0000 !important;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user