reset to setup module state
Remove Task Manager implementation to match `# Setup module` in module.md. Backend src/ reduced to Kernel.php + empty Entity/, all migrations deleted, database dropped and recreated. Frontend components/views/services/stores removed, App.vue/router/style.css reduced to skeletons. CLAUDE.md shortened to Setup-stand. Old backend/plan.md, plan2.md removed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,78 +1,7 @@
|
||||
<script setup>
|
||||
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,
|
||||
}))
|
||||
})
|
||||
import { RouterView } from 'vue-router'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<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>
|
||||
<RouterView />
|
||||
</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>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<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>
|
||||
@@ -1,65 +0,0 @@
|
||||
<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"
|
||||
:task="task"
|
||||
@toggle="(taskId) => emit('toggle', taskId)"
|
||||
/>
|
||||
</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,38 +0,0 @@
|
||||
<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>
|
||||
@@ -1,96 +0,0 @@
|
||||
<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>
|
||||
@@ -1,83 +0,0 @@
|
||||
<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 === 'done',
|
||||
'card--past': task.isPast,
|
||||
}"
|
||||
@click="emit('toggle', task.id)"
|
||||
>
|
||||
<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.id } })">
|
||||
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>
|
||||
@@ -1,84 +0,0 @@
|
||||
<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>
|
||||
@@ -1,185 +0,0 @@
|
||||
<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,46 +1,8 @@
|
||||
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' }] },
|
||||
},
|
||||
],
|
||||
routes: [],
|
||||
})
|
||||
|
||||
export default router
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
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 getSchemas = () => request('/schemas')
|
||||
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, deleteTasks = false) => {
|
||||
const params = deleteTasks ? '?deleteTasks=1' : ''
|
||||
return request(`/schemas/${id}${params}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
// Tasks
|
||||
export const getTasks = () => request('/tasks')
|
||||
export const getTask = (id) => request(`/tasks/${id}`)
|
||||
export const createTask = (data) => request('/tasks', { method: 'POST', body: JSON.stringify(data) })
|
||||
export const updateTask = (id, data) => request(`/tasks/${id}`, { method: 'PUT', body: JSON.stringify(data) })
|
||||
export const deleteTask = (id) => request(`/tasks/${id}`, { method: 'DELETE' })
|
||||
export const toggleTask = (id) => request(`/tasks/${id}/toggle`, { method: 'PATCH' })
|
||||
@@ -1,34 +0,0 @@
|
||||
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 }
|
||||
})
|
||||
@@ -1,140 +0,0 @@
|
||||
:root {
|
||||
--text: #6b6375;
|
||||
--text-h: #08060d;
|
||||
--bg: #fff;
|
||||
--border: #e5e4e7;
|
||||
--accent: #aa3bff;
|
||||
--accent-bg: rgba(170, 59, 255, 0.1);
|
||||
--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;
|
||||
|
||||
font: 16px/1.5 var(--sans);
|
||||
color-scheme: light dark;
|
||||
color: var(--text);
|
||||
background: var(--bg);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--text: #9ca3af;
|
||||
--text-h: #f3f4f6;
|
||||
--bg: #16171d;
|
||||
--border: #2e303a;
|
||||
--accent: #c084fc;
|
||||
--accent-bg: rgba(192, 132, 252, 0.15);
|
||||
--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;
|
||||
}
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.btn-row {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@@ -1,288 +0,0 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { getSchemas, getTasks, 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 getSchemas()
|
||||
: await getTasks()
|
||||
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',
|
||||
})
|
||||
}
|
||||
|
||||
function getDateKey(item) {
|
||||
if (!item.date) return null
|
||||
return item.date.split('T')[0]
|
||||
}
|
||||
|
||||
const groupedItems = computed(() => {
|
||||
const today = new Date().toISOString().split('T')[0]
|
||||
const noDate = items.value.filter(i => !getDateKey(i))
|
||||
const current = items.value.filter(i => {
|
||||
const d = getDateKey(i)
|
||||
return d && d >= today
|
||||
})
|
||||
const past = items.value.filter(i => {
|
||||
const d = getDateKey(i)
|
||||
return d && d < today
|
||||
})
|
||||
|
||||
const monthMap = {}
|
||||
const months = []
|
||||
for (const item of past) {
|
||||
const dateKey = getDateKey(item)
|
||||
const d = new Date(dateKey + 'T00:00:00')
|
||||
const sortKey = dateKey.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.id)
|
||||
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 === 'done' }">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<div class="task-right" @click.stop>
|
||||
<button @click="router.push({ name: 'task-detail', params: { id: item.id } })">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 === 'done' }">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<div class="task-right" @click.stop>
|
||||
<span class="task-date">{{ formatDate(getDateKey(item)) }}</span>
|
||||
<button @click="router.push({ name: 'task-detail', params: { id: item.id } })">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 === 'done' }">{{ item.name }}</span>
|
||||
<CategoryBadge :category="item.category" />
|
||||
</div>
|
||||
<span class="task-date">{{ formatDate(getDateKey(item)) }}</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>
|
||||
@@ -1,141 +0,0 @@
|
||||
<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>
|
||||
@@ -1,129 +0,0 @@
|
||||
<script setup>
|
||||
import { ref, computed, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useCategoriesStore } from '../stores/categories'
|
||||
import { getTasks, 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 allTasks = ref([])
|
||||
const loading = ref(true)
|
||||
const showCompleted = ref(true)
|
||||
|
||||
function getWeekDates() {
|
||||
const now = new Date()
|
||||
const day = now.getDay()
|
||||
const monday = new Date(now)
|
||||
monday.setDate(now.getDate() - ((day + 6) % 7))
|
||||
const dates = []
|
||||
for (let i = 0; i < 7; i++) {
|
||||
const d = new Date(monday)
|
||||
d.setDate(monday.getDate() + i)
|
||||
dates.push(d.toISOString().split('T')[0])
|
||||
}
|
||||
return dates
|
||||
}
|
||||
|
||||
const weekDates = getWeekDates()
|
||||
|
||||
function filterTasks(tasks) {
|
||||
if (showCompleted.value) return tasks
|
||||
return tasks.filter(t => t.status !== 'done')
|
||||
}
|
||||
|
||||
const tasksWithoutDeadline = computed(() => {
|
||||
const tasks = allTasks.value.filter(t => t.date === null)
|
||||
return filterTasks(tasks)
|
||||
})
|
||||
|
||||
const days = computed(() => {
|
||||
return weekDates.map(date => {
|
||||
const tasks = allTasks.value.filter(t => {
|
||||
if (!t.date) return false
|
||||
return t.date.split('T')[0] === date
|
||||
})
|
||||
return { date, tasks: filterTasks(tasks) }
|
||||
})
|
||||
})
|
||||
|
||||
async function fetchTasks(showLoading = true) {
|
||||
if (showLoading) loading.value = true
|
||||
try {
|
||||
allTasks.value = await getTasks()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleToggle(taskId) {
|
||||
await toggleTask(taskId)
|
||||
await fetchTasks(false)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
categoriesStore.fetchCategories()
|
||||
fetchTasks()
|
||||
})
|
||||
</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>
|
||||
@@ -1,294 +0,0 @@
|
||||
<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 deleteTasksOnRemove = ref(false)
|
||||
|
||||
const form = ref({
|
||||
name: '',
|
||||
categoryId: null,
|
||||
status: 'active',
|
||||
type: 'single',
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
days: {
|
||||
week: [],
|
||||
month: [],
|
||||
year: [],
|
||||
},
|
||||
})
|
||||
|
||||
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,
|
||||
type: task.type,
|
||||
startDate: formatDateForInput(task.startDate),
|
||||
endDate: formatDateForInput(task.endDate),
|
||||
days: {
|
||||
week: task.days?.week || [],
|
||||
month: task.days?.month || [],
|
||||
year: task.days?.year || [],
|
||||
},
|
||||
}
|
||||
setDynamicLabel(task.name)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function buildPayload() {
|
||||
const f = form.value
|
||||
const payload = {
|
||||
name: f.name,
|
||||
categoryId: f.categoryId,
|
||||
status: f.status,
|
||||
type: f.type,
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
days: null,
|
||||
}
|
||||
|
||||
if (f.type === 'single') {
|
||||
payload.days = { year: f.days.year }
|
||||
} else if (f.type === 'daily') {
|
||||
payload.startDate = f.startDate
|
||||
payload.endDate = f.endDate
|
||||
} else if (f.type === 'custom') {
|
||||
payload.startDate = f.startDate
|
||||
payload.endDate = f.endDate
|
||||
const days = {}
|
||||
if (f.days.week.length) days.week = f.days.week
|
||||
if (f.days.month.length) days.month = f.days.month
|
||||
if (f.days.year.length) days.year = f.days.year
|
||||
payload.days = Object.keys(days).length ? days : null
|
||||
}
|
||||
|
||||
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('Schema wirklich löschen?')) return
|
||||
await deleteSchema(route.params.id, deleteTasksOnRemove.value)
|
||||
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="active">Aktiv</option>
|
||||
<option value="disabled">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.type" value="single" /> Einzel
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.type" value="daily" /> Täglich
|
||||
</label>
|
||||
<label class="radio-label">
|
||||
<input type="radio" v-model="form.type" value="custom" /> Benutzerdefiniert
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Einzel: Jahresansicht -->
|
||||
<div v-if="form.type === 'single'" class="form-group">
|
||||
<label>Tage auswählen</label>
|
||||
<YearPicker v-model="form.days.year" />
|
||||
</div>
|
||||
|
||||
<!-- Daily + Custom: Start + Enddatum -->
|
||||
<template v-if="form.type === 'daily' || form.type === 'custom'">
|
||||
<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>
|
||||
|
||||
<!-- Custom: Alle Picker -->
|
||||
<template v-if="form.type === 'custom'">
|
||||
<div class="form-group">
|
||||
<label>Wochentage</label>
|
||||
<WeekdayPicker v-model="form.days.week" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Monatstage</label>
|
||||
<MonthdayPicker v-model="form.days.month" />
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Jahresansicht</label>
|
||||
<YearPicker v-model="form.days.year" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<p v-if="error" class="error">{{ error }}</p>
|
||||
|
||||
<div v-if="isEdit" class="form-actions">
|
||||
<div class="delete-section">
|
||||
<label class="checkbox-label">
|
||||
<input type="checkbox" v-model="deleteTasksOnRemove" />
|
||||
Aufgaben löschen
|
||||
</label>
|
||||
<button type="button" class="btn-danger" @click="remove">
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
</div>
|
||||
</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;
|
||||
}
|
||||
|
||||
.delete-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: var(--danger);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
</style>
|
||||
@@ -1,122 +0,0 @@
|
||||
<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: 'active', 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="active">Aktiv</option>
|
||||
<option value="done">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