ali 3 vuotta sitten
vanhempi
commit
25d0c54901

+ 7 - 12
src/components/Template/SideBard/AdminPanelSideBar.vue

@@ -51,12 +51,6 @@ export default {
               routeName: 'Admin.Classroom.Index',
               show: true,
               active: false
-            },
-            {
-              title: 'درخواست ها',
-              routeName: 'Admin.Classroom.Ticket',
-              show: true,
-              active: false
             }
           ]
         },
@@ -79,15 +73,16 @@ export default {
               routeName: 'Admin.Classroom.DiscussionCircles.Index',
               show: true,
               active: false
-            },
-            {
-              title: 'درخواست ها',
-              routeName: 'Admin.Classroom.DiscussionCircles.Ticket',
-              show: true,
-              active: false
             }
           ]
         },
+        {
+          title: 'درخواست ها',
+          routeName: 'Admin.Ticket.List',
+          icon: 'confirmation_number',
+          show: true,
+          active: false
+        },
         {
           title: 'محتوا',
           icon: 'live_tv',

+ 2 - 2
src/components/Widgets/Content/ContentShow/ContentShow.vue

@@ -122,8 +122,8 @@ export default {
       ticketCategoryList: new TicketCategoryList(),
       entityIdKey: 'id',
       entityParamKey: 'id',
-      showRouteName: 'AdminPanel.Ticket.Show',
-      indexRouteName: 'AdminPanel.Ticket.List',
+      showRouteName: 'Admin.Ticket.Show',
+      indexRouteName: 'Admin.Ticket.List',
       inputs: [
         {
           type: 'select',

+ 1 - 1
src/components/Widgets/ContentCategory/AdminContentCategoryShow/AdminContentCategoryShow.vue

@@ -79,7 +79,7 @@ export default {
       api: null,
       entityIdKey: 'id',
       entityParamKey: 'id',
-      showRouteName: 'AdminPanel.Ticket.Show',
+      showRouteName: 'Admin.Ticket.Show',
       inputs: [
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', value: null, placeholder: ' ', col: 'col-md-6 col-12' },
         { type: 'file', name: 'thumbnail', responseKey: 'thumbnail', label: 'عکس', value: null, placeholder: ' ', col: 'col-md-6 col-12' },

+ 2 - 2
src/components/Widgets/Ticket/AdminTicketCreate/AdminTicketCreate.vue

@@ -49,8 +49,8 @@ export default {
       api: APIGateway.ticket.APIAdresses.base,
       entityIdKeyInResponse: 'id',
       showRouteParamKey: 'id',
-      showRouteName: 'AdminPanel.Ticket.Show',
-      indexRouteName: 'AdminPanel.Ticket.List',
+      showRouteName: 'Admin.Ticket.Show',
+      indexRouteName: 'Admin.Ticket.List',
       inputs: [
         { type: 'select', name: 'category', responseKey: 'category', options: [], label: 'دسته', col: 'col-md-6 col-12' },
         {

+ 30 - 8
src/components/Widgets/Ticket/AdminTicketList/AdminTicketList.vue

@@ -37,7 +37,7 @@ import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 import { FormBuilderAssist } from 'quasar-form-builder'
 import BtnControl from 'src/components/Control/btn.vue'
-import { TicketCategoryList } from 'src/models/TicketCategory.js'
+import { TicketCategory, TicketCategoryList } from 'src/models/TicketCategory.js'
 
 const BtnControlComp = shallowRef(BtnControl)
 
@@ -56,9 +56,9 @@ export default {
         pageKey: 'page'
       },
       inputs: [
+        { type: 'hidden', name: 'category__type', value: null, col: 'col-md-4 col-12' },
         { type: 'select', name: 'category', responseKey: 'category', placeholder: ' ', options: [], label: 'دسته', col: 'col-md-4 col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' },
-        { type: 'hidden', name: 'category__type', value: null },
         { type: 'hidden', name: 'source_type', value: null }
       ],
       table: {
@@ -104,6 +104,16 @@ export default {
       ticketCategoryList: new TicketCategoryList()
     }
   },
+  computed: {
+    selectedSourceType () {
+      return FormBuilderAssist.getInputsByName(this.inputs, 'category__type')?.value
+    }
+  },
+  watch: {
+    selectedSourceType () {
+      this.loadCategories()
+    }
+  },
   mounted() {
     this.loadOptions()
     this.setActionBtn()
@@ -117,6 +127,18 @@ export default {
       if (this.localOptions.defaultSourceType) {
         FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'value', this.localOptions.defaultSourceType)
         FormBuilderAssist.setAttributeByName(this.inputs, 'category__type', 'value', this.getCategoryTypeFromSourceType())
+      } else if (this.localOptions.defaultCategoryType) {
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category__type', 'value', this.localOptions.defaultCategoryType)
+      } else {
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category__type', 'type', 'select')
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category__type', 'label', 'معاونت')
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category__type', 'placeholder', ' ')
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category__type', 'options', [
+          { label: 'مالی', value: 'FINANCIAL' },
+          { label: 'آموزش', value: 'EDUCATIONAL' },
+          { label: 'محتوا', value: 'CONTENT' },
+          { label: 'عمومی', value: 'GENERAL' }
+        ])
       }
     },
     setActionBtn () {
@@ -128,19 +150,19 @@ export default {
     getShowRoute (ticketId) {
       const defaultSourceType = this.localOptions.defaultSourceType
       if (!defaultSourceType) {
-        return { name: 'AdminPanel.Ticket.Show', params: { id: ticketId } }
+        return { name: 'Admin.Ticket.Show', params: { id: ticketId } }
       }
 
       if (defaultSourceType === 'INVOICE') {
         return { name: 'Admin.Invoice.Ticket.Show', params: { id: ticketId } }
       } else if (defaultSourceType === 'TRAINING_CLASSROOM') {
-        return { name: 'AdminPanel.Ticket.Show', params: { id: ticketId } }
+        return { name: 'Admin.Ticket.Show', params: { id: ticketId } }
       } else if (defaultSourceType === 'DISCUSSION_CIRCLE_CLASSROOM') {
-        return { name: 'AdminPanel.Ticket.Show', params: { id: ticketId } }
+        return { name: 'Admin.Ticket.Show', params: { id: ticketId } }
       } else if (defaultSourceType === 'CONTENT') {
-        return { name: 'AdminPanel.Ticket.Show', params: { id: ticketId } }
+        return { name: 'Admin.Ticket.Show', params: { id: ticketId } }
       } else {
-        return { name: 'AdminPanel.Ticket.Show', params: { id: ticketId } }
+        return { name: 'Admin.Ticket.Show', params: { id: ticketId } }
       }
     },
     getCategoryTypeFromSourceType () {
@@ -163,7 +185,7 @@ export default {
     },
     loadCategories () {
       return new Promise((resolve, reject) => {
-        const type = this.getCategoryTypeFromSourceType()
+        const type = this.localOptions.defaultCategoryType ? this.localOptions.defaultCategoryType : (new TicketCategory()).getCategoryTypeFromSourceType(this.selectedSourceType)
         APIGateway.ticketCategory.index({ type })
           .then(({ list }) => {
             FormBuilderAssist.setAttributeByName(this.inputs, 'category', 'options', list.list.map(item => {

+ 15 - 0
src/components/Widgets/Ticket/AdminTicketList/OptionPanel.vue

@@ -1,6 +1,13 @@
 <template>
   <option-panel-tabs v-model:options="localOptions">
     <template #main-tab>
+      <div>
+        defaultCategoryType
+      </div>
+      <q-select v-model="localOptions.defaultCategoryType"
+                :options="categoryTypeOptions"
+                emit-value
+                map-options />
       <div>
         defaultSourceType
       </div>
@@ -26,11 +33,19 @@ export default defineComponent({
   data: () => {
     return {
       options: [
+        { label: 'قابل انتخاب', value: null },
         { label: 'مالی', value: 'INVOICE' },
         { label: 'آموزش', value: 'TRAINING_CLASSROOM' },
         { label: 'حلقه های مباحثاتی', value: 'DISCUSSION_CIRCLE_CLASSROOM' },
         { label: 'محتوا', value: 'CONTENT' },
         { label: 'SESSION', value: 'SESSION' }
+      ],
+      categoryTypeOptions: [
+        { label: 'قابل انتخاب', value: null },
+        { label: 'آموزشی', value: 'EDUCATIONAL' },
+        { label: 'مالی', value: 'FINANCIAL' },
+        { label: 'محتوایی', value: 'CONTENT' },
+        { label: 'عمومی', value: 'GENERAL' }
       ]
     }
   }

+ 2 - 2
src/components/Widgets/Ticket/AdminTicketShow/AdminTicketShow.vue

@@ -170,8 +170,8 @@ export default {
       ticketCategoryList: new TicketCategoryList(),
       entityIdKey: 'id',
       entityParamKey: 'id',
-      showRouteName: 'AdminPanel.Ticket.Show',
-      indexRouteName: 'AdminPanel.Ticket.List',
+      showRouteName: 'Admin.Ticket.Show',
+      indexRouteName: 'Admin.Ticket.List',
       inputs: [
         {
           type: 'select',

+ 2 - 2
src/components/Widgets/Ticket/TicketShow/TicketShow.vue

@@ -148,8 +148,8 @@ export default {
       ticketCategoryList: new TicketCategoryList(),
       entityIdKey: 'id',
       entityParamKey: 'id',
-      showRouteName: 'AdminPanel.Ticket.Show',
-      indexRouteName: 'AdminPanel.Ticket.List',
+      showRouteName: 'Admin.Ticket.Show',
+      indexRouteName: 'Admin.Ticket.List',
       inputs: [
         {
           type: 'select',

+ 1 - 1
src/pages/Admin/Ticket/List.vue

@@ -13,7 +13,7 @@ export default {
   mixins: [mixinPageOptions],
   data: () => {
     return {
-      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'AdminTicketList' }, { name: 'AdminTicketCreate', options: { style: { marginTop: '32px' } } }], options: { style: { paddingTop: '124px' } } }], options: {} }] } }]
+      sections: [{ data: { rows: [{ cols: [{ widgets: [{ name: 'AdminTicketList', options: { 0: { label: 'قابل انتخاب', value: null }, 1: { label: 'مالی', value: 'INVOICE' }, 2: { label: 'آموزش', value: 'TRAINING_CLASSROOM' }, 3: { label: 'حلقه های مباحثاتی', value: 'DISCUSSION_CIRCLE_CLASSROOM' }, 4: { label: 'محتوا', value: 'CONTENT' }, 5: { label: 'SESSION', value: 'SESSION' }, style: {}, defaultCategoryType: 'EDUCATIONAL' } }], options: { style: { paddingTop: '', marginBottom: '124px' } } }], options: {} }] } }]
     }
   },
   created() {

+ 4 - 4
src/router/routes.js

@@ -449,22 +449,22 @@ const routes = [
           },
           {
             path: 'ticket',
-            name: 'AdminPanel.Ticket',
+            name: 'Admin.Ticket',
             component: () => import('layouts/bareLayout.vue'),
             children: [
               {
                 path: '',
-                name: 'AdminPanel.Ticket.List',
+                name: 'Admin.Ticket.List',
                 component: () => import('src/pages/Admin/Ticket/List.vue')
               },
               {
                 path: 'create',
-                name: 'AdminPanel.Ticket.Create',
+                name: 'Admin.Ticket.Create',
                 component: () => import('src/pages/Admin/Ticket/Create.vue')
               },
               {
                 path: ':id',
-                name: 'AdminPanel.Ticket.Show',
+                name: 'Admin.Ticket.Show',
                 component: () => import('src/pages/Admin/Ticket/Show.vue')
               }
             ]