Fix: CardDAV sync broke when todo items didn't have a creation date. Also fixed todos without a due date not being displays and wrong calculation of warning badge states.

This commit is contained in:
2026-05-25 15:31:29 +02:00
parent 2324ad95bf
commit da3ceeaff3
5 changed files with 95 additions and 45 deletions
+8 -3
View File
@@ -22,7 +22,6 @@ import TodoService from '@/services/TodoService'
import NumberInput from '@/components/ui/crm-number-input/NumberInput.vue';
import { alertStore } from '@/stores/alertStore'
import PipelineService from '@/services/PipelineService'
import { cva } from "class-variance-authority"
interface Props {
pipeline: PipelineLane[]
@@ -144,6 +143,12 @@ const badgeVariant = (date: string | null): "default" | "secondary" | "destructi
return "secondary"
}
const itemsNextTodoDueDate = (item: PipelineItem): string | null => {
if (!item.todos || item.todos.length === 0) return null
const next = item.todos.find(t => t.status.toLowerCase() !== 'completed')
return next?.dueDate || null
}
const editItem = async (item: PipelineItem) => {
// Load todos lazily
if (item.id !== 0 && (item.todos === undefined || item.todos.length === 0)) {
@@ -287,7 +292,7 @@ const saveItem = (item: PipelineItem | undefined) => {
</Badge>
<Badge v-if="item.todos && item.todos.length > 0"
:variant="badgeVariant(item.todos[item.todos.length - 1]?.dueDate || null)">
:variant="badgeVariant(itemsNextTodoDueDate(item))">
<SquareCheckBig /> {{item.todos.filter(todo => todo.status.toLowerCase() !==
'completed').length}}
</Badge>
@@ -351,7 +356,7 @@ const saveItem = (item: PipelineItem | undefined) => {
<template v-slot:sidebar>
<NumberInput label="Erwarteter Umsatz" :modelValue="selectedItem?.expectedRevenue as number" suffix=" "
@update:model-value="console.log" />
<Todos v-if="selectedItem" title="Aufgaben" :modelValue="selectedItem.todos" :show-completed="false" />
<Todos v-if="selectedItem" :modelValue="selectedItem.todos" :show-completed="false" />
</template>
</EditorDialog>