Fix #105
This commit is contained in:
@@ -264,7 +264,18 @@ const clearSearchString = () => {
|
|||||||
debouncedSearchString.value = ''
|
debouncedSearchString.value = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectableFilters = ref(dataType.filters.map(i => i.name))
|
const openUnpaidInvoicesFilter = {
|
||||||
|
name: 'Nur offene Rechnungen',
|
||||||
|
filterFunction: (row) => {
|
||||||
|
return ['invoices', 'advanceInvoices'].includes(row.type)
|
||||||
|
&& row.state === 'Gebucht'
|
||||||
|
&& !useSum().getIsPaid(row, items.value)
|
||||||
|
&& !items.value.find(i => i.linkedDocument && i.linkedDocument.id === row.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const availableFilters = computed(() => [...dataType.filters, openUnpaidInvoicesFilter])
|
||||||
|
const selectableFilters = computed(() => availableFilters.value.map(i => i.name))
|
||||||
const selectedFilters = ref(dataType.filters.filter(i => i.default).map(i => i.name) || [])
|
const selectedFilters = ref(dataType.filters.filter(i => i.default).map(i => i.name) || [])
|
||||||
|
|
||||||
const filteredRows = computed(() => {
|
const filteredRows = computed(() => {
|
||||||
@@ -286,8 +297,10 @@ const filteredRows = computed(() => {
|
|||||||
|
|
||||||
if (selectedFilters.value.length > 0) {
|
if (selectedFilters.value.length > 0) {
|
||||||
selectedFilters.value.forEach(filterName => {
|
selectedFilters.value.forEach(filterName => {
|
||||||
let filter = dataType.filters.find(i => i.name === filterName)
|
const filter = availableFilters.value.find(i => i.name === filterName)
|
||||||
tempItems = tempItems.filter(filter.filterFunction)
|
if (filter?.filterFunction) {
|
||||||
|
tempItems = tempItems.filter(filter.filterFunction)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -310,4 +323,4 @@ const isPaid = (item) => {
|
|||||||
item.statementallocations.forEach(allocation => amountPaid += allocation.amount)
|
item.statementallocations.forEach(allocation => amountPaid += allocation.amount)
|
||||||
return Number(amountPaid.toFixed(2)) === useSum().getCreatedDocumentSum(item, items.value)
|
return Number(amountPaid.toFixed(2)) === useSum().getCreatedDocumentSum(item, items.value)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user