LeftMenuLayoutMobile.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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
  14. class="flex flex-center full-width q-pa-sm"
  15. style="height: 50px"
  16. >
  17. <q-img :src="Logo" style="max-width: 92px" />
  18. </div>
  19. </div>
  20. <div class="column full-height no-wrap">
  21. <q-list class="column no-wrap">
  22. <template v-for="item in navigation_store.navigationItems">
  23. <template v-if="item.permission">
  24. <q-item
  25. v-if="item.type === 'single'"
  26. :key="item.name"
  27. v-ripple
  28. clickable
  29. exact-active-class="menu-selected"
  30. active-class="menu-selected"
  31. :exact="item.name == 'HomePage'"
  32. :to="{ name: item.name }"
  33. >
  34. <q-item-section avatar>
  35. <q-icon :name="item.icon" style="font-size: 20px" />
  36. </q-item-section>
  37. <q-item-section>{{ $t(item.title) }}</q-item-section>
  38. </q-item>
  39. <q-expansion-item
  40. v-else
  41. :key="item.icon"
  42. v-model="isExpasionItemExpanded"
  43. :class="{
  44. 'menu-selected':
  45. childrenAreActive(item.children) && !isExpasionItemExpanded,
  46. }"
  47. >
  48. <template #header>
  49. <q-item-section avatar>
  50. <q-icon :name="item.icon" style="font-size: 20px" />
  51. </q-item-section>
  52. <q-item-section>{{ $t(item.title) }}</q-item-section>
  53. </template>
  54. <div v-for="child in item.childrens" :key="child.name">
  55. <q-item
  56. v-ripple
  57. clickable
  58. :to="{ name: child.name }"
  59. exact
  60. exact-active-class="menu-selected"
  61. class="q-pl-lg"
  62. >
  63. <q-item-section avatar>
  64. <q-icon :name="child.icon" style="font-size: 20px" />
  65. </q-item-section>
  66. <q-item-section>{{ $t(child.title) }}</q-item-section>
  67. </q-item>
  68. </div>
  69. </q-expansion-item>
  70. </template>
  71. </template>
  72. </q-list>
  73. <q-list class="q-mt-auto">
  74. <q-item v-ripple clickable @click="openUrl('https://softpar.inf.br')">
  75. <div class="flex full-width justify-center">
  76. <q-img
  77. :src="$q.dark.isActive ? LogoSoftparLight : LogoSoftparDark"
  78. style="width: 100%; height: 30px; max-width: 114px"
  79. />
  80. </div>
  81. </q-item>
  82. </q-list>
  83. <div
  84. class="full-width text-center text-subtitle3 cursor-pointer"
  85. @click="gotoVersionPage()"
  86. >
  87. <span class="text-caption text-weight-light">{{
  88. $t("common.terms.version") + " " + version
  89. }}</span>
  90. </div>
  91. </div>
  92. </div>
  93. </q-drawer>
  94. </template>
  95. <script setup>
  96. import { ref, onMounted } from "vue";
  97. import { useRoute, useRouter } from "vue-router";
  98. import { navigationStore } from "src/stores/navigation";
  99. import { version } from "src/../package.json";
  100. import Logo from "src/assets/logo.png";
  101. import LogoSoftparLight from "src/assets/softpar_logo_light.svg";
  102. import LogoSoftparDark from "src/assets/softpar_logo_dark.svg";
  103. const router = useRouter();
  104. const route = useRoute();
  105. const navigation_store = navigationStore();
  106. const leftDrawerOpen = defineModel({ type: Boolean });
  107. const isExpasionItemExpanded = ref([]);
  108. const childrenAreActive = (children) => {
  109. if (!Array.isArray(children) || children.length === 0) {
  110. return false;
  111. }
  112. return children.some((child) => route?.name === child?.name);
  113. };
  114. const openUrl = (url) => {
  115. window.open(url, "_blank");
  116. };
  117. const gotoVersionPage = () => {
  118. router.push({ name: "SystemVersionsPage" });
  119. };
  120. onMounted(() => {
  121. navigation_store.navigationItems.forEach((item, index) => {
  122. if (childrenAreActive(item.childrens)) {
  123. isExpasionItemExpanded.value[index] = true;
  124. }
  125. });
  126. });
  127. </script>
  128. <style lang="scss" scoped>
  129. @import "/src/css/quasar.variables.scss";
  130. .text-subtitle3 {
  131. font-size: 1.1rem !important;
  132. font-weight: 400 !important;
  133. }
  134. .menu-selected {
  135. background-color: rgba($primary, 0.1);
  136. color: $primary;
  137. }
  138. </style>