Bladeren bron

ticket view and create

ali 3 jaren geleden
bovenliggende
commit
975f3292f9

+ 15 - 10
src/components/Widgets/Ticket/TicketCreate/TicketCreate.vue

@@ -66,14 +66,15 @@ export default {
       inputs: [
         {
           type: 'select',
-          name: 'source_type',
+          name: 'category_info__type',
           options: [
-            { label: 'مالی', value: 'INVOICE' },
-            { label: 'آموزش', value: 'TRAINING_CLASSROOM' },
-            { label: 'حلقه های مباحثاتی', value: 'DISCUSSION_CIRCLE_CLASSROOM' },
-            { label: 'محتوا', value: 'CONTENT' }
+            { label: 'مالی', value: 'FINANCIAL' },
+            { label: 'آموزش', value: 'EDUCATIONAL' },
+            { label: 'محتوا', value: 'CONTENT' },
+            { label: 'عمومی', value: 'GENERAL' }
           ],
-          label: 'دپارتمان',
+          label: 'معاونت',
+          ignoreValue: true,
           placeholder: ' ',
           col: 'col-md-4 col-12'
         },
@@ -83,13 +84,14 @@ export default {
         { type: 'inputEditor', name: 'body', label: 'متن درخواست', col: 'col-md-12 col-12' },
         { type: 'file', name: 'attachment', label: 'انتخاب فایل ضمیمه', col: 'col-md-3 col-12' },
         { type: 'hidden', name: 'owner', value: 1 },
+        { type: 'hidden', name: 'source_type', value: null },
         { type: 'hidden', name: 'source_id', value: null }
       ]
     }
   },
   computed: {
     selectedSourceType () {
-      return FormBuilderAssist.getInputsByName(this.inputs, 'source_type')?.value
+      return FormBuilderAssist.getInputsByName(this.inputs, 'category_info__type')?.value
     }
   },
   watch: {
@@ -107,13 +109,16 @@ export default {
     checkSource () {
       const sourceId = this.$route.query.source_id
       const sourceType = this.$route.query.source_type
+      const ticketCategory = (new TicketCategory()).getCategoryTypeFromSourceType(sourceType)
+
       if (sourceType && sourceId) {
         FormBuilderAssist.setAttributeByName(this.inputs, 'source_id', 'value', sourceId)
         FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'value', sourceType)
-        FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'readonly', true)
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category_info__type', 'value', ticketCategory)
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category_info__type', 'readonly', true)
       } else if (this.localOptions.defaultSourceType) {
-        FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'value', this.localOptions.defaultSourceType)
-        FormBuilderAssist.setAttributeByName(this.inputs, 'source_type', 'readonly', true)
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category_info__type', 'value', this.localOptions.defaultSourceType)
+        FormBuilderAssist.setAttributeByName(this.inputs, 'category_info__type', 'readonly', true)
       }
     },
     create() {

+ 15 - 1
src/components/Widgets/Ticket/TicketShow/TicketShow.vue

@@ -145,7 +145,21 @@ export default {
       showRouteName: 'AdminPanel.Ticket.Show',
       indexRouteName: 'AdminPanel.Ticket.List',
       inputs: [
-        { type: 'select', name: 'source_type', responseKey: 'source_type', options: [{ label: 'مالی', value: 'INVOICE' }, { label: 'آموزش', value: 'CLASSROOM' }], label: 'دپارتمان', placeholder: ' ', col: 'col-md-4 col-12' },
+        {
+          type: 'select',
+          name: 'category_info__type',
+          responseKey: 'category_info.type',
+          options: [
+            { label: 'مالی', value: 'FINANCIAL' },
+            { label: 'آموزش', value: 'EDUCATIONAL' },
+            { label: 'محتوا', value: 'CONTENT' },
+            { label: 'عمومی', value: 'GENERAL' }
+          ],
+          label: 'معاونت',
+          placeholder: ' ',
+          ignoreValue: true,
+          col: 'col-md-4 col-12'
+        },
         { type: 'select', name: 'category', responseKey: 'category', placeholder: ' ', options: [], label: 'دسته', col: 'col-md-4 col-12' },
         { type: 'select', name: 'status', responseKey: 'status', options: (new Ticket()).statusEnums, multiple: false, label: 'وضعیت', placeholder: ' ', col: 'col-md-4 col-12' },
         { type: 'input', name: 'title', responseKey: 'title', label: 'عنوان', placeholder: ' ', col: 'col-md-12 col-12' },