292 lines
5.4 KiB
Vue
292 lines
5.4 KiB
Vue
<template>
|
|
<div id="app">
|
|
<div class="navbar" v-if="authStore.isAuthenticated">
|
|
<div class="navbar-inner">
|
|
<div class="container">
|
|
<h1 class="brand">
|
|
<RouterLink to="/">Stechuhr</RouterLink>
|
|
</h1>
|
|
<div class="nav-title-menu">
|
|
<h2 class="page-title" v-if="pageTitle">{{ pageTitle }}</h2>
|
|
<div class="nav-collapse">
|
|
<SideMenu />
|
|
</div>
|
|
</div>
|
|
<ul class="pull-right navbar-nav nav">
|
|
<li class="user-info">
|
|
<span class="user-name">{{ authStore.user?.full_name }}</span>
|
|
</li>
|
|
<li>
|
|
<button @click="handleLogout" class="btn-logout">Abmelden</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Status-Bar unterhalb der Titelzeile -->
|
|
<div v-if="authStore.isAuthenticated" class="status-bar">
|
|
<div class="container status-bar-container">
|
|
<StatusBox />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<main class="app-main" :class="{ 'no-auth': !authStore.isAuthenticated }">
|
|
<div class="container" :class="{ 'full-width': !authStore.isAuthenticated }">
|
|
<RouterView />
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="app-footer" v-if="authStore.isAuthenticated">
|
|
<div class="container">
|
|
<p>© 2025 TimeClock v3 - Zeiterfassungssystem</p>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { RouterLink, RouterView, useRoute } from 'vue-router'
|
|
import { useAuthStore } from './stores/authStore'
|
|
import { useRouter } from 'vue-router'
|
|
import { computed } from 'vue'
|
|
import StatusBox from './components/StatusBox.vue'
|
|
import SideMenu from './components/SideMenu.vue'
|
|
|
|
const authStore = useAuthStore()
|
|
const router = useRouter()
|
|
const route = useRoute()
|
|
|
|
const handleLogout = async () => {
|
|
await authStore.logout()
|
|
router.push('/login')
|
|
}
|
|
|
|
// Seitentitel basierend auf der aktuellen Route
|
|
const pageTitle = computed(() => {
|
|
const titles = {
|
|
'week-overview': 'Wochenübersicht',
|
|
'timefix': 'Zeitkorrekturen',
|
|
'vacation': 'Urlaub',
|
|
'sick': 'Krankheit',
|
|
'workdays': 'Arbeitstage',
|
|
'calendar': 'Kalender',
|
|
'entries': 'Einträge',
|
|
'stats': 'Statistiken'
|
|
}
|
|
return titles[route.name] || ''
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
.navbar {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
margin: 0;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.navbar-inner {
|
|
background-image: none;
|
|
background-color: #f0ffec;
|
|
border-radius: 0;
|
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
border-bottom: 1px solid #e0ffe0;
|
|
}
|
|
|
|
.nav-title-menu {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: #2c3e50;
|
|
margin: 0;
|
|
padding: 0 15px;
|
|
}
|
|
|
|
.container {
|
|
max-width: 100%;
|
|
margin: 0 auto;
|
|
padding: 0 3rem;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.brand {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
.brand a {
|
|
font-weight: bold;
|
|
color: #000;
|
|
padding: 12px 20px 12px 0;
|
|
font-size: 24px;
|
|
text-decoration: none;
|
|
transition: color 0.2s;
|
|
}
|
|
|
|
.brand a:hover {
|
|
color: #333;
|
|
}
|
|
|
|
.nav-collapse {
|
|
display: flex;
|
|
width: 100%;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.navbar-nav {
|
|
list-style: none;
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
gap: 0;
|
|
}
|
|
|
|
.navbar-nav li {
|
|
display: inline-block;
|
|
}
|
|
|
|
.nav-link {
|
|
color: #555;
|
|
text-decoration: none;
|
|
font-weight: normal;
|
|
padding: 10px 15px;
|
|
display: block;
|
|
line-height: 20px;
|
|
}
|
|
|
|
.nav-link:hover {
|
|
color: #000;
|
|
}
|
|
|
|
.nav-link.router-link-active {
|
|
color: #000;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.pull-left {
|
|
float: left;
|
|
}
|
|
|
|
.pull-right {
|
|
float: right;
|
|
}
|
|
|
|
.user-info {
|
|
padding: 10px 15px;
|
|
}
|
|
|
|
.user-name {
|
|
color: #555;
|
|
font-weight: normal;
|
|
}
|
|
|
|
.status-bar {
|
|
position: fixed;
|
|
top: 60px; /* Höhe der Navbar */
|
|
left: 0;
|
|
right: 0;
|
|
background: transparent;
|
|
z-index: 999;
|
|
}
|
|
|
|
.status-bar-container {
|
|
justify-content: flex-end;
|
|
padding-top: 8px;
|
|
padding-bottom: 8px;
|
|
}
|
|
|
|
.app-main {
|
|
min-height: calc(100vh - 100px);
|
|
padding: 2rem 0;
|
|
margin-top: 20px; /* Navbar + StatusBox Höhe */
|
|
margin-bottom: 80px; /* Footer Höhe */
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.app-main.no-auth {
|
|
min-height: 100vh;
|
|
padding: 0;
|
|
margin-top: 0;
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
.container.full-width {
|
|
max-width: none;
|
|
padding: 0;
|
|
}
|
|
|
|
.btn-logout {
|
|
background: linear-gradient(135deg, #28a745, #20c997);
|
|
color: white;
|
|
border: none;
|
|
padding: 8px 16px;
|
|
border-radius: 6px;
|
|
font-weight: 500;
|
|
font-size: 0.85rem;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
margin: 5px 10px;
|
|
box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.btn-logout::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
|
transition: left 0.5s;
|
|
}
|
|
|
|
.btn-logout:hover {
|
|
background: linear-gradient(135deg, #20c997, #17a2b8);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
|
|
}
|
|
|
|
.btn-logout:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.btn-logout:active {
|
|
transform: translateY(0);
|
|
box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
|
|
}
|
|
|
|
.app-footer {
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
background-color: #f9f9f9;
|
|
padding: 1.5rem 0;
|
|
text-align: center;
|
|
color: #666;
|
|
border-top: 1px solid #ddd;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.app-footer p {
|
|
margin: 0;
|
|
font-size: 0.9rem;
|
|
}
|
|
</style>
|
|
|