2022-03-28 07:06:36 +00:00
|
|
|
<script setup>
|
2022-03-15 09:33:28 +00:00
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
|
import { useRole } from 'src/composables/useRole';
|
2022-06-08 12:53:10 +00:00
|
|
|
import { useQuasar } from 'quasar';
|
|
|
|
import { useNavigation } from 'src/composables/useNavigation';
|
2022-03-15 09:33:28 +00:00
|
|
|
|
|
|
|
const { t } = useI18n();
|
|
|
|
const { hasAny } = useRole();
|
2022-06-08 12:53:10 +00:00
|
|
|
const navigation = useNavigation();
|
2022-03-15 09:33:28 +00:00
|
|
|
|
2022-06-08 12:53:10 +00:00
|
|
|
const quasar = useQuasar();
|
2022-03-15 09:33:28 +00:00
|
|
|
|
2022-06-08 12:53:10 +00:00
|
|
|
async function onToggleFavoriteModule(moduleName, event) {
|
|
|
|
await navigation.toggleFavorite(moduleName, event);
|
2022-03-15 09:33:28 +00:00
|
|
|
|
2022-06-08 12:53:10 +00:00
|
|
|
quasar.notify({
|
|
|
|
message: t('globals.dataSaved'),
|
|
|
|
type: 'positive',
|
|
|
|
});
|
2022-03-15 09:33:28 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-10-17 14:23:19 +00:00
|
|
|
<q-list padding>
|
|
|
|
<q-item-label header>{{ t('globals.favoriteModules') }}</q-item-label>
|
|
|
|
<template v-for="module in navigation.favorites.value" :key="module.title">
|
|
|
|
<div class="module" v-if="!module.children">
|
|
|
|
<q-item
|
|
|
|
clickable
|
|
|
|
v-ripple
|
2022-10-25 12:48:46 +00:00
|
|
|
active-class="text-primary"
|
2022-10-17 14:23:19 +00:00
|
|
|
:key="module.title"
|
|
|
|
:to="{ name: module.stateName }"
|
|
|
|
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
|
|
|
|
>
|
|
|
|
<q-item-section avatar :if="module.icon">
|
|
|
|
<q-icon :name="module.icon" />
|
|
|
|
</q-item-section>
|
|
|
|
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
|
|
|
|
<q-item-section side>
|
|
|
|
<div @click="onToggleFavoriteModule(module.name, $event)" class="row items-center">
|
|
|
|
<q-icon name="vn:pin_off"></q-icon>
|
|
|
|
</div>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<template v-if="module.children">
|
|
|
|
<q-expansion-item
|
|
|
|
class="module"
|
2022-10-25 12:48:46 +00:00
|
|
|
active-class="text-primary"
|
2022-10-17 14:23:19 +00:00
|
|
|
:label="t(`${module.name}.pageTitles.${module.title}`)"
|
|
|
|
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
|
|
|
|
:to="{ name: module.stateName }"
|
|
|
|
>
|
|
|
|
<template #header>
|
|
|
|
<q-item-section avatar>
|
|
|
|
<q-icon :name="module.icon"></q-icon>
|
2022-06-08 12:53:10 +00:00
|
|
|
</q-item-section>
|
|
|
|
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
|
|
|
|
<q-item-section side>
|
|
|
|
<div @click="onToggleFavoriteModule(module.name, $event)" class="row items-center">
|
2022-06-09 15:15:17 +00:00
|
|
|
<q-icon name="vn:pin_off"></q-icon>
|
2022-06-08 12:53:10 +00:00
|
|
|
</div>
|
|
|
|
</q-item-section>
|
2022-10-17 14:23:19 +00:00
|
|
|
</template>
|
|
|
|
<template v-for="section in module.children" :key="section.title">
|
|
|
|
<q-item
|
|
|
|
clickable
|
|
|
|
v-ripple
|
2022-10-25 12:48:46 +00:00
|
|
|
active-class="text-primary"
|
2022-10-17 14:23:19 +00:00
|
|
|
:to="{ name: section.stateName }"
|
|
|
|
v-if="!section.roles || !section.roles.length || hasAny(section.roles)"
|
|
|
|
>
|
|
|
|
<q-item-section avatar :if="section.icon">
|
|
|
|
<q-icon :name="section.icon" />
|
2022-06-08 12:53:10 +00:00
|
|
|
</q-item-section>
|
2022-10-17 14:23:19 +00:00
|
|
|
<q-item-section>{{ t(`${module.name}.pageTitles.${section.title}`) }}</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</template>
|
|
|
|
</q-expansion-item>
|
2022-05-17 12:58:01 +00:00
|
|
|
</template>
|
2022-10-17 14:23:19 +00:00
|
|
|
</template>
|
|
|
|
</q-list>
|
2022-06-08 12:53:10 +00:00
|
|
|
|
|
|
|
<q-separator />
|
2022-05-17 12:58:01 +00:00
|
|
|
|
2022-06-08 12:53:10 +00:00
|
|
|
<q-expansion-item :label="t('moduleIndex.allModules')">
|
|
|
|
<q-list padding>
|
|
|
|
<template v-for="module in navigation.modules.value" :key="module.title">
|
|
|
|
<div class="module" v-if="!module.children">
|
|
|
|
<q-item
|
|
|
|
class="module"
|
|
|
|
clickable
|
|
|
|
v-ripple
|
2022-10-25 12:48:46 +00:00
|
|
|
active-class="text-primary"
|
2022-06-08 12:53:10 +00:00
|
|
|
:key="module.title"
|
|
|
|
:to="{ name: module.stateName }"
|
|
|
|
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
|
|
|
|
>
|
|
|
|
<q-item-section avatar :if="module.icon">
|
|
|
|
<q-icon :name="module.icon" />
|
|
|
|
</q-item-section>
|
|
|
|
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
|
|
|
|
<q-item-section side>
|
2022-06-09 07:45:53 +00:00
|
|
|
<div
|
|
|
|
@click="onToggleFavoriteModule(module.name, $event)"
|
|
|
|
class="row items-center"
|
|
|
|
v-if="module.name != 'dashboard'"
|
|
|
|
>
|
2022-06-09 15:15:17 +00:00
|
|
|
<q-icon name="vn:pin"></q-icon>
|
2022-06-08 12:53:10 +00:00
|
|
|
</div>
|
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<template v-if="module.children">
|
|
|
|
<q-expansion-item
|
|
|
|
class="module"
|
2022-10-25 12:48:46 +00:00
|
|
|
active-class="text-primary"
|
2022-06-08 12:53:10 +00:00
|
|
|
:label="t(`${module.name}.pageTitles.${module.title}`)"
|
|
|
|
v-if="!module.roles || !module.roles.length || hasAny(module.roles)"
|
|
|
|
:to="{ name: module.stateName }"
|
|
|
|
>
|
|
|
|
<template #header>
|
|
|
|
<q-item-section avatar>
|
|
|
|
<q-icon :name="module.icon"></q-icon>
|
|
|
|
</q-item-section>
|
|
|
|
<q-item-section>{{ t(`${module.name}.pageTitles.${module.title}`) }}</q-item-section>
|
|
|
|
<q-item-section side>
|
2022-06-09 07:45:53 +00:00
|
|
|
<div
|
|
|
|
@click="onToggleFavoriteModule(module.name, $event)"
|
|
|
|
class="row items-center"
|
|
|
|
v-if="module.name != 'dashboard'"
|
|
|
|
>
|
2022-06-09 15:15:17 +00:00
|
|
|
<q-icon name="vn:pin"></q-icon>
|
2022-06-08 12:53:10 +00:00
|
|
|
</div>
|
2022-05-17 12:58:01 +00:00
|
|
|
</q-item-section>
|
2022-06-08 12:53:10 +00:00
|
|
|
</template>
|
|
|
|
<template v-for="section in module.children" :key="section.title">
|
|
|
|
<q-item
|
|
|
|
clickable
|
|
|
|
v-ripple
|
2022-10-25 12:48:46 +00:00
|
|
|
active-class="text-primary"
|
2022-06-08 12:53:10 +00:00
|
|
|
:to="{ name: section.stateName }"
|
|
|
|
v-if="!section.roles || !section.roles.length || hasAny(section.roles)"
|
|
|
|
>
|
|
|
|
<q-item-section avatar :if="section.icon">
|
|
|
|
<q-icon :name="section.icon" />
|
|
|
|
</q-item-section>
|
|
|
|
<q-item-section>{{ t(`${module.name}.pageTitles.${section.title}`) }}</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</template>
|
|
|
|
</q-expansion-item>
|
|
|
|
</template>
|
2022-05-17 12:58:01 +00:00
|
|
|
</template>
|
2022-06-08 12:53:10 +00:00
|
|
|
</q-list>
|
|
|
|
</q-expansion-item>
|
2022-05-17 12:58:01 +00:00
|
|
|
</template>
|
2022-06-08 12:53:10 +00:00
|
|
|
|
|
|
|
<style>
|
2022-06-09 15:15:17 +00:00
|
|
|
.module .icon-pin,
|
|
|
|
.module .icon-pin_off {
|
2022-06-08 12:53:10 +00:00
|
|
|
visibility: hidden;
|
|
|
|
}
|
2022-06-09 15:15:17 +00:00
|
|
|
.module:hover .icon-pin,
|
|
|
|
.module:hover .icon-pin_off {
|
2022-06-08 12:53:10 +00:00
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
</style>
|