2021-03-29 10:50:50 +00:00
|
|
|
<template>
|
|
|
|
<div class="q-pa-sm full-width full-height row q-gutter-sm">
|
|
|
|
<q-card v-for="drink in drinks" :key="drink.id" style="max-width: 256px; width: 256px">
|
|
|
|
<q-img
|
|
|
|
style="max-width: 256px"
|
|
|
|
loading="lazy"
|
|
|
|
:src="drink.uuid ? `/api/pricelist/picture/${drink.uuid}?size=256` : 'no-image.svg'"
|
|
|
|
placeholder-src="no-image.svg"
|
|
|
|
>
|
|
|
|
<div class="absolute-bottom-right text-subtitle2">
|
|
|
|
{{ drink.name }}
|
|
|
|
</div>
|
|
|
|
</q-img>
|
|
|
|
<q-card-section>
|
|
|
|
<div class="text-h6">Zutaten</div>
|
|
|
|
<div v-for="ingredient in drink.volumes[0].ingredients" :key="ingredient.id">
|
|
|
|
{{
|
2021-03-29 20:35:54 +00:00
|
|
|
name(ingredient.drink_ingredient?.ingredient_id) || ingredient.extra_ingredient?.name
|
|
|
|
}}
|
|
|
|
{{
|
|
|
|
ingredient.drink_ingredient?.volume
|
|
|
|
? `${ingredient.drink_ingredient?.volume * 100} cl`
|
|
|
|
: ''
|
2021-03-29 10:50:50 +00:00
|
|
|
}}
|
|
|
|
</div>
|
|
|
|
</q-card-section>
|
|
|
|
<q-card-section>
|
|
|
|
<div class="text-h6">Preise</div>
|
|
|
|
<div class="full-width row q-gutter-sm">
|
|
|
|
<div v-for="price in drink.volumes[0].prices" :key="price.id">
|
|
|
|
{{ price.price.toFixed(2) }}€
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</q-card-section>
|
|
|
|
<q-card-section>
|
|
|
|
<div class="text-h6">Anleitung</div>
|
2021-03-29 20:35:54 +00:00
|
|
|
<build-manual :steps="drink.receipt" :editable="false" />
|
|
|
|
</q-card-section>
|
2021-03-29 10:50:50 +00:00
|
|
|
</q-card>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { computed, defineComponent, onBeforeMount } from 'vue';
|
|
|
|
import { usePricelistStore } from 'src/plugins/pricelist/store';
|
2021-03-29 20:35:54 +00:00
|
|
|
import BuildManual from 'src/plugins/pricelist/components/CalculationTable/BuildManual.vue';
|
2021-03-29 10:50:50 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'Reciepts',
|
2021-03-29 20:35:54 +00:00
|
|
|
components: { BuildManual },
|
2021-03-29 10:50:50 +00:00
|
|
|
setup() {
|
|
|
|
const store = usePricelistStore();
|
|
|
|
onBeforeMount(() => {
|
|
|
|
void store.getDrinks();
|
|
|
|
});
|
|
|
|
function name(id: number) {
|
|
|
|
return store.drinks.find((a) => a.id === id)?.name;
|
|
|
|
}
|
|
|
|
const drinks = computed(() =>
|
|
|
|
store.drinks.filter((drink) => {
|
|
|
|
return drink.volumes.some((volume) => volume.ingredients.length > 0);
|
|
|
|
})
|
|
|
|
);
|
2021-03-29 19:29:04 +00:00
|
|
|
|
2021-03-29 10:50:50 +00:00
|
|
|
return { drinks, name };
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|