diff --git a/src/front/src/components/vote/CurrentVote.vue b/src/front/src/components/vote/CurrentVote.vue index 52e9b18d8..be2299224 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -31,37 +31,54 @@ - +
-

{{ question.name }} (вариантов ответа: {{question.settings.multiChoice}})

+

+ {{ question.name }} + (вариантов ответа: {{ question.settings.multiChoice }}) +

- +
- - {{ answer.employee?.fio || answer.name }} - - - +
@@ -181,8 +198,6 @@ export default { }; const submitVote = () => { - console.log(props.data); - console.log("Отправляем данные голосования:", result.value); let voteData = [] for (let val of Object.values(result.value)) { val.forEach(e => voteData.push({answer: e, comment: null, user: accountStore.user.id})) @@ -198,6 +213,7 @@ export default { ).finally(() => isVoteSubmitted.value = true) }; + const activepick = ref(null) const dialog = ref(false) const opendialog = (val) => { @@ -205,7 +221,38 @@ export default { activepick.value = val } + const groupedAnswers = (question) => { + const filtered = question.answers.filter(answer => answer.employee?.id !== accountStore.user.is_idEmployee); + + if (question.settings.onlyDep === null) { + return groupByDepartment(filtered); + } else if (question.settings.onlyDep) { + const byDepartment = filtered.filter( + (answer) => answer.employee?.department === accountStore.user.department + ); + return groupByDepartment(byDepartment); + } else { + const notByDepartment = filtered.filter( + (answer) => answer.employee?.department !== accountStore.user.department + ); + return groupByDepartment(notByDepartment); + } + }; + + const groupByDepartment = (answers) => { + return answers.reduce((groups, answer) => { + const department = answer.employee?.department || ""; + if (!groups[department]) { + groups[department] = []; + } + groups[department].push(answer); + return groups; + }, {}); + }; + + return { + groupedAnswers, activepick, opendialog, dialog, diff --git a/src/front/src/components/vote/VoteCard.vue b/src/front/src/components/vote/VoteCard.vue index 9d93c9a2f..b44da5956 100644 --- a/src/front/src/components/vote/VoteCard.vue +++ b/src/front/src/components/vote/VoteCard.vue @@ -11,10 +11,10 @@ {{ voteCard.name }} - - mdi-pencil - + + + + diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 9a3e14516..63f71a540 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -1,38 +1,51 @@ @@ -191,8 +228,8 @@ - +
@@ -210,10 +247,16 @@
+
- Добавить вопрос + + +
+ + Добавить вопрос +
Назад @@ -224,10 +267,14 @@
- - + + + Подтверждение + + {{ errorMessage }} +

Название: {{ form.title }}

Описание: {{ form.description }}

@@ -266,11 +313,9 @@
Назад - Сохранить + Сохранить - - {{ errorMessage }} - +
@@ -516,4 +561,14 @@ export default { .v-input--horizontal .v-input__prepend { margin-inline-end: 4px; } +.list-enter-active, +.list-leave-active { + transition: all 0.5s ease; +} +.list-enter-from, +.list-leave-to { + opacity: 0; + transform: translateX(50px); +} + diff --git a/src/front/src/components/vote/VoteResult.vue b/src/front/src/components/vote/VoteResult.vue index 7d6b5742b..2723f3b18 100644 --- a/src/front/src/components/vote/VoteResult.vue +++ b/src/front/src/components/vote/VoteResult.vue @@ -1,11 +1,16 @@