From 37599fc85afb3a5b5aef87b92fec795a7962996f Mon Sep 17 00:00:00 2001
From: iriska-gri <79623434+iriska-gri@users.noreply.github.com>
Date: Mon, 27 May 2024 13:08:22 +0300
Subject: [PATCH] =?UTF-8?q?P-52=20=D1=80=D0=B5=D1=88=D0=B5=D0=BD=20=D0=B2?=
=?UTF-8?q?=D0=BE=D0=BF=D1=80=D0=BE=D1=81=20=D1=81=20=D0=BF=D1=80=D0=B0?=
=?UTF-8?q?=D0=B7=D0=B4=D0=BD=D0=B8=D0=BA=D0=B0=D0=BC=D0=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/back/calendar_of_events/models.py | 2 +-
src/back/calendar_of_events/urls.py | 1 +
src/back/calendar_of_events/views.py | 28 ++--
.../calendar_of_events/BigCalendar.vue | 152 ++++++++++++++++++
.../calendar_of_events/load-ical.vue | 62 +------
src/front/src/router/index.js | 4 +-
src/front/src/store/WeekendsStore.js | 4 +-
7 files changed, 179 insertions(+), 74 deletions(-)
create mode 100644 src/front/src/components/calendar_of_events/BigCalendar.vue
diff --git a/src/back/calendar_of_events/models.py b/src/back/calendar_of_events/models.py
index fa1c1d53a..2537429e8 100644
--- a/src/back/calendar_of_events/models.py
+++ b/src/back/calendar_of_events/models.py
@@ -15,7 +15,7 @@ class CalendarEventsName(models.Model):
# def get_choices(cls):
# return [(enum_.name, enum_.value) for enum_ in cls]
-# class FrequencyEvents(EnumChoice):
+# class FrequencyEvents(EnumChoice):
# default = "Без периода"
# daily = "Ежедневно"
# weekly = "Еженедельно"
diff --git a/src/back/calendar_of_events/urls.py b/src/back/calendar_of_events/urls.py
index d75a37e6a..abb372501 100644
--- a/src/back/calendar_of_events/urls.py
+++ b/src/back/calendar_of_events/urls.py
@@ -5,4 +5,5 @@ from .views import *
urlpatterns = [
path('calendarEvents/', CalendarEventsAPIView.as_view(), name='calendarEvents'),
+ path('exclusionDatas/', ExclusionDatesAPIView.as_view(), name='exclusionDatas'),
]
\ No newline at end of file
diff --git a/src/back/calendar_of_events/views.py b/src/back/calendar_of_events/views.py
index 3605b52fc..298a22a11 100644
--- a/src/back/calendar_of_events/views.py
+++ b/src/back/calendar_of_events/views.py
@@ -4,11 +4,12 @@ from .models import *
from rest_framework.views import APIView
from rest_framework.response import Response
import json
+from django.db.models.functions import TruncYear
class CalendarEventsAPIView(APIView):
def updateCreate(self, ev, calendar, bigname):
- print('2222222-- -----------------------------------------------------------------------2222', calendar)
+
CalendarEvents.objects.update_or_create(**ev,
defaults = {**calendar,
'author': User.objects.get(pk=self.request.user.id),
@@ -35,16 +36,14 @@ class CalendarEventsAPIView(APIView):
namecalendar, created = CalendarEventsName.objects.update_or_create(name=request.data['participants'],
defaults = {'name':request.data['participants'],
'author_id': self.request.user.id})
- # print('22222222222', request.data)
- # print('request.data', type(json.loads(request.POST.get("calendar"))))
+
if 'pk' in request.data['calendar']:
# FilesEvent.objects.create(link = request.data['file'], event_id = json.loads(request.data['calendar'])['pk'])
print('22--------------------------------------------222222222', request.data['file'], json.loads(request.data['calendar'])['pk'])
event = {"calendarname_id":namecalendar.pk,
"pk": json.loads(request.data['calendar'])['pk'],}
self.updateCreate(event, json.loads(request.data['calendar']), namecalendar)
-
-
+
else:
for cal in request.data['calendar']:
@@ -52,11 +51,18 @@ class CalendarEventsAPIView(APIView):
"name": cal['name'],
"author_id": self.request.user.id}
self.updateCreate(event, cal, namecalendar)
-
-
-
+ return Response('ru')
+
+class ExclusionDatesAPIView(APIView):
+ def post(self, request):
+
+ # year = self.request.query_params.get('chapter', "fire" ,)
+ ex = ExclusionDates.objects.filter(exclusiondate__year=self.request.query_params['year'])
+ formonth ={}
+ for i in range(12):
+ formonth[i+1] = ex.filter(exclusiondate__month =i+1).values_list("exclusiondate", flat=True)
+
+ print(formonth, 'formonthformonthformonth')
-
-
- return Response('ru')
\ No newline at end of file
+ return Response(formonth)
\ No newline at end of file
diff --git a/src/front/src/components/calendar_of_events/BigCalendar.vue b/src/front/src/components/calendar_of_events/BigCalendar.vue
new file mode 100644
index 000000000..3c0a97eed
--- /dev/null
+++ b/src/front/src/components/calendar_of_events/BigCalendar.vue
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ week }}
+
+
+
+
+
+
+
+
+
+
+ {{ drawer_right }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/front/src/components/calendar_of_events/load-ical.vue b/src/front/src/components/calendar_of_events/load-ical.vue
index 4c18f3ebb..2a00c7268 100644
--- a/src/front/src/components/calendar_of_events/load-ical.vue
+++ b/src/front/src/components/calendar_of_events/load-ical.vue
@@ -1,48 +1,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ drawer_right }}
-
-
-
-
-
-
-
+
diff --git a/src/front/src/router/index.js b/src/front/src/router/index.js
index 6a3189e27..6fe137cac 100644
--- a/src/front/src/router/index.js
+++ b/src/front/src/router/index.js
@@ -134,9 +134,9 @@ const routes = [
path: "/ical",
name: "Calendar",
component: () =>
- import("@/components/calendar_of_events/load-ical.vue"),
+ import("@/components/calendar_of_events/BigCalendar.vue"),
meta: {
- title: "Для работы над календарем",
+ title: "Календарь",
ico: "mdi-account",
},
},
diff --git a/src/front/src/store/WeekendsStore.js b/src/front/src/store/WeekendsStore.js
index e972bda5d..3ed49ef90 100644
--- a/src/front/src/store/WeekendsStore.js
+++ b/src/front/src/store/WeekendsStore.js
@@ -4,8 +4,8 @@ import { ref } from 'vue'
export const useWeekendsStore = defineStore('weekends', () => {
- const week = ref({ '2024': {'05': '09'} })
-
+ // const week = ref({ '2024': {'5': ["2024-05-08", "2024-05-11"], '6': ["2024-06-08", "2024-06-11"]} })
+ const week = ref({})
return { week }
},