From 7677fe5d9d8249831032833d35321b59db407555 Mon Sep 17 00:00:00 2001 From: flfeders Date: Thu, 6 Aug 2026 15:41:09 +0200 Subject: [PATCH] Show bank bookings before supporting data loads --- .../banking/statements/[mode]/[[id]].vue | 59 +++++++++++++------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/frontend/pages/banking/statements/[mode]/[[id]].vue b/frontend/pages/banking/statements/[mode]/[[id]].vue index 25f8261..b129af5 100644 --- a/frontend/pages/banking/statements/[mode]/[[id]].vue +++ b/frontend/pages/banking/statements/[mode]/[[id]].vue @@ -38,6 +38,7 @@ const accounts = ref([]) const ownaccounts = ref([]) const loading = ref(true) +const loadingDocuments = ref(true) const rebuildDocumentLists = () => { const documents = createddocuments.value.filter(i => i.type === "invoices" || i.type === "advanceInvoices") @@ -61,39 +62,56 @@ const rebuildDocumentLists = () => { const setup = async () => { loading.value = true - const [statement, documentItems, invoiceItems, accountItems, ownAccountItems, customerItems, vendorItems] = await Promise.all([ - route.params.id - ? useEntities("bankstatements").selectSingle(route.params.id, "*, statementallocations(*, cd_id(*), ii_id(*))") - : Promise.resolve(itemInfo.value), + loadingDocuments.value = true + + const supportingDataPromise = Promise.all([ useEntities("createddocuments").select("*, statementallocations(*), customer(id,name)"), useEntities("incominginvoices").select("*, statementallocations(*), vendor(*)"), - useEntities("accounts").selectSpecial("*", "number", true), useEntities("ownaccounts").select(), useEntities("customers").select(), useEntities("vendors").select() ]) + const [statement, accountItems] = await Promise.all([ + route.params.id + ? useEntities("bankstatements").selectSingle(route.params.id, "*, statementallocations(*, cd_id(*), ii_id(*))") + : Promise.resolve(itemInfo.value), + useEntities("accounts").selectSpecial("*", "number", true) + ]) + itemInfo.value = statement + accounts.value = accountItems if (itemInfo.value) oldItemInfo.value = JSON.parse(JSON.stringify(itemInfo.value)) manualAllocationSum.value = calculateOpenSum.value allocationDepreciationStartDate.value = dayjs(itemInfo.value?.date || new Date()).format("YYYY-MM-DD") + loading.value = false - createddocuments.value = documentItems - incominginvoices.value = invoiceItems.filter(i => i.state === "Gebucht") - accounts.value = accountItems - ownaccounts.value = ownAccountItems - customers.value = customerItems - vendors.value = vendorItems - rebuildDocumentLists() + const suggestionsPromise = itemInfo.value?.id + ? useFunctions().useBankingStatementSuggestions(itemInfo.value.id) + : Promise.resolve({ suggestions: [] }) - if (itemInfo.value?.id) { - statementSuggestions.value = await useFunctions().useBankingStatementSuggestions(itemInfo.value.id) - } else { - statementSuggestions.value = { suggestions: [] } + try { + const [documentItems, invoiceItems, ownAccountItems, customerItems, vendorItems] = await supportingDataPromise + + createddocuments.value = documentItems + incominginvoices.value = invoiceItems.filter(i => i.state === "Gebucht") + ownaccounts.value = ownAccountItems + customers.value = customerItems + vendors.value = vendorItems + rebuildDocumentLists() + } catch (error) { + console.error("Offene Belege konnten nicht geladen werden:", error) + } finally { + loadingDocuments.value = false } - loading.value = false + try { + statementSuggestions.value = await suggestionsPromise + } catch (error) { + console.error("Buchungsvorschläge konnten nicht geladen werden:", error) + statementSuggestions.value = { suggestions: [] } + } } const displayCurrency = (value, currency = "€") => { @@ -819,6 +837,11 @@ setup()
+
+ + Offene Belege werden geladen … +
+
@@ -1035,7 +1058,7 @@ setup()
-

Keine passenden offenen Belege gefunden.