diff --git a/src/front/src/components/UI/defaultportal/uploading-file.vue b/src/front/src/components/UI/defaultportal/uploading-file.vue index 957dba600..16cb4124b 100644 --- a/src/front/src/components/UI/defaultportal/uploading-file.vue +++ b/src/front/src/components/UI/defaultportal/uploading-file.vue @@ -1,151 +1,226 @@ - - - - {{ fileName }} - + - - +{{ files.length - 4 }} файла(ов) - + + + mdi-file-plus + + {{ file.name }}({{ formatFileSize(file.size) }}) + + + + - + + + Прикрепленный файл: + + + + {{ getFileIcon(file) }} + {{ getFileName(file) }} + + + + Файлов нет + + + - + diff --git a/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue b/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue index 67fd5f634..74647aa70 100644 --- a/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue +++ b/src/front/src/components/calendar_of_events/UI_calendar/CustomCalendar.vue @@ -483,7 +483,13 @@ export default { :deep(.fc-highlight) { background-color: transparent !important; } +:deep(.fc-day) { + cursor: pointer; +} +:deep(.fc-popover) { + background-color: rgb(248, 244, 244) !important; +} /* :deep(.fc-daygrid-day-frame) { position: relative; min-height: 50px; diff --git a/src/front/src/components/calendar_of_events/UI_calendar/HomeCalendarWidget.vue b/src/front/src/components/calendar_of_events/UI_calendar/HomeCalendarWidget.vue new file mode 100644 index 000000000..5f3829724 --- /dev/null +++ b/src/front/src/components/calendar_of_events/UI_calendar/HomeCalendarWidget.vue @@ -0,0 +1,487 @@ + + + + + + + + + mdi-chevron-left + + {{ currentMonth }} + + mdi-chevron-right + + + + + + + + {{ day }} + + + + + + + + {{ day.day }} + + + + + + + + + + + + + + {{ formattedSelectedDate }} + + Сегодня + + + + + + + + mdi-circle-small + + + + {{ formatTime(event.start) }} + + + {{ event.title }} + + + + + + На этот день событий нет + + + + + + + + + + + + + diff --git a/src/front/src/components/calendar_of_events/event-create.vue b/src/front/src/components/calendar_of_events/event-create.vue index 5fcaec4b2..9936a2f35 100644 --- a/src/front/src/components/calendar_of_events/event-create.vue +++ b/src/front/src/components/calendar_of_events/event-create.vue @@ -153,8 +153,8 @@ - - Файлы + + Файлы { return props.eventCalendar; @@ -278,6 +277,7 @@ export default { ]; const selectedRule = ref(repeatRules[0]); + // Инициализация при редактировании const initializeRule = () => { if (!propsEvent.value.event.period) { @@ -292,7 +292,6 @@ export default { (rule) => rule.rule?.freq === periodData.origOptions.freq, ); selectedRule.value = foundRule || repeatRules[0]; - console.log('Initialized rule:', foundRule); // для дебага } } catch (error) { console.error('Error parsing period:', error, 'Raw period:', propsEvent.value.event.period); @@ -313,7 +312,6 @@ export default { const isNewEvent = computed(() => !propsEvent.value.event.hasOwnProperty('id')); const myCalendar = ref(null); - // const isNewEvent = computed(() => !propsEvent.value.event.id); // Computed property с защитой от undefined const safeCalendars = computed(() => props.myCalendars || []); @@ -334,10 +332,7 @@ export default { const isNewEvent = !newEvent.event.id; - if (isNewEvent) { - // НОВОЕ СОБЫТИЕ - первый календарь из списка или календарь по умолчанию - myCalendar.value = safeCalendars.value[0]; - } else { + if (!isNewEvent) { // РЕДАКТИРОВАНИЕ - календарь из события const eventCalendar = safeCalendars.value.find( (cal) => cal.id === newEvent.event.calendar, @@ -442,8 +437,12 @@ export default { }; const files = ref([]); - const postFiles = (f) => { - files.value = f; + + const postFiles = (newFiles) => { + files.value = newFiles; + + const updatedFiles = [...propsEvent.value.event.files, ...newFiles]; + propsEvent.value.event.files = updatedFiles; }; const returnIdParticant = (idPart) => { @@ -481,11 +480,13 @@ export default { propsEvent.value.event.calendar = myCalendar.value.id; let postEvent = new FormData(); - postEvent.append('event', JSON.stringify({ ...propsEvent.value.event })); + postEvent.append('event', JSON.stringify({ ...propsEvent.value.event, files: [] })); if (propsEvent.value.event.files !== null) { files.value.forEach((e) => postEvent.append('files', e)); } + console.log(postEvent); + axiosApiInstance.post('api/calendar_of_events/my_events/', postEvent).then((result) => { feedalert.alert = true; feedalert.text = result.data.mess; @@ -565,6 +566,7 @@ export default { selectedRule, updateDateEnd, updateDateStart, + initializeRule, createDialog, }; diff --git a/src/front/src/store/calendarStore.js b/src/front/src/store/calendarStore.js index 5a958460e..014919c49 100644 --- a/src/front/src/store/calendarStore.js +++ b/src/front/src/store/calendarStore.js @@ -21,15 +21,39 @@ export const useCalendarStore = defineStore('calendarStore', () => { // Getters const formattedSelectedDate = computed(() => selectedDate.value.toISOString().split('T')[0]); - const myCalendars = computed(() => - calendars.value - .filter((e) => e.author === accountStore.user.is_idEmployee) - .map((calendar) => ({ + // const myCalendars = computed(() => + // calendars.value + // .filter((e) => e.author === accountStore.user.is_idEmployee) + // .map((calendar) => ({ + // ...calendar, + // // Видимый, если его нет в массиве скрытых + // visible: !hiddenCalendarIds.value.includes(calendar.id), + // })), + // ); + const myCalendars = computed(() => { + const userId = accountStore.user.is_idEmployee; + + return calendars.value + .map((calendar) => { + const isAuthor = calendar.author === userId; + const participant = calendar.participant.find((p) => p.participant_calendar === userId); + const isEditor = participant?.editor === true; + + return { + calendar, + isAuthor, + isEditor, + hasAccess: isAuthor || isEditor, + }; + }) + .filter(({ hasAccess }) => hasAccess) + .map(({ calendar, isAuthor, isEditor }) => ({ ...calendar, - // Видимый, если его нет в массиве скрытых + isAuthor, + isEditor, visible: !hiddenCalendarIds.value.includes(calendar.id), - })), - ); + })); + }); const subscribedCalendars = computed(() => calendars.value @@ -130,20 +154,6 @@ export const useCalendarStore = defineStore('calendarStore', () => { }); }); - // Календари, где пользователь имеет права редактора - const editableCalendars = computed(() => { - return myCalendars.value - .filter((calendar) => { - if (calendar.author == accountStore.user.is_idEmployee) return true; - - const participant = calendar.participant.find( - (p) => p.participant_calendar === accountStore.user.is_idEmployee, - ); - return participant?.editor == true; - }) - .map((calendar) => calendar.id); - }); - const canEditEvent = (eventId) => { const id = Number(eventId); @@ -180,7 +190,7 @@ export const useCalendarStore = defineStore('calendarStore', () => { eventsForSelectedDate, visibleCalendars, allEvents, - editableCalendars, + editableEvents, canEditEvent, diff --git a/src/front/src/views/HomePage.vue b/src/front/src/views/HomePage.vue index 6aaee70c8..5844b9d41 100644 --- a/src/front/src/views/HomePage.vue +++ b/src/front/src/views/HomePage.vue @@ -7,14 +7,15 @@ - - + @@ -82,18 +83,15 @@ import NewsHome from '@/components/news-home.vue'; import DigitalLetna from '@/components/digital-letna.vue'; import { axiosApiInstance } from '@/utils/axios-api'; -import CustomCalendar from '../components/calendar_of_events/UI_calendar/CustomCalendar.vue'; +import HomeCalendarWidget from '@/components/calendar_of_events/UI_calendar/HomeCalendarWidget.vue'; import { useCalendarStore } from '@/store/calendarStore'; export default { components: { CarouselList, - DigitalLetna, - NewsHome, - - CustomCalendar, + HomeCalendarWidget, }, setup() { @@ -106,8 +104,8 @@ export default { pagecounter(); - const fetchMyCalendars = () => { - calendarStore.loadCalendars(); + const fetchMyCalendars = () => { + calendarStore.loadCalendars(); }; onMounted(() => { @@ -182,41 +180,4 @@ export default { color: #222 !important; font-family: 'Montserrat', 'Arial', sans-serif; } - -.mini-calendar { - // max-width: 100%; - width: 100%; - font-size: 12px; - display: flex; - flex-direction: column; -} - -.mini-calendar :deep(.fc-day) { - height: 8px !important; - // width: 10px !important; -} - -.mini-calendar :deep(.fc-event) { - font-size: 0.8em; - padding: 0 1px; - margin: 1px 0; - flex: 0 0 auto; - height: 250px; -} - -.mini-calendar :deep(.fc-daygrid-day-number) { - font-size: 1em; - padding: 2px; -} - -.mini-calendar :deep(.fc) { - width: 100% !important; - max-height: 320px !important; -} - -.mini-calendar :deep(.fc .fc-daygrid-week-number) { - background-color: transparent !important; - border: none !important; - color: transparent !important; -}