diff --git a/frontend/pages/banking/index.vue b/frontend/pages/banking/index.vue index 53d4076..11ed42b 100644 --- a/frontend/pages/banking/index.vue +++ b/frontend/pages/banking/index.vue @@ -24,6 +24,7 @@ const incominginvoices = ref([]) const openDocuments = ref([]) const openIncomingInvoices = ref([]) const filterAccount = ref([]) +const filterAccountInitialized = ref(false) const isSyncing = ref(false) const cashbookBookingModalOpen = ref(false) const savingCashbookBooking = ref(false) @@ -134,8 +135,14 @@ const setupPage = async () => { openIncomingInvoices.value = invoiceItems .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) { - filterAccount.value = bankaccounts.value + const availableAccountIds = bankaccounts.value.map((account) => account.id) + 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 @@ -250,6 +257,12 @@ const getBankAccountLabel = (account) => { if (isCashbookAccount(account)) return `${account.name || account.ownerName || "Kassenbuch"} - Konto ${account.datevNumber || 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(() => { if (filterAccount.value.length !== 1) return null const account = resolveBankAccount(filterAccount.value[0]) @@ -711,12 +724,11 @@ onMounted(() => { value-key="id" label-key="displayLabel" multiple - by="id" placeholder="Konten" class="w-64" >