Merge branch 'dev-denzel' into cja_new

This commit is contained in:
cja committed 2025-06-03 12:40:12 +03:00
commit 45cd0b9ab2
2 files changed
+22 -15

No files matched your search

@@ -92,14 +92,21 @@
Дата окончания: {{ new Date(employee.completion_date).toLocaleDateString('ru-RU') }} Дата окончания: {{ new Date(employee.completion_date).toLocaleDateString('ru-RU') }}
</div> </div>
</div> </div>
<v-tooltip text="Снять назначение" location="top">
<template #activator="{ props }">
<v-btn <v-btn
v-bind="props"
icon="mdi-close" icon="mdi-close"
variant="text" variant="text"
density="compact" density="compact"
color="red-darken-1" color="red-darken-1"
class="ml-auto" class="ml-auto"
@click="$emit('unassign', employee)" @click="$emit('unassign', employee)"
/> >
<v-icon icon="mdi-close" />
</v-btn>
</template>
</v-tooltip>
</div> </div>
</template> </template>
</v-list-item> </v-list-item>
@@ -163,26 +163,26 @@ export default {
showFinishDialog.value = false; showFinishDialog.value = false;
try { try {
// [{ question_id, answers_id: [id, ...] }]
let answersToSubmit = []; let answersToSubmit = [];
data.value.questions.forEach((question, questionIndex) => {
answers.value.forEach((answer, questionIndex) => { const answer = answers.value[questionIndex];
if (answer === null) return; if (answer === null) return;
let selectedIds = [];
const question = data.value.questions[questionIndex];
if (Array.isArray(answer)) { if (Array.isArray(answer)) {
answer.forEach((answerText) => { selectedIds = answer.map((answerText) => {
const selectedAnswer = question.answers.find((a) => a.name === answerText); const selectedAnswer = question.answers.find((a) => a.name === answerText);
if (selectedAnswer) { return selectedAnswer ? selectedAnswer.id : null;
answersToSubmit.push({ answer: selectedAnswer.id }); }).filter(Boolean);
} } else {
});
}
else {
const selectedAnswer = question.answers.find((a) => a.name === answer); const selectedAnswer = question.answers.find((a) => a.name === answer);
if (selectedAnswer) { if (selectedAnswer) selectedIds = [selectedAnswer.id];
answersToSubmit.push({ answer: selectedAnswer.id });
} }
if (selectedIds.length > 0) {
answersToSubmit.push({
question_id: question.id,
answers_id: selectedIds,
});
} }
}); });