LeftMenuLayoutAdministrador.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <q-drawer
  3. v-bind="$attrs"
  4. :model-value="true"
  5. show-if-above
  6. no-swipe-close
  7. no-swipe-open
  8. :width="235"
  9. :mini-width="64"
  10. :breakpoint="500"
  11. :mini="navigation_store.miniState"
  12. :behavior="'desktop'"
  13. class="left-menu-drawer"
  14. >
  15. <div class="column full-height no-wrap left-menu-inner">
  16. <div class="left-menu-items-wrapper column full-height no-wrap">
  17. <div class="left-menu-bg-overlay" />
  18. <div class="left-menu-bg-tint" />
  19. <q-list class="left-menu-list column no-wrap">
  20. <template v-for="(item, index) in navigation_store.navigationItems" :key="index">
  21. <template v-if="item.permission">
  22. <q-item
  23. v-if="item.type === 'single'"
  24. v-ripple
  25. clickable
  26. :exact="item.name === 'ParceiroHomePage'"
  27. exact-active-class="menu-selected"
  28. active-class="menu-selected"
  29. :to="{ name: item.name }"
  30. class="left-menu-item"
  31. >
  32. <q-item-section avatar>
  33. <q-icon :name="item.icon" class="left-menu-icon" />
  34. </q-item-section>
  35. <q-item-section v-if="!navigation_store.miniState">{{ $t(item.title) }}</q-item-section>
  36. <q-tooltip
  37. v-if="navigation_store.miniState"
  38. anchor="center right"
  39. self="center left"
  40. :offset="[10, 10]"
  41. >{{ $t(item.title) }}</q-tooltip>
  42. </q-item>
  43. <div v-else>
  44. <template v-if="!navigation_store.miniState">
  45. <q-expansion-item
  46. v-model="isExpasionItemExpanded[index]"
  47. :class="{ 'menu-selected': childrenAreActive(item.childrens) && !isExpasionItemExpanded[index] }"
  48. class="left-menu-item"
  49. >
  50. <template #header>
  51. <q-item-section avatar>
  52. <q-icon :name="item.icon" class="left-menu-icon" />
  53. </q-item-section>
  54. <q-item-section>{{ $t(item.title) }}</q-item-section>
  55. </template>
  56. <div v-for="child in item.childrens" :key="child.name">
  57. <q-item
  58. v-ripple
  59. clickable
  60. :to="{ name: child.name }"
  61. exact
  62. exact-active-class="menu-selected"
  63. class="q-pl-lg left-menu-item"
  64. >
  65. <q-item-section avatar>
  66. <q-icon :name="child.icon" class="left-menu-icon" />
  67. </q-item-section>
  68. <q-item-section>{{ $t(child.title) }}</q-item-section>
  69. </q-item>
  70. </div>
  71. </q-expansion-item>
  72. </template>
  73. <template v-else>
  74. <q-item
  75. v-ripple
  76. clickable
  77. :class="{ 'menu-selected': childrenAreActive(item.childrens) }"
  78. class="left-menu-item"
  79. >
  80. <q-item-section avatar>
  81. <q-icon :name="item.icon" class="left-menu-icon" />
  82. </q-item-section>
  83. <q-tooltip anchor="center right" self="center left" :offset="[10, 10]">
  84. {{ $t(item.title) }}
  85. </q-tooltip>
  86. <q-menu class="menu-drawer" anchor="center right" self="top start">
  87. <q-list>
  88. <q-item
  89. v-for="child in item.childrens"
  90. :key="child.name"
  91. v-ripple
  92. v-close-popup
  93. clickable
  94. :to="{ name: child.name }"
  95. exact
  96. exact-active-class="menu-selected"
  97. class="menu-drawer"
  98. >
  99. <q-item-section avatar>
  100. <q-icon :name="child.icon" class="left-menu-icon" />
  101. </q-item-section>
  102. <q-item-section>{{ $t(child.title) }}</q-item-section>
  103. </q-item>
  104. </q-list>
  105. </q-menu>
  106. </q-item>
  107. </template>
  108. </div>
  109. </template>
  110. </template>
  111. </q-list>
  112. <q-list class="q-mt-auto left-menu-footer">
  113. <q-item v-ripple class="left-menu-item" clickable @click="openUrl('https://softpar.inf.br')">
  114. <div class="flex full-width justify-center">
  115. <q-img
  116. :src="navigation_store.miniState || $q.screen.lt.md ? LogoSoftparMini : $q.dark.isActive ? LogoSoftparLight : LogoSoftparDark"
  117. style="height: 30px"
  118. :style="navigation_store.miniState || $q.screen.lt.md ? 'max-width: 48px; width: 48px' : 'max-width: 100px; width: 100%'"
  119. />
  120. </div>
  121. </q-item>
  122. </q-list>
  123. <div
  124. class="full-width text-center q-pb-xs cursor-pointer left-menu-version"
  125. @click="gotoVersionPage()"
  126. >
  127. <span v-if="!(navigation_store.miniState || $q.screen.lt.md)" class="text-caption text-weight-light">
  128. {{ $t('common.terms.version') + ' ' + version }}
  129. </span>
  130. <span v-else class="text-caption text-weight-light">{{ version }}</span>
  131. </div>
  132. </div>
  133. </div>
  134. </q-drawer>
  135. </template>
  136. <script setup>
  137. import { ref, watchEffect, onMounted } from "vue";
  138. import { useRouter, useRoute } from "vue-router";
  139. import { navigationStore } from "src/stores/navigation";
  140. import { useQuasar } from "quasar";
  141. import { version } from "src/../package.json";
  142. import LogoSoftparLight from "src/assets/softpar_logo_light.svg";
  143. import LogoSoftparDark from "src/assets/softpar_logo_dark.svg";
  144. import LogoSoftparMini from "src/assets/softpar_logo_mini.svg";
  145. const router = useRouter();
  146. const route = useRoute();
  147. const navigation_store = navigationStore();
  148. const $q = useQuasar();
  149. const childrenAreActive = (children) => {
  150. if (!Array.isArray(children) || children.length === 0) {
  151. return false;
  152. }
  153. return children.some((child) => route?.name === child?.name);
  154. };
  155. const isExpasionItemExpanded = ref([]);
  156. watchEffect(() => {
  157. if ($q.screen.lt.md) {
  158. navigation_store.miniState = true;
  159. isExpasionItemExpanded.value.forEach((_, index) => {
  160. isExpasionItemExpanded.value[index] = false;
  161. });
  162. }
  163. });
  164. const openUrl = (url) => {
  165. window.open(url, "_blank");
  166. };
  167. const gotoVersionPage = () => {
  168. router.push({ name: "SystemVersionsPage" });
  169. };
  170. onMounted(() => {
  171. navigation_store.navigationItems.forEach((item, index) => {
  172. if (childrenAreActive(item.childrens)) {
  173. isExpasionItemExpanded.value[index] = true;
  174. }
  175. });
  176. });
  177. </script>
  178. <style lang="scss" scoped>
  179. @use "sass:map";
  180. @use "src/css/quasar.variables.scss" as vars;
  181. :deep(.q-drawer) {
  182. background: transparent !important;
  183. box-shadow: none !important;
  184. border: none !important;
  185. }
  186. .left-menu-drawer {
  187. background: transparent;
  188. }
  189. .left-menu-inner {
  190. height: 100%;
  191. background: transparent;
  192. }
  193. .left-menu-items-wrapper {
  194. position: relative;
  195. flex: 1;
  196. overflow: hidden;
  197. border-radius: 8px;
  198. &::before {
  199. content: "";
  200. position: absolute;
  201. inset: 0;
  202. background-color: vars.$violet-light;
  203. z-index: 0;
  204. }
  205. .left-menu-bg-overlay {
  206. position: absolute;
  207. inset: 0;
  208. background-image: url("src/assets/pessoas_fundo.jpg");
  209. background-size: cover;
  210. background-position: center top;
  211. opacity: 0.15;
  212. mix-blend-mode: multiply;
  213. z-index: 1;
  214. pointer-events: none;
  215. }
  216. .left-menu-bg-tint {
  217. display: none;
  218. }
  219. }
  220. .left-menu-list {
  221. position: relative;
  222. z-index: 3;
  223. padding-top: 8px;
  224. }
  225. .left-menu-item {
  226. position: relative;
  227. z-index: 3;
  228. color: vars.$violet-normal !important;
  229. border-radius: 6px;
  230. margin: 2px 8px;
  231. &:hover {
  232. background-color: rgba(vars.$violet-normal, 0.08);
  233. }
  234. }
  235. .left-menu-icon {
  236. font-size: 20px;
  237. color: vars.$violet-normal;
  238. }
  239. .menu-selected {
  240. background-color: rgba(vars.$violet-normal, 0.12) !important;
  241. color: vars.$violet-normal !important;
  242. }
  243. :deep(.q-expansion-item__header) {
  244. color: vars.$violet-normal;
  245. }
  246. .left-menu-footer {
  247. position: relative;
  248. z-index: 3;
  249. border-top: 1px solid rgba(vars.$violet-normal, 0.15);
  250. padding-top: 4px;
  251. }
  252. .left-menu-version {
  253. position: relative;
  254. z-index: 3;
  255. color: rgba(vars.$violet-normal, 0.6);
  256. font-size: 0.75rem;
  257. padding-bottom: 6px;
  258. }
  259. </style>