Ver Fonte

update admin event test

ali há 2 anos atrás
pai
commit
4fb35cffd8

+ 19 - 0
src/api/models/Test.js

@@ -68,4 +68,23 @@ export default class TestAPI extends APIRepository {
       }
     })
   }
+
+  createTestForEvent (testTitle, eventId, tstSetId) {
+    return this.sendRequest({
+      apiMethod: 'post',
+      api: this.api,
+      request: this.APIAdresses.base,
+      data: {
+        title: testTitle,
+        event: eventId,
+        test_set: tstSetId
+      },
+      resolveCallback: (response) => {
+        return new Test(response.data)
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
 }

+ 6 - 5
src/components/FormBuilderCustumComponents/FormBuilderInputEditor.vue

@@ -95,7 +95,7 @@
           <q-list dense>
             <q-item tag="label"
                     clickable
-                    @click="color('backColor', highlight)">
+                    @click="setColor('backColor', highlight)">
               <q-item-section side>
                 <q-icon name="highlight" />
               </q-item-section>
@@ -113,7 +113,7 @@
             </q-item>
             <q-item tag="label"
                     clickable
-                    @click="color('foreColor', foreColor)">
+                    @click="setColor('foreColor', foreColor)">
               <q-item-section side>
                 <q-icon name="format_paint" />
               </q-item-section>
@@ -155,19 +155,20 @@ export default {
   },
   data () {
     return {
+      inputData: '',
       foreColor: '#000000',
       highlight: '#ffff00aa'
     }
   },
   watch: {
     value(newValue) {
-      if (newValue === false) {
+      if (!newValue) {
         this.inputData = ''
       }
     }
   },
   created() {
-    if (this.inputData === false) {
+    if (!this.inputData) {
       this.inputData = ''
     }
   },
@@ -175,7 +176,7 @@ export default {
     onPaste () {
       this.inputData = this.inputData.replaceAll(/<!--\[if .*endif\]-->/gms, 'ferret')
     },
-    color (cmd, name) {
+    setColor (cmd, name) {
       const edit = this.$refs.editor
       this.$refs.token.hide()
       edit.caret.restore()

+ 10 - 9
src/components/Widgets/Classroom/AdminClassroomShow/AdminClassroomShow.vue

@@ -61,42 +61,43 @@
                    class="q-pa-none">
         <classroom-info v-model:classroom="classroom"
                         :classroom-type="localOptions.classroomType"
-                        :classroom-id="$route.params.id" />
+                        :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="sessions"
                    class="q-pa-none">
-        <session-list :classroom-id="$route.params.id"
+        <session-list :classroom-id="parseInt($route.params.id)"
                       :classroom-type="localOptions.classroomType" />
       </q-tab-panel>
 
       <q-tab-panel name="projects"
                    class="q-pa-none">
-        <project-list :classroom-id="$route.params.id" />
+        <project-list :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="exams"
                    class="q-pa-none">
-        <test-list :classroom-id="$route.params.id"
+        <test-list :classroom="classroom"
+                   :classroom-id="parseInt($route.params.id)"
                    :classroom-type="localOptions.classroomType" />
       </q-tab-panel>
       <q-tab-panel name="members"
                    class="q-pa-none">
-        <members-list :classroom-id="$route.params.id" />
+        <members-list :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="teams"
                    class="q-pa-none">
-        <team-list :classroom-id="$route.params.id" />
+        <team-list :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="graders"
                    class="q-pa-none">
-        <grader-list :classroom-id="$route.params.id" />
+        <grader-list :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="leaders"
                    class="q-pa-none">
-        <leader-list :classroom-id="$route.params.id" />
+        <leader-list :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="activity_sheet"
                    class="q-pa-none">
-        <activity-sheet-list :classroom-id="$route.params.id" />
+        <activity-sheet-list :classroom-id="parseInt($route.params.id)" />
       </q-tab-panel>
       <q-tab-panel name="live_streaming_url">
         <live-streaming :classroom="classroom" />

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

@@ -13,7 +13,7 @@
       <q-btn color="primary"
              outline
              :loading="addNewSessionLoading"
-             :to="{name: 'Admin.Classroom.TestSet.Index', params: {classroom_id: classroomId}}">
+             :to="{name: 'Admin.Classroom.TestSet.Index', params: {classroom_id: classroomId, unit_id: classroom.unit}}">
         {{ addBtnTitle }}
       </q-btn>
     </template>
@@ -53,6 +53,7 @@
 import { EntityIndex } from 'quasar-crud'
 import { Test } from 'src/models/Test.js'
 import { APIGateway } from 'src/api/APIGateway.js'
+import { Classroom } from 'src/models/Classroom'
 
 export default {
   name: 'TestList',
@@ -67,6 +68,10 @@ export default {
     classroomType: {
       type: String,
       default: 'TRAINING'
+    },
+    classroom: {
+      type: Classroom,
+      default: new Classroom()
     }
   },
   data () {

+ 16 - 3
src/components/Widgets/TestSet/AdminEventTestSetIndex/AdminEventTestSetIndex.vue

@@ -33,10 +33,16 @@
           <div class="action-column-entity-index">
             <q-btn size="md"
                    color="primary"
-                   label="انتخاب"
+                   label="مشاهده"
                    :to="{name: 'Admin.Event.TestSet.Show', params: {test_set_id:inputData.props.row.id}}"
-                   :loading="createInvoiceLoading"
+                   :loading="loading"
                    class="q-mr-md" />
+            <!--            <q-btn size="md"-->
+            <!--                   color="primary"-->
+            <!--                   label="انتخاب"-->
+            <!--                   :loading="loading"-->
+            <!--                   class="q-mr-md"-->
+            <!--                   @click="selectTestSet(inputData.props.row.id)" />-->
           </div>
         </template>
         <template v-else>
@@ -67,7 +73,7 @@ export default {
   data () {
     return {
       mounted: false,
-      createInvoiceLoading: false,
+      loading: false,
       classroom: new Classroom(),
 
       dropClassroomByAdminLoading: false,
@@ -147,6 +153,13 @@ export default {
     setMembersListActionBtn () {
       FormBuilderAssist.setAttributeByName(this.testSetListInputs, 'btn', 'atClick', this.searchMembersList)
     },
+    selectTestSet () {
+      // this.loading = true
+      // APIGateway.test.createTestForEvent (testTitle, eventId, tstSetId)
+      // .then(()=>{
+      //   this.loading = false
+      // })
+    },
     searchMembersList () {
       this.$refs.testSetList.search()
     }

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

@@ -67,6 +67,7 @@ export default {
       dropClassroomByAdminLoading: false,
       exportReportLoading: false,
       testSetListInputs: [
+        { type: 'hidden', name: 'unit', value: this.$route.params.unit_id },
         { type: 'hidden', name: 'classroom', value: this.$route.params.classroom_id }
       ],
       testSetListApi: APIGateway.testSet.APIAdresses.base,

+ 23 - 0
src/pages/Admin/Event/TestSet/Create.vue

@@ -0,0 +1,23 @@
+<template>
+  <q-page-builder v-model:sections="currenSections"
+                  v-model:options="pageConfig"
+                  :editable="pageBuilderEditable"
+                  :loading="pageBuilderLoading" />
+</template>
+
+<script>
+import { mixinPageOptions } from 'src/mixin/Mixins.js'
+
+export default {
+  name: 'Admin.Event.TestSet.Create',
+  mixins: [mixinPageOptions],
+  data: () => {
+    return {
+      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'AdminEventTestSetCreate' }] }] }] } }]
+    }
+  },
+  created() {
+    this.currenSections = this.sections
+  }
+}
+</script>

+ 23 - 0
src/pages/Admin/Event/TestSet/Index.vue

@@ -0,0 +1,23 @@
+<template>
+  <q-page-builder v-model:sections="currenSections"
+                  v-model:options="pageConfig"
+                  :editable="pageBuilderEditable"
+                  :loading="pageBuilderLoading" />
+</template>
+
+<script>
+import { mixinPageOptions } from 'src/mixin/Mixins.js'
+
+export default {
+  name: 'Admin.Event.TestSet.Index',
+  mixins: [mixinPageOptions],
+  data: () => {
+    return {
+      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'AdminEventTestSetIndex' }] }] }] } }]
+    }
+  },
+  created() {
+    this.currenSections = this.sections
+  }
+}
+</script>

