KI-AGENT: Kontenauswahl im Bankportal stabilisieren

This commit is contained in:
2026-05-28 16:38:32 +02:00
parent b91c9d0fd8
commit f2055d59eb

View File

@@ -24,6 +24,7 @@ const incominginvoices = ref([])
const openDocuments = ref([]) const openDocuments = ref([])
const openIncomingInvoices = ref([]) const openIncomingInvoices = ref([])
const filterAccount = ref([]) const filterAccount = ref([])
const filterAccountInitialized = ref(false)
const isSyncing = ref(false) const isSyncing = ref(false)
const cashbookBookingModalOpen = ref(false) const cashbookBookingModalOpen = ref(false)
const savingCashbookBooking = ref(false) const savingCashbookBooking = ref(false)
@@ -134,8 +135,14 @@ const setupPage = async () => {
openIncomingInvoices.value = invoiceItems openIncomingInvoices.value = invoiceItems
.filter(i => i.state === "Gebucht" && !i.archived && i.statementallocations.reduce((n, {amount}) => n + amount, 0).toFixed(2) !== getInvoiceSum(i, false)) .filter(i => i.state === "Gebucht" && !i.archived && i.statementallocations.reduce((n, {amount}) => n + amount, 0).toFixed(2) !== getInvoiceSum(i, false))
if (bankaccounts.value.length > 0 && filterAccount.value.length === 0) { const availableAccountIds = bankaccounts.value.map((account) => account.id)
filterAccount.value = bankaccounts.value if (!filterAccountInitialized.value) {
filterAccount.value = availableAccountIds
filterAccountInitialized.value = true
} else {
filterAccount.value = filterAccount.value
.map((account) => getBankAccountId(account))
.filter((id) => availableAccountIds.includes(id))
} }
// Erst nach dem Laden der Daten die Store-Werte anwenden // Erst nach dem Laden der Daten die Store-Werte anwenden
@@ -250,6 +257,12 @@ const getBankAccountLabel = (account) => {
if (isCashbookAccount(account)) return `${account.name || account.ownerName || "Kassenbuch"} - Konto ${account.datevNumber || account.iban}` if (isCashbookAccount(account)) return `${account.name || account.ownerName || "Kassenbuch"} - Konto ${account.datevNumber || account.iban}`
return `${account.name || account.ownerName || "Bankkonto"} - ${account.iban}` return `${account.name || account.ownerName || "Bankkonto"} - ${account.iban}`
} }
const selectedAccountLabel = computed(() => {
if (filterAccount.value.length === 0) return "Keine Konten"
if (filterAccount.value.length === bankaccounts.value.length) return "Alle Konten"
if (filterAccount.value.length === 1) return getBankAccountLabel(resolveBankAccount(filterAccount.value[0]))
return `${filterAccount.value.length} Konten`
})
const selectedCashbookAccount = computed(() => { const selectedCashbookAccount = computed(() => {
if (filterAccount.value.length !== 1) return null if (filterAccount.value.length !== 1) return null
const account = resolveBankAccount(filterAccount.value[0]) const account = resolveBankAccount(filterAccount.value[0])
@@ -711,12 +724,11 @@ onMounted(() => {
value-key="id" value-key="id"
label-key="displayLabel" label-key="displayLabel"
multiple multiple
by="id"
placeholder="Konten" placeholder="Konten"
class="w-64" class="w-64"
> >
<template #default> <template #default>
{{ filterAccount.length > 0 ? `${filterAccount.length} Kont${filterAccount.length > 1 ? 'en' : 'o'}` : 'Konten' }} {{ selectedAccountLabel }}
</template> </template>
</USelectMenu> </USelectMenu>
<USeparator orientation="vertical" class="h-6"/> <USeparator orientation="vertical" class="h-6"/>