AdminPanelHeader.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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. :to="{name: 'Public.Home'}">
  18. <svg xmlns="http://www.w3.org/2000/svg"
  19. width="20.5"
  20. height="21.505"
  21. viewBox="0 0 20.5 21.505">
  22. <g id="Home"
  23. transform="translate(0 0)">
  24. <path id="Fill_1"
  25. data-name="Fill 1"
  26. d="M16.277,21.506H14.353A1.973,1.973,0,0,1,12.4,19.536V16.46a.677.677,0,0,0-.684-.669H8.831a.675.675,0,0,0-.674.669v3.066a.742.742,0,0,1-.031.215,1.983,1.983,0,0,1-1.979,1.764H4.223A4.211,4.211,0,0,1,0,17.317V8.6A3.158,3.158,0,0,1,1.259,6.1L7.794.855a3.913,3.913,0,0,1,4.88,0L19.256,6.1A3.154,3.154,0,0,1,20.5,8.582v8.734A4.211,4.211,0,0,1,16.277,21.506ZM8.826,14.291h2.891A2.179,2.179,0,0,1,13.9,16.46v3.076a.472.472,0,0,0,.47.469h1.906A2.709,2.709,0,0,0,19,17.317V8.593a1.672,1.672,0,0,0-.667-1.309L11.74,2.026a2.416,2.416,0,0,0-3.01,0L2.181,7.282A1.684,1.684,0,0,0,1.5,8.61v8.707a2.709,2.709,0,0,0,2.723,2.688H6.147a.486.486,0,0,0,.491-.479.766.766,0,0,1,.019-.171v-2.9A2.182,2.182,0,0,1,8.826,14.291Z"
  27. transform="translate(0 0)"
  28. fill="#aaa095" />
  29. </g>
  30. </svg>
  31. صفحه اصلی
  32. </q-btn>
  33. </div>
  34. <div class="left-side">
  35. <q-btn flat>
  36. <svg id="_000000ff"
  37. data-name="#000000ff"
  38. xmlns="http://www.w3.org/2000/svg"
  39. width="30"
  40. height="30"
  41. viewBox="0 0 30 30">
  42. <path id="Path_29101"
  43. data-name="Path 29101"
  44. d="M8.807,0H21.19a9.015,9.015,0,0,1,8.266,5.926A9.2,9.2,0,0,1,30,8.811V21.135a9.019,9.019,0,0,1-6.97,8.631A9.442,9.442,0,0,1,21.19,30H8.811A9.013,9.013,0,0,1,0,21.133V8.81A9.021,9.021,0,0,1,8.807,0M8.291,2.034A7.012,7.012,0,0,0,2,9.025q0,6.006,0,12.011A7.016,7.016,0,0,0,9.026,28q6,0,12.007,0A7.014,7.014,0,0,0,28,21.035Q28,15,28,8.961a7.012,7.012,0,0,0-5.962-6.885A12.06,12.06,0,0,0,20.154,2H9.434A10.63,10.63,0,0,0,8.291,2.034Z"
  45. fill="#aaa095" />
  46. <path id="Path_29102"
  47. data-name="Path 29102"
  48. d="M159.237,85.32A6,6,0,1,1,155.26,87.2a6.006,6.006,0,0,1,3.977-1.876m-.343,2.06a4,4,0,1,0,2.664.429A4.011,4.011,0,0,0,158.895,87.38Z"
  49. transform="translate(-144.628 -80.308)"
  50. fill="#aaa095" />
  51. <path id="Path_29103"
  52. data-name="Path 29103"
  53. d="M124.8,324.32c1.223-.023,2.446-.006,3.669-.01a8.967,8.967,0,0,1,6.065,2.409,1,1,0,0,1,.218,1.1.976.976,0,0,1-1.124.578,1.694,1.694,0,0,1-.749-.488,6.993,6.993,0,0,0-4.412-1.622q-1.64,0-3.281,0a6.992,6.992,0,0,0-4.654,1.845,1.041,1.041,0,0,1-.792.32,1,1,0,0,1-.685-1.682A8.994,8.994,0,0,1,124.8,324.32Z"
  54. transform="translate(-111.831 -305.305)"
  55. fill="#aaa095" />
  56. </svg>
  57. {{ user.fullname() }}
  58. <q-menu>
  59. <q-list style="min-width: 100px">
  60. <q-item v-if="user.canSeeUserProfilePanel()"
  61. v-close-popup
  62. clickable
  63. :to="{name: 'UserPanel.Profile.UserInfo'}">
  64. <q-item-section>پروفایل</q-item-section>
  65. </q-item>
  66. <q-item v-close-popup
  67. clickable
  68. @click="logOut">
  69. <q-item-section>خروج</q-item-section>
  70. </q-item>
  71. </q-list>
  72. </q-menu>
  73. </q-btn>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. import { mapMutations } from 'vuex'
  81. import { User } from 'src/models/User.js'
  82. export default {
  83. name: 'AdminPanelHeader',
  84. data () {
  85. return {
  86. user: new User(),
  87. topMenuItems: [
  88. // {
  89. // title: 'معرفی پروژه',
  90. // scrollTo: '#introSection',
  91. // routeName: 'aaaaaaaaaaaa'
  92. // },
  93. // {
  94. // title: 'مجامع',
  95. // scrollTo: '#majameSection',
  96. // routeName: 'aaaaaaaaaaaa'
  97. // },
  98. // {
  99. // title: 'مشاورین حقوقی',
  100. // scrollTo: '#moshaverinSection',
  101. // routeName: 'aaaaaaaaaaaa'
  102. // },
  103. // {
  104. // title: 'تصاویر',
  105. // scrollTo: '#gallerySection',
  106. // routeName: 'aaaaaaaaaaaa'
  107. // },
  108. // {
  109. // title: 'اخبار و رویدادها',
  110. // scrollTo: '#newsSection',
  111. // routeName: 'aaaaaaaaaaaa'
  112. // },
  113. // {
  114. // title: 'ارتباط با ما',
  115. // scrollTo: '#feedback',
  116. // routeName: 'aaaaaaaaaaaa'
  117. // }
  118. ]
  119. }
  120. },
  121. computed: {
  122. isAdminPage () {
  123. return this.$route.name && this.$route.name.includes('Admin.')
  124. },
  125. isProfilePage () {
  126. return this.$route.name && this.$route.name.includes('UserPanel.Profile.')
  127. },
  128. isHomePage () {
  129. return this.$route.name && this.$route.name === 'Public.Home'
  130. }
  131. },
  132. mounted () {
  133. this.loadAuthData()
  134. },
  135. methods: {
  136. loadAuthData () {
  137. this.user = this.$store.getters['Auth/user']
  138. },
  139. ...mapMutations('AppLayout', [
  140. 'updateLayoutLeftDrawerVisible'
  141. ]),
  142. goToHome () {
  143. this.$router.push({ name: 'Public.Home' })
  144. },
  145. goToAdminDashboard () {
  146. this.$router.push({ name: 'Admin.Content.Index' })
  147. },
  148. logOut () {
  149. this.$store.dispatch('Auth/logOut')
  150. },
  151. toggleLeftDrawer () {
  152. this.updateLayoutLeftDrawerVisible(true)
  153. },
  154. hasRoute (route) {
  155. if (!route) {
  156. return
  157. }
  158. return !!(route.name || route.path)
  159. },
  160. getRoute (route) {
  161. if (!this.hasRoute(route)) {
  162. return { name: null }
  163. }
  164. if (route.name) {
  165. return { name: route.name }
  166. } else if (route.path) {
  167. return { path: route.path }
  168. } else {
  169. return { name: null }
  170. }
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .drawer-btn {
  177. display: none;
  178. @media screen and (max-width: 1439px) {
  179. display: block;
  180. }
  181. @media screen and (max-width: 599px) {
  182. margin-bottom: 10px;
  183. }
  184. }
  185. .right-side {
  186. display: flex;
  187. align-items: center;
  188. @media screen and (max-width: 1439px) {
  189. margin-left: 78px;
  190. }
  191. @media screen and (max-width: 1023px) {
  192. margin-left: 0;
  193. }
  194. .breadcrumbs {
  195. &:deep(> *) {
  196. font-style: normal;
  197. font-weight: bold;
  198. font-size: 16px;
  199. line-height: 31px;
  200. text-align: right;
  201. color: #23263B;
  202. div:first-child {
  203. font-size: 18px;
  204. }
  205. }
  206. }
  207. }
  208. .left-side {
  209. display: flex;
  210. justify-content: flex-end;
  211. @media screen and (max-width: 1439px) {
  212. position: absolute;
  213. right: 30px;
  214. }
  215. @media screen and (max-width: 599px) {
  216. right: 16px;
  217. margin-bottom: 10px;
  218. }
  219. }
  220. </style>
  221. <style scoped lang="scss">
  222. .header-inside {
  223. height: 100%;
  224. border-bottom: 1px solid #DFE1EC;
  225. .admin-top-menu {
  226. display: flex;
  227. flex-flow: row;
  228. height: 100%;
  229. background: #F6F7FB;
  230. .top-menu-items {
  231. width: calc( 100% - 240px );
  232. display: flex;
  233. flex-flow: row;
  234. justify-content: space-between;
  235. @media screen and (max-width: 1023px) {
  236. width: 100%;
  237. }
  238. .q-btn {
  239. height: 40px;
  240. svg {
  241. margin-right: 10px;
  242. }
  243. }
  244. .right-side {
  245. display: flex;
  246. flex-flow: row;
  247. align-items: center;
  248. padding-left: 50px;
  249. @media screen and (max-width: 1023px) {
  250. padding-left: 0;
  251. }
  252. }
  253. .left-side {
  254. display: flex;
  255. flex-flow: row;
  256. align-items: center;
  257. padding-right: 50px;
  258. @media screen and (max-width: 1023px) {
  259. padding-right: 0;
  260. }
  261. }
  262. }
  263. .logo {
  264. width: 240px;
  265. height: 100%;
  266. background: #FBF4EA;
  267. border-right: solid 1px #DFE1EC;
  268. display: flex;
  269. align-items: center;
  270. justify-content: center;
  271. .logo-image {
  272. width: 106px;
  273. height: auto;
  274. }
  275. }
  276. }
  277. }
  278. .top-menu-items {
  279. border-radius: 10px;
  280. @media only screen and (max-width: 500px) {
  281. .q-btn__content {
  282. margin: 4px;
  283. font-size: 0.7rem;
  284. }
  285. }
  286. @media only screen and (max-width: 400px) {
  287. .q-btn__content {
  288. margin: 3px;
  289. font-size: 0.6rem;
  290. }
  291. }
  292. }
  293. .breadcrumbs {
  294. .q-breadcrumbs__separator {
  295. .q-icon {
  296. font-size: 22px;
  297. }
  298. }
  299. }
  300. .drawer-btn {
  301. .q-btn {
  302. flex-direction: row !important;
  303. &.toolbar-button {
  304. margin-left: 0 !important;
  305. }
  306. }
  307. }
  308. .q-btn {
  309. &.toolbar-button {
  310. margin-left: 12px;
  311. height: 48px;
  312. width: 48px;
  313. box-shadow: -2px -4px 10px rgba(255, 255, 255, 0.6), 2px 4px 10px rgba(112, 108, 162, 0.05);
  314. border-radius: 16px;
  315. border: solid 1px #c5c5c5;
  316. }
  317. }
  318. .left-side {
  319. .q-btn {
  320. &.toolbar-button {
  321. .q-btn__content {
  322. .q-btn-dropdown__arrow {
  323. display: none !important;
  324. }
  325. }
  326. }
  327. }
  328. }
  329. </style>