LeftMenuLayoutMobile.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
  2. <template>
  3. <q-drawer
  4. v-bind="$attrs"
  5. v-model="leftDrawerOpen"
  6. :width="214"
  7. :breakpoint="500"
  8. behavior="mobile"
  9. class="detached-container"
  10. >
  11. <div class="column full-height no-wrap">
  12. <div class="overflow-hidden" style="border-radius: 8px 8px 0px 0px">
  13. <div class="flex flex-center full-width q-pa-sm" style="height: 50px">
  14. <q-img :src="Logo" style="max-width: 92px" />
  15. </div>
  16. </div>
  17. <div class="column full-height no-wrap">
  18. <q-scroll-area class="menu-scroll col" bar-color="secondary">
  19. <q-list class="column no-wrap">
  20. <template v-for="item in navigation_store.navigationItems">
  21. <template v-if="item.permission">
  22. <!-- Single Menu -->
  23. <q-item
  24. v-if="item.type === 'single'"
  25. :key="item.name"
  26. v-ripple
  27. clickable
  28. exact-active-class="menu-selected"
  29. active-class="menu-selected"
  30. :exact="item.name == 'HomePage'"
  31. :to="{ name: item.name }"
  32. >
  33. <q-item-section avatar>
  34. <q-icon :name="item.icon" style="font-size: 20px" />
  35. </q-item-section>
  36. <q-item-section>{{ $t(item.title) }}</q-item-section>
  37. </q-item>
  38. <!-- Expansive Menu with children -->
  39. <q-expansion-item
  40. v-else
  41. :key="item.icon"
  42. v-model="isExpasionItemExpanded"
  43. :class="{
  44. 'menu-selected':
  45. childrenAreActive(item.children) &&
  46. !isExpasionItemExpanded,
  47. }"
  48. >
  49. <template #header>
  50. <q-item-section avatar>
  51. <q-icon :name="item.icon" style="font-size: 20px" />
  52. </q-item-section>
  53. <q-item-section>{{ $t(item.title) }}</q-item-section>
  54. </template>
  55. <div
  56. v-for="child in item.childrens"
  57. :key="child.name"
  58. :class="{
  59. 'financial-submenu': item.title === 'Financeiro',
  60. }"
  61. >
  62. <q-item
  63. v-ripple
  64. clickable
  65. :to="{ name: child.name }"
  66. exact
  67. exact-active-class="menu-selected"
  68. class="q-pl-lg"
  69. >
  70. <q-item-section avatar>
  71. <q-icon :name="child.icon" style="font-size: 20px" />
  72. </q-item-section>
  73. <q-item-section>{{ $t(child.title) }}</q-item-section>
  74. </q-item>
  75. </div>
  76. </q-expansion-item>
  77. </template>
  78. </template>
  79. </q-list>
  80. </q-scroll-area>
  81. <q-list class="q-mt-auto">
  82. <q-item v-ripple clickable @click="openUrl('https://softpar.inf.br')">
  83. <div class="flex full-width justify-center">
  84. <q-img
  85. :src="$q.dark.isActive ? LogoSoftparLight : LogoSoftparDark"
  86. style="width: 100%; height: 30px; max-width: 114px"
  87. />
  88. </div>
  89. </q-item>
  90. </q-list>
  91. <div
  92. class="full-width text-center text-subtitle3 cursor-pointer"
  93. @click="gotoVersionPage()"
  94. >
  95. <span class="text-caption text-weight-light">{{
  96. $t("common.terms.version") + " " + version
  97. }}</span>
  98. </div>
  99. </div>
  100. </div>
  101. </q-drawer>
  102. </template>
  103. <script setup>
  104. import { navigationStore } from "src/stores/navigation";
  105. import { onMounted, ref } from "vue";
  106. import { useRoute, useRouter } from "vue-router";
  107. import { version } from "src/../package.json";
  108. import Logo from "src/assets/logo.png";
  109. import LogoSoftparLight from "src/assets/softpar_logo_light.svg";
  110. import LogoSoftparDark from "src/assets/softpar_logo_dark.svg";
  111. const router = useRouter();
  112. const route = useRoute();
  113. const navigation_store = navigationStore();
  114. const leftDrawerOpen = defineModel({ type: Boolean });
  115. const isExpasionItemExpanded = ref([]);
  116. const childrenAreActive = (children) => {
  117. if (!Array.isArray(children) || children.length === 0) {
  118. return false;
  119. }
  120. return children.some((child) => route?.name === child?.name);
  121. };
  122. const openUrl = (url) => {
  123. window.open(url, "_blank");
  124. };
  125. const gotoVersionPage = () => {
  126. router.push({ name: "SystemVersionsPage" });
  127. };
  128. onMounted(() => {
  129. navigation_store.navigationItems.forEach((item, index) => {
  130. if (childrenAreActive(item.childrens)) {
  131. isExpasionItemExpanded.value[index] = true;
  132. }
  133. });
  134. });
  135. </script>
  136. <style lang="scss" scoped>
  137. @import "/src/css/quasar.variables.scss";
  138. .text-subtitle3 {
  139. font-size: 1.1rem !important;
  140. font-weight: 400 !important;
  141. }
  142. .menu-selected {
  143. background-color: rgba($primary, 0.1);
  144. color: $primary;
  145. }
  146. .financial-submenu :deep(.q-item) {
  147. color: $secondary;
  148. }
  149. .financial-submenu :deep(.q-item.menu-selected) {
  150. background-color: rgba($secondary, 0.14);
  151. color: $secondary;
  152. }
  153. .menu-scroll {
  154. min-height: 0;
  155. }
  156. .menu-scroll :deep(.q-scrollarea__bar--v) {
  157. width: 6px;
  158. right: 2px;
  159. border-radius: 6px;
  160. }
  161. </style>