UserPanelSideBar.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <div class="side-menu-main-layout">
  3. <div v-if="false"
  4. class="side-logo">
  5. <div class="logo-image" />
  6. </div>
  7. <q-list class="side-menu-list"
  8. padding>
  9. <q-input v-if="false"
  10. v-model="searchText"
  11. dense
  12. standout="bg-deep-purple-5 text-white"
  13. placeholder="جست و جو"
  14. @update:model-value ="search(userProfileMenuItems)">
  15. <template v-slot:append>
  16. <q-icon name="search" />
  17. </template>
  18. </q-input>
  19. <menu-item :menu="userProfileMenuItems" />
  20. </q-list>
  21. <div v-if="false"
  22. class="log-out"
  23. @click="logOut">
  24. <span>
  25. <q-avatar icon="isax:logout"
  26. size="30"
  27. dir="rtl" />
  28. </span>
  29. <span class="logout-text">خروج </span>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import { User } from 'src/models/User.js'
  35. import menuItem from 'src/components/Menu/SideMenu/MenuItem.vue'
  36. export default {
  37. name: 'SideMenu-dashboard',
  38. components: { menuItem },
  39. data () {
  40. return {
  41. user: new User(),
  42. clickedItem: null,
  43. searchText: '',
  44. userProfileMenuItems: [
  45. {
  46. title: 'پیشخوان',
  47. routeName: 'Public.AllClassrooms',
  48. scrollTo: '#introSection',
  49. show: true,
  50. active: false
  51. },
  52. {
  53. title: 'دوره های آموزشی',
  54. routeName: null,
  55. show: true,
  56. open: true,
  57. active: false,
  58. children: [
  59. {
  60. title: 'دوره های من',
  61. routeName: 'UserPanel.Profile.AllClassrooms',
  62. show: true,
  63. active: false
  64. }
  65. ]
  66. },
  67. {
  68. title: 'درخواست ها',
  69. routeName: 'UserPanel.Ticket.List',
  70. show: true,
  71. active: false
  72. },
  73. {
  74. title: 'بخش مالی',
  75. routeName: null,
  76. show: true,
  77. open: true,
  78. active: false,
  79. children: [
  80. {
  81. title: 'صورتحساب ها',
  82. scrollTo: '#introSection',
  83. routeName: 'UserPanel.Invoice.List',
  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. .side-menu-main-layout {
  176. display: flex;
  177. flex-direction: column;
  178. border-radius: 0;
  179. margin: 30px 0 0 0;
  180. overflow-y: auto;
  181. .side-logo {
  182. display: flex;
  183. height: 167px;
  184. align-items: center;
  185. justify-content: center;
  186. @media screen and (max-width: 1919px) {
  187. height: 136px;
  188. }
  189. @media screen and (max-width: 1439px) {
  190. height: 100px;
  191. }
  192. @media screen and (max-width: 599px) {
  193. height: 110px;
  194. }
  195. .logo-image {
  196. width: 140px;
  197. height: 95px;
  198. @media screen and (max-width: 1919px) {
  199. height: 76px;
  200. }
  201. @media screen and (max-width: 1439px) {
  202. width: 100px;
  203. height: 50px;
  204. }
  205. .q-img__container {
  206. width: 140px;
  207. height: 95px;
  208. @media screen and (max-width: 1919px) {
  209. height: 76px;
  210. }
  211. @media screen and (max-width: 1439px) {
  212. width: 100px;
  213. height: 50px;
  214. }
  215. }
  216. }
  217. }
  218. .q-list {
  219. padding: 0;
  220. width: 100%;
  221. &.side-menu-list {
  222. margin: 0;
  223. .top-separator {
  224. margin: 0 40px 32px 40px;
  225. @media screen and (max-width: 1919px) {
  226. margin: 0 30px 25px 30px;
  227. }
  228. @media screen and (max-width: 1439px) {
  229. margin: 0 45px 22px 45px;
  230. }
  231. }
  232. .q-item {
  233. padding: 0;
  234. min-height: 0;
  235. &.item-list {
  236. display: flex;
  237. flex-direction: column;
  238. justify-content: center;
  239. font-size: 16px;
  240. font-weight: 500;
  241. cursor: pointer;
  242. padding: 0 14px 0 10px;
  243. border-radius: 14px;
  244. &.alone-item {
  245. height: 40px;
  246. &.active-route {
  247. .indicator {
  248. height: 8px;
  249. width: 8px;
  250. background-color: white;
  251. border-radius: 50%;
  252. margin: auto;
  253. }
  254. }
  255. }
  256. .section-title {
  257. height: 30px;
  258. display: flex;
  259. flex-direction: row;
  260. align-items: center;
  261. .title-icon {
  262. margin-right: 12px;
  263. }
  264. .q-item__section--side {
  265. padding: 0;
  266. }
  267. }
  268. .list-section {
  269. display: flex;
  270. flex-direction: row;
  271. justify-content: right;
  272. .q-avatar {
  273. height: 22px;
  274. width: 22px;
  275. }
  276. }
  277. }
  278. }
  279. .side-expansion-list {
  280. &.top-expansion {
  281. margin-bottom: 10px;
  282. }
  283. .expansion-body {
  284. display: flex;
  285. margin-left: 8px;
  286. }
  287. .q-expansion-item__content {
  288. .vertical-separator {
  289. margin: 6px 9px 9px 9px;
  290. @media screen and (max-width: 599px) {
  291. margin: 0 10px 12px 10px;
  292. }
  293. }
  294. }
  295. .q-list {
  296. &.list-expansion {
  297. margin-bottom: 0;
  298. .item-list-expansion {
  299. height: 30px;
  300. margin: 5px;
  301. .item-list-expansion-title {
  302. justify-content: start;
  303. }
  304. }
  305. .top-expansion-separator {
  306. margin: 0 40px 5px 40px;
  307. @media screen and (max-width: 1439px) {
  308. margin: 0 30px 5px 30px;
  309. }
  310. @media screen and (max-width: 599px) {
  311. margin: 0 45px 5px 45px;
  312. }
  313. }
  314. .list-child-item {
  315. height: 30px;
  316. justify-content: right;
  317. margin-bottom: 8px;
  318. width: 157px;
  319. border-radius: 10px;
  320. padding: 0 14px;
  321. @media screen and (max-width: 1439px) {
  322. width: 148px;
  323. }
  324. @media screen and (max-width: 599px) {
  325. width: 160px;
  326. margin-bottom: 5px;
  327. padding: 0 10px 0 12px;
  328. }
  329. &:last-child {
  330. margin-bottom: 0;
  331. }
  332. .list-child-section {
  333. font-size: 14px !important;
  334. justify-content: center;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. .active-route {
  341. background-color: rgb(91 122 95 / 8%);
  342. color: #616161;
  343. .indicator {
  344. height: 6px;
  345. width: 6px;
  346. background-color: white;
  347. border-radius: 50%;
  348. margin: auto;
  349. }
  350. }
  351. }
  352. .q-item__section--avatar {
  353. min-width: 0 !important;
  354. }
  355. a {
  356. text-decoration: none;
  357. color: #212121;
  358. padding: 0;
  359. }
  360. }
  361. .log-out {
  362. color: white;
  363. font-size: 16px;
  364. font-weight: 500;
  365. cursor: pointer;
  366. height: 40px !important;
  367. //width: 232px;
  368. border-radius: 14px;
  369. display: flex;
  370. align-items: center;
  371. padding: 0 14px 0 10px;
  372. margin: 0 0 36px 27px;
  373. @media screen and (max-width: 1439px) {
  374. margin: 0 31px 33px 31px;
  375. }
  376. @media screen and (max-width: 599px) {
  377. margin: 0 30px 30px 30px;
  378. //padding: 0 0 0 10px;
  379. }
  380. &:hover {
  381. background-color: rgba(255, 255, 255, 0.1);
  382. }
  383. .q-avatar {
  384. height: 22px;
  385. width: 22px;
  386. margin-right: 12px;
  387. transform: matrix(-1, 0, 0, 1, 0, 0);
  388. }
  389. }
  390. &:deep(.side-menu-main-layout) {
  391. .q-expansion-item__container {
  392. .q-item {
  393. display: flex;
  394. padding: 0 10px !important;
  395. }
  396. .q-icon {
  397. font-size: 21px;
  398. }
  399. }
  400. }
  401. }
  402. </style>