salix-front/src/components/NavBar.vue

132 lines
4.2 KiB
Vue
Raw Normal View History

2022-03-24 15:49:33 +00:00
<script setup>
2023-08-08 10:11:27 +00:00
import { onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
2022-03-24 15:49:33 +00:00
import { useSession } from 'src/composables/useSession';
2023-02-09 14:07:27 +00:00
import { useState } from 'src/composables/useState';
import { useStateStore } from 'stores/useStateStore';
2023-08-08 10:36:11 +00:00
import { useQuasar } from 'quasar';
2022-11-29 13:45:48 +00:00
import PinnedModules from './PinnedModules.vue';
2023-08-08 10:11:27 +00:00
import UserPanel from 'components/UserPanel.vue';
2023-10-06 07:11:29 +00:00
import VnBreadCrumbs from './common/VnBreadCrumbs.vue';
2022-03-24 15:49:33 +00:00
const { t } = useI18n();
2022-03-24 15:49:33 +00:00
const session = useSession();
2023-02-09 14:07:27 +00:00
const stateStore = useStateStore();
2023-08-08 10:11:27 +00:00
const quasar = useQuasar();
2022-03-24 15:49:33 +00:00
const state = useState();
const user = state.getUser();
const token = session.getToken();
2023-01-05 13:57:47 +00:00
const appName = 'Lilium';
2022-03-24 15:49:33 +00:00
2023-02-09 14:07:27 +00:00
onMounted(() => stateStore.setMounted());
2023-08-02 10:03:50 +00:00
2023-08-08 10:11:27 +00:00
const pinnedModulesRef = ref();
2022-03-24 15:49:33 +00:00
</script>
<template>
2023-04-11 11:31:03 +00:00
<QHeader class="bg-dark" color="white" elevated>
<QToolbar class="q-py-sm q-px-md">
<QBtn
2023-03-07 14:03:22 +00:00
@click="stateStore.toggleLeftDrawer()"
icon="menu"
class="q-mr-sm"
round
dense
flat
>
2023-04-11 11:31:03 +00:00
<QTooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
2023-04-11 11:31:03 +00:00
</QTooltip>
</QBtn>
<RouterLink to="/">
2023-08-08 10:36:11 +00:00
<QBtn
class="q-ml-xs"
color="primary"
flat
round
v-if="!quasar.platform.is.mobile"
>
2023-04-11 11:31:03 +00:00
<QAvatar square size="md">
<QImg
2023-02-09 06:26:08 +00:00
src="~/assets/logo_icon.svg"
2023-02-09 14:07:27 +00:00
:alt="appName"
2023-02-09 06:26:08 +00:00
spinner-color="primary"
/>
2023-04-11 11:31:03 +00:00
</QAvatar>
<QTooltip bottom>
{{ t('globals.backToDashboard') }}
2023-04-11 11:31:03 +00:00
</QTooltip>
</QBtn>
</RouterLink>
<QToolbarTitle shrink class="text-weight-bold" v-if="$q.screen.gt.sm">
2023-01-17 13:57:12 +00:00
{{ appName }}
2023-04-11 11:31:03 +00:00
<QBadge label="Beta" align="top" />
</QToolbarTitle>
2023-10-06 07:11:29 +00:00
<VnBreadCrumbs v-if="$q.screen.gt.xs" />
2023-04-11 11:31:03 +00:00
<QSpace />
2023-08-21 10:50:01 +00:00
<div id="searchbar" class="searchbar"></div>
2023-04-11 11:31:03 +00:00
<QSpace />
2022-03-24 15:49:33 +00:00
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
<div id="actions-prepend"></div>
2023-08-08 10:11:27 +00:00
<QBtn
flat
v-if="!quasar.platform.is.mobile"
@click="pinnedModulesRef.redirect($route.params.id)"
2023-08-08 10:54:18 +00:00
icon="more_up"
2023-08-08 10:11:27 +00:00
>
2023-08-09 08:02:48 +00:00
<QTooltip>
{{ t('Go to Salix') }}
</QTooltip>
2023-08-08 10:11:27 +00:00
</QBtn>
2023-08-08 10:36:11 +00:00
<QBtn
2023-08-21 10:50:01 +00:00
:class="{ 'q-pa-none': quasar.platform.is.mobile }"
id="pinnedModules"
2023-08-08 10:36:11 +00:00
icon="apps"
flat
dense
rounded
>
2023-04-11 11:31:03 +00:00
<QTooltip bottom>
2022-11-29 13:45:48 +00:00
{{ t('globals.pinnedModules') }}
2023-04-11 11:31:03 +00:00
</QTooltip>
2023-08-08 10:11:27 +00:00
<PinnedModules ref="pinnedModulesRef" />
2023-04-11 11:31:03 +00:00
</QBtn>
2023-08-09 12:41:50 +00:00
<QBtn
2023-08-21 10:50:01 +00:00
:class="{ 'q-pa-none': quasar.platform.is.mobile }"
2023-08-09 12:41:50 +00:00
rounded
dense
flat
no-wrap
id="user"
>
2023-04-11 11:31:03 +00:00
<QAvatar size="lg">
<QImg
2022-03-24 15:49:33 +00:00
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
2023-02-09 06:26:08 +00:00
spinner-color="primary"
>
2023-04-11 11:31:03 +00:00
</QImg>
</QAvatar>
<QTooltip bottom>
{{ t('globals.userPanel') }}
2023-04-11 11:31:03 +00:00
</QTooltip>
2022-03-24 15:49:33 +00:00
<UserPanel />
2023-04-11 11:31:03 +00:00
</QBtn>
<div id="actions-append"></div>
2022-03-24 15:49:33 +00:00
</div>
2023-04-11 11:31:03 +00:00
</QToolbar>
2023-10-06 07:11:29 +00:00
<VnBreadCrumbs v-if="$q.screen.xs" class="q-ml-md" />
2023-04-11 11:31:03 +00:00
</QHeader>
2022-03-24 15:49:33 +00:00
</template>
2023-08-08 10:36:11 +00:00
2023-08-21 10:50:01 +00:00
<style lang="scss" scoped>
.searchbar {
width: max-content;
2023-08-08 10:36:11 +00:00
}
2023-08-21 10:50:01 +00:00
</style>
2023-08-09 08:02:48 +00:00
<i18n>
en:
Go to Salix: Go to Salix
es:
Go to Salix: Ir a Salix
</i18n>