LeftMenuLayoutMobile.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
  2. <template>
  3. <q-drawer
  4. v-bind="$attrs"
  5. v-model="leftDrawerOpen"
  6. :width="250"
  7. :breakpoint="500"
  8. behavior="mobile"
  9. class="detached-container"
  10. >
  11. <div class="column full-height q-pa-sm no-wrap">
  12. <q-list class="column no-wrap">
  13. <template v-for="item in navigationItems">
  14. <template v-if="item.permission">
  15. <!-- Single Menu -->
  16. <q-item
  17. v-if="item.type === 'single'"
  18. :key="item.name"
  19. v-ripple
  20. clickable
  21. exact-active-class="menu-selected"
  22. exact
  23. active-class="menu-selected"
  24. :to="{ name: item.name }"
  25. class="q-my-xs"
  26. >
  27. <q-item-section avatar>
  28. <q-icon :name="item.icon" style="font-size: 18px" />
  29. </q-item-section>
  30. <q-item-section>{{ $t(item.title) }}</q-item-section>
  31. </q-item>
  32. <!-- Expansive Menu with children -->
  33. <q-expansion-item
  34. v-else
  35. :key="item.name"
  36. v-model="isExpasionItemExpanded"
  37. header-class="menu-item--spaced"
  38. :class="{
  39. 'menu-selected':
  40. childrenAreActive(item.children) && !isExpasionItemExpanded,
  41. }"
  42. >
  43. <template #header>
  44. <q-item-section avatar>
  45. <q-icon :name="item.icon" style="font-size: 18px" />
  46. </q-item-section>
  47. <q-item-section>{{ $t(item.title) }}</q-item-section>
  48. </template>
  49. <div v-for="child in item.childrens" :key="child.name">
  50. <q-item
  51. v-ripple
  52. clickable
  53. :to="{ name: child.name }"
  54. exact
  55. exact-active-class="menu-selected"
  56. class="menu-item--spaced q-pl-lg"
  57. >
  58. <q-item-section avatar>
  59. <q-icon :name="child.icon" style="font-size: 18px" />
  60. </q-item-section>
  61. <q-item-section>{{ $t(child.title) }}</q-item-section>
  62. </q-item>
  63. </div>
  64. </q-expansion-item>
  65. </template>
  66. </template>
  67. </q-list>
  68. <q-list class="q-mt-auto">
  69. <q-item v-ripple clickable @click="openUrl('https://softpar.inf.br')">
  70. <div class="flex full-width justify-center">
  71. <q-img
  72. :src="$q.dark.isActive ? LogoSoftparLight : LogoSoftparDark"
  73. style="width: 100%; height: 30px; max-width: 114px"
  74. />
  75. </div>
  76. </q-item>
  77. </q-list>
  78. <div class="full-width text-center text-subtitle3">
  79. <span class="text-caption text-weight-light">1.0.0</span>
  80. </div>
  81. </div>
  82. </q-drawer>
  83. </template>
  84. <script setup>
  85. import { ref } from "vue";
  86. import { useRoute } from "vue-router";
  87. import { navigationStore } from "src/stores/navigation";
  88. import LogoSoftparLight from "src/assets/softpar_logo_light.svg";
  89. import LogoSoftparDark from "src/assets/softpar_logo_dark.svg";
  90. const route = useRoute();
  91. const leftDrawerOpen = defineModel({ type: Boolean });
  92. const { navigationItems } = navigationStore();
  93. const childrenAreActive = (children) => {
  94. if (!children) return false;
  95. return children.some((child) => {
  96. return route.path.includes(child.path);
  97. });
  98. };
  99. const isExpasionItemExpanded = ref(false);
  100. const openUrl = (url) => {
  101. window.open(url, "_blank");
  102. };
  103. </script>
  104. <style lang="scss" scoped>
  105. @import "/src/css/quasar.variables.scss";
  106. .text-subtitle3 {
  107. font-size: 1.1rem !important;
  108. font-weight: 400 !important;
  109. }
  110. .menu-selected {
  111. background-color: rgba($primary, 0.1);
  112. color: $primary;
  113. }
  114. .menu-item--spaced {
  115. margin-top: 5px;
  116. margin-bottom: 5px;
  117. }
  118. </style>