90 lines
1.4 KiB
Vue
90 lines
1.4 KiB
Vue
<template>
|
|
<div id="main">
|
|
|
|
<div class="flex items-center gap-1">
|
|
<UButton @click="router.push(`/vendorinvoices/create/`)">+ Eingangsrechnung</UButton>
|
|
|
|
<UInput
|
|
v-model="searchString"
|
|
placeholder="Suche..."
|
|
/>
|
|
</div>
|
|
|
|
|
|
|
|
<UTable
|
|
:rows="filteredRows"
|
|
:columns="itemColumns"
|
|
@select="selectItem"
|
|
|
|
/>
|
|
|
|
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
|
|
definePageMeta({
|
|
middleware: "auth"
|
|
})
|
|
|
|
|
|
const router = useRouter()
|
|
const {vendorInvoices } = storeToRefs(useDataStore())
|
|
const mode = ref("show")
|
|
|
|
const itemColumns = [
|
|
{
|
|
key: 'id',
|
|
label: "Id",
|
|
sortable: true
|
|
},
|
|
{
|
|
key: 'state',
|
|
label: "Status.",
|
|
sortable: true
|
|
},
|
|
{
|
|
key: 'vendor',
|
|
label: "Lieferantennr.",
|
|
sortable: true
|
|
},
|
|
{
|
|
key: "reference",
|
|
label: "Referenz",
|
|
sortable: true
|
|
},
|
|
{
|
|
key: "date",
|
|
label: "Datum",
|
|
sortable: true
|
|
},
|
|
]
|
|
|
|
|
|
const selectItem = (item) => {
|
|
console.log(item)
|
|
router.push(`/vendorinvoices/show/${item.id} `)
|
|
}
|
|
|
|
|
|
const searchString = ref('')
|
|
|
|
const filteredRows = computed(() => {
|
|
if(!searchString.value) {
|
|
return vendorInvoices.value
|
|
}
|
|
|
|
return vendorInvoices.value.filter(item => {
|
|
return Object.values(item).some((value) => {
|
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
|
})
|
|
})
|
|
})
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |