Admin: manual scoring for open-ended questions

This commit is contained in:
jeremy bayse
2026-03-22 22:06:12 +01:00
parent 732d9416f4
commit 2df0d6def0
5 changed files with 105 additions and 20 deletions

View File

@@ -100,6 +100,14 @@ const saveScores = () => {
const openPreview = (doc) => {
selectedDocument.value = doc;
};
const updateAnswerScore = (answerId, score) => {
router.patch(route('admin.answers.update-score', answerId), {
score: score
}, {
preserveScroll: true,
});
};
</script>
<template>
@@ -461,10 +469,28 @@ const openPreview = (doc) => {
</div>
<!-- Open Answer -->
<div v-else>
<div v-else class="space-y-4">
<div class="p-6 bg-slate-50 dark:bg-slate-900 border border-slate-100 dark:border-slate-800 rounded-3xl text-[13px] text-slate-600 dark:text-slate-400 leading-relaxed italic shadow-inner">
" {{ answer.text_content || 'Aucune réponse fournie.' }} "
</div>
<!-- Score Input for Open Question -->
<div class="flex items-center gap-4 bg-slate-50 dark:bg-slate-900/50 p-4 rounded-2xl border border-dashed border-slate-200 dark:border-slate-700">
<div class="text-[10px] font-black uppercase tracking-widest text-slate-400">Note Attribuée :</div>
<div class="flex items-center gap-2">
<input
type="number"
v-model="answer.score"
min="0"
:max="answer.question.points"
step="0.5"
@change="updateAnswerScore(answer.id, answer.score)"
class="w-20 bg-white dark:bg-slate-800 border-none rounded-xl py-1 px-3 font-black text-indigo-600 focus:ring-2 focus:ring-indigo-500/20 transition-all text-center"
/>
<span class="text-xs font-bold text-slate-300">/ {{ answer.question.points }}</span>
</div>
<div class="text-[9px] text-slate-400 italic">Enregistré au clic/changement</div>
</div>
</div>
</div>
</div>