current init
This commit is contained in:
@@ -1,7 +1,78 @@
|
||||
<script setup>
|
||||
import HelloWorld from './components/HelloWorld.vue'
|
||||
import { computed, provide, ref } from 'vue'
|
||||
import { RouterView, RouterLink, useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
const dynamicLabel = ref('')
|
||||
|
||||
provide('setDynamicLabel', (label) => { dynamicLabel.value = label })
|
||||
|
||||
const breadcrumbs = computed(() => {
|
||||
const items = route.meta.breadcrumb || []
|
||||
return items.map(item => ({
|
||||
...item,
|
||||
label: item.dynamic ? dynamicLabel.value : item.label,
|
||||
}))
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<HelloWorld />
|
||||
<header class="app-header">
|
||||
<nav class="breadcrumb">
|
||||
<RouterLink to="/" class="breadcrumb-item">Haushalt</RouterLink>
|
||||
<template v-for="(crumb, i) in breadcrumbs" :key="i">
|
||||
<span class="breadcrumb-sep">></span>
|
||||
<RouterLink v-if="crumb.to" :to="crumb.to" class="breadcrumb-item">{{ crumb.label }}</RouterLink>
|
||||
<span v-else class="breadcrumb-item breadcrumb-current">{{ crumb.label }}</span>
|
||||
</template>
|
||||
</nav>
|
||||
</header>
|
||||
<main class="app-main">
|
||||
<RouterView />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.app-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
background: var(--bg);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
}
|
||||
|
||||
.breadcrumb-item {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-h);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.breadcrumb-item:first-child {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.breadcrumb-sep {
|
||||
color: var(--text);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.breadcrumb-current {
|
||||
color: var(--text);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.app-main {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 44 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 8.5 KiB |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||
|
Before Width: | Height: | Size: 496 B |
26
frontend/src/components/CategoryBadge.vue
Normal file
26
frontend/src/components/CategoryBadge.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<script setup>
|
||||
defineProps({
|
||||
category: { type: Object, default: null },
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
class="badge"
|
||||
:style="{ backgroundColor: category?.color || '#808080' }"
|
||||
>
|
||||
{{ category?.name || 'Allgemein' }}
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 0.125rem 0.5rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
65
frontend/src/components/DayColumn.vue
Normal file
65
frontend/src/components/DayColumn.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<script setup>
|
||||
import TaskCard from './TaskCard.vue'
|
||||
|
||||
defineProps({
|
||||
date: { type: String, required: true },
|
||||
tasks: { type: Array, required: true },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['toggle'])
|
||||
|
||||
function formatDate(dateStr) {
|
||||
const d = new Date(dateStr + 'T00:00:00')
|
||||
return d.toLocaleDateString('de-DE', {
|
||||
weekday: 'long',
|
||||
day: 'numeric',
|
||||
month: 'long',
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="tasks.length" class="day">
|
||||
<div class="day-header"><span>{{ formatDate(date) }}</span></div>
|
||||
<div class="day-tasks">
|
||||
<TaskCard
|
||||
v-for="task in tasks"
|
||||
:key="`${task.id}-${date}`"
|
||||
:task="task"
|
||||
@toggle="(taskId, deadline) => emit('toggle', taskId, deadline || date)"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.day {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.day-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-top: 1px solid var(--border);
|
||||
margin-top: 1.25rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.day-header span {
|
||||
margin-top: -0.7rem;
|
||||
background: var(--bg);
|
||||
padding: 0.15rem 0.75rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
font-weight: 600;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
.day-tasks {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
@@ -1,93 +0,0 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import viteLogo from '../assets/vite.svg'
|
||||
import heroImg from '../assets/hero.png'
|
||||
import vueLogo from '../assets/vue.svg'
|
||||
|
||||
const count = ref(0)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="center">
|
||||
<div class="hero">
|
||||
<img :src="heroImg" class="base" width="170" height="179" alt="" />
|
||||
<img :src="vueLogo" class="framework" alt="Vue logo" />
|
||||
<img :src="viteLogo" class="vite" alt="Vite logo" />
|
||||
</div>
|
||||
<div>
|
||||
<h1>Get started</h1>
|
||||
<p>Edit <code>src/App.vue</code> and save to test <code>HMR</code></p>
|
||||
</div>
|
||||
<button class="counter" @click="count++">Count is {{ count }}</button>
|
||||
</section>
|
||||
|
||||
<div class="ticks"></div>
|
||||
|
||||
<section id="next-steps">
|
||||
<div id="docs">
|
||||
<svg class="icon" role="presentation" aria-hidden="true">
|
||||
<use href="/icons.svg#documentation-icon"></use>
|
||||
</svg>
|
||||
<h2>Documentation</h2>
|
||||
<p>Your questions, answered</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://vite.dev/" target="_blank">
|
||||
<img class="logo" :src="viteLogo" alt="" />
|
||||
Explore Vite
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://vuejs.org/" target="_blank">
|
||||
<img class="button-icon" :src="vueLogo" alt="" />
|
||||
Learn more
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="social">
|
||||
<svg class="icon" role="presentation" aria-hidden="true">
|
||||
<use href="/icons.svg#social-icon"></use>
|
||||
</svg>
|
||||
<h2>Connect with us</h2>
|
||||
<p>Join the Vite community</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="https://github.com/vitejs/vite" target="_blank">
|
||||
<svg class="button-icon" role="presentation" aria-hidden="true">
|
||||
<use href="/icons.svg#github-icon"></use>
|
||||
</svg>
|
||||
GitHub
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://chat.vite.dev/" target="_blank">
|
||||
<svg class="button-icon" role="presentation" aria-hidden="true">
|
||||
<use href="/icons.svg#discord-icon"></use>
|
||||
</svg>
|
||||
Discord
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://x.com/vite_js" target="_blank">
|
||||
<svg class="button-icon" role="presentation" aria-hidden="true">
|
||||
<use href="/icons.svg#x-icon"></use>
|
||||
</svg>
|
||||
X.com
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://bsky.app/profile/vite.dev" target="_blank">
|
||||
<svg class="button-icon" role="presentation" aria-hidden="true">
|
||||
<use href="/icons.svg#bluesky-icon"></use>
|
||||
</svg>
|
||||
Bluesky
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="ticks"></div>
|
||||
<section id="spacer"></section>
|
||||
</template>
|
||||
38
frontend/src/components/Icon.vue
Normal file
38
frontend/src/components/Icon.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<script setup>
|
||||
defineProps({
|
||||
name: { type: String, required: true },
|
||||
})
|
||||
|
||||
const icons = {
|
||||
eyeOpen: '<path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/>',
|
||||
eyeClosed: '<path d="M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/>',
|
||||
plus: '<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>',
|
||||
arrowLeft: '<polyline points="15 18 9 12 15 6"/>',
|
||||
save: '<path d="M19 21H5a2 2 0 01-2-2V5a2 2 0 012-2h11l5 5v11a2 2 0 01-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/>',
|
||||
trash: '<polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"/>',
|
||||
edit: '<path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"/>',
|
||||
close: '<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>',
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<svg
|
||||
class="icon"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
v-html="icons[name]"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.icon {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
vertical-align: -0.125em;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
96
frontend/src/components/MonthdayPicker.vue
Normal file
96
frontend/src/components/MonthdayPicker.vue
Normal file
@@ -0,0 +1,96 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: { type: Array, default: () => [] },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const now = new Date()
|
||||
const daysInMonth = computed(() => new Date(now.getFullYear(), now.getMonth() + 1, 0).getDate())
|
||||
const firstDayOffset = computed(() => (new Date(now.getFullYear(), now.getMonth(), 1).getDay() + 6) % 7)
|
||||
|
||||
function toggle(value) {
|
||||
const current = [...props.modelValue]
|
||||
const index = current.indexOf(value)
|
||||
if (index === -1) current.push(value)
|
||||
else current.splice(index, 1)
|
||||
emit('update:modelValue', current)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="monthday-picker">
|
||||
<div class="weekday-header">Mo</div>
|
||||
<div class="weekday-header">Di</div>
|
||||
<div class="weekday-header">Mi</div>
|
||||
<div class="weekday-header">Do</div>
|
||||
<div class="weekday-header">Fr</div>
|
||||
<div class="weekday-header">Sa</div>
|
||||
<div class="weekday-header">So</div>
|
||||
<div v-for="n in firstDayOffset" :key="'pad-' + n" class="day-pad"></div>
|
||||
<label
|
||||
v-for="day in daysInMonth"
|
||||
:key="day"
|
||||
class="day-option"
|
||||
:class="{ active: modelValue.includes(day) }"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="modelValue.includes(day)"
|
||||
@change="toggle(day)"
|
||||
class="sr-only"
|
||||
/>
|
||||
{{ day }}
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.monthday-picker {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.weekday-header {
|
||||
font-size: 0.6rem;
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.day-pad {
|
||||
height: 2.5rem;
|
||||
}
|
||||
|
||||
.day-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 2.5rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
color: var(--text);
|
||||
transition: all 0.15s;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.day-option.active {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
</style>
|
||||
83
frontend/src/components/TaskCard.vue
Normal file
83
frontend/src/components/TaskCard.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<script setup>
|
||||
import CategoryBadge from './CategoryBadge.vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const props = defineProps({
|
||||
task: { type: Object, required: true },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['toggle'])
|
||||
const router = useRouter()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="card"
|
||||
:class="{
|
||||
'card--completed': task.status === 'erledigt',
|
||||
'card--past': task.isPast,
|
||||
}"
|
||||
@click="emit('toggle', task.schemaId, task.deadline)"
|
||||
>
|
||||
<div class="card-left">
|
||||
<span class="task-name">{{ task.name }}</span>
|
||||
<CategoryBadge :category="task.category" />
|
||||
</div>
|
||||
<div class="card-right" @click.stop>
|
||||
<button @click="router.push({ name: 'task-detail', params: { id: task.taskId } })">
|
||||
Anzeigen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0.5rem 0.75rem;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.15s;
|
||||
}
|
||||
|
||||
.card:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.card--completed {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.card--completed .task-name {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.card--past {
|
||||
border-left: 3px solid var(--danger);
|
||||
background: var(--danger-bg);
|
||||
}
|
||||
|
||||
.card-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.task-name {
|
||||
font-weight: 500;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
.card-right button {
|
||||
font-size: 0.75rem;
|
||||
padding: 0.25rem 0.5rem;
|
||||
}
|
||||
</style>
|
||||
84
frontend/src/components/WeekdayPicker.vue
Normal file
84
frontend/src/components/WeekdayPicker.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<script setup>
|
||||
const props = defineProps({
|
||||
modelValue: { type: Array, default: () => [] },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const days = [
|
||||
{ value: 1, label: 'Mo' },
|
||||
{ value: 2, label: 'Di' },
|
||||
{ value: 3, label: 'Mi' },
|
||||
{ value: 4, label: 'Do' },
|
||||
{ value: 5, label: 'Fr' },
|
||||
{ value: 6, label: 'Sa' },
|
||||
{ value: 7, label: 'So' },
|
||||
]
|
||||
|
||||
function toggle(value) {
|
||||
const current = [...props.modelValue]
|
||||
const index = current.indexOf(value)
|
||||
if (index === -1) {
|
||||
current.push(value)
|
||||
} else {
|
||||
current.splice(index, 1)
|
||||
}
|
||||
emit('update:modelValue', current)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="weekday-picker">
|
||||
<label
|
||||
v-for="day in days"
|
||||
:key="day.value"
|
||||
class="day-option"
|
||||
:class="{ active: modelValue.includes(day.value) }"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="modelValue.includes(day.value)"
|
||||
@change="toggle(day.value)"
|
||||
class="sr-only"
|
||||
/>
|
||||
{{ day.label }}
|
||||
</label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.weekday-picker {
|
||||
display: flex;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.day-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 2.5rem;
|
||||
height: 2.5rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
color: var(--text);
|
||||
transition: all 0.15s;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.day-option.active {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
</style>
|
||||
185
frontend/src/components/YearPicker.vue
Normal file
185
frontend/src/components/YearPicker.vue
Normal file
@@ -0,0 +1,185 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: { type: Array, default: () => [] },
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const monthNames = ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']
|
||||
|
||||
function buildCells(startIndex, count) {
|
||||
const now = new Date()
|
||||
const currentMonth = now.getMonth()
|
||||
const currentYear = now.getFullYear()
|
||||
const result = []
|
||||
|
||||
let row = 2
|
||||
let col = 2
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
const idx = startIndex + i
|
||||
const m = (currentMonth + idx) % 12
|
||||
const y = currentYear + Math.floor((currentMonth + idx) / 12)
|
||||
const daysInMonth = new Date(y, m + 1, 0).getDate()
|
||||
const firstDayOffset = (new Date(y, m, 1).getDay() + 6) % 7
|
||||
|
||||
result.push({
|
||||
type: 'label',
|
||||
name: monthNames[m],
|
||||
row,
|
||||
col: 1,
|
||||
key: `label-${y}-${m}`,
|
||||
})
|
||||
|
||||
if (i === 0) {
|
||||
row++
|
||||
col = 2 + firstDayOffset
|
||||
} else {
|
||||
const newCol = 2 + firstDayOffset
|
||||
if (newCol < col) {
|
||||
row++
|
||||
}
|
||||
col = newCol
|
||||
}
|
||||
|
||||
for (let d = 1; d <= daysInMonth; d++) {
|
||||
result.push({
|
||||
type: 'day',
|
||||
month: m + 1,
|
||||
day: d,
|
||||
row,
|
||||
col,
|
||||
key: `d-${y}-${m}-${d}`,
|
||||
})
|
||||
col++
|
||||
if (col > 8) {
|
||||
col = 2
|
||||
row++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
const totalMonths = 12 - new Date().getMonth()
|
||||
const leftCount = Math.ceil(totalMonths / 2)
|
||||
const rightCount = totalMonths - leftCount
|
||||
|
||||
const leftCells = computed(() => buildCells(0, leftCount))
|
||||
const rightCells = computed(() => buildCells(leftCount, rightCount))
|
||||
|
||||
function isSelected(month, day) {
|
||||
return props.modelValue.some(yd => yd.month === month && yd.day === day)
|
||||
}
|
||||
|
||||
function toggle(month, day) {
|
||||
const current = [...props.modelValue]
|
||||
const index = current.findIndex(yd => yd.month === month && yd.day === day)
|
||||
if (index === -1) {
|
||||
current.push({ month, day })
|
||||
} else {
|
||||
current.splice(index, 1)
|
||||
}
|
||||
emit('update:modelValue', current)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="year-picker-columns">
|
||||
<div v-for="(cells, side) in [leftCells, rightCells]" :key="side" class="year-picker">
|
||||
<div class="header" style="grid-row:1;grid-column:1"></div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:2">Mo</div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:3">Di</div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:4">Mi</div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:5">Do</div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:6">Fr</div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:7">Sa</div>
|
||||
<div class="weekday-header" style="grid-row:1;grid-column:8">So</div>
|
||||
|
||||
<template v-for="cell in cells" :key="cell.key">
|
||||
<div
|
||||
v-if="cell.type === 'label'"
|
||||
class="month-label"
|
||||
:style="{ gridRow: cell.row, gridColumn: cell.col }"
|
||||
>
|
||||
{{ cell.name }}
|
||||
</div>
|
||||
<label
|
||||
v-else
|
||||
class="day-option"
|
||||
:class="{ active: isSelected(cell.month, cell.day) }"
|
||||
:style="{ gridRow: cell.row, gridColumn: cell.col }"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="isSelected(cell.month, cell.day)"
|
||||
@change="toggle(cell.month, cell.day)"
|
||||
class="sr-only"
|
||||
/>
|
||||
{{ cell.day }}
|
||||
</label>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.year-picker-columns {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.year-picker {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
grid-template-columns: 2.5rem repeat(7, 1fr);
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.weekday-header {
|
||||
font-size: 0.6rem;
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.month-label {
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-h);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.day-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 2rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.65rem;
|
||||
color: var(--text);
|
||||
transition: all 0.15s;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.day-option.active {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,10 @@
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import { createPinia } from 'pinia'
|
||||
import router from './router'
|
||||
import App from './App.vue'
|
||||
import './style.css'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
const app = createApp(App)
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
|
||||
46
frontend/src/router/index.js
Normal file
46
frontend/src/router/index.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import HomeView from '../views/HomeView.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: HomeView,
|
||||
meta: { breadcrumb: [] },
|
||||
},
|
||||
{
|
||||
path: '/tasks/all',
|
||||
name: 'tasks-all',
|
||||
component: () => import('../views/AllTasksView.vue'),
|
||||
meta: { breadcrumb: [{ label: 'Übersicht' }] },
|
||||
},
|
||||
{
|
||||
path: '/tasks/new',
|
||||
name: 'schema-create',
|
||||
component: () => import('../views/SchemaView.vue'),
|
||||
meta: { breadcrumb: [{ label: 'Übersicht', to: '/tasks/all' }, { label: 'Neue Aufgabe' }] },
|
||||
},
|
||||
{
|
||||
path: '/tasks/:id',
|
||||
name: 'task-detail',
|
||||
component: () => import('../views/TaskDetailView.vue'),
|
||||
meta: { breadcrumb: [{ label: 'Übersicht', to: '/tasks/all' }, { label: '', dynamic: true }] },
|
||||
},
|
||||
{
|
||||
path: '/schemas/:id',
|
||||
name: 'schema-detail',
|
||||
component: () => import('../views/SchemaView.vue'),
|
||||
meta: { breadcrumb: [{ label: 'Übersicht', to: '/tasks/all' }, { label: '', dynamic: true }] },
|
||||
},
|
||||
{
|
||||
path: '/categories',
|
||||
name: 'categories',
|
||||
component: () => import('../views/CategoriesView.vue'),
|
||||
meta: { breadcrumb: [{ label: 'Kategorien' }] },
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
export default router
|
||||
43
frontend/src/services/api.js
Normal file
43
frontend/src/services/api.js
Normal file
@@ -0,0 +1,43 @@
|
||||
const API_BASE = `${location.protocol}//${location.hostname}/api`
|
||||
|
||||
async function request(path, options = {}) {
|
||||
const url = API_BASE + path
|
||||
const res = await fetch(url, {
|
||||
headers: { 'Content-Type': 'application/json', ...options.headers },
|
||||
...options,
|
||||
})
|
||||
if (res.status === 204) return null
|
||||
if (!res.ok) {
|
||||
const err = await res.json().catch(() => ({}))
|
||||
throw { status: res.status, body: err }
|
||||
}
|
||||
return res.json()
|
||||
}
|
||||
|
||||
// Categories
|
||||
export const getCategories = () => request('/categories')
|
||||
export const getCategory = (id) => request(`/categories/${id}`)
|
||||
export const createCategory = (data) => request('/categories', { method: 'POST', body: JSON.stringify(data) })
|
||||
export const updateCategory = (id, data) => request(`/categories/${id}`, { method: 'PUT', body: JSON.stringify(data) })
|
||||
export const deleteCategory = (id) => request(`/categories/${id}`, { method: 'DELETE' })
|
||||
|
||||
// Schemas
|
||||
export const getWeekTasks = (start) => {
|
||||
const params = start ? `?start=${start}` : ''
|
||||
return request(`/schemas/week${params}`)
|
||||
}
|
||||
export const getSchema = (id) => request(`/schemas/${id}`)
|
||||
export const createSchema = (data) => request('/schemas', { method: 'POST', body: JSON.stringify(data) })
|
||||
export const updateSchema = (id, data) => request(`/schemas/${id}`, { method: 'PUT', body: JSON.stringify(data) })
|
||||
export const deleteSchema = (id) => request(`/schemas/${id}`, { method: 'DELETE' })
|
||||
export const toggleTask = (id, date) => request(`/schemas/${id}/toggle`, {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(date ? { date } : {}),
|
||||
})
|
||||
export const getAllSchemas = () => request('/schemas/all')
|
||||
export const getAllTasks = () => request('/schemas/all-tasks')
|
||||
|
||||
// Tasks
|
||||
export const getTask = (id) => request(`/tasks/${id}`)
|
||||
export const updateTask = (id, data) => request(`/tasks/${id}`, { method: 'PUT', body: JSON.stringify(data) })
|
||||
export const deleteTask = (id) => request(`/tasks/${id}`, { method: 'DELETE' })
|
||||
34
frontend/src/stores/categories.js
Normal file
34
frontend/src/stores/categories.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import * as api from '../services/api'
|
||||
|
||||
export const useCategoriesStore = defineStore('categories', () => {
|
||||
const items = ref([])
|
||||
const loaded = ref(false)
|
||||
|
||||
async function fetchCategories(force = false) {
|
||||
if (loaded.value && !force) return
|
||||
items.value = await api.getCategories()
|
||||
loaded.value = true
|
||||
}
|
||||
|
||||
async function addCategory(data) {
|
||||
const category = await api.createCategory(data)
|
||||
items.value.push(category)
|
||||
return category
|
||||
}
|
||||
|
||||
async function editCategory(id, data) {
|
||||
const updated = await api.updateCategory(id, data)
|
||||
const index = items.value.findIndex((c) => c.id === id)
|
||||
if (index !== -1) items.value[index] = updated
|
||||
return updated
|
||||
}
|
||||
|
||||
async function removeCategory(id) {
|
||||
await api.deleteCategory(id)
|
||||
items.value = items.value.filter((c) => c.id !== id)
|
||||
}
|
||||
|
||||
return { items, loaded, fetchCategories, addCategory, editCategory, removeCategory }
|
||||
})
|
||||
@@ -3,31 +3,22 @@
|
||||
--text-h: #08060d;
|
||||
--bg: #fff;
|
||||
--border: #e5e4e7;
|
||||
--code-bg: #f4f3ec;
|
||||
--accent: #aa3bff;
|
||||
--accent-bg: rgba(170, 59, 255, 0.1);
|
||||
--accent-border: rgba(170, 59, 255, 0.5);
|
||||
--social-bg: rgba(244, 243, 236, 0.5);
|
||||
--shadow:
|
||||
rgba(0, 0, 0, 0.1) 0 10px 15px -3px, rgba(0, 0, 0, 0.05) 0 4px 6px -2px;
|
||||
--danger: #dc2626;
|
||||
--danger-bg: rgba(220, 38, 38, 0.1);
|
||||
--warning: #f59e0b;
|
||||
--warning-bg: rgba(245, 158, 11, 0.1);
|
||||
--success: #16a34a;
|
||||
--shadow: rgba(0, 0, 0, 0.1) 0 2px 8px;
|
||||
|
||||
--sans: system-ui, 'Segoe UI', Roboto, sans-serif;
|
||||
--heading: system-ui, 'Segoe UI', Roboto, sans-serif;
|
||||
--mono: ui-monospace, Consolas, monospace;
|
||||
|
||||
font: 18px/145% var(--sans);
|
||||
letter-spacing: 0.18px;
|
||||
font: 16px/1.5 var(--sans);
|
||||
color-scheme: light dark;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
@@ -36,261 +27,114 @@
|
||||
--text-h: #f3f4f6;
|
||||
--bg: #16171d;
|
||||
--border: #2e303a;
|
||||
--code-bg: #1f2028;
|
||||
--accent: #c084fc;
|
||||
--accent-bg: rgba(192, 132, 252, 0.15);
|
||||
--accent-border: rgba(192, 132, 252, 0.5);
|
||||
--social-bg: rgba(47, 48, 58, 0.5);
|
||||
--shadow:
|
||||
rgba(0, 0, 0, 0.4) 0 10px 15px -3px, rgba(0, 0, 0, 0.25) 0 4px 6px -2px;
|
||||
--danger: #ef4444;
|
||||
--danger-bg: rgba(239, 68, 68, 0.15);
|
||||
--warning: #fbbf24;
|
||||
--warning-bg: rgba(251, 191, 36, 0.15);
|
||||
--success: #22c55e;
|
||||
--shadow: rgba(0, 0, 0, 0.3) 0 2px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
#social .button-icon {
|
||||
filter: invert(1) brightness(2);
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2 {
|
||||
font-family: var(--heading);
|
||||
h1, h2, h3 {
|
||||
font-weight: 600;
|
||||
color: var(--text-h);
|
||||
margin: 0 0 0.5rem;
|
||||
}
|
||||
|
||||
h1 { font-size: 1.5rem; }
|
||||
h2 { font-size: 1.25rem; }
|
||||
h3 { font-size: 1rem; }
|
||||
|
||||
a {
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
button {
|
||||
font-family: var(--sans);
|
||||
font-size: 0.875rem;
|
||||
padding: 0.5rem 1rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--bg);
|
||||
color: var(--text-h);
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
color: var(--danger);
|
||||
border-color: var(--danger);
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
background: var(--danger-bg);
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="date"],
|
||||
select {
|
||||
font-family: var(--sans);
|
||||
font-size: 0.875rem;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
background: var(--bg);
|
||||
color: var(--text-h);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type="text"]:focus,
|
||||
input[type="date"]:focus,
|
||||
select:focus {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-h);
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 56px;
|
||||
letter-spacing: -1.68px;
|
||||
margin: 32px 0;
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 36px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
}
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
line-height: 118%;
|
||||
letter-spacing: -0.24px;
|
||||
margin: 0 0 8px;
|
||||
@media (max-width: 1024px) {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
p {
|
||||
margin: 0;
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
code,
|
||||
.counter {
|
||||
font-family: var(--mono);
|
||||
display: inline-flex;
|
||||
border-radius: 4px;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 15px;
|
||||
line-height: 135%;
|
||||
padding: 4px 8px;
|
||||
background: var(--code-bg);
|
||||
}
|
||||
|
||||
.counter {
|
||||
font-size: 16px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 5px;
|
||||
color: var(--accent);
|
||||
background: var(--accent-bg);
|
||||
border: 2px solid transparent;
|
||||
transition: border-color 0.3s;
|
||||
margin-bottom: 24px;
|
||||
|
||||
&:hover {
|
||||
border-color: var(--accent-border);
|
||||
}
|
||||
&:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.hero {
|
||||
position: relative;
|
||||
|
||||
.base,
|
||||
.framework,
|
||||
.vite {
|
||||
inset-inline: 0;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.base {
|
||||
width: 170px;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.framework,
|
||||
.vite {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.framework {
|
||||
z-index: 1;
|
||||
top: 34px;
|
||||
height: 28px;
|
||||
transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
|
||||
scale(1.4);
|
||||
}
|
||||
|
||||
.vite {
|
||||
z-index: 0;
|
||||
top: 107px;
|
||||
height: 26px;
|
||||
width: auto;
|
||||
transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
|
||||
scale(0.8);
|
||||
}
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 1126px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
border-inline: 1px solid var(--border);
|
||||
min-height: 100svh;
|
||||
.btn-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#center {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 25px;
|
||||
place-content: center;
|
||||
place-items: center;
|
||||
flex-grow: 1;
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
padding: 32px 20px 24px;
|
||||
gap: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
#next-steps {
|
||||
display: flex;
|
||||
border-top: 1px solid var(--border);
|
||||
text-align: left;
|
||||
|
||||
& > div {
|
||||
flex: 1 1 0;
|
||||
padding: 32px;
|
||||
@media (max-width: 1024px) {
|
||||
padding: 24px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
margin-bottom: 16px;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
#docs {
|
||||
border-right: 1px solid var(--border);
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
}
|
||||
|
||||
#next-steps ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin: 32px 0 0;
|
||||
|
||||
.logo {
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--text-h);
|
||||
font-size: 16px;
|
||||
border-radius: 6px;
|
||||
background: var(--social-bg);
|
||||
display: flex;
|
||||
padding: 6px 12px;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
text-decoration: none;
|
||||
transition: box-shadow 0.3s;
|
||||
|
||||
&:hover {
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
.button-icon {
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
margin-top: 20px;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
|
||||
li {
|
||||
flex: 1 1 calc(50% - 8px);
|
||||
}
|
||||
|
||||
a {
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#spacer {
|
||||
height: 88px;
|
||||
border-top: 1px solid var(--border);
|
||||
@media (max-width: 1024px) {
|
||||
height: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
.ticks {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&::before,
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -4.5px;
|
||||
border: 5px solid transparent;
|
||||
}
|
||||
|
||||
&::before {
|
||||
left: 0;
|
||||
border-left-color: var(--border);
|
||||
}
|
||||
&::after {
|
||||
right: 0;
|
||||
border-right-color: var(--border);
|
||||
}
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
276
frontend/src/views/AllTasksView.vue
Normal file
276
frontend/src/views/AllTasksView.vue
Normal file
@@ -0,0 +1,276 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getAllSchemas, getAllTasks, toggleTask } from '../services/api'
|
||||
import CategoryBadge from '../components/CategoryBadge.vue'
|
||||
import Icon from '../components/Icon.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const items = ref([])
|
||||
const loading = ref(true)
|
||||
const mode = ref('schemas')
|
||||
|
||||
async function fetchData(showLoading = true) {
|
||||
if (showLoading) loading.value = true
|
||||
items.value = mode.value === 'schemas'
|
||||
? await getAllSchemas()
|
||||
: await getAllTasks()
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
function switchMode(newMode) {
|
||||
mode.value = newMode
|
||||
fetchData()
|
||||
}
|
||||
|
||||
function formatDate(dateStr) {
|
||||
return new Date(dateStr + 'T00:00:00').toLocaleDateString('de-DE', {
|
||||
day: '2-digit', month: '2-digit', year: 'numeric',
|
||||
})
|
||||
}
|
||||
|
||||
const groupedItems = computed(() => {
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
const noDate = items.value.filter(i => !i.deadline)
|
||||
const current = items.value.filter(i => i.deadline && i.deadline >= today)
|
||||
const past = items.value.filter(i => i.deadline && i.deadline < today)
|
||||
|
||||
const monthMap = {}
|
||||
const months = []
|
||||
for (const item of past) {
|
||||
const d = new Date(item.deadline + 'T00:00:00')
|
||||
const sortKey = item.deadline.substring(0, 7)
|
||||
const label = d.toLocaleDateString('de-DE', { month: 'long', year: 'numeric' })
|
||||
if (!monthMap[sortKey]) {
|
||||
monthMap[sortKey] = { sortKey, label, items: [] }
|
||||
months.push(monthMap[sortKey])
|
||||
}
|
||||
monthMap[sortKey].items.push(item)
|
||||
}
|
||||
months.sort((a, b) => b.sortKey.localeCompare(a.sortKey))
|
||||
|
||||
return { noDate, current, months }
|
||||
})
|
||||
|
||||
async function handleToggle(item) {
|
||||
await toggleTask(item.schemaId, item.deadline)
|
||||
await fetchData(false)
|
||||
}
|
||||
|
||||
onMounted(fetchData)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="header-row">
|
||||
<button @click="router.push({ name: 'categories' })">Kategorien</button>
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" @click="router.push({ name: 'schema-create' })">
|
||||
<Icon name="plus" />
|
||||
</button>
|
||||
<button @click="router.back()"><Icon name="arrowLeft" /></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-row">
|
||||
<div class="toggle-group">
|
||||
<button :class="{ 'btn-primary': mode === 'schemas' }" @click="switchMode('schemas')">
|
||||
Alle Schemas
|
||||
</button>
|
||||
<button :class="{ 'btn-primary': mode === 'occurrences' }" @click="switchMode('occurrences')">
|
||||
Alle Aufgaben
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="loading" class="loading">Laden...</p>
|
||||
|
||||
<ul v-else class="task-list">
|
||||
<!-- Schema-Modus: Anzeigen-Button -->
|
||||
<template v-if="mode === 'schemas'">
|
||||
<li v-for="(item, index) in items" :key="index" class="task-item">
|
||||
<div class="task-left">
|
||||
<span class="task-name">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<button @click="router.push({ name: 'schema-detail', params: { id: item.id } })">
|
||||
Anzeigen
|
||||
</button>
|
||||
</li>
|
||||
</template>
|
||||
<!-- Aufgaben-Modus: gruppiert -->
|
||||
<template v-else>
|
||||
<!-- Ohne Datum -->
|
||||
<li
|
||||
v-for="(item, i) in groupedItems.noDate"
|
||||
:key="'nd-' + i"
|
||||
class="task-item task-item--clickable"
|
||||
@click="handleToggle(item)"
|
||||
>
|
||||
<div class="task-left">
|
||||
<span class="task-name" :class="{ 'task--completed': item.status === 'erledigt' }">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<div class="task-right" @click.stop>
|
||||
<button @click="router.push({ name: 'task-detail', params: { id: item.taskId } })">Anzeigen</button>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<!-- Aktuell -->
|
||||
<li v-if="groupedItems.current.length" class="section-header"><span>Aktuell</span></li>
|
||||
<li
|
||||
v-for="(item, i) in groupedItems.current"
|
||||
:key="'cur-' + i"
|
||||
class="task-item task-item--clickable"
|
||||
@click="handleToggle(item)"
|
||||
>
|
||||
<div class="task-left">
|
||||
<span class="task-name" :class="{ 'task--completed': item.status === 'erledigt' }">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<div class="task-right" @click.stop>
|
||||
<span class="task-date">{{ formatDate(item.deadline) }}</span>
|
||||
<button @click="router.push({ name: 'task-detail', params: { id: item.taskId } })">Anzeigen</button>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<!-- Vergangene Monate -->
|
||||
<template v-for="month in groupedItems.months" :key="month.sortKey">
|
||||
<li class="section-header"><span>{{ month.label }}</span></li>
|
||||
<li
|
||||
v-for="(item, i) in month.items"
|
||||
:key="month.sortKey + '-' + i"
|
||||
class="task-item task-item--clickable task-item--past"
|
||||
@click="handleToggle(item)"
|
||||
>
|
||||
<div class="task-left">
|
||||
<span class="task-name" :class="{ 'task--completed': item.status === 'erledigt' }">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<span class="task-date">{{ formatDate(item.deadline) }}</span>
|
||||
</li>
|
||||
</template>
|
||||
</template>
|
||||
</ul>
|
||||
|
||||
<p v-if="!loading && items.length === 0" class="empty">Keine Einträge.</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.header-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.filter-row {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.toggle-group {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.toggle-group button {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.toggle-group button:first-child {
|
||||
border-radius: 6px 0 0 6px;
|
||||
}
|
||||
|
||||
.toggle-group button:last-child {
|
||||
border-radius: 0 6px 6px 0;
|
||||
}
|
||||
|
||||
.task-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.task-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.6rem 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.task-item:has(+ .section-header) {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.task-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.task-name {
|
||||
font-weight: 500;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
.task--completed {
|
||||
text-decoration: line-through;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.task-item--clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.task-item--clickable:hover {
|
||||
background: var(--accent-bg);
|
||||
}
|
||||
|
||||
.task-item--past {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
list-style: none;
|
||||
margin-top: 1rem;
|
||||
padding: 0;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.section-header span {
|
||||
margin-top: -0.7rem;
|
||||
background: var(--bg);
|
||||
padding: 0.15rem 0.75rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
font-weight: 600;
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
.task-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
}
|
||||
|
||||
.task-date {
|
||||
font-size: 0.75rem;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.loading, .empty {
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
</style>
|
||||
141
frontend/src/views/CategoriesView.vue
Normal file
141
frontend/src/views/CategoriesView.vue
Normal file
@@ -0,0 +1,141 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useCategoriesStore } from '../stores/categories'
|
||||
import CategoryBadge from '../components/CategoryBadge.vue'
|
||||
import Icon from '../components/Icon.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const store = useCategoriesStore()
|
||||
|
||||
const newName = ref('')
|
||||
const newColor = ref('#808080')
|
||||
const editingId = ref(null)
|
||||
const editName = ref('')
|
||||
const editColor = ref('')
|
||||
|
||||
onMounted(() => store.fetchCategories(true))
|
||||
|
||||
async function add() {
|
||||
if (!newName.value.trim()) return
|
||||
await store.addCategory({ name: newName.value.trim(), color: newColor.value })
|
||||
newName.value = ''
|
||||
newColor.value = '#808080'
|
||||
}
|
||||
|
||||
function startEdit(cat) {
|
||||
editingId.value = cat.id
|
||||
editName.value = cat.name
|
||||
editColor.value = cat.color
|
||||
}
|
||||
|
||||
async function saveEdit() {
|
||||
if (!editName.value.trim()) return
|
||||
await store.editCategory(editingId.value, { name: editName.value.trim(), color: editColor.value })
|
||||
editingId.value = null
|
||||
}
|
||||
|
||||
async function remove(id) {
|
||||
await store.removeCategory(id)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="header-row">
|
||||
<div></div>
|
||||
<button @click="router.back()"><Icon name="arrowLeft" /></button>
|
||||
</div>
|
||||
|
||||
<div class="new-form">
|
||||
<input v-model="newName" type="text" placeholder="Name" />
|
||||
<input v-model="newColor" type="color" class="color-input" />
|
||||
<button class="btn-primary" @click="add"><Icon name="plus" /></button>
|
||||
</div>
|
||||
|
||||
<ul class="category-list">
|
||||
<li v-for="cat in store.items" :key="cat.id" class="category-item">
|
||||
<template v-if="editingId === cat.id">
|
||||
<input v-model="editName" type="text" />
|
||||
<input v-model="editColor" type="color" class="color-input" />
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" @click="saveEdit"><Icon name="save" /></button>
|
||||
<button @click="editingId = null"><Icon name="close" /></button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<CategoryBadge :category="cat" />
|
||||
<span class="category-name">{{ cat.name }}</span>
|
||||
<div class="btn-row">
|
||||
<button @click="startEdit(cat)"><Icon name="edit" /></button>
|
||||
<button class="btn-danger" @click="remove(cat.id)"><Icon name="trash" /></button>
|
||||
</div>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p v-if="store.loaded && store.items.length === 0" class="empty">
|
||||
Keine Kategorien vorhanden.
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.header-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.new-form {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.new-form input[type="text"] {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.color-input {
|
||||
width: 40px;
|
||||
height: 36px;
|
||||
padding: 2px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.category-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.category-item input[type="text"] {
|
||||
flex: 1;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.category-name {
|
||||
flex: 1;
|
||||
color: var(--text-h);
|
||||
}
|
||||
|
||||
.empty {
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
margin-top: 2rem;
|
||||
}
|
||||
</style>
|
||||
107
frontend/src/views/HomeView.vue
Normal file
107
frontend/src/views/HomeView.vue
Normal file
@@ -0,0 +1,107 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useCategoriesStore } from '../stores/categories'
|
||||
import { getWeekTasks, toggleTask } from '../services/api'
|
||||
import DayColumn from '../components/DayColumn.vue'
|
||||
import TaskCard from '../components/TaskCard.vue'
|
||||
import Icon from '../components/Icon.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const categoriesStore = useCategoriesStore()
|
||||
|
||||
const rawDays = ref([])
|
||||
const rawTasksWithoutDeadline = ref([])
|
||||
const loading = ref(true)
|
||||
const showCompleted = ref(true)
|
||||
|
||||
function filterTasks(tasks) {
|
||||
if (showCompleted.value) return tasks
|
||||
return tasks.filter(t => t.status !== 'erledigt')
|
||||
}
|
||||
|
||||
const tasksWithoutDeadline = computed(() => filterTasks(rawTasksWithoutDeadline.value))
|
||||
const days = computed(() => rawDays.value.map(d => ({
|
||||
...d,
|
||||
tasks: filterTasks(d.tasks),
|
||||
})))
|
||||
|
||||
async function fetchWeek(showLoading = true) {
|
||||
if (showLoading) loading.value = true
|
||||
try {
|
||||
const data = await getWeekTasks()
|
||||
rawDays.value = data.days
|
||||
rawTasksWithoutDeadline.value = data.tasksWithoutDeadline
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleToggle(taskId, date) {
|
||||
await toggleTask(taskId, date)
|
||||
await fetchWeek(false)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
categoriesStore.fetchCategories()
|
||||
fetchWeek()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="top-bar">
|
||||
<div></div>
|
||||
<div class="btn-row">
|
||||
<button @click="router.push({ name: 'tasks-all' })">Übersicht</button>
|
||||
<button @click="showCompleted = !showCompleted" :title="showCompleted ? 'Erledigte ausblenden' : 'Erledigte anzeigen'">
|
||||
<Icon :name="showCompleted ? 'eyeOpen' : 'eyeClosed'" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="loading" class="loading">Laden...</p>
|
||||
|
||||
<template v-else>
|
||||
<div v-if="tasksWithoutDeadline.length" class="no-deadline-section">
|
||||
<TaskCard
|
||||
v-for="task in tasksWithoutDeadline"
|
||||
:key="task.id"
|
||||
:task="task"
|
||||
@toggle="handleToggle"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DayColumn
|
||||
v-for="day in days"
|
||||
:key="day.date"
|
||||
:date="day.date"
|
||||
:tasks="day.tasks"
|
||||
@toggle="handleToggle"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.top-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.no-deadline-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
</style>
|
||||
278
frontend/src/views/SchemaView.vue
Normal file
278
frontend/src/views/SchemaView.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted, inject } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useCategoriesStore } from '../stores/categories'
|
||||
import { getSchema, createSchema, updateSchema, deleteSchema } from '../services/api'
|
||||
import WeekdayPicker from '../components/WeekdayPicker.vue'
|
||||
import MonthdayPicker from '../components/MonthdayPicker.vue'
|
||||
import YearPicker from '../components/YearPicker.vue'
|
||||
import Icon from '../components/Icon.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const categoriesStore = useCategoriesStore()
|
||||
|
||||
const setDynamicLabel = inject('setDynamicLabel')
|
||||
const isEdit = computed(() => !!route.params.id)
|
||||
const loading = ref(false)
|
||||
const saving = ref(false)
|
||||
const error = ref(null)
|
||||
|
||||
const form = ref({
|
||||
name: '',
|
||||
categoryId: null,
|
||||
status: 'aktiv',
|
||||
taskType: 'einzel',
|
||||
deadline: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
weekdays: [],
|
||||
monthDays: [],
|
||||
yearDays: [],
|
||||
})
|
||||
|
||||
function formatDateForInput(dateStr) {
|
||||
if (!dateStr) return null
|
||||
return dateStr.split('T')[0]
|
||||
}
|
||||
|
||||
async function loadTask() {
|
||||
loading.value = true
|
||||
try {
|
||||
const task = await getSchema(route.params.id)
|
||||
form.value = {
|
||||
name: task.name,
|
||||
categoryId: task.category?.id ?? null,
|
||||
status: task.status,
|
||||
taskType: task.taskType,
|
||||
deadline: formatDateForInput(task.deadline),
|
||||
startDate: formatDateForInput(task.startDate),
|
||||
endDate: formatDateForInput(task.endDate),
|
||||
weekdays: task.weekdays || [],
|
||||
monthDays: task.monthDays || [],
|
||||
yearDays: task.yearDays || [],
|
||||
}
|
||||
setDynamicLabel(task.name)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function buildPayload() {
|
||||
const f = form.value
|
||||
const payload = {
|
||||
name: f.name,
|
||||
categoryId: f.categoryId,
|
||||
status: f.status,
|
||||
taskType: f.taskType,
|
||||
deadline: null,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
weekdays: null,
|
||||
monthDays: null,
|
||||
yearDays: null,
|
||||
}
|
||||
|
||||
if (f.taskType === 'einzel') {
|
||||
payload.deadline = f.deadline
|
||||
} else {
|
||||
payload.startDate = f.startDate
|
||||
payload.endDate = f.endDate
|
||||
if (f.taskType === 'woechentlich') payload.weekdays = f.weekdays
|
||||
if (f.taskType === 'monatlich') payload.monthDays = f.monthDays
|
||||
if (f.taskType === 'multi' || f.taskType === 'jaehrlich') payload.yearDays = f.yearDays
|
||||
}
|
||||
|
||||
return payload
|
||||
}
|
||||
|
||||
async function save() {
|
||||
saving.value = true
|
||||
error.value = null
|
||||
try {
|
||||
const payload = buildPayload()
|
||||
if (isEdit.value) {
|
||||
await updateSchema(route.params.id, payload)
|
||||
} else {
|
||||
await createSchema(payload)
|
||||
}
|
||||
router.back()
|
||||
} catch (e) {
|
||||
error.value = 'Speichern fehlgeschlagen.'
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
if (!confirm('Aufgabe wirklich löschen?')) return
|
||||
await deleteSchema(route.params.id)
|
||||
router.back()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
categoriesStore.fetchCategories()
|
||||
if (isEdit.value) loadTask()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="header-row">
|
||||
<div></div>
|
||||
<div class="btn-row">
|
||||
<button type="submit" form="task-form" class="btn-primary" :disabled="saving">
|
||||
<Icon name="save" />
|
||||
</button>
|
||||
<button @click="router.back()"><Icon name="arrowLeft" /></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="loading" class="loading">Laden...</p>
|
||||
|
||||
<form v-else id="task-form" @submit.prevent="save">
|
||||
<!-- Name + Kategorie nebeneinander -->
|
||||
<div class="form-row">
|
||||
<div class="form-group flex-1">
|
||||
<label for="name">Name</label>
|
||||
<input id="name" v-model="form.name" type="text" required />
|
||||
</div>
|
||||
<div class="form-group flex-1">
|
||||
<label for="category">Kategorie</label>
|
||||
<select id="category" v-model="form.categoryId">
|
||||
<option :value="null">Keine Kategorie</option>
|
||||
<option v-for="cat in categoriesStore.items" :key="cat.id" :value="cat.id">
|
||||
{{ cat.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isEdit" class="form-group">
|
||||
<label for="status">Status</label>
|
||||
<select id="status" v-model="form.status">
|
||||
<option value="aktiv">Aktiv</option>
|
||||
<option value="erledigt">Erledigt</option>
|
||||
<option value="inaktiv">Inaktiv</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Aufgabentyp -->
|
||||
<div class="form-group">
|
||||
<label>Aufgabentyp</label>
|
||||
<div class="radio-group">
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.taskType" value="einzel" /> Einzel
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.taskType" value="taeglich" /> Täglich
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.taskType" value="multi" /> Multi
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.taskType" value="woechentlich" /> Wöchentlich
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.taskType" value="monatlich" /> Monatlich
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.taskType" value="jaehrlich" /> Jährlich
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Einzel: Datum -->
|
||||
<div v-if="form.taskType === 'einzel'" class="form-group">
|
||||
<label for="deadline">Datum (optional)</label>
|
||||
<input id="deadline" v-model="form.deadline" type="date" />
|
||||
</div>
|
||||
|
||||
<!-- Alle außer Einzel: Start + Enddatum nebeneinander -->
|
||||
<template v-if="form.taskType !== 'einzel'">
|
||||
<div class="form-row">
|
||||
<div class="form-group flex-1">
|
||||
<label for="startDate">Startdatum (leer = heute)</label>
|
||||
<input id="startDate" v-model="form.startDate" type="date" />
|
||||
</div>
|
||||
<div class="form-group flex-1">
|
||||
<label for="endDate">Enddatum (optional)</label>
|
||||
<input id="endDate" v-model="form.endDate" type="date" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Wöchentlich -->
|
||||
<div v-if="form.taskType === 'woechentlich'" class="form-group">
|
||||
<label>Wochentage</label>
|
||||
<WeekdayPicker v-model="form.weekdays" />
|
||||
</div>
|
||||
|
||||
<!-- Monatlich -->
|
||||
<div v-if="form.taskType === 'monatlich'" class="form-group">
|
||||
<label>Monatstage</label>
|
||||
<MonthdayPicker v-model="form.monthDays" />
|
||||
</div>
|
||||
|
||||
<!-- Multi + Jährlich -->
|
||||
<div v-if="form.taskType === 'multi' || form.taskType === 'jaehrlich'" class="form-group">
|
||||
<label>Jahresansicht</label>
|
||||
<YearPicker v-model="form.yearDays" />
|
||||
</div>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
|
||||
<div v-if="isEdit" class="form-actions">
|
||||
<button type="button" class="btn-danger" @click="remove">
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.header-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.radio-group {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.radio-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--danger);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
</style>
|
||||
122
frontend/src/views/TaskDetailView.vue
Normal file
122
frontend/src/views/TaskDetailView.vue
Normal file
@@ -0,0 +1,122 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, inject } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { getTask, updateTask, deleteTask } from '../services/api'
|
||||
import { useCategoriesStore } from '../stores/categories'
|
||||
import Icon from '../components/Icon.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const setDynamicLabel = inject('setDynamicLabel')
|
||||
|
||||
const categoriesStore = useCategoriesStore()
|
||||
const loading = ref(true)
|
||||
const saving = ref(false)
|
||||
const occurrence = ref(null)
|
||||
const form = ref({ name: '', status: 'aktiv', date: '', categoryId: null })
|
||||
|
||||
async function load() {
|
||||
loading.value = true
|
||||
const data = await getTask(route.params.id)
|
||||
occurrence.value = data
|
||||
form.value = { name: data.name, status: data.status, date: data.date, categoryId: data.category?.id ?? null }
|
||||
setDynamicLabel(data.name)
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
async function save() {
|
||||
saving.value = true
|
||||
await updateTask(route.params.id, {
|
||||
name: form.value.name,
|
||||
categoryId: form.value.categoryId,
|
||||
status: form.value.status,
|
||||
date: form.value.date || null,
|
||||
})
|
||||
saving.value = false
|
||||
router.back()
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
if (!confirm('Aufgabe wirklich löschen?')) return
|
||||
await deleteTask(route.params.id)
|
||||
router.back()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
categoriesStore.fetchCategories()
|
||||
load()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="header-row">
|
||||
<button type="button" class="btn-danger" @click="remove">
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
<div class="btn-row">
|
||||
<button class="btn-primary" :disabled="saving" @click="save">
|
||||
<Icon name="save" />
|
||||
</button>
|
||||
<button @click="router.back()"><Icon name="arrowLeft" /></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p v-if="loading" class="loading">Laden...</p>
|
||||
|
||||
<div v-else>
|
||||
<div class="form-row">
|
||||
<div class="form-group flex-1">
|
||||
<label for="name">Name</label>
|
||||
<input id="name" v-model="form.name" type="text" required />
|
||||
</div>
|
||||
<div class="form-group flex-1">
|
||||
<label for="category">Kategorie</label>
|
||||
<select id="category" v-model="form.categoryId">
|
||||
<option :value="null">Keine Kategorie</option>
|
||||
<option v-for="cat in categoriesStore.items" :key="cat.id" :value="cat.id">
|
||||
{{ cat.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<div class="form-group flex-1">
|
||||
<label for="status">Status</label>
|
||||
<select id="status" v-model="form.status">
|
||||
<option value="aktiv">Aktiv</option>
|
||||
<option value="erledigt">Erledigt</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group flex-1">
|
||||
<label for="date">Datum</label>
|
||||
<input id="date" v-model="form.date" type="date" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.header-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user