ソースを参照

lint and remove unit from event

ali 3 年 前
親
コミット
a7c9bca216

+ 1 - 1
src/components/Widgets/Event/AdminEventShow/AdminEventShow.vue

@@ -68,9 +68,9 @@
 
 <script>
 import { Event } from 'src/models/Event.js'
+import EventInfo from './components/EventInfo.vue'
 import ProjectList from './components/ProjectList.vue'
 import MembersList from './components/MembersList.vue'
-import EventInfo from './components/EventInfo.vue'
 import LiveStreaming from './components/LiveStreaming.vue'
 import ActivitySheetList from './components/ActivitySheetList.vue'
 import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'

+ 2 - 44
src/components/Widgets/Event/AdminEventShow/components/EventInfo.vue

@@ -60,8 +60,7 @@ export default {
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'آپلود عکس رویدادها', col: 'col-md-3 col-12' },
         { type: 'file', name: 'codes', responseKey: 'codes', label: 'آیین نامه رویدادها', col: 'col-md-3 col-12' },
         { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
-        { type: 'select', name: 'category', responseKey: 'unit_info.category_info.id', options: (new Event()).categoryEnums, value: null, placeholder: ' ', label: 'دسته بندی', col: 'col-md-3 col-12' },
-        { type: 'select', name: 'unit', responseKey: 'unit', options: [], value: null, placeholder: ' ', label: 'درس', col: 'col-md-3 col-12' },
+        { type: 'select', name: 'category', responseKey: 'category', options: (new Event()).categoryEnums, value: null, placeholder: ' ', label: 'دسته بندی', col: 'col-md-3 col-12' },
         { type: 'select', name: 'holding_type', responseKey: 'holding_type', options: (new Event()).holding_typeEnums, value: null, placeholder: ' ', label: 'نوع برگزاری', col: 'col-md-3 col-12' },
         { type: 'input', name: 'price', responseKey: 'price', placeholder: ' ', label: 'هزینه برگزاری', col: 'col-md-3 col-12' },
         { type: 'input', name: 'live_streaming_url', responseKey: 'live_streaming_url', placeholder: ' ', label: 'لینک مکان مجازی رویدادها', col: 'col-12' },
@@ -158,9 +157,6 @@ export default {
     }
   },
   computed: {
-    // selectedCategoryId () {
-    //   return FormBuilderAssist.getInputsByName(this.inputs, 'category').value
-    // },
     localClassroom: {
       get () {
         return this.event
@@ -170,15 +166,6 @@ export default {
       }
     }
   },
-  // watch: {
-  //   selectedCategoryId () {
-  //     if (!this.mounted) {
-  //       return
-  //     }
-  //     FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'value', null)
-  //     this.getUnits(this.selectedCategoryId)
-  //   }
-  // },
   mounted () {
     this.localClassroom.loading = true
     this.preLoadData()
@@ -204,7 +191,6 @@ export default {
         APIGateway.event.get(this.eventId)
           .then((event) => {
             this.setInputAttr('category', 'value', event.category)
-            this.setInputAttr('unit', 'value', event.unit)
             this.beforeLoadInputData(event)
               .then((event) => {
                 resolve(event)
@@ -221,14 +207,10 @@ export default {
     beforeLoadInputData (/* responseData */) {
       return new Promise((resolve, reject) => {
         const promise1 = this.getProfessors()
-        const promise2 = this.getCategories()
-        const promise3 = this.getUnits()
-        // const promise3 = this.getUnits(responseData.unit_info.category)
         this.$nextTick(() => {
-          Promise.all([promise1, promise2, promise3])
+          Promise.all([promise1])
             .then(() => {
               // this.setInputAttr('category', 'value', responseData.unit_info.category)
-              // this.setInputAttr('unit', 'value', responseData.unit)
               this.eventEntityEditKey = Date.now()
               resolve()
             })
@@ -250,30 +232,6 @@ export default {
         })
         .catch(() => {})
     },
-    getCategories () {
-      return APIGateway.unitCategory.index({ per_page: 9999 })
-        .then((categories) => {
-          this.setInputAttr('category', 'options', categories.list.list.map(item => {
-            return {
-              value: item.id,
-              label: item.title
-            }
-          }))
-        })
-        .catch(() => {})
-    },
-    getUnits (selectedcategoryId) {
-      return APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId })
-        .then((units) => {
-          this.setInputAttr('unit', 'options', units.list.list.map(item => {
-            return {
-              value: item.id,
-              label: item.title
-            }
-          }))
-        })
-        .catch(() => {})
-    },
     getUserFullname (user) {
       return user.firstname + ' ' + user.lastname
     },

+ 2 - 33
src/pages/Admin/Event/create.vue

@@ -39,7 +39,6 @@
 import { shallowRef } from 'vue'
 import { EntityCreate } from 'quasar-crud'
 import { Event } from 'src/models/Event.js'
-import Enums from 'src/assets/Enums/Enums.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 import { FormBuilderAssist } from 'quasar-form-builder'
 import FormBuilderInputEditor from 'src/components/FormBuilderCustumComponents/FormBuilderInputEditor.vue'
@@ -69,8 +68,7 @@ export default {
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'آپلود عکس دوره', col: 'col-md-3 col-12' },
         { type: 'file', name: 'codes', responseKey: 'codes', label: 'آیین نامه دوره', col: 'col-md-3 col-12' },
         { type: 'separator', name: 'space', size: '0', col: 'col-md-12' },
-        { type: 'select', name: 'category', responseKey: 'unit_info.category', options: (new Event()).categoryEnums, value: null, placeholder: ' ', label: 'دسته بندی', col: 'col-md-3 col-12' },
-        { type: 'select', name: 'unit', responseKey: 'unit', options: [], value: null, placeholder: ' ', label: 'درس', col: 'col-md-3 col-12' },
+        { type: 'select', name: 'category', responseKey: 'category', options: (new Event()).categoryEnums, value: null, placeholder: ' ', label: 'دسته بندی', col: 'col-md-3 col-12' },
         { type: 'select', name: 'holding_type', responseKey: 'holding_type', options: (new Event()).holding_typeEnums, value: null, placeholder: ' ', label: 'نوع برگزاری', col: 'col-md-3 col-12' },
         { type: 'input', name: 'price', responseKey: 'price', placeholder: ' ', label: 'هزینه برگزاری', col: 'col-md-3 col-12' },
         { type: 'input', name: 'live_streaming_url', responseKey: 'live_streaming_url', placeholder: ' ', label: 'لینک مکان مجازی دوره', col: 'col-12' },
@@ -163,18 +161,6 @@ export default {
       ]
     }
   },
-  // computed: {
-  //   selectedCategoryId () {
-  //     return FormBuilderAssist.getInputsByName(this.inputs, 'category')?.value
-  //   }
-  // },
-  // watch: {
-  //   selectedCategoryId () {
-  //     FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'value', null)
-  //     FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'options', [])
-  //     this.getUnits(this.selectedCategoryId)
-  //   }
-  // },
   mounted () {
     this.preLoadData()
       .then(() => {
@@ -190,9 +176,8 @@ export default {
     preLoadData () {
       return new Promise((resolve, reject) => {
         const promise1 = this.getProfessors()
-        const promise2 = this.getUnits()
         this.$nextTick(() => {
-          Promise.all([promise1, promise2])
+          Promise.all([promise1])
             .then(() => {
               resolve()
             })
@@ -214,22 +199,6 @@ export default {
         })
         .catch(() => {})
     },
-    getUnits (selectedcategoryId = null) {
-      this.unitsLoading = true
-      APIGateway.unit.index({ per_page: 9999, category: selectedcategoryId })
-        .then((units) => {
-          FormBuilderAssist.setAttributeByName(this.inputs, 'unit', 'options', units.list.list.map(item => {
-            return {
-              value: item.id,
-              label: item.title
-            }
-          }))
-          this.unitsLoading = false
-        })
-        .catch(() => {
-          this.unitsLoading = false
-        })
-    },
     getUserFullname (user) {
       return user.firstname + ' ' + user.lastname
     },

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

@@ -151,7 +151,7 @@
 import { EntityIndex } from 'quasar-crud'
 import { Event } from 'src/models/Event.js'
 import Enums from 'src/assets/Enums/Enums.js'
-import {Invoice} from "src/models/Invoice.js";
+import { Invoice } from 'src/models/Invoice.js'
 import { mixinAuth } from 'src/mixin/Mixins.js'
 import ShamsiDate from 'src/assets/ShamsiDate.js'
 import { APIGateway } from 'src/api/APIGateway.js'
@@ -443,7 +443,6 @@ export default {
     },
     getInvoiceStatusTitle (type) {
       const target = (new Invoice()).statusEnums.find(item => item.value === type)
-      const target = Enums.invoiceStatus.find(item => item.value === type)
       if (!target) {
         return '-'
       }