Files
FEDEO/spaces/pages/banking/index.vue
2024-02-18 19:51:00 +01:00

87 lines
1.6 KiB
Vue

<template>
<div id="main">
<!-- TODO: Kontakte erstellen und dem Kunden zuweisen -->
<!--<InputGroup>
<UButton @click="router.push(`/banking/accounts/create/`)">+ Kontakt</UButton>
<UInput
v-model="searchString"
placeholder="Suche..."
/>
</InputGroup>-->
<Toolbar>
<UButton
@click="router.push('/banking/newAccount')"
>
+ Konto
</UButton>
</Toolbar>
<UTable
:rows="filteredRows"
:columns="itemColumns"
@select="selectItem"
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
>
</UTable>
</div>
</template>
<script setup>
definePageMeta({
middleware: "auth"
})
const dataStore = useDataStore()
const router = useRouter()
const mode = ref("show")
const itemColumns = [
{
key: "iban",
label: "IBAN",
sortable: true
},
{
key: "bankId",
label: "Bank",
sortable: true
},
{
key: "ownerName",
label: "Besitzer",
sortable: true
}
]
const selectItem = (item) => {
router.push(`/banking/statements/${item.id} `)
}
const searchString = ref('')
const filteredRows = computed(() => {
dataStore.bankAccounts = dataStore.bankAccounts.filter(account => account.used)
if(!searchString.value) {
return dataStore.bankAccounts
}
return dataStore.bankAccounts.filter(item => {
return Object.values(item).some((value) => {
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
})
})
})
</script>
<style scoped>
</style>