Added Productcategories

This commit is contained in:
2024-09-18 20:00:12 +02:00
parent 1e4d0153b4
commit c546e2cf3c
5 changed files with 449 additions and 53 deletions

View File

@@ -68,8 +68,8 @@
<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 #purchasePrice-data="{row}">
{{row.purchasePrice ? Number(row.purchasePrice).toFixed(2) + " €" : ""}}
<template #sellingPrice-data="{row}">
{{row.sellingPrice ? (Number(row.sellingPrice).toFixed(2) + " €").replace(".",",") : ""}}
</template>
<template #tags-data="{row}">
<UBadge
@@ -84,6 +84,9 @@
<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>
@@ -129,10 +132,12 @@ const dataStore = useDataStore()
const router = useRouter()
const items = ref([])
const productcategories = ref([])
const selectedItem = ref(0)
const setupPage = async () => {
items.value = await useSupabaseSelect("products","*")
productcategories.value = await useSupabaseSelect("productcategories", "*")
}
setupPage()
@@ -164,14 +169,19 @@ const templateColumns = [
sortable: true
},
{
key: "purchasePrice",
label: "Einkaufspreis",
key: "sellingPrice",
label: "Verkaufpreispreis",
sortable: true
},
{
key: "tags",
label: "Tags",
sortable: true
},
{
key: "productcategories",
label: "Artikelkategorien",
sortable: true
}
]
const selectedColumns = ref(templateColumns)