From d83c260e59634c1d4e565a9e8c1f0f9257658b7d Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:00:49 +0300 Subject: [PATCH] =?UTF-8?q?P-47=20=D0=A0=D0=B5=D0=B4=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BA=D0=B0=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B4=D0=B0=D1=80=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/back/calendar_of_events/views.py | 3 +- .../calendar_of_events/BigCalendar.vue | 29 +++- .../calendar-create-select.vue | 2 +- .../calendar_of_events/calendar-create.vue | 143 +----------------- .../calendar_of_events/event-create.vue | 142 ++++++++++++++++- 5 files changed, 173 insertions(+), 146 deletions(-) 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 @@