Sfoglia il codice sorgente

AdminTicketList.vue filter bug fix

ali 3 anni fa
parent
commit
17a24da840

+ 41 - 22
src/components/Widgets/Ticket/AdminTicketList/AdminTicketList.vue

@@ -62,40 +62,51 @@ export default {
           name: 'creation_time__gte',
           label: 'از تاریخ',
           placeholder: ' ',
-          col: 'col-md-3 col-12'
+          col: 'col-md-4 col-12'
         },
         {
           type: 'dateTime',
           name: 'creation_time__lt',
           label: 'تا تاریخ',
           placeholder: ' ',
-          col: 'col-md-3 col-12'
+          col: 'col-md-4 col-12'
         },
-        { type: 'input', name: 'owner__national_code', label: 'کدملی', placeholder: ' ', col: 'col-md-3 col-12' },
+        { type: 'input', name: 'owner__national_code', label: 'کدملی', placeholder: ' ', col: 'col-md-4 col-12' },
 
+        // {
+        //   type: 'select',
+        //   name: 'source_type',
+        //   responseKey: 'source_type',
+        //   placeholder: ' ',
+        //   options: [
+        //     { label: ' ', value: null },
+        //     { label: 'مالی', value: 'INVOICE' },
+        //     { label: 'آموزش', value: 'TRAINING_CLASSROOM' },
+        //     { label: 'حلقه های مباحثاتی', value: 'DISCUSSION_CIRCLE_CLASSROOM' },
+        //     { label: 'محتوا', value: 'CONTENT' },
+        //     { label: 'SESSION', value: 'SESSION' }
+        //   ],
+        //   label: 'مرجع',
+        //   value: null,
+        //   col: 'col-md-3 col-12'
+        // },
         {
           type: 'select',
-          name: 'source_type',
-          responseKey: 'source_type',
+          name: 'category__type',
+          responseKey: 'category__type',
           placeholder: ' ',
-          options: [
-            { label: ' ', value: null },
-            { label: 'مالی', value: 'INVOICE' },
-            { label: 'آموزش', value: 'TRAINING_CLASSROOM' },
-            { label: 'حلقه های مباحثاتی', value: 'DISCUSSION_CIRCLE_CLASSROOM' },
-            { label: 'محتوا', value: 'CONTENT' },
-            { label: 'SESSION', value: 'SESSION' }
-          ],
-          label: 'مرجع',
+          options: (new TicketCategory()).typeEnums,
+          label: 'معاونت',
           value: null,
-          col: 'col-md-3 col-12'
+          col: 'col-md-4 col-12'
         },
-        { type: 'select', name: 'category', responseKey: 'category', placeholder: ' ', options: [], label: 'دسته', col: 'col-md-3 col-12' },
-        { type: 'select', name: 'status', responseKey: 'status', placeholder: ' ', options: (new Ticket()).statusEnums, label: 'وضعیت', col: 'col-md-3 col-12' },
+        { type: 'select', name: 'category', responseKey: 'category', placeholder: ' ', options: [], label: 'دسته', col: 'col-md-4 col-12' },
+        { type: 'select', name: 'status', responseKey: 'status', placeholder: ' ', options: (new Ticket()).statusEnums, 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: 'source_type', value: null },
+        // { type: 'hidden', name: 'source_type', value: null },
         // { type: 'space', name: 'space', value: null, col: 'col-12' },
-        { type: 'space', name: 'space', value: null, col: 'col-md-2 col-12' },
+        { type: 'space', name: 'space', value: null, col: 'col-md-8 col-12' },
         { type: 'select', name: 'per_page', responseKey: 'per_page', placeholder: ' ', options: [10, 25, 50], value: 10, label: 'تعداد در صفحه', col: 'col-md-2 col-12' }
       ],
       table: {
@@ -175,13 +186,19 @@ export default {
     },
     selectedSourceType () {
       return FormBuilderAssist.getInputsByName(this.inputs, 'category__type')?.value
+    },
+    selectedTicketCategoryType () {
+      return FormBuilderAssist.getInputsByName(this.inputs, 'category__type')?.value
     }
   },
   watch: {
     selectedPerPage () {
       this.search()
     },
-    selectedSourceType () {
+    // selectedSourceType () {
+    //   this.loadCategories()
+    // },
+    selectedTicketCategoryType () {
       this.loadCategories()
     }
   },
@@ -196,7 +213,7 @@ export default {
   methods: {
     checkSource () {
       if (this.localOptions.defaultSourceType) {
-        FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'value', 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)
@@ -237,7 +254,9 @@ export default {
     },
     loadCategories () {
       return new Promise((resolve, reject) => {
-        const type = this.localOptions.defaultCategoryType ? this.localOptions.defaultCategoryType : (new TicketCategory()).getCategoryTypeFromSourceType(this.selectedSourceType)
+        // const type = this.localOptions.defaultCategoryType ? this.localOptions.defaultCategoryType : (new TicketCategory()).getCategoryTypeFromSourceType(this.selectedSourceType)
+        const type = this.selectedTicketCategoryType
+
         APIGateway.ticketCategory.index({ type })
           .then(({ list }) => {
             FormBuilderAssist.setAttributeByName(this.inputs, 'category', 'options', list.list.map(item => {