many changes

This commit is contained in:
2024-01-11 18:33:56 +01:00
parent d62fc5d668
commit 12323382a5
17 changed files with 941 additions and 537 deletions

View File

@@ -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} `)
}