UserPanelSideBar.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. :user="user" />
  16. </q-list>
  17. </div>
  18. </template>
  19. <script>
  20. import { User } from 'src/models/User.js'
  21. import menuItem from 'src/components/Menu/SideMenu/MenuItem.vue'
  22. export default {
  23. name: 'UserPanelSideBar',
  24. components: { menuItem },
  25. data () {
  26. return {
  27. user: new User(),
  28. clickedItem: null,
  29. searchText: '',
  30. userProfileMenuItems: [
  31. {
  32. title: 'پیشخوان',
  33. routeName: 'Public.AllClassrooms',
  34. icon: 'grid_view',
  35. show: true,
  36. active: false
  37. },
  38. // {
  39. // title: 'مدیریت حلقه ها',
  40. // routeName: 'UserPanel.Profile.AllDiscussionCirclesClassrooms',
  41. // icon: 'groups',
  42. // show: true,
  43. // active: false
  44. // },
  45. {
  46. title: 'دوره های آموزشی',
  47. routeName: null,
  48. icon: 'auto_stories',
  49. show: true,
  50. open: true,
  51. active: false,
  52. children: [
  53. {
  54. title: 'دوره های من',
  55. routeName: 'UserPanel.Profile.AllClassrooms',
  56. show: true,
  57. active: false
  58. },
  59. {
  60. title: 'گروه های من',
  61. roles: ['team_leader'],
  62. routeName: 'UserPanel.Leader.Teams.Index',
  63. icon: 'diversity_3',
  64. show: true,
  65. active: false
  66. }
  67. ]
  68. },
  69. {
  70. title: 'تصحیح های من',
  71. roles: ['superuser', 'grader'],
  72. icon: 'quiz',
  73. show: true,
  74. active: false,
  75. routeName: 'UserPanel.Classroom.MyAsGraderClassroom.Index'
  76. },
  77. {
  78. title: 'رویدادها',
  79. routeName: null,
  80. icon: 'auto_stories',
  81. show: true,
  82. open: true,
  83. active: false,
  84. children: [
  85. {
  86. title: 'رویدادهای من',
  87. routeName: 'UserPanel.Profile.AllEvents',
  88. show: true,
  89. active: false
  90. }
  91. ]
  92. },
  93. {
  94. title: 'درخواست ها',
  95. routeName: 'UserPanel.Ticket.List',
  96. icon: 'email',
  97. show: true,
  98. active: false
  99. },
  100. {
  101. title: 'بخش مالی',
  102. icon: 'account_balance_wallet',
  103. routeName: null,
  104. show: true,
  105. open: true,
  106. active: false,
  107. children: [
  108. {
  109. title: 'صورتحساب ها',
  110. routeName: 'UserPanel.Invoice.List',
  111. show: true,
  112. active: false
  113. },
  114. {
  115. title: 'سفارش های من',
  116. routeName: 'UserPanel.MyOrders.List',
  117. show: true,
  118. active: false
  119. },
  120. {
  121. title: 'تاریخچه اتصال به درگاه بانک',
  122. routeName: 'UserPanel.Payment.TransactionList',
  123. show: true,
  124. active: false
  125. },
  126. {
  127. title: 'کیف پول الکترونیک',
  128. routeName: 'UserPanel.Wallet',
  129. show: true,
  130. active: false
  131. }
  132. ]
  133. }
  134. ],
  135. titlesList: []
  136. }
  137. },
  138. computed: {
  139. isAdminRoute () {
  140. return this.$route.name && this.$route.name.includes('Admin.')
  141. },
  142. isProfilePage () {
  143. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  144. }
  145. },
  146. mounted () {
  147. this.loadAuthData()
  148. },
  149. methods: {
  150. loadAuthData () {
  151. this.user = this.$store.getters['Auth/user']
  152. },
  153. loadUserItems () {
  154. if (this.user.isSuperUser()) {
  155. this.titlesList.unshift(...[
  156. {
  157. title: 'کاربران',
  158. routeName: 'Admin.User.Index',
  159. show: true,
  160. active: false
  161. },
  162. {
  163. title: 'سامانه آموزشی',
  164. routeName: null,
  165. show: true,
  166. open: false,
  167. active: false,
  168. children: [
  169. {
  170. title: 'دسته بندی ها',
  171. routeName: 'Admin.Category.Index',
  172. show: true,
  173. active: false
  174. },
  175. {
  176. title: 'دوره های آموزشی',
  177. routeName: 'Admin.Classroom.Index',
  178. show: true,
  179. active: false
  180. }
  181. ]
  182. }
  183. ])
  184. }
  185. },
  186. search (list, parentContain = false) {
  187. if (!list || list.length === 0) {
  188. return false
  189. }
  190. if (parentContain) {
  191. return true
  192. }
  193. let flag = false
  194. list.forEach(item => {
  195. const contain = item.title.includes(this.searchText)
  196. if (this.search(item.children, contain) || contain) {
  197. flag = true
  198. item.show = true
  199. item.open = true
  200. } else {
  201. item.open = false
  202. item.show = false
  203. }
  204. })
  205. return flag
  206. },
  207. logOut () {
  208. return this.$store.dispatch('Auth/logOut')
  209. }
  210. }
  211. }
  212. </script>
  213. <style lang="scss" scoped>
  214. .UserPanelSideBar {
  215. .logo {
  216. padding: 10px 60px;
  217. .q-btn {
  218. width: 100%;
  219. }
  220. }
  221. .side-menu-list {
  222. }
  223. }
  224. </style>