ali 3 年 前
親
コミット
e568bce270

+ 2 - 0
src/api/APIGateway.js

@@ -29,6 +29,7 @@ import InstalmentOfferAPI from 'src/api/models/InstalmentOffer.js'
 import ClassroomGraderAPI from 'src/api/models/ClassroomGraders.js'
 import ClassroomLeadersAPI from 'src/api/models/ClassroomLeaders.js'
 import TeamRegistrationsAPI from 'src/api/models/TeamRegistrations.js'
+import EventRegistrationApi from 'src/api/models/EventRegistration.js'
 import ClassroomRegistrationAPI from 'src/api/models/ClassroomRegistration.js'
 import ProjectAttendanceSheetsAPI from 'src/api/models/ProjectAttendanceSheets.js'
 import SessionAttendanceSheetsAPI from 'src/api/models/SessionAttendanceSheets.js'
@@ -66,6 +67,7 @@ export const APIGateway = {
   classroomGrader: new ClassroomGraderAPI(),
   classroomLeaders: new ClassroomLeadersAPI(),
   teamRegistrations: new TeamRegistrationsAPI(),
+  eventRegistration: new EventRegistrationApi(),
   classroomRegistration: new ClassroomRegistrationAPI(),
   projectAttendanceSheets: new ProjectAttendanceSheetsAPI(),
   sessionAttendanceSheets: new SessionAttendanceSheetsAPI()

+ 73 - 0
src/api/models/EventRegistration.js

@@ -0,0 +1,73 @@
+import { appApi } from 'src/boot/axios.js'
+import APIRepository from '../classes/APIRepository.js'
+import { Registration, RegistrationList } from 'src/models/Registration.js'
+
+export default class EventRegistrationAPI extends APIRepository {
+  constructor() {
+    super('registrations', appApi, '/ema/registrations', Registration)
+    this.APIAdresses = {
+      base: '/ema/registrations',
+      exportReport: '/ema/registrations/export_report',
+      classroomDetail: (registrationId) => '/ema/registrations/' + registrationId + '/classroom_detail',
+      byId: (id) => '/ema/registrations/' + id
+    }
+    this.CacheList = {
+      base: this.name + this.APIAdresses.base,
+      byId: (id) => this.name + this.APIAdresses.byId(id)
+    }
+  }
+
+  index(data) {
+    return this.sendRequest({
+      apiMethod: 'get',
+      api: this.api,
+      request: this.APIAdresses.base,
+      data: this.getNormalizedSendData({
+        classroom: null, // Number
+        owner: null, // Number
+        per_page: 10, // Number
+        page: 1 // Number
+      }, data),
+      resolveCallback: (response) => {
+        const paginate = response.data
+        const results = response.data.results
+        delete paginate.results
+        return {
+          list: new RegistrationList(results),
+          paginate
+          // {
+          //   "count": 1,
+          //   "num_pages": 1,
+          //   "per_page": 10,
+          //   "current": 1,
+          //   "next": null,
+          //   "previous": null,
+          // }
+        }
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+
+  exportReport(data) {
+    return this.sendRequest({
+      apiMethod: 'get',
+      api: this.api,
+      request: this.APIAdresses.exportReport,
+      data: this.getNormalizedSendData({
+        classroom: null, // Number
+        type: null, // String
+        status: null // String
+      }, data),
+      responseType: 'blob',
+      resolveCallback: (response) => {
+        return response.data // xlsxData
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+}

+ 1 - 1
src/pages/User/Profile/EventInfo.vue

@@ -17,7 +17,7 @@
             align="justify"
             narrow-indicator>
       <q-tab name="eventInfo"
-             label="اطلاعات دوره آموزشی" />
+             label="اطلاعات رویداد" />
       <q-tab v-if="event.live_streaming_url"
              name="live_streaming_url"
              label="بخش آنلاین" />

+ 1 - 34
src/pages/User/Profile/Events.vue

@@ -90,21 +90,11 @@ export default {
           placeholder: ' ',
           col: 'col-md-2 col-12'
         },
-        {
-          type: 'select',
-          name: 'unit',
-          responseKey: 'unit',
-          options: [],
-          value: null,
-          label: 'درس',
-          placeholder: ' ',
-          col: 'col-md-2 col-12'
-        },
         { type: 'hidden', name: 'owner', value: null },
         { type: 'input', name: 'search', label: 'جستجو', placeholder: ' ', col: 'col-md-2 col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
       ],
-      api: APIGateway.registration.APIAdresses.base,
+      api: APIGateway.eventRegistration.APIAdresses.base,
       table: {
         columns: [
           {
@@ -203,21 +193,9 @@ export default {
       }
     }
   },
-  // computed: {
-  //   selectedCategoryId () {
-  //     return this.getInputValue('category')
-  //   }
-  // },
-  // watch: {
-  //   selectedCategoryId () {
-  //     this.setInputValue('unit', null)
-  //     this.getUnits(this.selectedCategoryId)
-  //   }
-  // },
   mounted () {
     this.setOwner()
     this.setActionBtn()
-    this.loadInputDataOptions()
     this.mounted = true
   },
   methods: {
@@ -255,17 +233,6 @@ export default {
 
       return target.label
     },
-    loadInputDataOptions () {
-      this.getUnits()
-    },
-    getUnits (selectedcategoryId) {
-      APIGateway.unit.index({ category: selectedcategoryId })
-        .then(unitList => {
-          this.loadSelectOptions('unit', this.getSelectOptions(unitList.list.list, 'id', 'title'))
-        })
-        .catch(() => {
-        })
-    },
     getInputValue (name) {
       const inputIndex = this.inputs.findIndex(input => input.name === name)
       return this.inputs[inputIndex].value

+ 23 - 23
src/router/routes.js

@@ -225,17 +225,17 @@ const routes = [
                 component: () => import('src/pages/User/Profile/OverdueInstalment.vue')
               },
               {
-                name: 'UserPanel.Profile.AllClassrooms',
-                path: 'all-classrooms',
-                component: () => import('src/pages/User/Profile/classrooms.vue'),
+                name: 'UserPanel.Profile.AllDiscussionCirclesClassrooms',
+                path: 'all-discussion-circles-classrooms',
+                component: () => import('src/pages/User/Profile/DiscussionCirclesClassrooms.vue'),
                 meta: {
                   breadcrumbs: {
                     visible: true,
                     loading: false,
                     path: [
                       {
-                        label: 'دوره های من',
-                        to: { name: 'UserPanel.Profile.AllClassrooms' }
+                        label: 'حلقه های مباحثاتی من',
+                        to: { name: 'UserPanel.Profile.AllDiscussionCirclesClassrooms' }
                       }
                     ]
                   },
@@ -243,17 +243,17 @@ const routes = [
                 }
               },
               {
-                name: 'UserPanel.Profile.AllEvents',
-                path: 'all-events',
-                component: () => import('src/pages/User/Profile/Events.vue'),
+                name: 'UserPanel.Profile.AllClassrooms',
+                path: 'all-classrooms',
+                component: () => import('src/pages/User/Profile/classrooms.vue'),
                 meta: {
                   breadcrumbs: {
                     visible: true,
                     loading: false,
                     path: [
                       {
-                        label: 'رویدادهای من',
-                        to: { name: 'UserPanel.Profile.AllEvents' }
+                        label: 'دوره های من',
+                        to: { name: 'UserPanel.Profile.AllClassrooms' }
                       }
                     ]
                   },
@@ -261,31 +261,31 @@ const routes = [
                 }
               },
               {
-                name: 'UserPanel.Profile.AllDiscussionCirclesClassrooms',
-                path: 'all-discussion-circles-classrooms',
-                component: () => import('src/pages/User/Profile/DiscussionCirclesClassrooms.vue'),
+                name: 'UserPanel.Profile.ClassroomInfo',
+                path: 'classroom/:id',
+                component: () => import('src/pages/User/Profile/classroomInfo.vue'),
+                meta: {
+                  middlewares: [HasOverdueInstalment]
+                }
+              },
+              {
+                name: 'UserPanel.Profile.AllEvents',
+                path: 'all-events',
+                component: () => import('src/pages/User/Profile/Events.vue'),
                 meta: {
                   breadcrumbs: {
                     visible: true,
                     loading: false,
                     path: [
                       {
-                        label: 'حلقه های مباحثاتی من',
-                        to: { name: 'UserPanel.Profile.AllDiscussionCirclesClassrooms' }
+                        label: 'رویدادهای من',
+                        to: { name: 'UserPanel.Profile.AllEvents' }
                       }
                     ]
                   },
                   middlewares: [HasOverdueInstalment]
                 }
               },
-              {
-                name: 'UserPanel.Profile.ClassroomInfo',
-                path: 'classroom/:id',
-                component: () => import('src/pages/User/Profile/classroomInfo.vue'),
-                meta: {
-                  middlewares: [HasOverdueInstalment]
-                }
-              },
               {
                 name: 'UserPanel.Profile.EventInfo',
                 path: 'event/:id',