style [P-302]: корректная подсветка выходных и праздников в светлой и тёмной темах
This commit is contained in:
1 parent
8355e62d4e
commit
0cfc8f1dea
6 files changed
+206
-221
No files matched your search
@@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { ref, onMounted, watch, computed, provide } from 'vue';
|
import { ref, onMounted, watch, computed, provide } from 'vue';
|
||||||
import { useWeekendsStore } from '@/store/WeekendsStore';
|
|
||||||
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
import EventCreate from '@/components/calendar_of_events/event-create.vue';
|
||||||
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
import CustomCalendar from '@/components/calendar_of_events/UI_calendar/CustomCalendar.vue';
|
||||||
import { useCalendarStore } from '@/store/calendarStore';
|
import { useCalendarStore } from '@/store/calendarStore';
|
||||||
@@ -48,7 +47,6 @@ import EventCalendarShow from '@/components/calendar_of_events/event-calendar-sh
|
|||||||
export default {
|
export default {
|
||||||
components: { EventCreate, MiniCalendar, CustomCalendar, EventCalendarShow },
|
components: { EventCreate, MiniCalendar, CustomCalendar, EventCalendarShow },
|
||||||
setup() {
|
setup() {
|
||||||
const week = useWeekendsStore();
|
|
||||||
const selectdate = ref(new Date());
|
const selectdate = ref(new Date());
|
||||||
const MyYear = ref(selectdate.value.getFullYear());
|
const MyYear = ref(selectdate.value.getFullYear());
|
||||||
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
const MyMonth = ref(selectdate.value.getMonth() + 1);
|
||||||
@@ -127,7 +125,7 @@ export default {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getEvent();
|
getEvent();
|
||||||
week.getWeekend(MyYear.value);
|
calendarStore.fetchHolidays(MyYear.value);
|
||||||
getDictEmployee();
|
getDictEmployee();
|
||||||
getCalendar();
|
getCalendar();
|
||||||
getEmployees();
|
getEmployees();
|
||||||
@@ -143,15 +141,7 @@ export default {
|
|||||||
}, 200);
|
}, 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
const CheckingStore = () => {
|
const openCalendarCreate = () => {
|
||||||
if (MyYear.value in week.week) {
|
|
||||||
weekendsData();
|
|
||||||
} else {
|
|
||||||
week.getWeekend(MyYear.value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const openCalendarCreate = () => {
|
|
||||||
miniCalendarRef.value?.openCalendarCreate();
|
miniCalendarRef.value?.openCalendarCreate();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -212,8 +202,6 @@ export default {
|
|||||||
selectedDate,
|
selectedDate,
|
||||||
getMonth,
|
getMonth,
|
||||||
getYear,
|
getYear,
|
||||||
week,
|
|
||||||
CheckingStore,
|
|
||||||
showEventDialog,
|
showEventDialog,
|
||||||
calendarForMy,
|
calendarForMy,
|
||||||
getCalendar,
|
getCalendar,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<v-row no-gutters class="mb-2 align-end" style="height: 60px" justify="space-between">
|
<v-row no-gutters class="mb-2 align-end" style="height: 60px" justify="space-between">
|
||||||
<v-col md="5" class="flex-grow-0 d-flex align-center">
|
<v-col md="5" class="flex-grow-0 d-flex align-center">
|
||||||
<template v-if="currentView !== 'listAllEvents'">
|
<template v-if="currentView !== 'listAllEvents'">
|
||||||
<div class="pb-3 d-flex align-center">
|
<div class="pb-1 d-flex align-center">
|
||||||
<v-btn
|
<v-btn
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
class="text-subtitle-2 mr-2"
|
class="text-subtitle-2 mr-2"
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<v-icon size="large">mdi-chevron-right</v-icon>
|
<v-icon size="large">mdi-chevron-right</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
|
||||||
<span class="text-h5 text-no-wrap ml-2">
|
<span class="text-h6 text-no-wrap ml-2">
|
||||||
{{ currentTitle }}
|
{{ currentTitle }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,12 +62,12 @@
|
|||||||
variant="plain"
|
variant="plain"
|
||||||
density="comfortable"
|
density="comfortable"
|
||||||
>
|
>
|
||||||
<v-btn value="timeGridDay">День</v-btn>
|
<v-btn value="timeGridDay" class="px-2">День</v-btn>
|
||||||
<v-btn value="timeGridWeek">Неделя</v-btn>
|
<v-btn value="timeGridWeek" class="px-2">Неделя</v-btn>
|
||||||
<v-btn value="dayGridMonth">Месяц</v-btn>
|
<v-btn value="dayGridMonth" class="px-2">Месяц</v-btn>
|
||||||
<v-btn value="multiMonthYear">Год</v-btn>
|
<v-btn value="multiMonthYear" class="px-2">Год</v-btn>
|
||||||
<v-btn value="listWeek">Расписание</v-btn>
|
<v-btn value="listWeek" class="px-2">Расписание</v-btn>
|
||||||
<v-btn value="listAllEvents">Все события</v-btn>
|
<v-btn value="listAllEvents" class="px-2">Все события</v-btn>
|
||||||
</v-btn-toggle>
|
</v-btn-toggle>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -113,6 +113,12 @@ export default {
|
|||||||
EventsListView,
|
EventsListView,
|
||||||
EventListFilters,
|
EventListFilters,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
props: {
|
||||||
|
forHomePage: { type: Boolean, default: false },
|
||||||
|
view: { type: String, default: 'dayGridMonth' },
|
||||||
|
},
|
||||||
|
|
||||||
setup(props, { emit }) {
|
setup(props, { emit }) {
|
||||||
const currentView = ref('dayGridMonth');
|
const currentView = ref('dayGridMonth');
|
||||||
const currentTitle = ref('Календарь');
|
const currentTitle = ref('Календарь');
|
||||||
@@ -175,19 +181,21 @@ export default {
|
|||||||
selectable: true,
|
selectable: true,
|
||||||
unselectAuto: false,
|
unselectAuto: false,
|
||||||
selectMirror: false,
|
selectMirror: false,
|
||||||
|
dayCellClassNames: (arg) => {
|
||||||
dayCellDidMount: (arg) => {
|
const dayInfo = calendarStore.isNonWorkingDay(arg.date);
|
||||||
const date = arg.date;
|
const classes = [];
|
||||||
const dayInfo = calendarStore.isNonWorkingDay(date);
|
if (dayInfo.isHoliday) classes.push('non-working-day');
|
||||||
|
if (dayInfo.isWeekendForStyling) classes.push('grey-background');
|
||||||
if (dayInfo.isHoliday === true) {
|
return classes;
|
||||||
arg.el.classList.add('non-working-day');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dayInfo.isWeekendForStyling === true) {
|
|
||||||
arg.el.classList.add('grey-background');
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
dayHeaderClassNames: (arg) => {
|
||||||
|
const dayInfo = calendarStore.isNonWorkingDay(arg.date);
|
||||||
|
const classes = [];
|
||||||
|
if (dayInfo.isHoliday) classes.push('non-working-day');
|
||||||
|
if (dayInfo.isWeekendForStyling) classes.push('grey-background');
|
||||||
|
return classes;
|
||||||
|
},
|
||||||
|
|
||||||
views: {
|
views: {
|
||||||
timeGridDay: {
|
timeGridDay: {
|
||||||
type: 'timeGrid',
|
type: 'timeGrid',
|
||||||
@@ -312,7 +320,6 @@ export default {
|
|||||||
|
|
||||||
successCallback(events);
|
successCallback(events);
|
||||||
},
|
},
|
||||||
selectable: true,
|
|
||||||
eventClick: handleEventClick,
|
eventClick: handleEventClick,
|
||||||
|
|
||||||
dateClick: (info) => {
|
dateClick: (info) => {
|
||||||
@@ -324,18 +331,8 @@ export default {
|
|||||||
|
|
||||||
datesSet: (info) => {
|
datesSet: (info) => {
|
||||||
if (info.view.type === 'listWeek' && selectedDate.value) {
|
if (info.view.type === 'listWeek' && selectedDate.value) {
|
||||||
const date = new Date(selectedDate.value);
|
currentTitle.value = formatScheduleTitle(selectedDate.value);
|
||||||
|
} else if (info.view.type !== 'listWeek') {
|
||||||
const options = {
|
|
||||||
weekday: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
};
|
|
||||||
|
|
||||||
const formattedDate = date.toLocaleDateString('ru-RU', options);
|
|
||||||
currentTitle.value = `Расписание на ${formattedDate}`;
|
|
||||||
} else {
|
|
||||||
currentTitle.value = info.view.title;
|
currentTitle.value = info.view.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,39 +392,82 @@ export default {
|
|||||||
selectedDate.value = dateStr;
|
selectedDate.value = dateStr;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
const weekdayMap = {
|
||||||
|
воскресенье: 'воскресенье',
|
||||||
|
понедельник: 'понедельник',
|
||||||
|
вторник: 'вторник',
|
||||||
|
среда: 'среду',
|
||||||
|
четверг: 'четверг',
|
||||||
|
пятница: 'пятницу',
|
||||||
|
суббота: 'субботу',
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatScheduleTitle = (dateValue) => {
|
||||||
|
const date = new Date(dateValue);
|
||||||
|
const weekdayRaw = date.toLocaleDateString('ru-RU', { weekday: 'long' });
|
||||||
|
const weekday = weekdayMap[weekdayRaw] || weekdayRaw;
|
||||||
|
const rest = date.toLocaleDateString('ru-RU', {
|
||||||
|
day: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
});
|
||||||
|
return `Расписание на ${weekday}, ${rest}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const applyView = async (newView) => {
|
||||||
|
if (newView === 'listAllEvents') {
|
||||||
|
currentTitle.value = 'Все события';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (newView === 'listWeek' && selectedDate.value) {
|
||||||
|
currentTitle.value = formatScheduleTitle(selectedDate.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
await nextTick();
|
||||||
|
if (!calendarApi.value) return;
|
||||||
|
|
||||||
|
calendarApi.value.changeView(newView);
|
||||||
|
|
||||||
|
if (newView !== 'listWeek') {
|
||||||
|
currentTitle.value = calendarApi.value.view.title;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
calendarStore.fetchHolidays(currentYear);
|
calendarStore.fetchHolidays(currentYear);
|
||||||
// Ждем следующего тика для гарантии, что календарь инициализирован
|
// Ждем следующего тика для гарантии, что календарь инициализирован
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
// Принудительно обновляем события после загрузки праздников
|
// Принудительно обновляем события после загрузки праздников
|
||||||
if (calendarApi.value) {
|
if (calendarApi.value && currentView.value !== 'listAllEvents') {
|
||||||
calendarApi.value.refetchEvents();
|
calendarApi.value.refetchEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDate.value) {
|
if (selectedDate.value && currentView.value !== 'listAllEvents') {
|
||||||
handleDateSelection(selectedDate.value);
|
handleDateSelection(selectedDate.value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(currentView, (newView) => {
|
||||||
|
applyView(newView);
|
||||||
|
});
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
[() => calendarStore.calendars, () => calendarStore.hiddenCalendarIds],
|
[() => calendarStore.calendars, () => calendarStore.hiddenCalendarIds],
|
||||||
() => {
|
() => {
|
||||||
// При изменении событий перезагружаем календарь
|
// При изменении событий перезагружаем календарь
|
||||||
if (calendarApi.value) {
|
if (currentView.value === 'listAllEvents') return;
|
||||||
calendarApi.value.refetchEvents();
|
calendarApi.value?.refetchEvents();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
calendarColorMap,
|
calendarColorMap,
|
||||||
(newColorMap, oldColorMap) => {
|
() => {
|
||||||
if (calendarRef.value && JSON.stringify(newColorMap) !== JSON.stringify(oldColorMap)) {
|
if (currentView.value === 'listAllEvents') return;
|
||||||
renderEvents();
|
calendarApi.value?.refetchEvents();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{ deep: true },
|
{ deep: true },
|
||||||
);
|
);
|
||||||
@@ -441,15 +481,6 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(currentView, (newView) => {
|
|
||||||
if (newView === 'listAllEvents') {
|
|
||||||
currentTitle.value = 'Все события';
|
|
||||||
} else if (calendarApi.value) {
|
|
||||||
calendarApi.value.changeView(newView);
|
|
||||||
currentTitle.value = calendarApi.value.view.title;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const handleFiltersUpdate = (newFilters) => {
|
const handleFiltersUpdate = (newFilters) => {
|
||||||
Object.keys(newFilters).forEach((key) => {
|
Object.keys(newFilters).forEach((key) => {
|
||||||
if (filters[key] !== undefined) {
|
if (filters[key] !== undefined) {
|
||||||
@@ -504,7 +535,7 @@ export default {
|
|||||||
:deep(.fc-day-today .fc-daygrid-day-number) {
|
:deep(.fc-day-today .fc-daygrid-day-number) {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
color: #00897b;
|
color: rgb(var(--v-theme-btn_text));
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
content: '';
|
content: '';
|
||||||
@@ -514,7 +545,7 @@ export default {
|
|||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
border: 1px solid #00897b;
|
border: 1px solid rgb(var(--v-theme-btn_text));
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
@@ -529,7 +560,7 @@ export default {
|
|||||||
:deep(.fc-day-selected-custom .fc-daygrid-day-number) {
|
:deep(.fc-day-selected-custom .fc-daygrid-day-number) {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
color: white !important;
|
color: rgb(var(--v-theme-bg_white)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.fc-day-selected-custom .fc-daygrid-day-number::before) {
|
:deep(.fc-day-selected-custom .fc-daygrid-day-number::before) {
|
||||||
@@ -540,7 +571,7 @@ export default {
|
|||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
background-color: #00897b;
|
background-color: rgb(var(--v-theme-btn_text));
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
z-index: -1;
|
z-index: -1;
|
||||||
}
|
}
|
||||||
@@ -555,11 +586,16 @@ export default {
|
|||||||
|
|
||||||
:deep(.v-btn--active) {
|
:deep(.v-btn--active) {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
color: #00897b !important;
|
color: rgb(var(--v-theme-btn_text)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.fc .fc-timegrid-col.fc-day-today) {
|
:deep(.fc .fc-timegrid-col.fc-day-today) {
|
||||||
background-color: #e0f2f1 !important;
|
background-color: rgba(var(--v-theme-btn_text), 0.1) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.fc-timegrid-col.non-working-day),
|
||||||
|
:deep(.fc-day.non-working-day:not(.fc-daygrid-day)) {
|
||||||
|
background-color: rgba(var(--v-theme-holiday_text), 0.05) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.fc-highlight) {
|
:deep(.fc-highlight) {
|
||||||
@@ -571,27 +607,31 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
:deep(.fc-popover) {
|
:deep(.fc-popover) {
|
||||||
background-color: rgb(248, 244, 244) !important;
|
background-color: rgb(var(--v-theme-cards)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.non-working-day {
|
:deep(.fc-day.non-working-day .fc-daygrid-day-number),
|
||||||
color: red !important;
|
:deep(.fc-day.non-working-day .fc-daygrid-day-top) {
|
||||||
|
color: rgb(var(--v-theme-holiday_text)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
:global(.fc-daygrid-day.non-working-day .fc-daygrid-day-number) {
|
:deep(.fc-col-header-cell.non-working-day),
|
||||||
color: #d32f2f !important;
|
:deep(.fc-col-header-cell.non-working-day .fc-col-header-cell-cushion) {
|
||||||
}
|
color: rgb(var(--v-theme-holiday_text)) !important;
|
||||||
|
|
||||||
:global(.fc-daygrid-day.grey-background.fc-daygrid-day-number) {
|
|
||||||
background-color: rgb(196, 187, 187) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grey-background {
|
|
||||||
background-color: rgb(240, 229, 229) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.grey-background),
|
||||||
:deep(.fc-day.grey-background) {
|
:deep(.fc-day.grey-background) {
|
||||||
background-color: #f5f5f5 !important;
|
background-color: rgb(var(--v-theme-weekend_bg)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.fc-day.grey-background .fc-daygrid-day-number) {
|
||||||
|
color: rgb(var(--v-theme-weekend_text)) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.fc-col-header-cell.grey-background),
|
||||||
|
:deep(.fc-col-header-cell.grey-background .fc-col-header-cell-cushion) {
|
||||||
|
color: rgb(var(--v-theme-weekend_text)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-calendar {
|
.custom-calendar {
|
||||||
|
|||||||
@@ -32,8 +32,8 @@
|
|||||||
'current-month': day.isCurrentMonth,
|
'current-month': day.isCurrentMonth,
|
||||||
today: isToday(day.date),
|
today: isToday(day.date),
|
||||||
selected: isSelected(day.date),
|
selected: isSelected(day.date),
|
||||||
'non-working-day': calendarStore.isNonWorkingDay(day.date).isHoliday,
|
'non-working-day': day.isHoliday,
|
||||||
'grey-background': calendarStore.isNonWorkingDay(day.date).isWeekendForStyling,
|
'grey-background': day.isWeekend,
|
||||||
}"
|
}"
|
||||||
@click="onDateClick(day.date)"
|
@click="onDateClick(day.date)"
|
||||||
>
|
>
|
||||||
@@ -228,9 +228,7 @@ export default {
|
|||||||
const calendarWeeks = computed(() => {
|
const calendarWeeks = computed(() => {
|
||||||
const year = currentDate.value.getFullYear();
|
const year = currentDate.value.getFullYear();
|
||||||
const month = currentDate.value.getMonth();
|
const month = currentDate.value.getMonth();
|
||||||
|
|
||||||
const firstDay = new Date(year, month, 1);
|
const firstDay = new Date(year, month, 1);
|
||||||
const lastDay = new Date(year, month + 1, 0);
|
|
||||||
|
|
||||||
const weeks = [];
|
const weeks = [];
|
||||||
let week = [];
|
let week = [];
|
||||||
@@ -244,10 +242,14 @@ export default {
|
|||||||
const currentDay = new Date(startDay);
|
const currentDay = new Date(startDay);
|
||||||
currentDay.setDate(startDay.getDate() + i);
|
currentDay.setDate(startDay.getDate() + i);
|
||||||
|
|
||||||
|
const dayInfo = calendarStore.isNonWorkingDay(currentDay);
|
||||||
|
|
||||||
week.push({
|
week.push({
|
||||||
day: currentDay.getDate(),
|
day: currentDay.getDate(),
|
||||||
date: formatToLocalDate(currentDay),
|
date: formatToLocalDate(currentDay),
|
||||||
isCurrentMonth: currentDay.getMonth() === month,
|
isCurrentMonth: currentDay.getMonth() === month,
|
||||||
|
isHoliday: dayInfo.isHoliday,
|
||||||
|
isWeekend: dayInfo.isWeekendForStyling,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (week.length === 7) {
|
if (week.length === 7) {
|
||||||
@@ -348,17 +350,9 @@ export default {
|
|||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
selectedDate.value = formatToLocalDate(new Date());
|
selectedDate.value = formatToLocalDate(new Date());
|
||||||
calendarStore.fetchHolidays(currentYear);
|
await calendarStore.fetchHolidays(currentYear);
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(
|
|
||||||
calendarColorMap,
|
|
||||||
(newMap) => {
|
|
||||||
newMap.value;
|
|
||||||
},
|
|
||||||
{ deep: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
// Реактивные данные
|
// Реактивные данные
|
||||||
currentDate,
|
currentDate,
|
||||||
@@ -416,7 +410,7 @@ export default {
|
|||||||
.month-title {
|
.month-title {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #333;
|
color: rgb(var(--v-theme-text_carous));
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -433,10 +427,10 @@ export default {
|
|||||||
.weekday-header {
|
.weekday-header {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #666;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 8px 4px;
|
padding: 8px 4px;
|
||||||
border-bottom: 1px solid #afadad;
|
color: rgb(var(--v-theme-text_grey));
|
||||||
|
border-bottom: 1px solid rgb(var(--v-theme-btn_gray));
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell {
|
.day-cell {
|
||||||
@@ -450,28 +444,29 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.day-cell:hover {
|
.day-cell:hover {
|
||||||
background-color: #f5f5f5;
|
background-color: rgba(var(--v-theme-on-surface), 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.current-month {
|
.day-cell.current-month {
|
||||||
color: #333;
|
color: rgb(var(--v-theme-text_carous));
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell:not(.current-month) {
|
.day-cell:not(.current-month) {
|
||||||
color: #ccc;
|
color: rgb(var(--v-theme-text_grey));
|
||||||
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.today {
|
.day-cell.today {
|
||||||
background-color: #e3f2fd;
|
background-color: rgba(var(--v-theme-primary), 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.selected {
|
.day-cell.selected {
|
||||||
background-color: #00897b;
|
background-color: rgb(var(--v-theme-btn_text));
|
||||||
color: white;
|
color: rgb(var(--v-theme-bg_white));
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell.selected .day-number {
|
.day-cell.selected .day-number {
|
||||||
color: white;
|
color: rgb(var(--v-theme-bg_white));
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-content {
|
.day-content {
|
||||||
@@ -524,13 +519,13 @@ export default {
|
|||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
color: #333;
|
color: rgb(var(--v-theme-text_carous));
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-schedule {
|
.day-schedule {
|
||||||
height: 90%;
|
height: 90%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
border: 1px solid #e0e0e0;
|
border: 1px solid rgb(var(--v-theme-btn_gray));
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -538,7 +533,7 @@ export default {
|
|||||||
min-height: 48px;
|
min-height: 48px;
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
border-left: 4px solid transparent;
|
border-left: 4px solid transparent;
|
||||||
border-bottom: 1px solid #d3cecede;
|
border-bottom: 1px solid rgb(var(--v-theme-btn_gray));
|
||||||
}
|
}
|
||||||
|
|
||||||
.schedule-item:last-child {
|
.schedule-item:last-child {
|
||||||
@@ -546,14 +541,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.schedule-item.current-event {
|
.schedule-item.current-event {
|
||||||
border-left-color: #2196f3;
|
border-left-color: rgb(var(--v-theme-primary));
|
||||||
background-color: #f8f9fa;
|
background-color: rgba(var(--v-theme-primary), 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.event-time {
|
.event-time {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #302f2f;
|
color: #302f2f;
|
||||||
|
color: rgb(var(--v-theme-text_carous));
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +558,7 @@ export default {
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
color: #1b1b1b;
|
color: rgb(var(--v-theme-text_carous));
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-events {
|
.no-events {
|
||||||
@@ -592,14 +588,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.non-working-day {
|
.non-working-day {
|
||||||
color: red !important;
|
color: rgb(var(--v-theme-holiday_text)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grey-background {
|
.grey-background {
|
||||||
background-color: rgb(243, 243, 243) !important;
|
background-color: rgb(var(--v-theme-weekend_bg)) !important;
|
||||||
|
color: rgb(var(--v-theme-weekend_text)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.day-cell:not(.current-month).non-working-day {
|
.day-cell:not(.current-month).non-working-day {
|
||||||
/* color: inherit !important; */
|
color: inherit !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card class="h-100 rounded-0 d-flex flex-colmn">
|
<v-card class="h-100 rounded-0 d-flex flex-column">
|
||||||
<v-row no-gutters class="flex-column">
|
<v-row no-gutters class="flex-column">
|
||||||
<v-col class="flex-grow-0 px-2 pt-1">
|
<v-col class="flex-grow-0 px-2 pt-1">
|
||||||
<SearchEvents />
|
<SearchEvents />
|
||||||
@@ -56,7 +56,7 @@ import { useCalendarStore } from '@/store/calendarStore';
|
|||||||
import { useAccountStore } from '@/store/AccountStore';
|
import { useAccountStore } from '@/store/AccountStore';
|
||||||
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
|
import CalendarMy from '@/components/calendar_of_events/calendar-my.vue';
|
||||||
import SearchEvents from '@/components/calendar_of_events/UI_calendar/SearchEvents.vue';
|
import SearchEvents from '@/components/calendar_of_events/UI_calendar/SearchEvents.vue';
|
||||||
import { onMounted, watch, nextTick, ref } from 'vue';
|
import { onMounted, watch, nextTick, ref, onBeforeUnmount } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -67,14 +67,10 @@ export default {
|
|||||||
const accountStore = useAccountStore();
|
const accountStore = useAccountStore();
|
||||||
|
|
||||||
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
|
const { selectedDate, myCalendars, subscribedCalendars } = storeToRefs(calendarStore);
|
||||||
|
|
||||||
// const selectedDate = computed(() => calendarStore.selectedDate);
|
|
||||||
// const myCalendars = computed(() => calendarStore.myCalendars);
|
|
||||||
// const subscribedCalendars = computed(() => calendarStore.subscribedCalendars);
|
|
||||||
|
|
||||||
const { user } = storeToRefs(accountStore);
|
const { user } = storeToRefs(accountStore);
|
||||||
|
|
||||||
const currentDisplay = ref(null);
|
const currentDisplay = ref(null);
|
||||||
|
let observer = null;
|
||||||
|
|
||||||
const handleDateClick = (date) => {
|
const handleDateClick = (date) => {
|
||||||
calendarStore.setSelectedDateFromPicker(date);
|
calendarStore.setSelectedDateFromPicker(date);
|
||||||
@@ -89,12 +85,6 @@ export default {
|
|||||||
calendarStore.loadCalendars();
|
calendarStore.loadCalendars();
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
loadCalendars();
|
|
||||||
|
|
||||||
updateCalendarDays();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Реакция на изменения пользователя
|
// Реакция на изменения пользователя
|
||||||
watch(user, (newUser) => {
|
watch(user, (newUser) => {
|
||||||
if (newUser) {
|
if (newUser) {
|
||||||
@@ -192,25 +182,24 @@ export default {
|
|||||||
{ deep: true },
|
{ deep: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
// При смене месяца через кнопки навигации
|
|
||||||
const observer = new MutationObserver((mutations) => {
|
|
||||||
mutations.forEach((mutation) => {
|
|
||||||
if (mutation.type === 'childList') {
|
|
||||||
updateCalendarDays();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
loadCalendars();
|
||||||
|
updateCalendarDays();
|
||||||
// Наблюдаем за изменениями в DOM date-picker
|
// Наблюдаем за изменениями в DOM date-picker
|
||||||
const datePicker = document.querySelector('.minCal');
|
const datePicker = document.querySelector('.minCal');
|
||||||
if (datePicker) {
|
if (datePicker) {
|
||||||
|
observer = new MutationObserver(() => updateCalendarDays());
|
||||||
observer.observe(datePicker, { childList: true, subtree: true });
|
observer.observe(datePicker, { childList: true, subtree: true });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
observer?.disconnect();
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accountStore,
|
accountStore,
|
||||||
|
calendarStore,
|
||||||
user,
|
user,
|
||||||
myCalendars,
|
myCalendars,
|
||||||
subscribedCalendars,
|
subscribedCalendars,
|
||||||
@@ -225,16 +214,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* .minCal:deep(.v-date-picker-month__days) {
|
.minCal .v-date-picker-month__day {
|
||||||
display: grid !important;
|
|
||||||
grid-template-columns: repeat(7, 40px) !important;
|
|
||||||
gap: 3px !important;
|
|
||||||
width: 250px !important;
|
|
||||||
justify-content: center !important;
|
|
||||||
margin: 0 auto !important;
|
|
||||||
} */
|
|
||||||
|
|
||||||
.minCal .v-date-picker-monWth__day {
|
|
||||||
height: 31px;
|
height: 31px;
|
||||||
width: 31px;
|
width: 31px;
|
||||||
}
|
}
|
||||||
@@ -255,23 +235,24 @@ export default {
|
|||||||
/* СТИЛИ ДЛЯ ВЫХОДНЫХ И ПРАЗДНИКОВ */
|
/* СТИЛИ ДЛЯ ВЫХОДНЫХ И ПРАЗДНИКОВ */
|
||||||
|
|
||||||
.minCal:deep(.weekend-day .v-btn__content) {
|
.minCal:deep(.weekend-day .v-btn__content) {
|
||||||
color: #666 !important;
|
color: rgb(var(--v-theme-weekend_text)) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.minCal:deep(.holiday-day .v-btn__content) {
|
.minCal:deep(.holiday-day .v-btn__content) {
|
||||||
color: #ff4444 !important;
|
color: rgb(var(--v-theme-holiday_text)) !important;
|
||||||
font-weight: bold !important;
|
font-weight: 600 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.minCal:deep(.weekend-day.holiday-day) {
|
.minCal:deep(.weekend-day.holiday-day) .v-btn {
|
||||||
background-color: #ffe0e0 !important;
|
background-color: rgba(var(--v-theme-holiday_text), 0.12) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.minCal:deep(.weekend-day.holiday-day .v-btn__content) {
|
.minCal:deep(.weekend-day.holiday-day .v-btn__content) {
|
||||||
color: #cc0000 !important;
|
color: rgb(var(--v-theme-holiday_text)) !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
search-dropdown {
|
.search-dropdown {
|
||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<v-btn @click="f_feedbackdata"> ical</v-btn>
|
<v-btn @click="f_feedbackdata"> ical</v-btn>
|
||||||
|
|
||||||
@@ -23,13 +23,11 @@ import { axiosApiInstance } from "@/utils/axios-api";
|
|||||||
import { ref, onMounted } from "vue";
|
import { ref, onMounted } from "vue";
|
||||||
|
|
||||||
import ical from "ical.js";
|
import ical from "ical.js";
|
||||||
import { useWeekendsStore } from '@/store/WeekendsStore'
|
|
||||||
|
|
||||||
// const burl = baseURL.slice(0, -1);
|
// const burl = baseURL.slice(0, -1);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const week= useWeekendsStore()
|
|
||||||
const drawer_right = ref(false);
|
const drawer_right = ref(false);
|
||||||
const cal = ref(null)
|
const cal = ref(null)
|
||||||
const participant = ref("");
|
const participant = ref("");
|
||||||
@@ -42,15 +40,15 @@ export default {
|
|||||||
|
|
||||||
|
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
|
|
||||||
cal.value.$el.querySelectorAll(".v-date-picker-month__day").forEach((e)=>{
|
cal.value.$el.querySelectorAll(".v-date-picker-month__day").forEach((e)=>{
|
||||||
if (hol.includes(e.getAttribute("data-v-date"))) {
|
if (hol.includes(e.getAttribute("data-v-date"))) {
|
||||||
e.querySelectorAll("span").forEach(n=>{n.classList.add("text-red")})
|
e.querySelectorAll("span").forEach(n=>{n.classList.add("text-red")})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function f_feedbackdata() {
|
function f_feedbackdata() {
|
||||||
@@ -59,7 +57,7 @@ export default {
|
|||||||
participants: participant.value,
|
participants: participant.value,
|
||||||
calendar: calendar.value,
|
calendar: calendar.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleFilesUpload = (event) => {
|
const handleFilesUpload = (event) => {
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
|||||||
const currentView = ref('dayGridMonth'); // Текущий вид календаря
|
const currentView = ref('dayGridMonth'); // Текущий вид календаря
|
||||||
const calendars = ref([]); // Список календарей пользователя
|
const calendars = ref([]); // Список календарей пользователя
|
||||||
const lastUpdatedBy = ref(null);
|
const lastUpdatedBy = ref(null);
|
||||||
const holidays = ref([]);
|
const holidays = ref({});
|
||||||
|
const loadingYears = ref(new Set());
|
||||||
const dictEmployees = ref([]);
|
const dictEmployees = ref([]);
|
||||||
const dictEmployeesLoaded = ref(false);
|
const dictEmployeesLoaded = ref(false);
|
||||||
const employees = ref([]);
|
const employees = ref([]);
|
||||||
@@ -43,7 +44,6 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const subscribedCalendars = computed(() => {
|
const subscribedCalendars = computed(() => {
|
||||||
const userId = accountStore.user.is_idEmployee;
|
const userId = accountStore.user.is_idEmployee;
|
||||||
|
|
||||||
@@ -175,66 +175,47 @@ export const useCalendarStore = defineStore('calendarStore', () => {
|
|||||||
return editableEvents.value.some((e) => e.id === id);
|
return editableEvents.value.some((e) => e.id === id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchHolidays = async (year) => {
|
const fetchHolidays = async (year) => {
|
||||||
try {
|
if (holidays.value[year] || loadingYears.value.has(year)) {
|
||||||
const response = await axiosApiInstance.get(
|
return holidays.value[year];
|
||||||
`api/calendar_of_events/exclusion_dates/?year=${year}`,
|
}
|
||||||
);
|
loadingYears.value.add(year);
|
||||||
holidays.value = response.data;
|
try {
|
||||||
return holidays.value;
|
const { data } = await axiosApiInstance.get(
|
||||||
} catch (err) {
|
`api/calendar_of_events/exclusion_dates/?year=${year}`,
|
||||||
console.error('Ошибка загрузки праздников:', err);
|
);
|
||||||
throw err;
|
holidays.value = { ...holidays.value, ...data };
|
||||||
}
|
return holidays.value[year];
|
||||||
};
|
} catch (err) {
|
||||||
|
console.error('Ошибка загрузки праздников:', err);
|
||||||
|
throw err;
|
||||||
|
} finally {
|
||||||
|
loadingYears.value.delete(year);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Метод для проверки, является ли день выходным или праздничным
|
// Метод для проверки, является ли день выходным или праздничным
|
||||||
const isNonWorkingDay = (dateInput) => {
|
const isNonWorkingDay = (dateInput) => {
|
||||||
let date;
|
const date = dateInput instanceof Date ? dateInput : new Date(dateInput);
|
||||||
|
if (isNaN(date.getTime())) {
|
||||||
|
return { isNonWorking: false, isWeekendForStyling: false, isHoliday: false };
|
||||||
|
}
|
||||||
|
|
||||||
// Если входные данные — это строка в формате 'YYYY-MM-DD'
|
const year = date.getFullYear();
|
||||||
if (typeof dateInput === 'string') {
|
const month = date.getMonth() + 1;
|
||||||
date = new Date(dateInput);
|
const iso = `${year}-${String(month).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
|
||||||
}
|
|
||||||
// Если входные данные — это объект Date
|
|
||||||
else if (dateInput instanceof Date) {
|
|
||||||
date = new Date(dateInput);
|
|
||||||
}
|
|
||||||
// Если входные данные некорректны
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Проверяем, что дата корректна
|
const day = date.getDay();
|
||||||
if (isNaN(date.getTime())) {
|
const isWeekend = day === 0 || day === 6;
|
||||||
return false;
|
const isHoliday = (holidays.value[year]?.[month] ?? []).includes(iso);
|
||||||
}
|
|
||||||
|
|
||||||
const day = date.getDay();
|
return {
|
||||||
|
isNonWorking: isWeekend || isHoliday,
|
||||||
// Проверка на выходной (суббота или воскресенье)
|
isWeekendForStyling: isWeekend,
|
||||||
const isWeekend = day === 0 || day === 6;
|
isHoliday,
|
||||||
|
|
||||||
// Получаем год, месяц и день
|
|
||||||
const year = date.getFullYear();
|
|
||||||
const month = date.getMonth() + 1; // Месяцы в JS начинаются с 0
|
|
||||||
const dayOfMonth = date.getDate();
|
|
||||||
|
|
||||||
const normalizedCurrentDate = `${year}-${String(month).padStart(2, '0')}-${String(dayOfMonth).padStart(2, '0')}`;
|
|
||||||
// Проверяем, что данные о праздничных днях существуют для текущего года и месяца
|
|
||||||
const holidaysForYear = holidays.value[year] || {};
|
|
||||||
const holidaysForMonth = holidaysForYear[month] || [];
|
|
||||||
|
|
||||||
// Проверка на исключение (рабочая суббота или праздничный будний день)
|
|
||||||
const isExceptionDay = holidaysForMonth.includes(normalizedCurrentDate);
|
|
||||||
|
|
||||||
const result = {
|
|
||||||
isNonWorking: (isWeekend && !isExceptionDay) || (!isWeekend && isExceptionDay),
|
|
||||||
isWeekendForStyling: isWeekend && !isExceptionDay,
|
|
||||||
isHoliday: !isWeekend && isExceptionDay,
|
|
||||||
};
|
|
||||||
return result;
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
// Открыть диалог создания/редактирования
|
// Открыть диалог создания/редактирования
|
||||||
const openEventDialog = (event = null) => {
|
const openEventDialog = (event = null) => {
|
||||||
|
|||||||
Reference in new issue
Block a user