+ 23 - 0
src/pages/Admin/Event/TestSet/Show.vue

@@ -0,0 +1,23 @@
+<template>
+  <q-page-builder v-model:sections="currenSections"
+                  v-model:options="pageConfig"
+                  :editable="pageBuilderEditable"
+                  :loading="pageBuilderLoading" />
+</template>
+
+<script>
+import { mixinPageOptions } from 'src/mixin/Mixins.js'
+
+export default {
+  name: 'Admin.Event.TestSet.Show',
+  mixins: [mixinPageOptions],
+  data: () => {
+    return {
+      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'AdminEventTestSetShow' }] }] }] } }]
+    }
+  },
+  created() {
+    this.currenSections = this.sections
+  }
+}
+</script>

+ 4 - 2
src/router/routes.js

@@ -669,7 +669,7 @@ const routes = [
               { name: 'Admin.Classroom.Team.Show', path: ':classroom_id/team/:team_id', component: () => import('src/pages/Admin/Classroom/Team/show.vue') },
               { name: 'Admin.Classroom.Ticket', path: 'ticket', component: () => import('src/pages/Admin/Classroom/Ticket.vue'), breadcrumbs: { title: 'درخواست ها دوره های آموزشی' } },
 
-              { name: 'Admin.Classroom.TestSet.Index', path: ':classroom_id/test_set', component: () => import('src/pages/Admin/TestSet/Index.vue') },
+              { name: 'Admin.Classroom.TestSet.Index', path: ':classroom_id/unit/:unit_id/test_set', component: () => import('src/pages/Admin/TestSet/Index.vue') },
               { name: 'Admin.Classroom.TestSet.Test.Show', path: ':classroom_id/test_set/:test_set_id/test/:id', component: () => import('src/pages/Admin/Test/Show.vue') },
               { name: 'Admin.Classroom.TestSet.Test.Create', path: ':classroom_id/test_set/:test_set_id/test/create', component: () => import('src/pages/Admin/Test/Create.vue') },
 
@@ -702,7 +702,9 @@ const routes = [
 
               { name: 'Admin.Event.TestSet.Questions.Index', path: 'test_set/:test_set_id/questions', component: () => import('src/pages/Admin/Event/Question/Index.vue') },
               { name: 'Admin.Event.TestSet.Questions.Create', path: 'test_set/questions/create', component: () => import('src/pages/Admin/Event/Question/Create.vue') },
-              { name: 'Admin.Event.TestSet.Questions.Show', path: 'test_set/questions/:question_id', component: () => import('src/pages/Admin/Event/Question/Show.vue') }
+              { name: 'Admin.Event.TestSet.Questions.Show', path: 'test_set/questions/:question_id', component: () => import('src/pages/Admin/Event/Question/Show.vue') },
+
+              { name: 'Admin.Event.TestSet.Test.Create', path: ':event_id/test_set/:test_set_id/test/create', component: () => import('src/pages/Admin/Event/Question/Show.vue') }
             ]
           },
           {