UserPanelSideBar.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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.Payment.TransactionList',
  84. show: true,
  85. active: false
  86. },
  87. {
  88. title: 'کیف پول الکترونیک',
  89. routeName: 'UserPanel.Wallet',
  90. show: true,
  91. active: false
  92. }
  93. ]
  94. }
  95. ],
  96. titlesList: []
  97. }
  98. },
  99. computed: {
  100. isAdminRoute () {
  101. return this.$route.name && this.$route.name.includes('Admin.')
  102. },
  103. isProfilePage () {
  104. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  105. }
  106. },
  107. mounted () {
  108. this.loadAuthData()
  109. },
  110. methods: {
  111. loadAuthData () {
  112. this.user = this.$store.getters['Auth/user']
  113. },
  114. loadUserItems () {
  115. if (this.user.isSuperUser()) {
  116. this.titlesList.unshift(...[
  117. {
  118. title: 'کاربران',
  119. routeName: 'Admin.User.Index',
  120. show: true,
  121. active: false
  122. },
  123. {
  124. title: 'سامانه آموزشی',
  125. routeName: null,
  126. show: true,
  127. open: false,
  128. active: false,
  129. children: [
  130. {
  131. title: 'دسته بندی ها',
  132. routeName: 'Admin.Category.Index',
  133. show: true,
  134. active: false
  135. },
  136. {
  137. title: 'دوره های آموزشی',
  138. routeName: 'Admin.Classroom.Index',
  139. show: true,
  140. active: false
  141. }
  142. ]
  143. }
  144. ])
  145. }
  146. },
  147. search (list, parentContain = false) {
  148. if (!list || list.length === 0) {
  149. return false
  150. }
  151. if (parentContain) {
  152. return true
  153. }
  154. let flag = false
  155. list.forEach(item => {
  156. const contain = item.title.includes(this.searchText)
  157. if (this.search(item.children, contain) || contain) {
  158. flag = true
  159. item.show = true
  160. item.open = true
  161. } else {
  162. item.open = false
  163. item.show = false
  164. }
  165. })
  166. return flag
  167. },
  168. logOut () {
  169. return this.$store.dispatch('Auth/logOut')
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. .UserPanelSideBar {
  176. .logo {
  177. padding: 10px 60px;
  178. .q-btn {
  179. width: 100%;
  180. }
  181. }
  182. .side-menu-list {
  183. }
  184. }
  185. </style>