ref
This commit is contained in:
1 parent
6713cf2506
commit
0992331fa7
1 file changed
+10
-3
@@ -1,5 +1,7 @@
|
||||
<template>
|
||||
<v-container>
|
||||
<v-card-title class="text-subtitle-1">Результат голосования: {{ title }}</v-card-title>
|
||||
<v-card-subtitle class="text-subtitle-2">{{ description }}</v-card-subtitle>
|
||||
<v-tabs v-model="activeTab" class="mb-4">
|
||||
<v-tab
|
||||
v-for="(question, questionIndex) in questions"
|
||||
@@ -26,7 +28,7 @@
|
||||
<v-row>
|
||||
<!-- Победитель -->
|
||||
<v-col cols="12">
|
||||
<h3>{{ question.name }}</h3>
|
||||
<h3 class="text-center">{{ question.name }}</h3>
|
||||
<v-card-title class="d-flex ga-2 align-center">
|
||||
<h4 class="text-teal-darken-4">Победитель:</h4>
|
||||
<h3>{{ getWinner(question).employee?.fio || getWinner(question).name }} 🏆</h3>
|
||||
@@ -80,6 +82,9 @@ export default {
|
||||
const activeTab = ref(0);
|
||||
const questions = computed(() => props.data.questions || []);
|
||||
|
||||
const title = props.data.name;
|
||||
const description = props.data.description;
|
||||
|
||||
const getWinner = (question) => {
|
||||
return question.answers.reduce(
|
||||
(max, answer) => (answer.count > max.count ? answer : max),
|
||||
@@ -105,7 +110,7 @@ export default {
|
||||
const lastDigit = count % 10;
|
||||
if (lastDigit === 1) currentVote = 'голос'
|
||||
if (lastDigit > 1) currentVote = 'голоса'
|
||||
if (lastDigit > 4 || count === 0) currentVote = 'голосов'
|
||||
if (lastDigit > 4 || count === 0 || count === 11 || count === 12 || count === 13 || count === 14) currentVote = 'голосов'
|
||||
return currentVote
|
||||
}
|
||||
|
||||
@@ -116,7 +121,9 @@ export default {
|
||||
getTopResults,
|
||||
truncateText,
|
||||
shouldShowTooltip,
|
||||
voteCount
|
||||
voteCount,
|
||||
title,
|
||||
description
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user