浏览代码

complete event test for admin side

ali 2 年之前
父节点
当前提交
b64e21437a

+ 1 - 1
package.json

@@ -77,7 +77,7 @@
     "workbox-window": "^7.0.0"
   },
   "engines": {
-    "node": "^20 || ^19 || ^18 || ^16 || ^14.19",
+    "node": "^20 || ^18",
     "npm": ">= 6.13.4",
     "yarn": ">= 1.21.1"
   }

+ 1 - 1
src/components/Widgets/Classroom/AdminClassroomShow/AdminClassroomShow.vue

@@ -32,7 +32,7 @@
              label="پروژه‌ها" />
       <q-tab v-if="canShowTabPage('exams')"
              name="exams"
-             label="آزمون" />
+             :label="localOptions.classroomType === 'TRAINING' ? 'آزمون' : 'پرسشنامه'" />
       <q-tab v-if="canShowTabPage('members')"
              name="members"
              label="اندیشه جویان" />

+ 2 - 2
src/components/Widgets/Classroom/AdminClassroomShow/components/TestList.vue

@@ -27,7 +27,7 @@
                  outline
                  color="grey"
                  label="تصحیح"
-                 :to="{name: 'Admin.Classroom.Test.AnswerBooks.Index', params: {classroom_id: classroomId, test_id: inputData.props.row.id}}" />
+                 :to="{name: 'Admin.Classroom.Test.AnswerBooks.Index', params: {classroom_id: classroomId, test_id: inputData.props.row.id}, query: { classroom_type: classroomType}}" />
         </div>
       </template>
       <template v-else-if="inputData.col.name === 'actions'">
@@ -35,7 +35,7 @@
           <q-btn size="md"
                  color="primary"
                  label="جزییات"
-                 :to="{name: 'Admin.Classroom.TestSet.Test.Show', params: {classroom_id: classroomId, test_set_id: inputData.props.row.test_set_info.id, id: inputData.props.row.id}}"
+                 :to="{name: 'Admin.Classroom.TestSet.Test.Show', params: {classroom_id: classroomId, test_set_id: inputData.props.row.test_set_info.id, id: inputData.props.row.id}, query: { classroom_type: classroomType}}"
                  class="q-mr-md" />
         </div>
       </template>

+ 24 - 4
src/components/Widgets/Test/AdminTestCreate/AdminTestCreate.vue

@@ -12,7 +12,7 @@
     <entity-create v-if="mounted"
                    ref="entityCreate"
                    v-model:value="inputs"
-                   title="مشخصات آزمون"
+                   :title="$route.query.classroom_type === 'EVENT' ? 'مشخصات پرسشنامه' : 'مشخصات آزمون'"
                    :api="api"
                    :entity-id-key="entityIdKey"
                    :entity-param-key="entityParamKey"
@@ -51,7 +51,7 @@ export default {
       entityIdKey: 'id',
       entityParamKey: 'id',
       showRouteName: 'Admin.Unit.TestSet.Show',
-      inputs: [
+      classroomInputs: [
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات آزمون', col: 'col-12' },
         { type: 'dateTime', name: 'start_time', responseKey: 'start_time', label: 'زمان شروع آزمون', placeholder: ' ', col: 'col-md-6 col-12' },
@@ -64,7 +64,23 @@ export default {
         { type: 'hidden', name: 'classroom', responseKey: 'classroom', value: this.$route.params.classroom_id },
         { type: UsersOfTestSelectorComp, name: 'examinees', responseKey: 'examinees', classroomId: this.$route.params.classroom_id, col: 'col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'تعیین جزییات', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' }
-      ]
+      ],
+      eventInputs: [
+        { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
+        { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات آزمون', col: '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 },
+        { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'تعیین جزییات', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' }
+      ],
+      inputs: []
+    }
+  },
+  created() {
+    if (this.$route.query.classroom_type === 'EVENT') {
+      this.inputs = this.eventInputs
+    } else {
+      this.inputs = this.classroomInputs
     }
   },
   mounted() {
@@ -93,7 +109,11 @@ export default {
       this.entityLoading = true
       this.$refs.entityCreate.createEntity(false)
         .then((response) => {
-          this.$router.push({ name: 'Admin.Classroom.TestSet.Test.Show', params: { classroom_id: this.$route.params.classroom_id, test_set_id: this.$route.params.test_set_id, id: response.data.id } })
+          this.$router.push({
+            name: 'Admin.Classroom.TestSet.Test.Show',
+            params: { classroom_id: this.$route.params.classroom_id, test_set_id: this.$route.params.test_set_id, id: response.data.id },
+            query: this.$route.query
+          })
           this.entityLoading = false
         })
         .catch(() => {

+ 19 - 3
src/components/Widgets/Test/AdminTestShow/AdminTestShow.vue

@@ -12,7 +12,7 @@
     <entity-edit v-if="mounted"
                  ref="entityEdit"
                  v-model:value="inputs"
-                 title="مشخصات آزمون"
+                 :title="$route.query.classroom_type === 'EVENT' ? 'مشخصات پرسشنامه' : 'مشخصات آزمون'"
                  :api="api"
                  :entity-id-key="entityIdKey"
                  :entity-param-key="entityParamKey"
@@ -48,7 +48,7 @@ export default {
       api: APIGateway.test.APIAdresses.byId(this.$route.params.id),
       entityIdKey: 'id',
       entityParamKey: 'id',
-      inputs: [
+      classroomInputs: [
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
         { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات آزمون', col: 'col-12' },
         { type: 'dateTime', name: 'start_time', responseKey: 'start_time', label: 'زمان شروع آزمون', placeholder: ' ', col: 'col-md-6 col-12' },
@@ -61,7 +61,23 @@ export default {
         { type: 'hidden', name: 'classroom', responseKey: 'classroom', value: this.$route.params.classroom_id },
         { type: UsersOfTestSelectorComp, name: 'examinees', responseKey: 'examinees', classroomId: this.$route.params.classroom_id, col: 'col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'تعیین جزییات', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' }
-      ]
+      ],
+      eventInputs: [
+        { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-12' },
+        { type: 'inputEditor', name: 'description', responseKey: 'description', label: 'توضیحات آزمون', col: '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 },
+        { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'تعیین جزییات', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' }
+      ],
+      inputs: []
+    }
+  },
+  created() {
+    if (this.$route.query.classroom_type === 'EVENT') {
+      this.inputs = this.eventInputs
+    } else {
+      this.inputs = this.classroomInputs
     }
   },
   mounted() {

+ 1 - 1
src/components/Widgets/TestSet/AdminTestSetIndex/AdminTestSetIndex.vue

@@ -27,7 +27,7 @@
             <q-btn size="md"
                    color="primary"
                    label="انتخاب"
-                   :to="{name: 'Admin.Classroom.TestSet.Test.Create', params: {classroom_id: $route.params.classroom_id, test_set_id:inputData.props.row.id}}"
+                   :to="{name: 'Admin.Classroom.TestSet.Test.Create', params: {classroom_id: $route.params.classroom_id, test_set_id:inputData.props.row.id}, query: $route.query}"
                    :loading="createInvoiceLoading"
                    class="q-mr-md" />
           </div>