diff --git a/db.sqlite3 b/db.sqlite3 index 2b05981b7..e0b3edf2e 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/front/src/components/UI/Calendar-full.vue b/front/src/components/UI/Calendar-full.vue index 220e0b908..db5745986 100644 --- a/front/src/components/UI/Calendar-full.vue +++ b/front/src/components/UI/Calendar-full.vue @@ -115,18 +115,33 @@ export default { function f_generalvacation() { axiosApiInstance.get('api/general_vacation/generalvacation/') .then(data => { - + for (let x in data.data) { + console.log(data.data, 'data-----------------------'); + // if (x =="Отпуск") { + - data.data[x].map(e=>{ - let d = new Date(e.planned_date) - - calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]}) + // data.data[x].map(e=>{ + // let d = new Date(e.planned_date) + + // calendarOptions.events.push({ description: 'description for All Day Event', title: x, start: e.planned_date, end: new Date(d.setDate(d.getDate() + e.count_days)).toISOString().split('T')[0]}) - } + // } + + + // ) + // } + if (x=="План-график") { + data.data[x].map(e=>{ + + + calendarOptions.events.push({ description: 'description for All Day Event', title: e.name, start: e.start_work_period, end: e.end_work_period}) + + } + ) - + } } diff --git a/general_vacation/models.py b/general_vacation/models.py index a92731b1b..d126ab3b8 100644 --- a/general_vacation/models.py +++ b/general_vacation/models.py @@ -27,7 +27,7 @@ class GeneralVacation(models.Model): class PlanCalendar(models.Model): name = models.CharField(verbose_name='Название', max_length=500, blank=True, db_index=True) - start_work_period = models.DateField(verbose_name='Начало рабочего периода') + start_work_period = models.DateField(auto_now_add=True, verbose_name='Начало рабочего периода') end_work_period = models.DateField(verbose_name='Конец рабочего периода') class Meta: diff --git a/general_vacation/serializers.py b/general_vacation/serializers.py index 1c6508707..9207d8fa9 100644 --- a/general_vacation/serializers.py +++ b/general_vacation/serializers.py @@ -5,4 +5,10 @@ class GeneralVacationSerializer(serializers.ModelSerializer): class Meta: model = GeneralVacation + fields ='__all__' + +class PlanCalendarSerializer(serializers.ModelSerializer): + + class Meta: + model = PlanCalendar fields ='__all__' \ No newline at end of file diff --git a/general_vacation/views.py b/general_vacation/views.py index cf0ffb23e..904f04bb5 100644 --- a/general_vacation/views.py +++ b/general_vacation/views.py @@ -8,10 +8,16 @@ from rest_framework.views import APIView class GeneralVacationAPIView(APIView): def get(self, request): general = GeneralVacation.objects.all() + plan = PlanCalendar.objects.all() # Сериализуем извлечённый набор записей serializer_for_basecrit = GeneralVacationSerializer( instance=general, # Передаём набор записей many=True # Указываем, что на вход подаётся именно набор записей ) - return Response({"Отпуск": serializer_for_basecrit.data}) + + serializer_for_plan = PlanCalendarSerializer( + instance=plan, # Передаём набор записей + many=True # Указываем, что на вход подаётся именно набор записей + ) + return Response({"Отпуск": serializer_for_basecrit.data, "План-график": serializer_for_plan.data})