Reduce duplicate dashboard data loading
This commit is contained in:
@@ -10,9 +10,11 @@ let draftInvoicesSum = ref(0)
|
||||
let draftInvoicesCount = ref(0)
|
||||
|
||||
let countPreparedOpenIncomingInvoices = ref(0)
|
||||
const { loadCoreData } = useDashboardData()
|
||||
|
||||
const setupPage = async () => {
|
||||
let items = (await useEntities("createddocuments").select("*, statementallocations(*), customer(id,name), linkedDocument(*)")).filter(i => !i.archived)
|
||||
const { createdDocuments, incomingInvoices } = await loadCoreData()
|
||||
let items = createdDocuments.filter(i => !i.archived)
|
||||
let documents = items.filter(i => i.type === "invoices" ||i.type === "advanceInvoices")
|
||||
|
||||
let draftDocuments = documents.filter(i => i.state === "Entwurf")
|
||||
@@ -36,7 +38,7 @@ const setupPage = async () => {
|
||||
})
|
||||
draftInvoicesCount.value = draftDocuments.length
|
||||
|
||||
countPreparedOpenIncomingInvoices.value = (await useEntities("incominginvoices").select("id, state")).filter(i => i.state === "Vorbereitet" && !i.archived).length
|
||||
countPreparedOpenIncomingInvoices.value = incomingInvoices.filter(i => i.state === "Vorbereitet" && !i.archived).length
|
||||
}
|
||||
|
||||
setupPage()
|
||||
|
||||
Reference in New Issue
Block a user