fixed archived filtering

added tabs to incominginvoices
added Badges to tabs
This commit is contained in:
2025-09-24 19:33:00 +02:00
parent ce39e96c0a
commit 850ef006c5
2 changed files with 140 additions and 104 deletions

View File

@@ -47,10 +47,11 @@
</template>
</USelectMenu>
<USelectMenu
v-if="selectableFilters.length > 0"
icon="i-heroicons-adjustments-horizontal-solid"
multiple
v-model="selectedFilters"
:options="['Nur offene anzeigen']"
:options="selectableFilters"
:color="selectedFilters.length > 0 ? 'primary' : 'white'"
:ui-menu="{ width: 'min-w-max' }"
>
@@ -61,6 +62,15 @@
</template>
</UDashboardToolbar>
<UTabs :items="selectedTypes" class="m-3">
<template #default="{item}">
{{item.label}}
<UBadge
variant="outline"
class="ml-2"
>
{{filteredRows.filter(i => item.key === 'invoices' ? ['invoices','advanceInvoices','cancellationInvoices'].includes(i.type) : item.key === i.type).length}}
</UBadge>
</template>
<template #item="{item}">
<div style="height: 80vh; overflow-y: scroll">
<UTable
@@ -182,12 +192,15 @@ const dataStore = useDataStore()
const tempStore = useTempStore()
const router = useRouter()
const type = "createddocuments"
const dataType = dataStore.dataTypes[type]
const items = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
items.value = (await useEntities("createddocuments").select("*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber",true)).filter(i => !i.archived)
items.value = (await useEntities("createddocuments").select("*, customer(id,name), statementallocations(id,amount),linkedDocument(*)","documentNumber",true, true))
}
setupPage()
@@ -279,24 +292,34 @@ const clearSearchString = () => {
tempStore.clearSearchString('createddocuments')
searchString.value = ''
}
const selectedFilters = ref([])
const selectableFilters = ref(dataType.filters.map(i => i.name))
const selectedFilters = ref(dataType.filters.filter(i => i.default).map(i => i.name) || [])
const filteredRows = computed(() => {
let temp = items.value.filter(i => types.value.find(x => x.key === 'invoices' ? ['invoices', 'advanceInvoices', 'cancellationInvoices'].includes(i.type) : x.key === i.type))
temp = temp.filter(i => i.type !== "serialInvoices")
let tempItems = items.value.filter(i => types.value.find(x => x.key === 'invoices' ? ['invoices', 'advanceInvoices', 'cancellationInvoices'].includes(i.type) : x.key === i.type))
tempItems = tempItems.filter(i => i.type !== "serialInvoices")
/*if(showDrafts.value === true) {
temp = temp.filter(i => i.state === "Entwurf")
} else {
temp = temp.filter(i => i.state !== "Entwurf")
}*/
tempItems = tempItems.map(i => {
return {
...i,
class: i.archived ? 'bg-red-500/50 dark:bg-red-400/50' : null
}
})
if (selectedFilters.value.includes("Nur offene anzeigen")) {
temp = temp.filter(i => !isPaid(i))
if(selectedFilters.value.length > 0) {
selectedFilters.value.forEach(filterName => {
let filter = dataType.filters.find(i => i.name === filterName)
tempItems = tempItems.filter(filter.filterFunction)
})
}
return useSearch(searchString.value, temp.slice().reverse())
tempItems = useSearch(searchString.value, tempItems)
return useSearch(searchString.value, tempItems.slice().reverse())
})