{
+ calendarStore.handleEventClick({ event: { id: event.id } });
+ };
+
onMounted(async () => {
selectedDate.value = formatToLocalDate(new Date());
await calendarStore.fetchHolidays(currentYear);
@@ -381,6 +386,7 @@ export default {
allEvents,
expandMultiDayInstance,
formatForWidget,
+ handleEventClick,
};
},
};
@@ -455,19 +461,6 @@ export default {
opacity: 0.5;
}
-.day-cell.today {
- background-color: rgba(var(--v-theme-primary), 0.15);
-}
-
-.day-cell.selected {
- background-color: rgb(var(--v-theme-btn_text));
- color: rgb(var(--v-theme-bg_white));
-}
-
-.day-cell.selected .day-number {
- color: rgb(var(--v-theme-bg_white));
-}
-
.day-content {
display: flex;
flex-direction: column;
@@ -547,7 +540,6 @@ export default {
.event-time {
font-size: 0.8rem;
font-weight: 600;
- color: #302f2f;
color: rgb(var(--v-theme-text_carous));
margin-bottom: 2px;
}
@@ -573,17 +565,17 @@ export default {
}
.day-schedule::-webkit-scrollbar-track {
- background: #f1f1f1;
+ background: rgba(var(--v-theme-on-surface), 0.05);
border-radius: 0 8px 8px 0;
}
.day-schedule::-webkit-scrollbar-thumb {
- background: #c1c1c1;
+ background: rgba(var(--v-theme-on-surface), 0.25);
border-radius: 3px;
}
.day-schedule::-webkit-scrollbar-thumb:hover {
- background: #a8a8a8;
+ background: rgba(var(--v-theme-on-surface), 0.4);
}
.non-working-day {
@@ -598,4 +590,15 @@ export default {
.day-cell:not(.current-month).non-working-day {
color: inherit !important;
}
+
+.day-cell.selected,
+.day-cell.selected.grey-background,
+.day-cell.selected.non-working-day {
+ background-color: rgb(var(--v-theme-btn_text)) !important;
+ color: rgb(var(--v-theme-bg_white)) !important;
+}
+
+.day-cell.selected .day-number {
+ color: rgb(var(--v-theme-bg_white)) !important;
+}
diff --git a/src/front/src/components/calendar_of_events/calendar-create.vue b/src/front/src/components/calendar_of_events/calendar-create.vue
index 5bf43d0ba..4b0928fce 100644
--- a/src/front/src/components/calendar_of_events/calendar-create.vue
+++ b/src/front/src/components/calendar_of_events/calendar-create.vue
@@ -27,16 +27,10 @@
@@ -235,23 +229,6 @@ export default {
'#22c55e', // Зеленый
];
-// const color = [
-// '#3b82f6', // Синий
-// '#10b981', // Зеленый
-// '#dc2626', // Красный
-// '#d97706', // Оранжевый
-// '#7c3aed', // Фиолетовый
-// '#0ea5e9', // Голубой
-// '#84cc16', // Лаймовый
-// '#f59e0b', // Янтарный
-// '#8b5cf6', // Пурпурный
-// '#06b6d4', // Бирюзовый
-// '#f97316', // Теплый оранжевый
-// '#6366f1', // Фиолетово-синий
-// '#14b8a6', // Морской волны
-// '#ec4899', // Розовый
-// '#64748b', // Серо-синий
-// ];
const colorPik = (col) => {
if (propsCalendar.value.cl_color === col) {
propsCalendar.value.cl_color = null;
@@ -299,4 +276,13 @@ export default {
.custom-tooltip {
max-width: 350px; /* Установка максимальной ширины для подсказки */
}
+
+.avatar-dimmed {
+ opacity: 0.45;
+ transition: opacity 0.15s ease;
+}
+
+.avatar-dimmed:hover {
+ opacity: 0.8;
+}
diff --git a/src/front/src/components/calendar_of_events/event-create.vue b/src/front/src/components/calendar_of_events/event-create.vue
deleted file mode 100644
index 532d2d8f2..000000000
--- a/src/front/src/components/calendar_of_events/event-create.vue
+++ /dev/null
@@ -1,805 +0,0 @@
-
-
-
-
-
-
- Название
-
-
-
-
-
- Участники
-
-
-
-
- Календарь
-
-
-
-
-
- {{ item.title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
- Дата и время
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Повтор события
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Файлы
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/front/src/plugins/vuetify.js b/src/front/src/plugins/vuetify.js
index f6241c5df..75ddbdddb 100644
--- a/src/front/src/plugins/vuetify.js
+++ b/src/front/src/plugins/vuetify.js
@@ -77,7 +77,7 @@ export default createVuetify({
'on-background': '#FFFFFF',
'on-surface': '#FFFFFF',
'card-background': '#1E1E1E',
- weekend_text: '#EF5350',
+ weekend_text: '#EF5350',
holiday_text: '#FF5252',
weekend_bg: '#2A2A2A',
},
diff --git a/src/front/src/store/calendarStore.js b/src/front/src/store/calendarStore.js
index 7433f9da5..415b4b5f5 100644
--- a/src/front/src/store/calendarStore.js
+++ b/src/front/src/store/calendarStore.js
@@ -9,8 +9,6 @@ export const useCalendarStore = defineStore('calendarStore', () => {
// State
const selectedDate = ref(new Date());
const events = ref([]);
- const selectedEvent = ref(null);
- const showEventDialog = ref(false);
const currentView = ref('dayGridMonth'); // Текущий вид календаря
const calendars = ref([]); // Список календарей пользователя
const lastUpdatedBy = ref(null);
@@ -20,6 +18,11 @@ export const useCalendarStore = defineStore('calendarStore', () => {
const dictEmployeesLoaded = ref(false);
const employees = ref([]);
+ const selectedEvent = ref(null);
+ const showEventDialog = ref(false);
+ const selectedEventForView = ref(null);
+ const showViewDialog = ref(false);
+
// Массив ID скрытых календарей. Загружаем из localStorage при инициализации.
const hiddenCalendarIds = ref([]);
@@ -175,60 +178,141 @@ export const useCalendarStore = defineStore('calendarStore', () => {
return editableEvents.value.some((e) => e.id === id);
};
-const fetchHolidays = async (year) => {
- if (holidays.value[year] || loadingYears.value.has(year)) {
- return holidays.value[year];
- }
- loadingYears.value.add(year);
- try {
- const { data } = await axiosApiInstance.get(
- `api/calendar_of_events/exclusion_dates/?year=${year}`,
- );
- holidays.value = { ...holidays.value, ...data };
- return holidays.value[year];
- } catch (err) {
- console.error('Ошибка загрузки праздников:', err);
- throw err;
- } finally {
- loadingYears.value.delete(year);
- }
-};
-
+ const fetchHolidays = async (year) => {
+ if (holidays.value[year] || loadingYears.value.has(year)) {
+ return holidays.value[year];
+ }
+ loadingYears.value.add(year);
+ try {
+ const { data } = await axiosApiInstance.get(
+ `api/calendar_of_events/exclusion_dates/?year=${year}`,
+ );
+ 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 date = dateInput instanceof Date ? dateInput : new Date(dateInput);
- if (isNaN(date.getTime())) {
- return { isNonWorking: false, isWeekendForStyling: false, isHoliday: false };
- }
+ const isNonWorkingDay = (dateInput) => {
+ const date = dateInput instanceof Date ? dateInput : new Date(dateInput);
+ if (isNaN(date.getTime())) {
+ return { isNonWorking: false, isWeekendForStyling: false, isHoliday: false };
+ }
- const year = date.getFullYear();
- const month = date.getMonth() + 1;
- const iso = `${year}-${String(month).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
+ const year = date.getFullYear();
+ const month = date.getMonth() + 1;
+ const iso = `${year}-${String(month).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`;
- const day = date.getDay();
- const isWeekend = day === 0 || day === 6;
- const isHoliday = (holidays.value[year]?.[month] ?? []).includes(iso);
+ const day = date.getDay();
+ const isWeekend = day === 0 || day === 6;
+ const isHoliday = (holidays.value[year]?.[month] ?? []).includes(iso);
- return {
- isNonWorking: isWeekend || isHoliday,
- isWeekendForStyling: isWeekend,
- isHoliday,
+ return {
+ isNonWorking: isWeekend || isHoliday,
+ isWeekendForStyling: isWeekend,
+ isHoliday,
+ };
+ };
+
+ const setSelectedEvent = (event) => {
+ selectedEvent.value = event;
+ };
+
+ // Шаблон пустого события (создание)
+ const getEmptyEventWrapper = () => {
+ const now = new Date();
+ const inHour = new Date(now.getTime() + 60 * 60 * 1000);
+ return {
+ event: {
+ name: '',
+ description: '',
+ date_start: now.toISOString(),
+ date_end: inHour.toISOString(),
+ allday: false,
+ period: null,
+ participant: [accountStore.user.is_idEmployee],
+ calendar: null,
+ files: [],
+ },
+ mycalendars: calendars.value,
+ };
+ };
+
+ // Шаблон обёртки для редактирования
+ const buildEventWrapper = (fullEvent) => {
+ return {
+ event: {
+ ...fullEvent,
+ participant: Array.isArray(fullEvent.participant)
+ ? fullEvent.participant.map((p) => (typeof p === 'object' ? p.id : p))
+ : [],
+ },
+ mycalendars: calendars.value,
+ };
};
-};
// Открыть диалог создания/редактирования
- const openEventDialog = (event = null) => {
- selectedEvent.value = event;
- showEventDialog.value = true;
+ const openEventDialog = async (eventOrInfo = null) => {
+ if (eventOrInfo === null) {
+ selectedEvent.value = getEmptyEventWrapper();
+ showEventDialog.value = true;
+ return;
+ }
+
+ const id = eventOrInfo?.event?.id ?? eventOrInfo?.id;
+ if (!id) {
+ selectedEvent.value = getEmptyEventWrapper();
+ showEventDialog.value = true;
+ return;
+ }
+
+ try {
+ const { data } = await axiosApiInstance.get(`api/calendar_of_events/my_events/?id=${id}`);
+ selectedEvent.value = data;
+ showEventDialog.value = true;
+ } catch (error) {
+ console.error('Ошибка загрузки события:', error);
+ }
};
- // Закрыть диалог
const closeEventDialog = () => {
showEventDialog.value = false;
selectedEvent.value = null;
};
+ const openEventView = async (eventId) => {
+ if (!eventId) return;
+
+ try {
+ const { data } = await axiosApiInstance.get(
+ `api/calendar_of_events/my_events/?id=${eventId}`,
+ );
+ selectedEventForView.value = data;
+ showViewDialog.value = true;
+ } catch (error) {
+ console.error('Ошибка загрузки события:', error);
+ }
+ };
+
+ const closeEventView = () => {
+ showViewDialog.value = false;
+ selectedEventForView.value = null;
+ };
+
+ const handleEventClick = (info) => {
+ const id = info.event?.id ?? info.id;
+ if (canEditEvent(id)) {
+ openEventDialog(info);
+ } else {
+ openEventView(id);
+ }
+ };
+
return {
// State
selectedDate,
@@ -262,6 +346,9 @@ const isNonWorkingDay = (dateInput) => {
loadCalendars,
openEventDialog,
closeEventDialog,
+ openEventView,
+ closeEventView,
+ handleEventClick,
setSelectedDateFromCalendar,
setSelectedDateFromPicker,
toggleCalendarVisibility,
@@ -269,5 +356,9 @@ const isNonWorkingDay = (dateInput) => {
isNonWorkingDay,
loadDictEmployees,
loadEmployees,
+ setSelectedEvent,
+
+ getEmptyEventWrapper,
+ buildEventWrapper,
};
});