diff --git a/src/back/calendar_of_events/views.py b/src/back/calendar_of_events/views.py index 592420e81..81ce8d024 100644 --- a/src/back/calendar_of_events/views.py +++ b/src/back/calendar_of_events/views.py @@ -100,10 +100,9 @@ class MyEvents(APIView): parser_classes = [MultiPartParser] @swagger_auto_schema(query_serializer=IdonlyRequieredSerializer) def get(self, request): - allcalendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id ) | Q(author__id=request.user.user.id)).distinct() + allcalendars = Calendar.objects.filter(Q(get_participants__participant_calendar__id=request.user.user.id ,get_participants__editor=1) | Q(author__id=request.user.user.id)).distinct() resp = {'mycalendars':CalendarsSerializerForEventEdit(allcalendars, many=True).data } if request.query_params.get("id") is not None: - event = Event.objects.get(id = request.query_params.get("id")) resp['event']=EventSerializerIdRequest(event).data return Response(resp) diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue index 68a908dae..a7454c646 100644 --- a/src/front/src/components/calendar_of_events/BigCalendar.vue +++ b/src/front/src/components/calendar_of_events/BigCalendar.vue @@ -26,6 +26,7 @@ @click="showDialog = true" >Создать событие + @@ -91,6 +92,7 @@ @@ -116,6 +118,8 @@ export default { const MyYear = ref(selectdate.value.getFullYear()); const MyMonth = ref(selectdate.value.getMonth() + 1); const calendarForMy = ref([]); + const eventFromCalendar = ref({}) + const idEvent = ref(null) const getMonth = (month) => { MyMonth.value = month + 1; @@ -126,7 +130,7 @@ export default { const getCalendar = () => { axiosApiInstance - .get("api/calendar_of_events/my_calendars/") + .get(`api/calendar_of_events/my_calendars/`) .then((res) => { res.data.forEach( (e) => @@ -138,6 +142,28 @@ export default { getCalendar(); + + const getEvents = () => { + + axiosApiInstance + .get(`api/calendar_of_events/my_events/${idEvent.value==null?'':`?id=${idEvent.value}`}`) + .then((res) => { + eventFromCalendar.value = res.data + if (idEvent.value==null) { + eventFromCalendar.value.event = {name:'', participant: [], files: [], date_start: "", date_end: "", period: null, description: ''} + } + + // res.data.forEach( + // (e) => + // (e.visible = accountStore.calendar.includes(e.id) ? false : true) + // ); + // calendarForMy.value = res.data; + }); + }; + + getEvents(); + + const weekendsData = () => { cal.value.$el .querySelectorAll(".v-date-picker-month__day") @@ -197,6 +223,7 @@ export default { calendarForMy, accountStore, getCalendar, + eventFromCalendar }; }, }; diff --git a/src/front/src/components/calendar_of_events/calendar-create-select.vue b/src/front/src/components/calendar_of_events/calendar-create-select.vue index 6ca51e1c7..ff8045287 100644 --- a/src/front/src/components/calendar_of_events/calendar-create-select.vue +++ b/src/front/src/components/calendar_of_events/calendar-create-select.vue @@ -119,7 +119,7 @@ export default { .get("api/calendar_of_events/get_employees/") .then((res) => { staff.value = res.data.filter((e) => e.employees.length > 0); - + console.log(staff.value, 'staff.valuestaff.value') staff.value.forEach((e) => { if (props.participant.length > 0) { e.employees.forEach((empl) => { 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 1d57174e5..524be3bad 100644 --- a/src/front/src/components/calendar_of_events/calendar-create.vue +++ b/src/front/src/components/calendar_of_events/calendar-create.vue @@ -1,142 +1,5 @@