Loheide-eu-mitarbeiterplatt.../resources/js/layouts/AppLayout.vue
Friederich Loheide 9c0f8de791
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
Phase 0: Fundament für Inhaus
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 20:35:30 +00:00

153 lines
5.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<script setup>
import { computed, ref } from 'vue';
import { Link, router, usePage } from '@inertiajs/vue3';
import { useDisplay } from 'vuetify';
import {
mdiAccountCircleOutline,
mdiAccountEditOutline,
mdiCogOutline,
mdiHomeOutline,
mdiLogout,
mdiMenu,
mdiMonitor,
mdiWeatherNight,
mdiWhiteBalanceSunny,
} from '@mdi/js';
import BrandMark from '../components/BrandMark.vue';
import UserAvatar from '../components/UserAvatar.vue';
import { useThemePreference } from '../composables/useThemePreference';
defineProps({
title: { type: String, default: '' },
});
const page = usePage();
const user = computed(() => page.props.auth.user);
const { mdAndUp } = useDisplay();
const drawer = ref(null);
const { preference, setPreference } = useThemePreference();
const navigation = [
{ title: 'Start', icon: mdiHomeOutline, href: '/', match: (url) => url === '/' },
{ title: 'Mein Profil', icon: mdiAccountCircleOutline, href: '/profil', match: (url) => url.startsWith(`/personen/${user.value.id}`) },
];
const themeOptions = [
{ value: 'system', title: 'System', icon: mdiMonitor },
{ value: 'light', title: 'Hell', icon: mdiWhiteBalanceSunny },
{ value: 'dark', title: 'Dunkel', icon: mdiWeatherNight },
];
function isActive(item) {
return item.match(page.url.split('?')[0]);
}
// Echte Links (Mittelklick, neuer Tab) – ein normaler Klick navigiert per Inertia.
function visit(event, href) {
if (event.metaKey || event.ctrlKey || event.shiftKey || event.button === 1) {
return;
}
event.preventDefault();
router.visit(href);
}
function logout() {
router.post('/logout');
}
</script>
<template>
<v-app>
<v-app-bar>
<v-app-bar-nav-icon v-if="!mdAndUp" :icon="mdiMenu" aria-label="Menü" @click="drawer = !drawer" />
<v-app-bar-title>
<Link href="/" class="brand-link">
<BrandMark />
</Link>
</v-app-bar-title>
<template #append>
<v-menu location="bottom end" :close-on-content-click="false" min-width="280">
<template #activator="{ props: menuProps }">
<v-btn v-bind="menuProps" icon variant="text" class="mr-2" :aria-label="`Menü für ${user.name}`">
<UserAvatar :user="user" :size="40" />
</v-btn>
</template>
<v-card rounded="xl" color="surface-container-high" elevation="3">
<div class="d-flex align-center ga-4 pa-4">
<UserAvatar :user="user" :size="56" />
<div class="overflow-hidden">
<div class="text-title-medium text-truncate">{{ user.name }}</div>
<div v-if="user.job_title" class="text-body-medium text-medium-emphasis text-truncate">{{ user.job_title }}</div>
<div class="text-body-small text-medium-emphasis text-truncate">{{ user.email }}</div>
</div>
</div>
<v-divider />
<v-list bg-color="transparent" density="comfortable">
<v-list-item :prepend-icon="mdiAccountCircleOutline" title="Mein Profil" href="/profil" @click="visit($event, '/profil')" />
<v-list-item :prepend-icon="mdiAccountEditOutline" title="Profil bearbeiten" href="/profil/bearbeiten" @click="visit($event, '/profil/bearbeiten')" />
<v-list-item v-if="user.is_admin" :prepend-icon="mdiCogOutline" title="Administration" href="/admin" />
</v-list>
<div class="px-4 pb-2">
<div class="text-label-large text-medium-emphasis mb-2">Darstellung</div>
<v-btn-toggle
:model-value="preference"
mandatory
divided
variant="outlined"
density="comfortable"
class="w-100"
@update:model-value="setPreference"
>
<v-btn v-for="option in themeOptions" :key="option.value" :value="option.value" class="flex-grow-1" :prepend-icon="option.icon">
{{ option.title }}
</v-btn>
</v-btn-toggle>
</div>
<v-divider class="mt-2" />
<v-list bg-color="transparent" density="comfortable">
<v-list-item :prepend-icon="mdiLogout" title="Abmelden" @click="logout" />
</v-list>
</v-card>
</v-menu>
</template>
</v-app-bar>
<v-navigation-drawer v-model="drawer" :permanent="mdAndUp" width="280">
<v-list nav class="pa-3">
<v-list-item
v-for="item in navigation"
:key="item.href"
:href="item.href"
:prepend-icon="item.icon"
:title="item.title"
:class="{ 'bg-secondary-container': isActive(item) }"
:aria-current="isActive(item) ? 'page' : undefined"
rounded="xl"
@click="visit($event, item.href)"
/>
</v-list>
</v-navigation-drawer>
<v-main>
<div class="page-container pa-4 pa-md-8">
<h1 v-if="title" class="text-headline-medium mb-6">{{ title }}</h1>
<slot />
</div>
</v-main>
</v-app>
</template>
<style scoped>
.brand-link {
color: inherit;
text-decoration: none;
}
</style>