2023-05-11 06:03:22 +02:00
|
|
|
<script setup>
|
2023-12-21 03:18:41 +01:00
|
|
|
import { useDisplay, useTheme } from "vuetify/lib/framework.mjs";
|
2023-12-21 03:31:33 +01:00
|
|
|
import { ref, watch } from "vue";
|
2023-12-21 03:39:47 +01:00
|
|
|
import { navigateTo, useRouter } from "#app";
|
2023-12-12 16:17:21 +01:00
|
|
|
|
2023-12-21 03:39:47 +01:00
|
|
|
const route = useRouter().currentRoute;
|
2023-05-11 06:03:22 +02:00
|
|
|
|
|
|
|
const { mobile } = useDisplay();
|
|
|
|
const navOpen = ref(!mobile.value);
|
2023-12-21 03:39:47 +01:00
|
|
|
const navSelected = ref([route.value.path]);
|
2023-12-21 03:18:41 +01:00
|
|
|
|
2023-12-21 03:31:33 +01:00
|
|
|
watch(route, (v) => {
|
2023-12-21 03:39:47 +01:00
|
|
|
navSelected.value = [v.path];
|
2023-12-21 03:31:33 +01:00
|
|
|
});
|
|
|
|
|
2023-12-21 03:18:41 +01:00
|
|
|
const theme = useTheme();
|
|
|
|
function switchTheme() {
|
|
|
|
theme.global.name.value = theme.global.current.value.dark ? 'light' : 'dark';
|
|
|
|
}
|
2023-05-11 06:03:22 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<VAppBar v-if="mobile" order="5">
|
|
|
|
<VAppBarNavIcon @click.end="navOpen = !navOpen" />
|
|
|
|
<VToolbarTitle>Database Project</VToolbarTitle>
|
|
|
|
</VAppBar>
|
|
|
|
<VNavigationDrawer v-model="navOpen" :temporary="mobile">
|
2023-12-12 16:17:21 +01:00
|
|
|
<VList v-model:selected="navSelected" density="compact" nav>
|
2023-05-24 09:40:45 +02:00
|
|
|
<VListItem prepend-icon="mdi-account" title="Clients" value="/clients" @click="navigateTo('/clients')" />
|
2023-12-18 23:17:06 +01:00
|
|
|
<VListItem prepend-icon="mdi-receipt-text" title="Orders" value="/orders" @click="navigateTo('/orders')" />
|
2023-05-24 09:40:45 +02:00
|
|
|
<VDivider />
|
2023-05-11 06:03:22 +02:00
|
|
|
</VList>
|
2023-12-21 03:18:41 +01:00
|
|
|
<template #append>
|
2023-12-21 03:29:42 +01:00
|
|
|
<VList v-model:selected="navSelected" density="compact" nav>
|
2023-12-21 03:18:41 +01:00
|
|
|
<VDivider />
|
|
|
|
<VListItem prepend-icon="mdi-theme-light-dark" title="Switch theme" class="mx-auto" @click="switchTheme()" />
|
2023-12-21 03:29:42 +01:00
|
|
|
<VListItem prepend-icon="mdi-login" title="My account" value="/login" @click="navigateTo('/login')" />
|
2023-12-21 03:18:41 +01:00
|
|
|
</VList>
|
|
|
|
</template>
|
2023-05-11 06:03:22 +02:00
|
|
|
</VNavigationDrawer>
|
|
|
|
</template>
|