2023-10-31 14:38:43 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { usePage, router } from '@inertiajs/vue3';
|
2023-03-03 15:54:28 +00:00
|
|
|
// import { usePage } from '@inertiajs/inertia-vue3';
|
|
|
|
// import { Inertia } from '@inertiajs/inertia';
|
2023-10-31 14:38:43 +00:00
|
|
|
import { ComputedRef } from 'vue';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
import { computed, ref } from 'vue';
|
|
|
|
import { containerMaxW } from '@/config.js';
|
|
|
|
// import { MainService } from '@/Stores/main.js';
|
2023-03-17 15:13:37 +00:00
|
|
|
import { StyleService } from '@/Stores/style';
|
|
|
|
import { LayoutService } from '@/Stores/layout';
|
2023-03-03 15:54:28 +00:00
|
|
|
import {
|
2023-10-31 14:38:43 +00:00
|
|
|
mdiForwardburger,
|
|
|
|
mdiBackburger,
|
|
|
|
mdiClose,
|
|
|
|
mdiDotsVertical,
|
|
|
|
mdiMenu,
|
|
|
|
// mdiClockOutline,
|
|
|
|
mdiCloudDownloadOutline,
|
|
|
|
mdiCloud,
|
|
|
|
mdiCrop,
|
2023-12-15 16:17:33 +00:00
|
|
|
mdiAccountCog,
|
|
|
|
mdiFormatListGroup ,
|
|
|
|
mdiFormatListNumbered,
|
|
|
|
// mdiEmail,
|
2023-10-31 14:38:43 +00:00
|
|
|
mdiLogout,
|
|
|
|
mdiGithub,
|
|
|
|
mdiThemeLightDark,
|
2023-12-15 16:17:33 +00:00
|
|
|
mdiViewDashboard,
|
2023-12-21 08:30:21 +00:00
|
|
|
mdiMapSearch,
|
|
|
|
mdiInformationVariant,
|
2023-03-03 15:54:28 +00:00
|
|
|
} from '@mdi/js';
|
|
|
|
import NavBarItem from '@/Components/NavBarItem.vue';
|
|
|
|
import NavBarItemLabel from '@/Components/NavBarItemLabel.vue';
|
|
|
|
import NavBarMenu from '@/Components/NavBarMenu.vue';
|
|
|
|
import BaseDivider from '@/Components/BaseDivider.vue';
|
|
|
|
import UserAvatarCurrentUser from '@/Components/UserAvatarCurrentUser.vue';
|
|
|
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
2023-12-15 16:17:33 +00:00
|
|
|
// import NavBarSearch from '@/Components/NavBarSearch.vue';
|
2023-03-03 15:54:28 +00:00
|
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
2023-11-27 16:17:22 +00:00
|
|
|
import type { User } from '@/Dataset';
|
2023-12-21 08:30:21 +00:00
|
|
|
import FirstrunWizard from '@/Components/FirstrunWizard/FirstrunWizard.vue'
|
|
|
|
// import Lock from 'vue-material-design-icons/Lock.vue'
|
2023-12-15 16:17:33 +00:00
|
|
|
// import BriefcaseCheck from 'vue-material-design-icons/BriefcaseCheck.vue'
|
|
|
|
// import SwapHorizontal from 'vue-material-design-icons/SwapHorizontal.vue'
|
|
|
|
// import AccountGroup from 'vue-material-design-icons/AccountGroup.vue'
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
// const mainStore = MainService();
|
|
|
|
// const userName = computed(() =>mainStore.userName);
|
|
|
|
|
|
|
|
const styleService = StyleService();
|
2023-12-15 16:17:33 +00:00
|
|
|
const props = defineProps({
|
|
|
|
showBurger: {
|
|
|
|
type: Boolean,
|
|
|
|
default: true // Set default value to true
|
|
|
|
}
|
|
|
|
});
|
2023-03-03 15:54:28 +00:00
|
|
|
// const userName = computed(() => usePage().props.user.login)
|
|
|
|
|
2023-10-31 14:38:43 +00:00
|
|
|
const user: ComputedRef<User> = computed(() => {
|
|
|
|
return usePage().props.authUser as User;
|
2023-03-03 15:54:28 +00:00
|
|
|
});
|
|
|
|
// const userName = computed(() => props.user.login)
|
|
|
|
|
|
|
|
const toggleLightDark = () => {
|
2023-10-31 14:38:43 +00:00
|
|
|
styleService.setDarkMode();
|
2023-03-03 15:54:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const layoutStore = LayoutService();
|
|
|
|
|
|
|
|
const isMenuNavBarActive = ref(false);
|
|
|
|
|
|
|
|
const menuNavBarToggle = () => {
|
2023-10-31 14:38:43 +00:00
|
|
|
isMenuNavBarActive.value = !isMenuNavBarActive.value;
|
2023-03-03 15:54:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const menuOpenLg = () => {
|
2023-10-31 14:38:43 +00:00
|
|
|
layoutStore.isAsideLgActive = true;
|
2023-03-03 15:54:28 +00:00
|
|
|
};
|
2023-11-27 16:17:22 +00:00
|
|
|
const userHasRoles = (roleNames): boolean => {
|
|
|
|
return user.value.roles.some(role => roleNames.includes(role.name));
|
|
|
|
};
|
2023-03-03 15:54:28 +00:00
|
|
|
|
|
|
|
// const logout = () => {
|
|
|
|
// // router.post(route('logout'))
|
|
|
|
// Inertia.get(stardust.route('app.index'));
|
|
|
|
// };
|
2023-10-31 14:38:43 +00:00
|
|
|
const logout = async () => {
|
|
|
|
// router.post(route('logout'));
|
|
|
|
await router.post(stardust.route('logout'));
|
2023-03-03 15:54:28 +00:00
|
|
|
};
|
2023-12-15 16:17:33 +00:00
|
|
|
|
2023-12-21 08:30:21 +00:00
|
|
|
const about = ref();
|
|
|
|
const showAbout = async () => {
|
|
|
|
// router.post(route('logout'));
|
|
|
|
about.value.open();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2023-03-03 15:54:28 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-12-21 08:30:21 +00:00
|
|
|
|
2023-12-15 16:17:33 +00:00
|
|
|
<nav class="text-base top-0 left-0 right-0 fixed bg-gray-50 h-14 z-40 w-screen transition-position lg:w-auto dark:bg-slate-800"
|
|
|
|
:class="{ 'xl:pl-60': props.showBurger == true }">
|
2023-12-21 08:30:21 +00:00
|
|
|
<FirstrunWizard ref="about"></FirstrunWizard>
|
2023-10-31 14:38:43 +00:00
|
|
|
<div class="flex lg:items-stretch" :class="containerMaxW">
|
|
|
|
<div class="flex-1 items-stretch flex h-14">
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItem type="flex lg:hidden" @click.prevent="layoutStore.asideMobileToggle()" v-if="props.showBurger">
|
2023-10-31 14:38:43 +00:00
|
|
|
<BaseIcon :path="layoutStore.isAsideMobileExpanded ? mdiBackburger : mdiForwardburger" size="24" />
|
|
|
|
</NavBarItem>
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItem type="hidden lg:flex xl:hidden" @click.prevent="menuOpenLg" v-if="props.showBurger">
|
2023-10-31 14:38:43 +00:00
|
|
|
<BaseIcon :path="mdiMenu" size="24" />
|
|
|
|
</NavBarItem>
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItem route-name="apps.dashboard">
|
|
|
|
<NavBarItemLabel :icon="mdiViewDashboard" label="Dashboard" size="22" is-hover-label-only route-name="apps.dashboard" />
|
2023-10-31 14:38:43 +00:00
|
|
|
</NavBarItem>
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItem route-name="apps.map">
|
|
|
|
<NavBarItemLabel :icon="mdiMapSearch" label="Map" size="22" is-hover-label-only route-name="apps.map" />
|
|
|
|
</NavBarItem>
|
|
|
|
<!-- <NavBarItem>
|
|
|
|
<NavBarSearch />
|
|
|
|
</NavBarItem> -->
|
2023-10-31 14:38:43 +00:00
|
|
|
</div>
|
|
|
|
<div class="flex-none items-stretch flex h-14 lg:hidden">
|
|
|
|
<NavBarItem @click.prevent="menuNavBarToggle">
|
|
|
|
<BaseIcon :path="isMenuNavBarActive ? mdiClose : mdiDotsVertical" size="24" />
|
|
|
|
</NavBarItem>
|
|
|
|
</div>
|
2023-12-15 16:17:33 +00:00
|
|
|
<div class="absolute w-screen top-14 left-0 bg-gray-50 shadow lg:w-auto lg:items-stretch lg:flex lg:grow lg:static lg:border-b-0 lg:overflow-visible lg:shadow-none dark:bg-slate-800"
|
|
|
|
:class="[isMenuNavBarActive ? 'block' : 'hidden']">
|
|
|
|
<div
|
|
|
|
class="max-h-screen-menu overflow-y-auto lg:overflow-visible lg:flex lg:items-stretch lg:justify-end lg:ml-auto">
|
|
|
|
|
|
|
|
<!-- help menu -->
|
2023-10-31 14:38:43 +00:00
|
|
|
<NavBarMenu>
|
|
|
|
<NavBarItemLabel :icon="mdiMenu" label="Help menu" />
|
|
|
|
<template #dropdown>
|
|
|
|
<!-- <NavBarItem>
|
2023-03-03 15:54:28 +00:00
|
|
|
<NavBarItemLabel :icon="mdiClockOutline" label="Item One" />
|
|
|
|
</NavBarItem> -->
|
2023-10-31 14:38:43 +00:00
|
|
|
<NavBarItem href="/docs/HandbuchTethys.pdf" target="_blank">
|
|
|
|
<NavBarItemLabel :icon="mdiCloudDownloadOutline" label="Tethys Manual" />
|
|
|
|
</NavBarItem>
|
|
|
|
<NavBarItem href="/docs/geopackage_v01.pdf" target="_blank">
|
|
|
|
<NavBarItemLabel :icon="mdiCloud" label="GeoPackage Help" />
|
|
|
|
</NavBarItem>
|
|
|
|
<BaseDivider nav-bar />
|
|
|
|
<NavBarItem>
|
|
|
|
<NavBarItemLabel :icon="mdiCrop" label="Item Last" />
|
|
|
|
</NavBarItem>
|
|
|
|
</template>
|
|
|
|
</NavBarMenu>
|
|
|
|
|
2023-12-15 16:17:33 +00:00
|
|
|
<!-- personal menu -->
|
2023-10-31 14:38:43 +00:00
|
|
|
<NavBarMenu>
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItemLabel v-bind:label="`hello ${user.login}`">
|
2023-10-31 14:38:43 +00:00
|
|
|
<UserAvatarCurrentUser class="w-6 h-6 mr-3 inline-flex" />
|
|
|
|
</NavBarItemLabel>
|
|
|
|
<template #dropdown>
|
|
|
|
<!-- <NavBarItem> -->
|
|
|
|
<!-- <NavBarItem route-name="admin.account.info"> -->
|
2023-12-01 09:44:19 +00:00
|
|
|
<NavBarItem :route-name="'settings.user'">
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItemLabel :icon="mdiAccountCog" label="User Settings" />
|
2023-10-31 14:38:43 +00:00
|
|
|
</NavBarItem>
|
2023-12-15 16:17:33 +00:00
|
|
|
<NavBarItem v-if="userHasRoles(['administrator'])" :route-name="'settings.overview'">
|
|
|
|
<NavBarItemLabel :icon="mdiFormatListGroup" label="Administration" />
|
|
|
|
</NavBarItem>
|
|
|
|
<NavBarItem v-if="userHasRoles(['submitter'])" :route-name="'dataset.list'">
|
|
|
|
<NavBarItemLabel :icon="mdiFormatListNumbered" label="Submitter Setup" />
|
|
|
|
</NavBarItem>
|
|
|
|
<NavBarItem v-if="userHasRoles(['editor'])" :route-name="'editor.dataset.list'">
|
|
|
|
<NavBarItemLabel :icon="mdiFormatListNumbered" label="Editor Setup" />
|
|
|
|
</NavBarItem>
|
|
|
|
<!-- <NavBarItem>
|
2023-10-31 14:38:43 +00:00
|
|
|
<NavBarItemLabel :icon="mdiEmail" label="Messages" />
|
2023-12-15 16:17:33 +00:00
|
|
|
</NavBarItem> -->
|
2023-12-21 08:30:21 +00:00
|
|
|
<NavBarItem @click="showAbout">
|
|
|
|
<NavBarItemLabel :icon="mdiInformationVariant" label="About" />
|
|
|
|
</NavBarItem>
|
2023-10-31 14:38:43 +00:00
|
|
|
<BaseDivider nav-bar />
|
|
|
|
<NavBarItem @click="logout">
|
|
|
|
<NavBarItemLabel :icon="mdiLogout" label="Log Out" />
|
|
|
|
</NavBarItem>
|
|
|
|
</template>
|
|
|
|
</NavBarMenu>
|
|
|
|
|
|
|
|
<NavBarItem is-desktop-icon-only @click.prevent="toggleLightDark">
|
|
|
|
<NavBarItemLabel v-bind:icon="mdiThemeLightDark" label="Light/Dark" is-desktop-icon-only />
|
|
|
|
</NavBarItem>
|
|
|
|
<NavBarItem href="https://gitea.geologie.ac.at/geolba/tethys" target="_blank" is-desktop-icon-only>
|
|
|
|
<NavBarItemLabel v-bind:icon="mdiGithub" label="GitHub" is-desktop-icon-only />
|
|
|
|
</NavBarItem>
|
2023-12-21 08:30:21 +00:00
|
|
|
<NavBarItem is-desktop-icon-only @click="showAbout">
|
|
|
|
<NavBarItemLabel v-bind:icon="mdiInformationVariant" label="About" is-desktop-icon-only />
|
|
|
|
</NavBarItem>
|
2023-10-31 14:38:43 +00:00
|
|
|
<NavBarItem is-desktop-icon-only @click="logout">
|
|
|
|
<NavBarItemLabel v-bind:icon="mdiLogout" label="Log out" is-desktop-icon-only />
|
2023-12-21 08:30:21 +00:00
|
|
|
</NavBarItem>
|
2023-10-31 14:38:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</nav>
|
2023-03-03 15:54:28 +00:00
|
|
|
</template>
|