ali 2 lat temu
rodzic
commit
49ee20a4c5

+ 10 - 2
src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/CreateQuestionForm.vue

@@ -44,6 +44,10 @@ export default {
     testId: {
       type: Number,
       default: null
+    },
+    questionType: {
+      default: 'QUESTION_BANK',
+      type: String
     }
   },
   emits: ['onQuestionCreated'],
@@ -67,12 +71,16 @@ export default {
     }
   },
   mounted() {
-    this.setActionBtn()
+    this.setInputs()
     this.mounted = true
   },
   methods: {
-    setActionBtn () {
+    setInputs () {
       FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.edit)
+      if (this.questionType === 'EVENT') {
+        FormBuilderAssist.setAttributeByName(this.inputs, 'mark', 'type', 'hidden')
+        FormBuilderAssist.setAttributeByName(this.inputs, 'level', 'type', 'hidden')
+      }
     },
     afterLoadInputData () {
       this.entityLoading = false

+ 10 - 2
src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/EditQuestionForm.vue

@@ -43,6 +43,10 @@ export default {
     questionId: {
       type: Number,
       default: null
+    },
+    questionType: {
+      default: 'QUESTION_BANK',
+      type: String
     }
   },
   emits: ['onQuestionEdited'],
@@ -65,12 +69,16 @@ export default {
     }
   },
   mounted() {
-    this.setActionBtn()
+    this.setInputs()
     this.mounted = true
   },
   methods: {
-    setActionBtn () {
+    setInputs () {
       FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.edit)
+      if (this.questionType === 'EVENT') {
+        FormBuilderAssist.setAttributeByName(this.inputs, 'mark', 'type', 'hidden')
+        FormBuilderAssist.setAttributeByName(this.inputs, 'level', 'type', 'hidden')
+      }
     },
     afterLoadInputData () {
       this.entityLoading = false

+ 9 - 7
src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/QuestionsCreateAndAppend.vue

@@ -1,14 +1,13 @@
 <template>
   <div class="ContentsSelector q-mt-md">
-    <q-table title="سوالات"
-             :rows="testQuestionList"
+    <q-table :rows="testQuestionList"
              :columns="table.columns"
              row-key="name">
       <template #top>
         <q-banner class="full-width">
-          <div class="flex justify-between">
+          <div class="flex justify-between items-center">
             <span>
-              انتخاب سوال
+              سوالات
             </span>
             <q-btn color="primary"
                    class="q-mr-md"
@@ -49,7 +48,8 @@
                  @click="openDialogEditQuestion(props.row.question_info.id)">
             ویرایش سوال
           </q-btn>
-          <q-btn color="primary"
+          <q-btn v-if="questionType === 'QUESTION_BANK'"
+                 color="primary"
                  class="q-mr-lg"
                  size="sm"
                  outline
@@ -102,6 +102,7 @@
               transition-show="slide-up"
               transition-hide="slide-down">
       <edit-question-form :question-id="selectedQuestionIdForEdit"
+                          :question-type="questionType"
                           @onQuestionEdited="onQuestionEdited" />
     </q-dialog>
     <q-dialog v-model="createNewQuestionDialog"
@@ -109,6 +110,7 @@
               transition-show="slide-up"
               transition-hide="slide-down">
       <create-question-form :test-id="testId"
+                            :question-type="questionType"
                             @onQuestionCreated="onQuestionCreated" />
     </q-dialog>
   </div>
@@ -316,14 +318,14 @@ export default {
           required: true,
           label: 'شناسه',
           align: 'left',
-          field: row => row.id
+          field: row => row.question_info.id
         },
         {
           name: 'text',
           required: true,
           label: 'عنوان سوال',
           align: 'left',
-          field: row => row.text
+          field: row => row.question_info.text
         },
         {
           name: 'action',

+ 1 - 0
src/components/Widgets/Test/AdminTestShow/AdminTestShow.vue

@@ -81,6 +81,7 @@ export default {
       eventInputs: [
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات آزمون', col: 'col-12' },
+        { type: QuestionsCreateAndAppendComp, name: 'test_questions', responseKey: 'test_questions_info', testId: this.$route.params.id, questionType: 'EVENT', ignoreValue: true, col: 'col-md-12 col-12' },
         { type: 'hidden', name: 'event', responseKey: 'event', value: this.$route.params.classroom_id },
         { type: 'hidden', name: 'test_set', responseKey: 'test_set', value: this.$route.params.test_set_id },
         { type: 'hidden', name: 'classroom', responseKey: 'classroom', value: this.$route.params.classroom_id },