diff --git a/src/front/src/components/vote/CurrentVote.vue b/src/front/src/components/vote/CurrentVote.vue index 203b47cc1..ac912ae59 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -64,7 +64,7 @@ {{ answer.employee?.fio || answer.name }} @@ -197,6 +197,20 @@ export default { } }; + const toggleAnswer = (questionId, answerId) => { + const currentAnswers = result.value[questionId]; + const index = currentAnswers.indexOf(answerId); + + if (index === -1) { + const question = props.data.questions.find(q => q.id === questionId); + if (currentAnswers.length < question.settings.multiChoice) { + currentAnswers.push(answerId); + } + } else { + currentAnswers.splice(index, 1); + } + }; + const submitVote = () => { let voteData = [] for (let val of Object.values(result.value)) { @@ -263,6 +277,7 @@ export default { isCurrentQuestionAnswered, nextStep, prevStep, + toggleAnswer, submitVote, isVoteSubmitted, result