salix-front/src/components/Navbar.vue

92 lines
3.8 KiB
Vue
Raw Normal View History

2022-03-24 15:49:33 +00:00
<script setup>
import { useI18n } from 'vue-i18n';
2022-03-24 15:49:33 +00:00
import { useState } from 'src/composables/useState';
import { useSession } from 'src/composables/useSession';
import UserPanel from 'src/components/UserPanel.vue';
import FavoriteModules from './FavoriteModules.vue';
2022-03-24 15:49:33 +00:00
const { t } = useI18n();
2022-03-24 15:49:33 +00:00
const session = useSession();
const state = useState();
const user = state.getUser();
const token = session.getToken();
2022-04-19 11:50:54 +00:00
function onToggleDrawer() {
state.drawer.value = !state.drawer.value;
}
2022-03-24 15:49:33 +00:00
</script>
<template>
2022-11-09 07:29:04 +00:00
<q-header class="bg-dark" color="white" elevated>
2022-03-24 15:49:33 +00:00
<q-toolbar class="q-py-sm q-px-md">
<q-btn flat @click="onToggleDrawer()" round dense icon="menu">
<q-tooltip bottom anchor="bottom right">
{{ t('globals.collapseMenu') }}
</q-tooltip>
</q-btn>
2022-03-24 15:49:33 +00:00
<router-link to="/">
<q-btn flat round class="q-ml-xs" v-if="$q.screen.gt.xs">
<q-avatar square size="md">
<q-img src="~/assets/logo_icon.svg" alt="Logo" />
</q-avatar>
<q-tooltip bottom>
{{ t('globals.backToDashboard') }}
</q-tooltip>
2022-03-24 15:49:33 +00:00
</q-btn>
</router-link>
<q-toolbar-title shrink class="text-weight-bold">Salix</q-toolbar-title>
<q-space></q-space>
<div class="q-pl-sm q-gutter-sm row items-center no-wrap">
<!-- <q-btn v-if="$q.screen.gt.xs" dense flat size="md" icon="add">
2022-03-24 15:49:33 +00:00
<q-menu>
<q-list style="min-width: 150px">
<q-item :to="{ path: '/customer/create' }" clickable>
2022-03-24 15:49:33 +00:00
<q-item-section>New customer</q-item-section>
</q-item>
<q-item clickable>
<q-item-section>New ticket</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn> -->
<!-- <q-btn v-if="$q.screen.gt.xs" dense flat round size="md" icon="notifications">
<q-badge color="red" text-color="white" floating> 2 </q-badge>
<q-tooltip bottom>
{{ t('globals.notifications') }}
</q-tooltip>
<q-menu class="q-pa-md" style="min-width: 250px">
<strong>Notifications</strong>
<q-separator />
<div style="text-align: center; font-size: 2em">
<q-spinner-puff color="orange" />
</div>
</q-menu>
</q-btn> -->
<q-btn dense flat no-wrap id="favoriteModules">
<q-avatar size="lg">
<q-icon name="apps" size="s" />
</q-avatar>
<q-tooltip bottom>
{{ t('globals.favoriteModules') }}
</q-tooltip>
<FavoriteModules />
</q-btn>
<q-btn dense flat no-wrap id="user">
2022-03-24 15:49:33 +00:00
<q-avatar size="lg">
<q-img
:src="`/api/Images/user/160x160/${user.id}/download?access_token=${token}`"
spinner-color="white"
>
</q-img>
2022-03-24 15:49:33 +00:00
</q-avatar>
<q-icon name="arrow_drop_down" size="s" />
<q-tooltip bottom>
{{ t('globals.userPanel') }}
</q-tooltip>
2022-03-24 15:49:33 +00:00
<UserPanel />
</q-btn>
</div>
</q-toolbar>
</q-header>
</template>