@@ -10,9 +10,11 @@ const allQuestions = ref<Question[]>([])
1010const newQuestion = ref <{
1111 question_text: string
1212 answer_options: AnswerOption []
13+ note? : string
1314}>({
1415 question_text: ' ' ,
15- answer_options: [{ text: ' ' }, { text: ' ' }]
16+ answer_options: [{ text: ' ' }, { text: ' ' }],
17+ note: ' '
1618})
1719
1820// Load questions
@@ -63,7 +65,8 @@ async function handleCreateQuestion() {
6365 method: ' POST' ,
6466 body: {
6567 question_text: newQuestion .value .question_text ,
66- answer_options: filteredOptions
68+ answer_options: filteredOptions ,
69+ note: newQuestion .value .note
6770 }
6871 })
6972
@@ -72,7 +75,8 @@ async function handleCreateQuestion() {
7275 // Reset form
7376 newQuestion .value = {
7477 question_text: ' ' ,
75- answer_options: [{ text: ' ' }, { text: ' ' }]
78+ answer_options: [{ text: ' ' }, { text: ' ' }],
79+ note: ' '
7680 }
7781
7882 // alert('Question created successfully')
@@ -177,6 +181,12 @@ function removeOption(index: number) {
177181 class =" p-3 border-2 border-black text-base min-h-[100px] resize-y bg-white font-sans"
178182 ></textarea >
179183
184+ <textarea
185+ v-model =" newQuestion.note"
186+ placeholder =" Enter a note for the question (optional, only for admins)"
187+ class =" p-3 border-2 border-black text-base min-h-[70px] resize-y bg-white font-sans"
188+ ></textarea >
189+
180190 <div >
181191 <h3 class =" mb-2.5 text-lg" >Answer Options</h3 >
182192 <div v-for =" (option, index) in newQuestion.answer_options" :key =" index" class =" flex gap-2.5 mb-2.5" >
@@ -221,6 +231,7 @@ function removeOption(index: number) {
221231 :class =" { 'opacity-50': question.alreadyPublished }"
222232 >
223233 <p class =" font-bold mb-2.5" >{{ question.question_text }}</p >
234+ <p v-if =" question.note" class =" text-sm text-gray-600 mb-2.5 p-2 bg-gray-200 border border-black" >{{ question.note }}</p >
224235 <ul class =" list-disc list-inside p-0 mb-4" >
225236 <li v-for =" (option, index) in question.answer_options" :key =" index" >
226237 {{ option.text }} <span v-if =" option.emoji" >{{ option.emoji }}</span >
0 commit comments