+
mdi-chevron-right
-
+
{{ currentTitle }}
@@ -62,12 +62,12 @@
variant="plain"
density="comfortable"
>
-
День
-
Неделя
-
Месяц
-
Год
-
Расписание
-
Все события
+
День
+
Неделя
+
Месяц
+
Год
+
Расписание
+
Все события
@@ -107,17 +107,13 @@ import { useEventListFilters } from '../composables/useEventListFilters';
export default {
name: 'CustomCalendar',
+
+ emits: ['openEventDialog', 'openEventView'],
components: {
EventsListView,
EventListFilters,
},
-
- props: {
- forHomePage: { type: Boolean, default: false },
- view: { type: String, default: 'dayGridMonth' },
- },
-
- setup(props) {
+ setup(props, { emit }) {
const currentView = ref('dayGridMonth');
const currentTitle = ref('Календарь');
const calendarRef = ref(null);
@@ -140,7 +136,11 @@ export default {
}));
const handleEventClick = (info) => {
- calendarStore.handleEventClick(info);
+ if (calendarStore.canEditEvent(info.event.id)) {
+ emit('openEventDialog', info);
+ } else {
+ emit('openEventView', info.event.id);
+ }
};
const calendarOptions = ref({
@@ -155,13 +155,13 @@ export default {
initialView: props.forHomePage ? props.view : currentView.value,
locales: [ruLocale],
locale: 'ru',
- timeZone: 'Europe/Moscow',
+ timeZone: 'locale',
firstDay: 1,
headerToolbar: false,
height: '80vh',
aspectRatio: 1.5,
weekNumbers: true,
- eventDisplay: 'auto',
+ eventDisplay: 'block',
eventTimeFormat: {
hour: '2-digit',
minute: '2-digit',
@@ -175,21 +175,19 @@ export default {
selectable: true,
unselectAuto: false,
selectMirror: false,
- dayCellClassNames: (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;
- },
- 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;
- },
+ dayCellDidMount: (arg) => {
+ const date = arg.date;
+ const dayInfo = calendarStore.isNonWorkingDay(date);
+
+ if (dayInfo.isHoliday === true) {
+ arg.el.classList.add('non-working-day');
+ }
+
+ if (dayInfo.isWeekendForStyling === true) {
+ arg.el.classList.add('grey-background');
+ }
+ },
views: {
timeGridDay: {
type: 'timeGrid',
@@ -279,7 +277,7 @@ export default {
title: instance.title,
start: instance.start,
end: instance.end,
- allDay: instance.allDay,
+ allDay: instance.allday || isMultiDay,
textColor: '#ffffff',
backgroundColor: eventColor,
borderColor: eventColor,
@@ -289,12 +287,21 @@ export default {
},
}));
} else {
+ let end = event.date_end;
+
+ if (event.allday) {
+ // Для allDay: просто добавляем 1 день к конечной дате
+ const endDate = new Date(event.date_end);
+ endDate.setDate(endDate.getDate() + 1);
+ end = endDate.toISOString();
+ }
+
return [
{
id: event.id,
title: event.name,
start: event.date_start,
- end: event.date_end,
+ end: end,
allDay: event.allday,
textColor: '#ffffff',
backgroundColor: eventColor,
@@ -314,6 +321,7 @@ export default {
successCallback(events);
},
+ selectable: true,
eventClick: handleEventClick,
dateClick: (info) => {
@@ -325,8 +333,18 @@ export default {
datesSet: (info) => {
if (info.view.type === 'listWeek' && selectedDate.value) {
- currentTitle.value = formatScheduleTitle(selectedDate.value);
- } else if (info.view.type !== 'listWeek') {
+ const date = new Date(selectedDate.value);
+
+ 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;
}
@@ -386,47 +404,6 @@ export default {
selectedDate.value = dateStr;
};
- 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();
calendarStore.fetchHolidays(currentYear);
@@ -434,34 +411,32 @@ export default {
await nextTick();
// Принудительно обновляем события после загрузки праздников
- if (calendarApi.value && currentView.value !== 'listAllEvents') {
+ if (calendarApi.value) {
calendarApi.value.refetchEvents();
}
- if (selectedDate.value && currentView.value !== 'listAllEvents') {
+ if (selectedDate.value) {
handleDateSelection(selectedDate.value);
}
});
- watch(currentView, (newView) => {
- applyView(newView);
- });
-
watch(
allEvents,
() => {
// При изменении событий перезагружаем календарь
- if (currentView.value === 'listAllEvents') return;
- calendarApi.value?.refetchEvents();
+ if (calendarApi.value) {
+ calendarApi.value.refetchEvents();
+ }
},
{ deep: true },
);
watch(
calendarColorMap,
- () => {
- if (currentView.value === 'listAllEvents') return;
- calendarApi.value?.refetchEvents();
+ (newColorMap, oldColorMap) => {
+ if (calendarRef.value && JSON.stringify(newColorMap) !== JSON.stringify(oldColorMap)) {
+ renderEvents();
+ }
},
{ deep: true },
);
@@ -475,6 +450,15 @@ 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) => {
Object.keys(newFilters).forEach((key) => {
if (filters[key] !== undefined) {
@@ -529,7 +513,7 @@ export default {
:deep(.fc-day-today .fc-daygrid-day-number) {
position: relative;
z-index: 1;
- color: rgb(var(--v-theme-btn_text));
+ color: #00897b;
&::before {
content: '';
@@ -539,7 +523,7 @@ export default {
transform: translate(-50%, -50%);
width: 32px;
height: 32px;
- border: 1px solid rgb(var(--v-theme-btn_text));
+ border: 1px solid #00897b;
border-radius: 50%;
z-index: -1;
}
@@ -554,7 +538,7 @@ export default {
:deep(.fc-day-selected-custom .fc-daygrid-day-number) {
position: relative;
z-index: 1;
- color: rgb(var(--v-theme-bg_white)) !important;
+ color: white !important;
}
:deep(.fc-day-selected-custom .fc-daygrid-day-number::before) {
@@ -565,7 +549,7 @@ export default {
transform: translate(-50%, -50%);
width: 32px;
height: 32px;
- background-color: rgb(var(--v-theme-btn_text));
+ background-color: #00897b;
border-radius: 50%;
z-index: -1;
}
@@ -580,16 +564,11 @@ export default {
:deep(.v-btn--active) {
background-color: transparent !important;
- color: rgb(var(--v-theme-btn_text)) !important;
+ color: #00897b !important;
}
:deep(.fc .fc-timegrid-col.fc-day-today) {
- 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;
+ background-color: #e0f2f1 !important;
}
:deep(.fc-highlight) {
@@ -601,32 +580,27 @@ export default {
}
:deep(.fc-popover) {
- background-color: rgb(var(--v-theme-cards)) !important;
+ background-color: rgb(248, 244, 244) !important;
}
-:deep(.fc-day.non-working-day .fc-daygrid-day-number),
-:deep(.fc-day.non-working-day .fc-daygrid-day-top) {
- color: rgb(var(--v-theme-holiday_text)) !important;
+.non-working-day {
+ color: red !important;
}
-:deep(.fc-col-header-cell.non-working-day),
-: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.non-working-day .fc-daygrid-day-number) {
+ color: #d32f2f !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-daygrid-day),
:deep(.fc-day.grey-background) {
- 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;
+ background-color: #f5f5f5 !important;
}
.custom-calendar {
diff --git a/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue b/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue
index d66bddd1e..a02160d27 100644
--- a/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue
+++ b/src/front/src/components/calendar_of_events/UI_calendar/periodEvents.vue
@@ -13,56 +13,31 @@ import { computed } from 'vue';
export default {
props: {
- dateEvent: {
+ dateEventStart: {
type: Object,
default: () => {},
},
},
setup(props, { emit }) {
- // const newDate = computed({
- // get() {
- // return propsDateEvent.value.allday;
- // },
- // set(newValue) {
- // propsDateEvent.value.allday = newValue;
- // if (newValue === true)
- // (propsDateEvent.value.date_end = new Date(
- // new Date(propsDateEvent.value.date_end).setHours(23, 59, 59),
- // )) &&
- // (propsDateEvent.value.date_start = new Date(
- // new Date(propsDateEvent.value.date_start).setHours(0, 0, 0),
- // ));
- // },
- // });
-
const newDate = computed({
get() {
return propsDateEvent.value.allday;
},
set(newValue) {
propsDateEvent.value.allday = newValue;
-
- const startDate = new Date(propsDateEvent.value.date_start);
- const endDate = new Date(propsDateEvent.value.date_end);
-
- if (newValue === true) {
- // Весь день: 00:00 - 23:59
- startDate.setHours(0, 0, 0, 0);
- endDate.setHours(23, 59, 59, 999);
- } else {
- // Рабочие часы: 09:00 - 17:00
- startDate.setHours(9, 0, 0, 0);
- endDate.setHours(17, 0, 0, 0);
- }
-
- propsDateEvent.value.date_start = startDate.toISOString();
- propsDateEvent.value.date_end = endDate.toISOString();
+ if (newValue === true)
+ (propsDateEvent.value.date_end = new Date(
+ new Date(propsDateEvent.value.date_end).setHours(23, 59, 59),
+ )) &&
+ (propsDateEvent.value.date_start = new Date(
+ new Date(propsDateEvent.value.date_start).setHours(0, 0, 0),
+ ));
},
});
const propsDateEvent = computed({
- get: () => props.dateEvent,
- set: (value) => emit('update:dateEvent', value),
+ get: () => props.dateEventStart,
+ set: (value) => emit('update:dateEventStart', value),
});
return {
diff --git a/src/front/src/components/calendar_of_events/composables/useReccurrence.js b/src/front/src/components/calendar_of_events/composables/useReccurrence.js
index 2b1c45484..7d37ff134 100644
--- a/src/front/src/components/calendar_of_events/composables/useReccurrence.js
+++ b/src/front/src/components/calendar_of_events/composables/useReccurrence.js
@@ -8,18 +8,9 @@ export function useRecurrence() {
// Пробуем распарсить как RRULE-строку
if (periodString.includes('RRULE:')) {
const rrule = RRule.fromString(periodString);
- const start = new Date(eventDateStart);
- const localDtstart = new Date(
- start.getFullYear(),
- start.getMonth(),
- start.getDate(),
- start.getHours(),
- start.getMinutes(),
- start.getSeconds(),
- );
return {
...rrule.origOptions,
- dtstart: localDtstart,
+ dtstart: new Date(eventDateStart),
interval: rrule.origOptions.interval || 1,
};
}
@@ -71,14 +62,15 @@ export function useRecurrence() {
if (!rrule) return [event];
const dates = rrule.all((date, i) => i < count);
+ const start = new Date(event.date_start);
+ const end = new Date(event.date_end);
+ const duration = end - start;
- const duration = new Date(event.date_end) - new Date(event.date_start);
-
- return dates.map((date) => ({
+ return dates.map((date, index) => ({
id: event.id,
title: event.name,
start: date,
- end: date.getTime() + duration,
+ end: (date.getTime() + duration),
allDay: event.allday,
extendedProps: {
originalEventId: event.id,
diff --git a/src/front/src/components/calendar_of_events/event-create.vue b/src/front/src/components/calendar_of_events/event-create.vue
new file mode 100644
index 000000000..9dca2d6ef
--- /dev/null
+++ b/src/front/src/components/calendar_of_events/event-create.vue
@@ -0,0 +1,767 @@
+
+
+
+
+
+
+ Название
+
+
+
+
+
+ Участники
+
+
+
+
+ Календарь
+
+
+
+
+
+ {{ item.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Дата и время
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Окончание события
+
+
+
+
+
+
+
+
+ Файлы
+
+
+
+
+
+
+
+
+
+
+
+
+
+