diff --git a/src/db.sqlite3 b/src/db.sqlite3 index 5bb61f348..ddc3dacda 100644 Binary files a/src/db.sqlite3 and b/src/db.sqlite3 differ diff --git a/src/front/src/components/load-round.vue b/src/front/src/components/load-round.vue index b323875d1..e90cee606 100644 --- a/src/front/src/components/load-round.vue +++ b/src/front/src/components/load-round.vue @@ -1,7 +1,107 @@ @@ -65,8 +160,8 @@ export default { const info = ref({}) const t_dailyRound = ref('') const alert = ref(false) - const excelOp = () => { - axiosApiInstance.get(`api/general_vacation/dailyroundup/`).then(result => { + const excelOp = (ex) => { + axiosApiInstance.get(`api/general_vacation/dailyroundup/?excel=${ex}`).then(result => { let link = document.createElement("a") link.href = baseURL+result.data.path link.click() @@ -74,6 +169,10 @@ export default { }) } + // const excelVacation = () => { + + // } + @@ -123,5 +222,7 @@ export default { \ No newline at end of file diff --git a/src/general_vacation/admin.py b/src/general_vacation/admin.py index 7437e8b6a..beb3a6603 100644 --- a/src/general_vacation/admin.py +++ b/src/general_vacation/admin.py @@ -1,13 +1,13 @@ from django.contrib import admin from .models import * -# class GeneralVacationAdmin(admin.ModelAdmin): -# fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period') -# list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period') -# readonly_fields=('get_name',) -# def get_name(self, obj): +class GeneralVacationAdmin(admin.ModelAdmin): + fields = ('login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period') + list_display=('get_name', 'login', 'planned_date', 'count_days', 'type_of_vacation', 'start_work_period', 'end_work_period') + readonly_fields=('get_name',) + def get_name(self, obj): -# return obj.user.fio() + return obj.user.fio() class PlanCalendarAdmin(admin.ModelAdmin): list_display = ('name', 'start_work_period', 'end_work_period') diff --git a/src/general_vacation/excel.py b/src/general_vacation/excel.py index a0de38346..b5ba7f877 100644 --- a/src/general_vacation/excel.py +++ b/src/general_vacation/excel.py @@ -15,7 +15,7 @@ class roundExcel(): pass def excround(self): - + print(self.df ) self.df['tabel'] = self.df['login'].str.split('-', expand = True)[1]+self.df['login'].str.split('-', expand = True)[2] file_path = 'media/DailyRoundUp.xlsx' thins = Side(border_style="thin") @@ -167,6 +167,8 @@ class roundExcel(): PIXELS_PER_CHAR = 7 return (width) / PIXELS_PER_CHAR + def excelvacation(self): + print('helooooooooooooooooooooooooooooooooooooo') # def excroundread(self): # file = request.data['dailyfiles'] # ed = pd.read_excel(file) diff --git a/src/general_vacation/serializers.py b/src/general_vacation/serializers.py index aaa6a5a1a..374f14287 100644 --- a/src/general_vacation/serializers.py +++ b/src/general_vacation/serializers.py @@ -1,11 +1,11 @@ from rest_framework import serializers from .models import * -# class GeneralVacationSerializer(serializers.ModelSerializer): +class GeneralVacationSerializer(serializers.ModelSerializer): -# class Meta: -# model = GeneralVacation -# fields ='__all__' + class Meta: + model = GeneralVacation + fields ='__all__' class PlanCalendarSerializer(serializers.ModelSerializer): diff --git a/src/general_vacation/views.py b/src/general_vacation/views.py index 1d50530d6..e0d1e7efc 100644 --- a/src/general_vacation/views.py +++ b/src/general_vacation/views.py @@ -47,7 +47,13 @@ class DailyRoundUpAPIView(APIView): def get(self, request): user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname') re = roundExcel(user) - file_path = re.excround() + if request.GET.get("excel") == 'round': + file_path = re.excround() + if request.GET.get("excel") == 'vacation': + + file_path = re.excelvacation() + + diff --git a/src/media/DailyRoundUp.xlsx b/src/media/DailyRoundUp.xlsx index 2b4a94c1f..52116ebbf 100644 Binary files a/src/media/DailyRoundUp.xlsx and b/src/media/DailyRoundUp.xlsx differ diff --git a/src/r.txt b/src/r.txt index 95a5881c5..d56d294a0 100644 Binary files a/src/r.txt and b/src/r.txt differ