diff --git a/src/front/src/components/UI/defaultportal/uploading-file.vue b/src/front/src/components/UI/defaultportal/uploading-file.vue index 79589b296..957dba600 100644 --- a/src/front/src/components/UI/defaultportal/uploading-file.vue +++ b/src/front/src/components/UI/defaultportal/uploading-file.vue @@ -55,9 +55,10 @@ export default { const eventFiles = computed({ get() { + if (!props.value) return [] propsFiles.value.forEach((e) => { - + arrFiles.value.push( dataURLtoFile( "data:text/plain;base64,aGVsbG8gd29ybGQ=", @@ -82,8 +83,8 @@ export default { } emit("postFiles", newFile); - - + + }, }); // @@ -101,8 +102,8 @@ export default { return new File([u8arr], filename, { type: mime }); } - - + + // const eventFiles = computed({ // get() { // if (propsFiles.value.length > 0) { @@ -141,7 +142,7 @@ export default { return { eventFiles, arrFiles, - + }; }, }; diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue index 75b09613a..ce089347f 100644 --- a/src/front/src/components/calendar_of_events/BigCalendar.vue +++ b/src/front/src/components/calendar_of_events/BigCalendar.vue @@ -4,7 +4,7 @@ - + @@ -65,33 +65,64 @@ export default { calendarStore.loadCalendars(); }; - const getEvents = (idEvent, clik) => { - axiosApiInstance - .get(`api/calendar_of_events/my_events/${idEvent === undefined ? '' : `?id=${idEvent}`}`) - .then((res) => { - if (idEvent === undefined) { - res.data.event = { - name: '', - participant: [accountStore.user.is_idEmployee], - files: [], - date_start: new Date(), - date_end: new Date(), - period: null, - description: '', - calendar: null, - }; - } + // const getEvent = (idEvent) => { + // axiosApiInstance + // .get(`api/calendar_of_events/my_events/${idEvent === undefined ? '' : `?id=${idEvent}`}`) + // .then((res) => { + // if (idEvent === undefined) { + // res.data.event = { + // name: '', + // participant: [accountStore.user.is_idEmployee], + // files: [], + // date_start: new Date(), + // date_end: new Date(), + // period: null, + // description: '', + // calendar: null, + // }; + // } + // eventFromCalendar.value = res.data; + // }); + // }; + + const getEvent = (idEvent) => { + if (!idEvent) { + eventFromCalendar.value = createEmptyEvent(); + return; + } else { + axiosApiInstance.get(`api/calendar_of_events/my_events/?id=${idEvent}`).then((res) => { eventFromCalendar.value = res.data; + calendarStore.openEventDialog(); }); + } }; - onMounted(() => { - getEvents(); + const createEmptyEvent = () => ({ + event: { + name: '', + participant: [accountStore.user.is_idEmployee], + files: [], + date_start: new Date(), + date_end: new Date(), + period: null, + description: '', + calendar: null, + }, + }); + + const openEventDialog = (selectedEvent) => { + getEvent(selectedEvent.event.id); + calendarStore.openEventDialog(); + }; + + onMounted(() => { + getEvent(); week.getWeekend(MyYear.value); }); const closeEventDialog = () => { calendarStore.closeEventDialog(); + eventFromCalendar.value = createEmptyEvent(); // Очищаем событие }; const CheckingStore = () => { @@ -102,7 +133,7 @@ export default { } }; - return { + return { selectedDate, getMonth, getYear, @@ -111,11 +142,13 @@ export default { showEventDialog, calendarForMy, getCalendar, - // getEvents, + getEvent, eventFromCalendar, calendarStore, accountStore, closeEventDialog, + openEventDialog, + createEmptyEvent, }; }, }; 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 11c7df306..8e968ce82 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 @@ -69,7 +69,7 @@