ali 3 år sedan
förälder
incheckning
28cfbc8c29

+ 27 - 1
src/components/Template/Header/MainHeader.vue

@@ -116,6 +116,32 @@
           <span class="btn-label">
             حساب کاربری
           </span>
+          <q-menu v-if="user.isAdmin() || user.isSuperUser()"
+                  fit>
+            <q-list>
+              <q-item v-close-popup
+                      clickable
+                      :to="{ name: 'UserPanel.Profile.UserInfo' }">
+                <q-item-section>
+                  پنل کاربری
+                </q-item-section>
+              </q-item>
+              <q-item v-close-popup
+                      clickable
+                      :to="{ name: 'Admin.User.Index' }">
+                <q-item-section>
+                  پنل ادمین
+                </q-item-section>
+              </q-item>
+              <q-item v-close-popup
+                      clickable
+                      @click="logOut">
+                <q-item-section>
+                  خروچ
+                </q-item-section>
+              </q-item>
+            </q-list>
+          </q-menu>
         </q-btn>
         <q-btn v-else
                color="primary"
@@ -180,7 +206,7 @@ export default {
     },
     goToProperPanel () {
       if (this.user.isSuperUser()) {
-        this.$router.push({ name: 'Admin.User.Index' })
+        // this.$router.push({ name: 'Admin.User.Index' })
       } else {
         this.$router.push({ name: 'UserPanel.Profile.UserInfo' })
       }

+ 8 - 5
src/components/Widgets/Invoice/InvoiceList/InvoiceList.vue

@@ -54,6 +54,7 @@ import { Invoice } from 'src/models/Invoice.js'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 import BtnControl from 'src/components/Control/btn.vue'
+import { FormBuilderAssist } from 'quasar-form-builder'
 import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
 
 const BtnControlComp = shallowRef(BtnControl)
@@ -89,6 +90,7 @@ export default {
         },
         { type: 'select', name: 'category', options: [], label: 'وضعیت تراکنش', placeholder: ' ', col: 'col-md-2 col-12' },
         { type: 'input', name: 'category', label: 'نوع صورتحساب', placeholder: ' ', col: 'col-md-2 col-12' },
+        { type: 'hidden', name: 'owner', value: null },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
       ],
       table: {
@@ -156,16 +158,17 @@ export default {
     }
   },
   mounted() {
+    this.setOwner()
     this.setActionBtn()
     this.mounted = true
   },
   methods: {
+    setOwner () {
+      const user = this.$store.getters['Auth/user']
+      FormBuilderAssist.setAttributeByName(this.inputs, 'owner', 'value', user.id)
+    },
     setActionBtn () {
-      this.inputs.forEach((item, index) => {
-        if (item.name === 'btn') {
-          this.inputs[index].atClick = this.search
-        }
-      })
+      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
     },
     search () {
       this.$refs.entityIndex.search()

+ 8 - 5
src/components/Widgets/Payment/PaymentList/PaymentList.vue

@@ -54,6 +54,7 @@ import { Payment } from 'src/models/Payment.js'
 import { Invoice } from 'src/models/Invoice.js'
 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 EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
 
@@ -90,6 +91,7 @@ export default {
         },
         { type: 'select', name: 'category', options: [], label: 'نوع تراکنش', placeholder: ' ', col: 'col-md-2 col-12' },
         { type: 'input', name: 'category', label: 'عنوان تراکنش', placeholder: ' ', col: 'col-md-2 col-12' },
+        { type: 'hidden', name: 'owner', value: null },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'جستجو', placeholder: ' ', atClick: () => {}, col: 'col-md-2 col-12' }
       ],
       table: {
@@ -157,16 +159,17 @@ export default {
     }
   },
   mounted() {
+    this.setOwner()
     this.setActionBtn()
     this.mounted = true
   },
   methods: {
+    setOwner () {
+      const user = this.$store.getters['Auth/user']
+      FormBuilderAssist.setAttributeByName(this.inputs, 'owner', 'value', user.id)
+    },
     setActionBtn () {
-      this.inputs.forEach((item, index) => {
-        if (item.name === 'btn') {
-          this.inputs[index].atClick = this.search
-        }
-      })
+      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
     },
     search () {
       this.$refs.entityIndex.search()

+ 11 - 1
src/components/Widgets/Ticket/TicketList/TicketList.vue

@@ -51,6 +51,7 @@ import { Ticket } from 'src/models/Ticket.js'
 import { mixinWidget } from 'src/mixin/Mixins.js'
 import { APIGateway } from 'src/api/APIGateway.js'
 import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
+import { FormBuilderAssist } from 'quasar-form-builder'
 
 export default {
   name: 'TicketList',
@@ -66,7 +67,9 @@ export default {
         perPage: 'per_page',
         pageKey: 'page'
       },
-      inputs: [],
+      inputs: [
+        { type: 'hidden', name: 'owner', value: null }
+      ],
       table: {
         columns: [
           {
@@ -104,7 +107,14 @@ export default {
     }
   },
   mounted() {
+    this.setOwner()
     this.mounted = true
+  },
+  methods: {
+    setOwner () {
+      const user = this.$store.getters['Auth/user']
+      FormBuilderAssist.setAttributeByName(this.inputs, 'owner', 'value', user.id)
+    }
   }
 }
 </script>

+ 12 - 2
src/pages/User/Profile/DiscussionCirclesClassrooms.vue

@@ -1,6 +1,7 @@
 <template>
   <breadcrumbs style="margin-top: 29px; margin-bottom: 19px;" />
-  <entity-index ref="entityIndex"
+  <entity-index v-if="mounted"
+                ref="entityIndex"
                 v-model:value="inputs"
                 title="لیست مباحثات"
                 :api="api"
@@ -45,6 +46,7 @@ import { APIGateway } from 'src/api/APIGateway.js'
 import BtnControl from 'src/components/Control/btn.vue'
 import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
 import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
+import { FormBuilderAssist } from 'quasar-form-builder'
 
 const BtnControlComp = shallowRef(BtnControl)
 
@@ -57,6 +59,7 @@ export default {
   },
   data () {
     return {
+      mounted: false,
       inputs: [
         {
           type: 'select',
@@ -86,6 +89,7 @@ export default {
           placeholder: ' ',
           col: 'col-md-2 col-12'
         },
+        { type: 'hidden', name: 'owner', value: null },
         { type: 'hidden', name: 'type', value: 'DISCUSSION_CIRCLE' },
         { type: 'hidden', name: 'unit__category__type', value: 'DISCUSSION_CIRCLE' },
         { type: 'input', name: 'search', label: 'جستجو', placeholder: ' ', col: 'col-md-2 col-12' },
@@ -194,11 +198,17 @@ export default {
       this.getUnits(this.selectedCategoryId)
     }
   },
-  created () {
+  mounted () {
+    this.setOwner()
     this.setActionBtn()
     this.loadInputDataOptions()
+    this.mounted = true
   },
   methods: {
+    setOwner () {
+      const user = this.$store.getters['Auth/user']
+      FormBuilderAssist.setAttributeByName(this.inputs, 'owner', 'value', user.id)
+    },
     setActionBtn () {
       this.inputs.forEach((item, index) => {
         if (item.name === 'btn') {

+ 13 - 7
src/pages/User/Profile/classrooms.vue

@@ -1,6 +1,7 @@
 <template>
   <breadcrumbs style="margin-top: 29px; margin-bottom: 19px;" />
-  <entity-index ref="entityIndex"
+  <entity-index v-if="mounted"
+                ref="entityIndex"
                 v-model:value="inputs"
                 title="لیست دوره ها"
                 :api="api"
@@ -48,6 +49,7 @@ import { EntityIndex } from 'quasar-crud'
 import Enums from 'src/assets/Enums/Enums.js'
 import ShamsiDate from 'src/assets/ShamsiDate.js'
 import { APIGateway } from 'src/api/APIGateway.js'
+import { FormBuilderAssist } from 'quasar-form-builder'
 import BtnControl from 'src/components/Control/btn.vue'
 import EntityIndexGridItem from 'src/components/EntityIndexGridItem.vue'
 import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
@@ -63,6 +65,7 @@ export default {
   },
   data () {
     return {
+      mounted: false,
       inputs: [
         {
           type: 'select',
@@ -110,6 +113,7 @@ export default {
           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' }
       ],
@@ -230,17 +234,19 @@ export default {
       this.getUnits(this.selectedCategoryId)
     }
   },
-  created () {
+  mounted () {
+    this.setOwner()
     this.setActionBtn()
     this.loadInputDataOptions()
+    this.mounted = true
   },
   methods: {
+    setOwner () {
+      const user = this.$store.getters['Auth/user']
+      FormBuilderAssist.setAttributeByName(this.inputs, 'owner', 'value', user.id)
+    },
     setActionBtn () {
-      this.inputs.forEach((item, index) => {
-        if (item.name === 'btn') {
-          this.inputs[index].atClick = this.search
-        }
-      })
+      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.search)
     },
     search () {
       this.$refs.entityIndex.search()