Merge branch 'develop' into test

This commit is contained in:
Nukeap committed 2024-11-08 08:02:54 +03:00
commit 80b9ad3c8b
9 files changed
+266 -166

No files matched your search

+3
View File
@@ -89,6 +89,9 @@ class DictEmployee(models.Model):
return str(self.fio)
class DictPosition(models.Model):
name = models.CharField(max_length=1024, db_comment='═ршьхэютрэшх фюыцэюёЄш')
order_position = models.IntegerField()
+11 -1
View File
@@ -1,5 +1,5 @@
from django.db import models
from userauth.models import *
# Create your models here.
@@ -31,3 +31,13 @@ class BestVote(models.Model):
def __str__(self):
return self.cand_name
class DictEmplyeeR(models.Model):
id = models.IntegerField(primary_key=True)
id_dict_employee = models.ForeignKey(DictEmployee, models.DO_NOTHING)
id_dict_department = models.ForeignKey(DictDepartment, models.DO_NOTHING)
class Meta:
verbose_name = "Сотрудники(реальные отделы)"
verbose_name_plural = "Сотрудники(реальные отделы)"
def __str__(self):
return str(self.id_dict_employee)
+11
View File
@@ -9,6 +9,17 @@ class GetEmpSerializer(serializers.ModelSerializer):
fields = ['id', 'id_dict_department',
'fio', 'post', 'department']
class GetEmpSerializerR(serializers.ModelSerializer):
id = serializers.CharField(source="id_dict_employee.id")
fio = serializers.CharField(source="id_dict_employee.fio")
id_dict_department = serializers.CharField(source="id_dict_employee.id_dict_department")
post = serializers.CharField(source="id_dict_employee.post")
department = serializers.CharField(source="id_dict_employee.department")
class Meta:
model = DictEmplyeeR
fields = ['id', 'id_dict_department',
'fio', 'post', 'department']
class ThanksVoteSerializer(serializers.ModelSerializer):
+12 -14
View File
@@ -12,18 +12,17 @@ from .serializers import *
class GetForThn(APIView):
def get(self, request):
user_login = request.GET.get('login')
all_emps = DictEmployee.objects.exclude(
login=user_login).exclude(post='Начальник инспекции').exclude(deleted=1)
return Response(GetEmpSerializer(all_emps, many=True).data)
all_emps = DictEmplyeeR.objects.exclude(id_dict_employee__login=user_login).exclude(id_dict_employee__post='Начальник инспекции').exclude(id_dict_employee__deleted=1)
return Response(GetEmpSerializerR(all_emps, many=True).data)
class GetForBst(APIView):
def get(self, request):
user_login = request.GET.get('login')
dep_id = request.GET.get('dep')
emp_user = DictEmployee.objects.filter(Q(id_dict_department=dep_id), ~Q(
post="Начальник отдела"), ~Q(login=user_login)).exclude(deleted=1)
return Response(GetEmpSerializer(emp_user, many=True).data)
emp_user = DictEmplyeeR.objects.filter(Q(id_dict_department=dep_id), ~Q(
id_dict_employee__post="Начальник отдела"), ~Q(id_dict_employee__login=user_login)).exclude(id_dict_employee__deleted=1)
return Response(GetEmpSerializerR(emp_user, many=True).data)
class SetThanks(APIView):
@@ -64,22 +63,21 @@ class SetBest(APIView):
class GetBest(APIView):
def get(self, request):
# Группировка кандидатов по имени и подсчет каждого
count_bests = BestVote.objects.values('voted_user',
'department_user', 'cand_name').annotate(total=Count('id'))
count_bests = BestVote.objects.values('voted_user','department_user', 'cand_name').annotate(total=Count('id'))
return Response(count_bests)
class GetNotVoteThn(APIView):
def get(self, request):
list_thn_users = ThanksVote.objects.values('voted_user')
list_emp = DictEmployee.objects.filter(
deleted=0).exclude(login__in=list_thn_users)
return Response(GetEmpSerializer(list_emp, many=True).data)
list_emp = DictEmplyeeR.objects.filter(
id_dict_employee__deleted=0).exclude(id_dict_employee__login__in=list_thn_users)
return Response(GetEmpSerializerR(list_emp, many=True).data)
class GetNotVoteBst(APIView):
def get(self, request):
list_bst_users = BestVote.objects.values('voted_user')
list_emp_bst = DictEmployee.objects.filter(
deleted=0).exclude(login__in=list_bst_users)
return Response(GetEmpSerializer(list_emp_bst, many=True).data)
list_emp_bst = DictEmplyeeR.objects.filter(
id_dict_employee__deleted=0).exclude(id_dict_employee__login__in=list_bst_users)
return Response(GetEmpSerializerR(list_emp_bst, many=True).data)
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "front",
"version": "0.0.69",
"version": "0.0.70",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "front",
"version": "0.0.69",
"version": "0.0.70",
"dependencies": {
"-": "^0.0.1",
"@ckeditor/ckeditor5-build-classic": "^41.4.2",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "front",
"version": "0.0.69",
"version": "0.0.70",
"scripts": {
"dev": "vite",
"build": "vite build",
+5 -7
View File
@@ -1,9 +1,6 @@
<template>
<v-card color="teal-darken-1" width="420" height="150" elevation="24">
<v-card-title>До конца голосования осталось:</v-card-title>
<div class="card-count">{{ displayDays }}:{{ displayHours }}:{{ displayMinutes }}</div>
<span class="card-sub-title ">дней : часов : минут</span>
</v-card>
<h3>ДО КОНЦА ГОЛОСОВАНИЯ ОСТАЛОСЬ:</h3>
<div class="card-count">{{ displayDays }} дней {{ displayHours }} часов {{ displayMinutes }} минут</div>
</template>
<script>
export default {
@@ -35,7 +32,7 @@ export default {
const timer = setInterval(() => {
const now = new Date();
// здесь задается конец отчета (гггг, мм, дд, остальные цифры не меняются)
const end = new Date(2024, 11 - 1, 21, 10, 10, 10);
const end = new Date(2024, 11 - 1, 14, 10, 10, 10);
const distance = end.getTime() - now.getTime();
if (distance < 0) {
@@ -49,7 +46,7 @@ export default {
this.displayMinutes = minutes < 10 ? "0" + minutes : minutes;
this.displayHours = minutes < 10 & minutes > 10 ? "0" + hours : hours;
this.displayDays = days < 10 ? "0" + days : days;
this.displayDays = days;
}, 1000)
}
}
@@ -60,6 +57,7 @@ export default {
<style>
.card-count {
font-size: 3em;
color: #ff0000;
}
.card-sub-title {
+3 -3
View File
@@ -1,6 +1,6 @@
<template>
<v-form @submit="voteSend">
<v-card id="scroll-window-chekbox" height="520" elevation="0">
<v-card id="scroll-window-chekbox" height="420" elevation="0">
<!-- Форма голосования -->
<v-virtual-scroll :items="vote_data" :item-height="40">
<template v-slot:default="{ item }">
@@ -29,7 +29,8 @@
disabled>ДА</v-btn>
</v-col>
<v-col cols="2">
<v-btn variant="elevated" color="red-darken-1" @click="isActive.value = false">НЕТ</v-btn>
<v-btn variant="elevated" color="red-darken-1"
@click="isActive.value = false">НЕТ</v-btn>
</v-col>
</v-col>
</v-card>
@@ -122,6 +123,5 @@ export default {
<style>
#scroll-window-chekbox {
overflow-y: scroll !important;
height: 400px;
}
</style>
+218 -138
View File
@@ -1,132 +1,202 @@
<template>
<v-row justify="center" class="d-flex align-start h-100">
<v-col cols="12" class="h-15 d-flex justify-center proc-count_cell">
<v-col justify="center" align="center" cols="2">
<v-card color="teal-darken-1" width="200" height="100" elevation="24" class="procent-card-font">
<perc-bst />
</v-card>
<!-- Голосование Лучший сотрудник -->
<v-col cols="12" justify="center" class="d-flex vote-card-container">
<v-col cols="6" justify="center" align="center">
<div class="flip-card" :class="{ 'flipped': isFlipped1 }">
<div class="flip-card-inner">
<div v-if="voted_bst" class="flip-card-front">
<!-- Передняя сторона карточки -->
<v-card class="justify-center elevation-24 " color="teal-darken-1" width="500" height="600"
variant="elevated">
<div class="justify-center">
<div>
<v-card class="vote-card-information">
<v-card-title>&laquo;ЛУЧШИЙ В ОТДЕЛЕ&raquo;</v-card-title>
<v-card-text
class="justify-center align-center vote-card-information-title">
<p>ВЫ УЖЕ ПРОГОЛОСОВАЛИ.</p>
<p>СПАСИБО!</p>
</v-card-text>
</v-card>
</div>
</div>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<div v-else class="flip-card-front" @click="toggleFlip1">
<!-- Передняя сторона карточки -->
<v-card class="justify-center elevation-24 " color="teal-darken-1" width="500" height="600"
variant="elevated">
<div class="justify-center">
<div>
<v-card class="vote-card-information">
<v-card-title>&laquo;ЛУЧШИЙ В ОТДЕЛЕ&raquo;</v-card-title>
<v-card-text class="justify-center align-center
vote-card-information-title">
Выберите сотрудника<br>
который на Ваш взгляд,<br>
внес наибольший вклад в результат работы<br>
Отдела в 2024 году
</v-card-text>
</v-card>
</div>
</div>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<!-- Передняя сторона карточки КОНЕЦ-->
<div class="flip-card-back">
<!-- Задняя сторона карточки -->
<v-card class="justify-center elevation-24" width="500" height="600">
<v-card-title>
&laquo;МОЙ КОЛЛЕГА САМЫЙ ЛУЧШИЙ&raquo;
</v-card-title>
<v-card-text>
<vote-form :type_fetch="'bst'" />
</v-card-text>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button-back">
<v-btn @click="toggleFlip1" variant="elevated" color="teal-darken-1"
type="button">назад</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
</div>
</div>
<!-- Задняя сторона карточки КОНЕЦ-->
</v-col>
<v-col justify="center" align="center" cols="4" class="vote-cards_cell ">
<!-- Голосование Лучший сотрудник КОНЕЦ-->
<!-- Голосование Спасибо -->
<v-col cols="6" justify="center" align="center">
<div class="flip-card" :class="{ 'flipped': isFlipped2 }">
<div class="flip-card-inner">
<div v-if="voted_thn" class="flip-card-front">
<!-- Передняя сторона карточки -->
<v-card class="justify-center elevation-24" color="teal-darken-2" width="500" height="600"
variant="elevated">
<div class="justify-center">
<div>
<v-card class="vote-card-information">
<v-card-title>&laquo;ХОЧУ СКАЗАТЬ СПАСИБО&raquo;</v-card-title>
<v-card-text
class="justify-center align-center vote-card-information-title">
<p>ВЫ УЖЕ ПРОГОЛОСОВАЛИ.</p>
<p>СПАСИБО!</p>
</v-card-text>
</v-card>
</div>
</div>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<div v-else class="flip-card-front" @click="toggleFlip2">
<!-- Передняя сторона карточки -->
<v-card class="justify-center elevation-24" color="teal-darken-2" width="500" height="600"
variant="elevated">
<div class="justify-center">
<div>
<v-card class="vote-card-information">
<v-card-title>&laquo;ХОЧУ СКАЗАТЬ СПАСИБО&raquo;</v-card-title>
<v-card-text class="justify-center align-center
vote-card-information-title">
Выберите сотрудника <br>
(не из Вашего отдела)<br>
которому бы Вы лично обьявили бы<br>
благодарность по итогом работы в 2024 году
</v-card-text>
</v-card>
</div>
</div>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<!-- Передняя сторона карточки КОНЕЦ-->
<!-- Задняя сторона карточки -->
<div class="flip-card-back">
<v-card class="justify-center elevation-24" width="500" height="600" variant="elevated">
<v-card-title>
&laquo;ХОЧУ СКАЗАТЬ СПАСИБО!&raquo;
</v-card-title>
<v-card-text>
<vote-form :type_fetch="'thn'" />
</v-card-text>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button-back">
<v-btn @click="toggleFlip2" variant="elevated" color="teal-darken-1"
type="button">назад</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<!-- Задняя сторона карточки КОНЕЦ-->
</div>
</div>
</v-col>
</v-col>
<v-col cols="12" class="d-flex justify-center align-end ">
<h1>ПРИНЯЛИ УЧАСТИЕ В ГОЛОСОВАНИИ</h1>
</v-col>
<v-col cols="12" class="d-flex justify-center align-end pa-0">
<v-col v-if="admin_panel" justify="center" align="center" cols="6" class=" pa-0">
<v-dialog>
<template v-slot:activator="{ props: VoteAdmin }">
<v-btn variant="transparent" v-bind="VoteAdmin"
class="procent-card-font pa-0"><perc-bst /></v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-row justify="center" class="h-100 admin-vote">
<v-card width="1500" height="900">
<vote-admin />
<v-row justify="center" align="center">
<v-btn variant="elevated" color="teal-darken-1"
@click="isActive.value = false">ЗАКРЫТЬ</v-btn>
</v-row>
</v-card>
</v-row>
</template>
</v-dialog>
</v-col>
<v-col v-else justify="center" align="center" cols="6" class="procent-card-font pa-0">
<perc-bst />
</v-col>
<v-col v-if="admin_panel" justify="center" align="center" cols="6" class=" pa-0">
<v-dialog>
<template v-slot:activator="{ props: VoteAdmin }">
<v-btn variant="transparent" v-bind="VoteAdmin"
class="procent-card-font pa-0"><perc-thn /></v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-row justify="center" class="h-100 admin-vote">
<v-card width="1500" height="900">
<vote-admin />
<v-row justify="center" align="center">
<v-btn variant="elevated" color="teal-darken-1"
@click="isActive.value = false">ЗАКРЫТЬ</v-btn>
</v-row>
</v-card>
</v-row>
</template>
</v-dialog>
</v-col>
<v-col v-else justify="center" align="center" cols="6" class="procent-card-font pa-0">
<perc-thn />
</v-col>
</v-col>
<v-col cols="12" class="d-flex justify-center align-start pa-0">
<v-col justify="center" align="center" cols="6" class="vote-cards_cell ">
<count-down />
</v-col>
<v-col justify="center" align="center" cols="2">
<v-card color="teal-darken-1" width="200" height="100" elevation="24" class="procent-card-font">
<perc-thn />
</v-card>
</v-col>
</v-col>
<!-- Голосование Лучший сотрудник -->
<v-col justify="center" align="center">
<div class="flip-card" :class="{ 'flipped': isFlipped1 }">
<div class="flip-card-inner">
<div class="flip-card-front">
<!-- Передняя сторона карточки -->
<v-card class="justify-center elevation-24 " image="@/assets/best_employee.jpg" width="500"
height="700" variant="elevated">
<v-card-title class="vote-card-title">
&laquo;МОЙ КОЛЛЕГА САМЫЙ ЛУЧШИЙ&raquo;
</v-card-title>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button">
<v-card-title class="you-voted" v-if="voted_bst">
<div>Вы уже проголосовали!</div>
</v-card-title>
<v-btn v-else size="x-large" @click="toggleFlip1" variant="elevated"
color="teal-darken-1" type="button">ОТДАТЬ
ГОЛОС!</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<!-- Передняя сторона карточки КОНЕЦ-->
<div class="flip-card-back">
<!-- Задняя сторона карточки -->
<v-card class="justify-center elevation-24" width="500" height="700">
<v-card-title>
&laquo;МОЙ КОЛЛЕГА САМЫЙ ЛУЧШИЙ&raquo;
</v-card-title>
<v-card-text>
<vote-form :type_fetch="'bst'" />
</v-card-text>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button-back">
<v-btn @click="toggleFlip1" variant="elevated" color="teal-darken-1"
type="button">назад</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
</div>
</div>
<!-- Задняя сторона карточки КОНЕЦ-->
</v-col>
<!-- Голосование Лучший сотрудник КОНЕЦ-->
<v-col class="w-15" cols="2" v-if="admin_panel" justify="center" align="center">
<v-dialog>
<template v-slot:activator="{ props: VoteAdmin }">
<v-btn variant="elevated" v-bind="VoteAdmin" color="teal-darken-1">ИНФОРМАЦИЯ О ХОДЕ <br>
ГОЛОСОВАНИЯ</v-btn>
</template>
<template v-slot:default="{ isActive }">
<v-row justify="center" class="h-100 admin-vote">
<v-card width="1500" height="900">
<vote-admin />
<v-row justify="center" align="center">
<v-btn variant="elevated" color="teal-darken-1"
@click="isActive.value = false">ЗАКРЫТЬ</v-btn>
</v-row>
</v-card>
</v-row>
</template>
</v-dialog>
</v-col>
<!-- Голосование Спасибо -->
<v-col justify="center" align="center">
<div class="flip-card" :class="{ 'flipped': isFlipped2 }">
<div class="flip-card-inner">
<div class="flip-card-front">
<!-- Передняя сторона карточки -->
<v-card class="justify-center elevation-24" image="@/assets/thanks.jpeg" width="500"
height="700" variant="elevated">
<v-card-title class="vote-card-title">
&laquo;ХОЧУ СКАЗАТЬ СПАСИБО!&raquo;
</v-card-title>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button">
<v-card-title class="you-voted" v-if="voted_thn">
<div>Вы уже проголосовали!</div>
</v-card-title>
<v-btn v-else size="x-large" @click="toggleFlip2" variant="elevated"
color="teal-darken-1">ОТДАТЬ
ГОЛОС!</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<!-- Передняя сторона карточки КОНЕЦ-->
<!-- Задняя сторона карточки -->
<div class="flip-card-back">
<v-card class="justify-center elevation-24" width="500" height="700" variant="elevated">
<v-card-title>
&laquo;ХОЧУ СКАЗАТЬ СПАСИБО!&raquo;
</v-card-title>
<v-card-text>
<vote-form :type_fetch="'thn'" />
</v-card-text>
<!-- Кнопка активации поворота -->
<v-card-actions class="justify-center vote-button-back">
<v-btn @click="toggleFlip2" variant="elevated" color="teal-darken-1"
type="button">назад</v-btn>
</v-card-actions>
<!-- Кнопка активации поворота КОНЕЦ-->
</v-card>
</div>
<!-- Задняя сторона карточки КОНЕЦ-->
</div>
</div>
</v-col>
<!-- Голосование Спасибо КОНЕЦ-->
@@ -172,6 +242,7 @@ export default {
let finded_thn = votedListThn.find(({ voted_user }) => voted_user === account_login)
if (finded_thn.voted_user === account_login) {
voted_thn.value = true;
}
});
clearAxios.get(`/api/vote/getbest/`).then((data) => {
@@ -195,7 +266,7 @@ export default {
isFlipped2.value = !isFlipped2.value;
}
if (account_login == '9966-00-134' || account_login == '9966-00-141') {
if (account_login == '9966-00-134' || account_login == '9966-00-141' || account_login == '9966-00-011') {
admin_panel = true;
}
@@ -214,10 +285,12 @@ export default {
};
</script>
<style scoped>
.flip-card {
perspective: 1000px;
.vote-card-container {
height: 620px !important;
}
.flip-card {}
.flip-card-inner {
display: flex;
position: relative;
@@ -231,12 +304,8 @@ export default {
.flip-card-front,
.flip-card-back {
display: flex;
justify-content: center;
position: absolute;
align-items: center;
width: 100%;
height: 100%;
backface-visibility: hidden;
}
@@ -251,23 +320,21 @@ export default {
}
.vote-button {
margin-top: 577px;
margin-top: 57px;
}
.vote-cards_cell {
height: 14% !important;
height: 2% !important;
}
.proc-count_cell {
height: 18% !important;
}
.procent-card-font {
font-size: 4em;
font-size: 5em;
color: #008000;
}
.card-count {
font-size: 4em;
font-size: 3em;
}
.you-voted {
@@ -275,4 +342,17 @@ export default {
color: #ffff;
border-radius: 5px;
}
.vote-card-information {
background-color: rgba(255, 255, 255, 0.7);
margin-top: 45%;
width: 460px;
height: 200px;
}
.vote-card-information-title {
font-size: 1.2em;
}
</style>