133 lines
3.0 KiB
Vue
133 lines
3.0 KiB
Vue
<script setup>
|
|
import dayjs from "dayjs"
|
|
definePageMeta({
|
|
middleware: "auth"
|
|
})
|
|
|
|
defineShortcuts({
|
|
'/': () => {
|
|
//console.log(searchinput)
|
|
//searchinput.value.focus()
|
|
document.getElementById("searchinput").focus()
|
|
},
|
|
'+': () => {
|
|
router.push("/incomingInvoices/[mode]")
|
|
}
|
|
})
|
|
|
|
const dataStore = useDataStore()
|
|
const router = useRouter()
|
|
|
|
|
|
const templateColumns = [
|
|
{
|
|
key: 'state',
|
|
label: "Status:",
|
|
sortable: true
|
|
},
|
|
{
|
|
key: "date",
|
|
label: "Datum",
|
|
sortable: true
|
|
},
|
|
{
|
|
key: "vendor",
|
|
label: "Lieferant"
|
|
},
|
|
{
|
|
key: "dueDate",
|
|
label: "Fälligkeitsdatum"
|
|
},
|
|
{
|
|
key: "paid",
|
|
label: "Bezahlt"
|
|
}
|
|
]
|
|
const selectedColumns = ref(templateColumns)
|
|
const columns = computed(() => templateColumns.filter((column) => selectedColumns.value.includes(column)))
|
|
|
|
|
|
const searchString = ref('')
|
|
const filteredRows = computed(() => {
|
|
if(!searchString.value) {
|
|
return dataStore.incominginvoices
|
|
}
|
|
|
|
return dataStore.incominginvoices.filter(item => {
|
|
return Object.values(item).some((value) => {
|
|
return String(value).toLowerCase().includes(searchString.value.toLowerCase())
|
|
})
|
|
})
|
|
})
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<template>
|
|
<UDashboardNavbar title="Eingangsbelege">
|
|
<template #right>
|
|
<UInput
|
|
id="searchinput"
|
|
v-model="searchString"
|
|
icon="i-heroicons-funnel"
|
|
autocomplete="off"
|
|
placeholder="Suche..."
|
|
class="hidden lg:block"
|
|
@keydown.esc="$event.target.blur()"
|
|
>
|
|
<template #trailing>
|
|
<UKbd value="/" />
|
|
</template>
|
|
</UInput>
|
|
|
|
<UButton @click="router.push(`/incomingInvoices/edit`)">+ Beleg</UButton>
|
|
</template>
|
|
</UDashboardNavbar>
|
|
<UDashboardToolbar>
|
|
<template #right>
|
|
<USelectMenu
|
|
v-model="selectedColumns"
|
|
icon="i-heroicons-adjustments-horizontal-solid"
|
|
:options="templateColumns"
|
|
multiple
|
|
class="hidden lg:block"
|
|
by="key"
|
|
>
|
|
<template #label>
|
|
Spalten
|
|
</template>
|
|
</USelectMenu>
|
|
</template>
|
|
</UDashboardToolbar>
|
|
|
|
<UDashboardPanelContent>
|
|
<UTable
|
|
:rows="filteredRows"
|
|
:columns="columns"
|
|
class="w-full"
|
|
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
|
@select="(i) => router.push(`/incomingInvoices/show/${i.id}`) "
|
|
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Belege anzuzeigen' }"
|
|
>
|
|
<template #date-data="{row}">
|
|
{{dayjs(row.date).format("DD.MM.YYYY")}}
|
|
</template>
|
|
<template #vendor-data="{row}">
|
|
{{dataStore.getVendorById(row.vendor).name}}
|
|
</template>
|
|
<template #dueDate-data="{row}">
|
|
{{dayjs(row.dueDate).format("DD.MM.YYYY")}}
|
|
</template>
|
|
<template #paid-data="{row}">
|
|
<span v-if="row.paid" class="text-primary-500">Bezahlt</span>
|
|
<span v-else class="text-rose-600">Offen</span>
|
|
</template>
|
|
</UTable>
|
|
</UDashboardPanelContent>
|
|
|
|
</template>
|
|
|
|
<style scoped>
|
|
|
|
</style> |