| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <!-- eslint-disable @intlify/vue-i18n/no-raw-text -->
- <template>
- <q-drawer
- v-bind="$attrs"
- v-model="leftDrawerOpen"
- :width="214"
- :breakpoint="500"
- behavior="mobile"
- class="detached-container"
- >
- <div class="column full-height no-wrap">
- <div class="overflow-hidden" style="border-radius: 8px 8px 0px 0px">
- <div
- class="flex flex-center full-width q-pa-sm"
- style="height: 50px"
- >
- <q-img :src="Logo" style="max-width: 92px" />
- </div>
- </div>
- <div class="column full-height no-wrap">
- <q-list class="column no-wrap">
- <template v-for="item in navigation_store.navigationItems">
- <template v-if="item.permission">
- <q-item
- v-if="item.type === 'single'"
- :key="item.name"
- v-ripple
- clickable
- exact-active-class="menu-selected"
- active-class="menu-selected"
- :exact="item.name == 'HomePage'"
- :to="{ name: item.name }"
- >
- <q-item-section avatar>
- <q-icon :name="item.icon" style="font-size: 20px" />
- </q-item-section>
- <q-item-section>{{ $t(item.title) }}</q-item-section>
- </q-item>
- <q-expansion-item
- v-else
- :key="item.icon"
- v-model="isExpasionItemExpanded"
- :class="{
- 'menu-selected':
- childrenAreActive(item.children) && !isExpasionItemExpanded,
- }"
- >
- <template #header>
- <q-item-section avatar>
- <q-icon :name="item.icon" style="font-size: 20px" />
- </q-item-section>
- <q-item-section>{{ $t(item.title) }}</q-item-section>
- </template>
- <div v-for="child in item.childrens" :key="child.name">
- <q-item
- v-ripple
- clickable
- :to="{ name: child.name }"
- exact
- exact-active-class="menu-selected"
- class="q-pl-lg"
- >
- <q-item-section avatar>
- <q-icon :name="child.icon" style="font-size: 20px" />
- </q-item-section>
- <q-item-section>{{ $t(child.title) }}</q-item-section>
- </q-item>
- </div>
- </q-expansion-item>
- </template>
- </template>
- </q-list>
- <q-list class="q-mt-auto">
- <q-item v-ripple clickable @click="openUrl('https://softpar.inf.br')">
- <div class="flex full-width justify-center">
- <q-img
- :src="$q.dark.isActive ? LogoSoftparLight : LogoSoftparDark"
- style="width: 100%; height: 30px; max-width: 114px"
- />
- </div>
- </q-item>
- </q-list>
- <div
- class="full-width text-center text-subtitle3 cursor-pointer"
- @click="gotoVersionPage()"
- >
- <span class="text-caption text-weight-light">{{
- $t("common.terms.version") + " " + version
- }}</span>
- </div>
- </div>
- </div>
- </q-drawer>
- </template>
- <script setup>
- import { ref, onMounted } from "vue";
- import { useRoute, useRouter } from "vue-router";
- import { navigationStore } from "src/stores/navigation";
- import { version } from "src/../package.json";
- import Logo from "src/assets/logo.png";
- import LogoSoftparLight from "src/assets/softpar_logo_light.svg";
- import LogoSoftparDark from "src/assets/softpar_logo_dark.svg";
- const router = useRouter();
- const route = useRoute();
- const navigation_store = navigationStore();
- const leftDrawerOpen = defineModel({ type: Boolean });
- const isExpasionItemExpanded = ref([]);
- const childrenAreActive = (children) => {
- if (!Array.isArray(children) || children.length === 0) {
- return false;
- }
- return children.some((child) => route?.name === child?.name);
- };
- const openUrl = (url) => {
- window.open(url, "_blank");
- };
- const gotoVersionPage = () => {
- router.push({ name: "SystemVersionsPage" });
- };
- onMounted(() => {
- navigation_store.navigationItems.forEach((item, index) => {
- if (childrenAreActive(item.childrens)) {
- isExpasionItemExpanded.value[index] = true;
- }
- });
- });
- </script>
- <style lang="scss" scoped>
- @import "/src/css/quasar.variables.scss";
- .text-subtitle3 {
- font-size: 1.1rem !important;
- font-weight: 400 !important;
- }
- .menu-selected {
- background-color: rgba($primary, 0.1);
- color: $primary;
- }
- </style>
|