UserPanelHeader.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <div class="header-inside col">
  3. <div class="admin-top-menu">
  4. <div class="logo gt-sm">
  5. <router-link :to="{name: 'Public.Home'}">
  6. <q-img class="logo-image"
  7. src="/assets/images/admin/layout/admin-logo.png" />
  8. </router-link>
  9. </div>
  10. <div class="top-menu-items">
  11. <div class="right-side">
  12. <q-btn flat
  13. icon="menu"
  14. class="lt-md"
  15. @click="updateLayoutLeftDrawerVisible(true)" />
  16. <q-btn flat
  17. class="items-center"
  18. :to="{name: 'Public.Home'}">
  19. <q-icon name="home"
  20. class="material-icons-outlined" />
  21. صفحه اصلی
  22. </q-btn>
  23. </div>
  24. <div class="left-side">
  25. <q-btn flat
  26. :to="{name: 'UserPanel.Notice.List'}">
  27. <q-icon name="notifications_none" />
  28. پیام ها
  29. <q-badge v-if="myNotSeenNotificationsCount !== 0"
  30. color="warning">
  31. {{ myNotSeenNotificationsCount }}
  32. </q-badge>
  33. </q-btn>
  34. <q-btn flat>
  35. <q-icon name="person"
  36. class="material-icons-outlined" />
  37. {{ user.fullname() }}
  38. <q-menu>
  39. <q-list style="min-width: 100px">
  40. <q-item v-if="user.canSeeUserProfilePanel()"
  41. v-close-popup
  42. clickable
  43. :to="{name: 'UserPanel.Profile.UserInfo'}">
  44. <q-item-section>پروفایل</q-item-section>
  45. </q-item>
  46. <q-item v-close-popup
  47. clickable
  48. @click="logOut">
  49. <q-item-section>خروج</q-item-section>
  50. </q-item>
  51. </q-list>
  52. </q-menu>
  53. </q-btn>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { mapMutations } from 'vuex'
  61. import { User } from 'src/models/User.js'
  62. import { APIGateway } from 'src/api/APIGateway.js'
  63. export default {
  64. name: 'UserPanelHeader',
  65. data () {
  66. return {
  67. user: new User(),
  68. topMenuItems: [
  69. // {
  70. // title: 'معرفی پروژه',
  71. // scrollTo: '#introSection',
  72. // routeName: 'aaaaaaaaaaaa'
  73. // },
  74. // {
  75. // title: 'مجامع',
  76. // scrollTo: '#majameSection',
  77. // routeName: 'aaaaaaaaaaaa'
  78. // },
  79. // {
  80. // title: 'مشاورین حقوقی',
  81. // scrollTo: '#moshaverinSection',
  82. // routeName: 'aaaaaaaaaaaa'
  83. // },
  84. // {
  85. // title: 'تصاویر',
  86. // scrollTo: '#gallerySection',
  87. // routeName: 'aaaaaaaaaaaa'
  88. // },
  89. // {
  90. // title: 'اخبار و رویدادها',
  91. // scrollTo: '#newsSection',
  92. // routeName: 'aaaaaaaaaaaa'
  93. // },
  94. // {
  95. // title: 'ارتباط با ما',
  96. // scrollTo: '#feedback',
  97. // routeName: 'aaaaaaaaaaaa'
  98. // }
  99. ]
  100. }
  101. },
  102. computed: {
  103. myNotSeenNotificationsCount: {
  104. get () {
  105. return this.$store.getters['Auth/myNotSeenNotificationsCount']
  106. },
  107. set (newValue) {
  108. return this.$store.commit('Auth/updateMyNotSeenNotificationsCount', newValue)
  109. }
  110. },
  111. isAdminPage () {
  112. return this.$route.name && this.$route.name.includes('Admin.')
  113. },
  114. isProfilePage () {
  115. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  116. },
  117. isHomePage () {
  118. return this.$route.name && this.$route.name === 'Public.Home'
  119. }
  120. },
  121. mounted () {
  122. this.loadAuthData()
  123. },
  124. methods: {
  125. getMyNotSeenNotificationsCount () {
  126. APIGateway.noticeReceiver.myNotSeenNotificationsCount()
  127. .then((count) => {
  128. this.myNotSeenNotificationsCount = count
  129. })
  130. },
  131. loadAuthData () {
  132. this.user = this.$store.getters['Auth/user']
  133. },
  134. ...mapMutations('AppLayout', [
  135. 'updateLayoutLeftDrawerVisible'
  136. ]),
  137. goToHome () {
  138. this.$router.push({ name: 'Public.Home' })
  139. },
  140. goToAdminDashboard () {
  141. this.$router.push({ name: 'Admin.Content.Index' })
  142. },
  143. logOut () {
  144. this.$store.dispatch('Auth/logOut')
  145. },
  146. toggleLeftDrawer () {
  147. this.updateLayoutLeftDrawerVisible(true)
  148. },
  149. hasRoute (route) {
  150. if (!route) {
  151. return
  152. }
  153. return !!(route.name || route.path)
  154. },
  155. getRoute (route) {
  156. if (!this.hasRoute(route)) {
  157. return { name: null }
  158. }
  159. if (route.name) {
  160. return { name: route.name }
  161. } else if (route.path) {
  162. return { path: route.path }
  163. } else {
  164. return { name: null }
  165. }
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .header-inside {
  172. height: 70px;
  173. border-bottom: 1px solid #DFE1EC;
  174. .admin-top-menu {
  175. display: flex;
  176. flex-flow: row;
  177. height: 100%;
  178. background: #F6F7FB;
  179. .top-menu-items {
  180. width: calc( 100% - 240px );
  181. display: flex;
  182. flex-flow: row;
  183. justify-content: space-between;
  184. .q-btn {
  185. height: 40px;
  186. padding: 4px 4px;
  187. svg {
  188. margin-right: 10px;
  189. }
  190. }
  191. .right-side {
  192. display: flex;
  193. flex-flow: row;
  194. align-items: center;
  195. padding-left: 50px;
  196. @media screen and (max-width: 1023px) {
  197. & {
  198. padding-left: 0;
  199. }
  200. }
  201. }
  202. .left-side {
  203. display: flex;
  204. flex-flow: row;
  205. align-items: center;
  206. padding-right: 50px;
  207. @media screen and (max-width: 1023px) {
  208. & {
  209. padding-right: 0;
  210. }
  211. }
  212. }
  213. @media screen and (max-width: 1023px) {
  214. & {
  215. width: 100%;
  216. }
  217. }
  218. }
  219. .logo {
  220. width: 240px;
  221. height: 100%;
  222. background: #FBF4EA;
  223. border-right: solid 1px #DFE1EC;
  224. display: flex;
  225. align-items: center;
  226. justify-content: center;
  227. .logo-image {
  228. width: 106px;
  229. height: auto;
  230. }
  231. }
  232. }
  233. }
  234. .top-menu-items {
  235. border-radius: 10px;
  236. @media screen and (max-width: 1023px) {
  237. & {
  238. margin-left: 0;
  239. }
  240. }
  241. @media only screen and (max-width: 500px) {
  242. .q-btn__content {
  243. margin: 4px;
  244. font-size: 0.7rem;
  245. }
  246. }
  247. @media only screen and (max-width: 400px) {
  248. .q-btn__content {
  249. margin: 3px;
  250. font-size: 0.6rem;
  251. }
  252. }
  253. }
  254. .breadcrumbs {
  255. .q-breadcrumbs__separator {
  256. .q-icon {
  257. font-size: 22px;
  258. }
  259. }
  260. }
  261. .drawer-btn {
  262. .q-btn {
  263. flex-direction: row !important;
  264. &.toolbar-button {
  265. margin-left: 0 !important;
  266. }
  267. }
  268. }
  269. .q-btn {
  270. &.toolbar-button {
  271. margin-left: 12px;
  272. height: 48px;
  273. width: 48px;
  274. box-shadow: -2px -4px 10px rgba(255, 255, 255, 0.6), 2px 4px 10px rgba(112, 108, 162, 0.05);
  275. border-radius: 16px;
  276. border: solid 1px #c5c5c5;
  277. }
  278. }
  279. .q-icon {
  280. padding: 2px;
  281. }
  282. .left-side {
  283. .q-btn {
  284. &.toolbar-button {
  285. .q-btn__content {
  286. .q-btn-dropdown__arrow {
  287. display: none !important;
  288. }
  289. }
  290. }
  291. }
  292. }
  293. .drawer-btn {
  294. display: none;
  295. @media screen and (max-width: 1439px) {
  296. & {
  297. display: block;
  298. }
  299. }
  300. @media screen and (max-width: 599px) {
  301. & {
  302. margin-bottom: 10px;
  303. }
  304. }
  305. }
  306. .right-side {
  307. display: flex;
  308. align-items: center;
  309. @media screen and (max-width: 1439px) {
  310. & {
  311. margin-left: 78px;
  312. }
  313. }
  314. @media screen and (max-width: 1023px) {
  315. & {
  316. margin-left: 42px;
  317. }
  318. }
  319. @media screen and (max-width: 599px) {
  320. & {
  321. margin-left: 16px;
  322. }
  323. }
  324. .breadcrumbs {
  325. &:deep(> *) {
  326. font-style: normal;
  327. font-weight: bold;
  328. font-size: 16px;
  329. line-height: 31px;
  330. text-align: right;
  331. color: #23263B;
  332. div:first-child {
  333. font-size: 18px;
  334. }
  335. }
  336. }
  337. }
  338. .left-side {
  339. display: flex;
  340. justify-content: flex-end;
  341. @media screen and (max-width: 1439px) {
  342. //position: absolute;
  343. //right: 30px;
  344. }
  345. @media screen and (max-width: 599px) {
  346. & {
  347. margin-right: 16px;
  348. align-items: center;
  349. }
  350. }
  351. }
  352. </style>