117 lines
3.1 KiB
Vue
117 lines
3.1 KiB
Vue
<template>
|
|
<EntityList
|
|
:items="items"
|
|
type="products"
|
|
/>
|
|
<!-- <UDashboardNavbar title="Artikel" :badge="filteredRows.length">
|
|
<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(`/products/create`)">+ Artikel</UButton>
|
|
</template>
|
|
</UDashboardNavbar>
|
|
|
|
<UDashboardToolbar>
|
|
<template #left>
|
|
<USelectMenu
|
|
v-model="selectedTags"
|
|
icon="i-heroicons-adjustments-horizontal-solid"
|
|
:options="templateTags"
|
|
multiple
|
|
class="hidden lg:block"
|
|
>
|
|
<template #label>
|
|
Tags
|
|
</template>
|
|
</USelectMenu>
|
|
</template>
|
|
<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>
|
|
<UTable
|
|
:rows="filteredRows"
|
|
:columns="columns"
|
|
class="w-full"
|
|
:ui="{ divide: 'divide-gray-200 dark:divide-gray-800' }"
|
|
@select="(i) => router.push(`/products/show/${i.id}`) "
|
|
:empty-state="{ icon: 'i-heroicons-circle-stack-20-solid', label: 'Keine Artikel anzuzeigen' }"
|
|
>
|
|
<template #name-data="{row}">
|
|
<span
|
|
v-if="row === filteredRows[selectedItem]"
|
|
class="text-primary-500 font-bold">{{row.name}}</span>
|
|
<span v-else>
|
|
{{row.name}}
|
|
</span>
|
|
|
|
</template>
|
|
<template #stock-data="{row}">
|
|
{{`${dataStore.getStockByProductId(row.id)} ${(dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : "")}`}}
|
|
</template>
|
|
<template #sellingPrice-data="{row}">
|
|
{{row.sellingPrice ? (Number(row.sellingPrice).toFixed(2) + " €").replace(".",",") : ""}}
|
|
</template>
|
|
<template #tags-data="{row}">
|
|
<UBadge
|
|
v-if="row.tags.length > 0"
|
|
v-for="tag in row.tags"
|
|
class="mr-2"
|
|
>
|
|
{{tag}}
|
|
</UBadge>
|
|
<span v-else>-</span>
|
|
</template>
|
|
<template #unit-data="{row}">
|
|
{{dataStore.units.find(unit => unit.id === row.unit) ? dataStore.units.find(unit => unit.id === row.unit).name : row.unit}}
|
|
</template>
|
|
<template #productcategories-data="{row}">
|
|
{{row.productcategories.map(i => productcategories.find(x => x.id === i).name).join(", ")}}
|
|
</template>
|
|
</UTable>-->
|
|
|
|
</template>
|
|
|
|
<script setup>
|
|
|
|
definePageMeta({
|
|
middleware: "auth"
|
|
})
|
|
|
|
const items = ref([])
|
|
const productcategories = ref([])
|
|
|
|
const setupPage = async () => {
|
|
items.value = await useSupabaseSelect("products","*, unit(name)")
|
|
productcategories.value = await useSupabaseSelect("productcategories", "*")
|
|
}
|
|
|
|
setupPage()
|
|
</script>
|
|
|
|
<style scoped>
|
|
|
|
</style> |