UserPanelSideBar.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="UserPanelSideBar">
  3. <div class="logo lt-md">
  4. <q-btn flat
  5. round
  6. dense
  7. class="btn-logo"
  8. :to="{name: 'Public.Home'}">
  9. <q-img src="/assets/images/web/homepage-first-section-logo.png" />
  10. </q-btn>
  11. </div>
  12. <q-list class="side-menu-list"
  13. padding>
  14. <menu-item :menu="userProfileMenuItems" />
  15. </q-list>
  16. </div>
  17. </template>
  18. <script>
  19. import { User } from 'src/models/User.js'
  20. import menuItem from 'src/components/Menu/SideMenu/MenuItem.vue'
  21. export default {
  22. name: 'UserPanelSideBar',
  23. components: { menuItem },
  24. data () {
  25. return {
  26. user: new User(),
  27. clickedItem: null,
  28. searchText: '',
  29. userProfileMenuItems: [
  30. {
  31. title: 'پیشخوان',
  32. routeName: 'Public.AllClassrooms',
  33. icon: 'grid_view',
  34. show: true,
  35. active: false
  36. },
  37. // {
  38. // title: 'مدیریت حلقه ها',
  39. // routeName: 'UserPanel.Profile.AllDiscussionCirclesClassrooms',
  40. // icon: 'groups',
  41. // show: true,
  42. // active: false
  43. // },
  44. {
  45. title: 'دوره های آموزشی',
  46. routeName: null,
  47. icon: 'auto_stories',
  48. show: true,
  49. open: true,
  50. active: false,
  51. children: [
  52. {
  53. title: 'دوره های من',
  54. routeName: 'UserPanel.Profile.AllClassrooms',
  55. show: true,
  56. active: false
  57. }
  58. ]
  59. },
  60. {
  61. title: 'درخواست ها',
  62. routeName: 'UserPanel.Ticket.List',
  63. icon: 'email',
  64. show: true,
  65. active: false
  66. },
  67. {
  68. title: 'بخش مالی',
  69. icon: 'account_balance_wallet',
  70. routeName: null,
  71. show: true,
  72. open: true,
  73. active: false,
  74. children: [
  75. {
  76. title: 'صورتحساب ها',
  77. routeName: 'UserPanel.Invoice.List',
  78. show: true,
  79. active: false
  80. },
  81. {
  82. title: 'کیف پول الکترونیک',
  83. routeName: 'UserPanel.Wallet',
  84. show: true,
  85. active: false
  86. }
  87. ]
  88. }
  89. ],
  90. titlesList: []
  91. }
  92. },
  93. computed: {
  94. isAdminRoute () {
  95. return this.$route.name && this.$route.name.includes('Admin.')
  96. },
  97. isProfilePage () {
  98. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  99. }
  100. },
  101. mounted () {
  102. this.loadAuthData()
  103. },
  104. methods: {
  105. loadAuthData () {
  106. this.user = this.$store.getters['Auth/user']
  107. },
  108. loadUserItems () {
  109. if (this.user.isSuperUser()) {
  110. this.titlesList.unshift(...[
  111. {
  112. title: 'کاربران',
  113. routeName: 'Admin.User.Index',
  114. show: true,
  115. active: false
  116. },
  117. {
  118. title: 'سامانه آموزشی',
  119. routeName: null,
  120. show: true,
  121. open: false,
  122. active: false,
  123. children: [
  124. {
  125. title: 'دسته بندی ها',
  126. routeName: 'Admin.Category.Index',
  127. show: true,
  128. active: false
  129. },
  130. {
  131. title: 'دوره های آموزشی',
  132. routeName: 'Admin.Classroom.Index',
  133. show: true,
  134. active: false
  135. }
  136. ]
  137. }
  138. ])
  139. }
  140. },
  141. search (list, parentContain = false) {
  142. if (!list || list.length === 0) {
  143. return false
  144. }
  145. if (parentContain) {
  146. return true
  147. }
  148. let flag = false
  149. list.forEach(item => {
  150. const contain = item.title.includes(this.searchText)
  151. if (this.search(item.children, contain) || contain) {
  152. flag = true
  153. item.show = true
  154. item.open = true
  155. } else {
  156. item.open = false
  157. item.show = false
  158. }
  159. })
  160. return flag
  161. },
  162. logOut () {
  163. return this.$store.dispatch('Auth/logOut')
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. .UserPanelSideBar {
  170. .logo {
  171. padding: 10px 60px;
  172. .q-btn {
  173. width: 100%;
  174. }
  175. }
  176. .side-menu-list {
  177. }
  178. }
  179. </style>