Compare commits
No commits in common. "8401acd29320cdaf2c40f36a3fdc6b19e3ee5401" and "7dc1a1febc7bc172b273d2f0529d7008222b0bbf" have entirely different histories.
8401acd293
...
7dc1a1febc
|
@ -18,7 +18,6 @@
|
||||||
<div class="row justify-end q-gutter-sm">
|
<div class="row justify-end q-gutter-sm">
|
||||||
<search-input v-model="search" :keys="search_keys" />
|
<search-input v-model="search" :keys="search_keys" />
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
<q-toggle v-model="showPic" icon="mdi-camera-burst" />
|
|
||||||
<q-btn v-if="!public && !nodetails" label="Aufpreise">
|
<q-btn v-if="!public && !nodetails" label="Aufpreise">
|
||||||
<q-menu anchor="center middle" self="center middle">
|
<q-menu anchor="center middle" self="center middle">
|
||||||
<min-price-setting />
|
<min-price-setting />
|
||||||
|
@ -38,7 +37,7 @@
|
||||||
<template #item="props">
|
<template #item="props">
|
||||||
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
||||||
<q-card>
|
<q-card>
|
||||||
<q-img v-if="showPic" style="max-height: 256px" :src="image(props.row.uuid)">
|
<q-img style="max-height: 256px" :src="image(props.row.uuid)">
|
||||||
<div
|
<div
|
||||||
v-if="!public && !nodetails && editable"
|
v-if="!public && !nodetails && editable"
|
||||||
class="absolute-top-right justify-end"
|
class="absolute-top-right justify-end"
|
||||||
|
@ -83,19 +82,6 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</q-img>
|
</q-img>
|
||||||
<q-card-section v-if="!showPic">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col">
|
|
||||||
<div class="text-h4 text-center">
|
|
||||||
{{ props.row.name }}
|
|
||||||
</div>
|
|
||||||
<div class="text-caption text-center">
|
|
||||||
{{ props.row.type.name }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<q-btn rounded icon="mdi-pencil" @click="editDrink = props.row" />
|
|
||||||
</div>
|
|
||||||
</q-card-section>
|
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-badge
|
<q-badge
|
||||||
v-for="tag in props.row.tags"
|
v-for="tag in props.row.tags"
|
||||||
|
@ -439,12 +425,11 @@ export default defineComponent({
|
||||||
void store.updateDrink(drink);
|
void store.updateDrink(drink);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteDrink() {
|
function deleteDrink() {
|
||||||
if (editDrink.value) {
|
if (editDrink.value) {
|
||||||
await store.deleteDrink(editDrink.value);
|
store.deleteDrink(editDrink.value);
|
||||||
}
|
}
|
||||||
editDrink.value = undefined;
|
editDrink.value = undefined;
|
||||||
onRequest({ pagination: pagination.value, filter: search.value });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const showNewDrink = ref(false);
|
const showNewDrink = ref(false);
|
||||||
|
@ -537,7 +522,6 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
editDrink.value = undefined;
|
editDrink.value = undefined;
|
||||||
notLoading.value = true;
|
notLoading.value = true;
|
||||||
onRequest({ pagination: pagination.value, filter: search.value });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_volumes(drink_id: number) {
|
function get_volumes(drink_id: number) {
|
||||||
|
@ -562,8 +546,6 @@ export default defineComponent({
|
||||||
return 'no-image.svg';
|
return 'no-image.svg';
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPic = ref(true);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
drinks: computed(() => store.drinks),
|
drinks: computed(() => store.drinks),
|
||||||
pagination,
|
pagination,
|
||||||
|
@ -592,7 +574,6 @@ export default defineComponent({
|
||||||
image,
|
image,
|
||||||
loading,
|
loading,
|
||||||
onRequest,
|
onRequest,
|
||||||
showPic,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="q-pa-sm">
|
<div class="q-pa-sm">
|
||||||
<div v-for="(price, index) in filterPublic(volume.prices)" :key="price.id">
|
<div v-for="(price, index) in volume.prices" :key="price.id">
|
||||||
<div class="fit row justify-around q-py-sm">
|
<div v-if="isPublic(price, volume)" class="fit row justify-around q-py-sm">
|
||||||
<div
|
<div
|
||||||
v-if="!editable || !hasPermission(PERMISSIONS.EDIT_PRICE)"
|
v-if="!editable || !hasPermission(PERMISSIONS.EDIT_PRICE)"
|
||||||
class="text-body1 col-3"
|
class="text-body1 col-3"
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<q-separator v-if="index < filterPublic(volume.prices).length - 1" />
|
<q-separator v-if="index < volume.prices.length - 1" />
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-if="!public && !nodetails && isUnderMinPrice"
|
v-if="!public && !nodetails && isUnderMinPrice"
|
||||||
|
@ -294,11 +294,13 @@ export default defineComponent({
|
||||||
emit('update:modelValue', volumes.value);
|
emit('update:modelValue', volumes.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterPublic(prices: Array<FG.DrinkPrice>) {
|
function isPublic(price: FG.DrinkPrice, drink) {
|
||||||
|
console.log('drink', drink);
|
||||||
if (props.public) {
|
if (props.public) {
|
||||||
return prices.filter((price) => price.public);
|
console.log(price);
|
||||||
|
return price.public;
|
||||||
}
|
}
|
||||||
return prices;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isUnderMinPrice = computed(() => {
|
const isUnderMinPrice = computed(() => {
|
||||||
|
@ -335,7 +337,7 @@ export default defineComponent({
|
||||||
isUnderMinPrice,
|
isUnderMinPrice,
|
||||||
hasPermission,
|
hasPermission,
|
||||||
PERMISSIONS,
|
PERMISSIONS,
|
||||||
filterPublic,
|
isPublic,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
declare namespace FG {
|
||||||
|
interface Notification {
|
||||||
|
id: number;
|
||||||
|
plugin: string;
|
||||||
|
text: string;
|
||||||
|
data?: any;
|
||||||
|
time: Date;
|
||||||
|
}
|
||||||
|
interface User {
|
||||||
|
userid: string;
|
||||||
|
display_name: string;
|
||||||
|
firstname: string;
|
||||||
|
lastname: string;
|
||||||
|
mail: string;
|
||||||
|
birthday?: Date;
|
||||||
|
roles: Array<string>;
|
||||||
|
permissions?: Array<string>;
|
||||||
|
avatar_url?: string;
|
||||||
|
}
|
||||||
|
interface Session {
|
||||||
|
expires: Date;
|
||||||
|
token: string;
|
||||||
|
lifetime: number;
|
||||||
|
browser: string;
|
||||||
|
platform: string;
|
||||||
|
userid: string;
|
||||||
|
}
|
||||||
|
type Permission = string;
|
||||||
|
interface Role {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
permissions: Array<Permission>;
|
||||||
|
}
|
||||||
|
interface Drink {
|
||||||
|
id: number;
|
||||||
|
article_id?: string;
|
||||||
|
package_size?: number;
|
||||||
|
name: string;
|
||||||
|
volume?: number;
|
||||||
|
cost_per_volume?: number;
|
||||||
|
cost_per_package?: number;
|
||||||
|
uuid: string;
|
||||||
|
receipt?: Array<string>;
|
||||||
|
tags?: Array<Tag>;
|
||||||
|
type?: DrinkType;
|
||||||
|
volumes: Array<DrinkPriceVolume>;
|
||||||
|
}
|
||||||
|
interface DrinkIngredient {
|
||||||
|
id: number;
|
||||||
|
volume: number;
|
||||||
|
ingredient_id: number;
|
||||||
|
cost_per_volume: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
interface DrinkPrice {
|
||||||
|
id: number;
|
||||||
|
price: number;
|
||||||
|
volume: DrinkPriceVolume;
|
||||||
|
public: boolean;
|
||||||
|
description?: string;
|
||||||
|
}
|
||||||
|
interface DrinkPriceVolume {
|
||||||
|
id: number;
|
||||||
|
drink: Drink;
|
||||||
|
volume: number;
|
||||||
|
min_prices: Array<MinPrices>;
|
||||||
|
prices: Array<DrinkPrice>;
|
||||||
|
ingredients: Array<Ingredient>;
|
||||||
|
}
|
||||||
|
interface DrinkType {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
}
|
||||||
|
interface ExtraIngredient {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
|
interface Ingredient {
|
||||||
|
id: number;
|
||||||
|
drink_ingredient?: DrinkIngredient;
|
||||||
|
extra_ingredient?: ExtraIngredient;
|
||||||
|
}
|
||||||
|
interface MinPrices {
|
||||||
|
percentage: number;
|
||||||
|
price: number;
|
||||||
|
}
|
||||||
|
interface Tag {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue