many changes
This commit is contained in:
@@ -1,10 +1,17 @@
|
||||
<template>
|
||||
<div id="main">
|
||||
<InputGroup>
|
||||
<UButton @click="router.push(`/plants/create/`)">+ Anlage</UButton>
|
||||
|
||||
<UInput
|
||||
v-model="searchString"
|
||||
placeholder="Suche..."
|
||||
/>
|
||||
</InputGroup>
|
||||
|
||||
<UButton @click="router.push(`/plants/create/`)">+ Anlage</UButton>
|
||||
|
||||
<UTable
|
||||
:rows="dataStore.plants"
|
||||
:rows="filteredRows"
|
||||
:columns="columns"
|
||||
@select="selectItem"
|
||||
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Noch keine Einträge' }"
|
||||
@@ -39,7 +46,22 @@ const columns = [
|
||||
}
|
||||
]
|
||||
|
||||
const searchString = ref('')
|
||||
|
||||
const filteredRows = computed(() => {
|
||||
if(!searchString.value) {
|
||||
return dataStore.plants
|
||||
}
|
||||
|
||||
return dataStore.plants.filter(item => {
|
||||
|
||||
item.customerName = dataStore.customers.find(i => i.id === item.customer).name
|
||||
|
||||
return Object.values(item).some((value) => {
|
||||
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
||||
})
|
||||
})
|
||||
})
|
||||
const selectItem = (item) => {
|
||||
router.push(`/plants/show/${item.id} `)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user