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">
|
||||
<search-input v-model="search" :keys="search_keys" />
|
||||
<slot></slot>
|
||||
<q-toggle v-model="showPic" icon="mdi-camera-burst" />
|
||||
<q-btn v-if="!public && !nodetails" label="Aufpreise">
|
||||
<q-menu anchor="center middle" self="center middle">
|
||||
<min-price-setting />
|
||||
|
@ -38,7 +37,7 @@
|
|||
<template #item="props">
|
||||
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
||||
<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
|
||||
v-if="!public && !nodetails && editable"
|
||||
class="absolute-top-right justify-end"
|
||||
|
@ -83,19 +82,6 @@
|
|||
</div>
|
||||
</template>
|
||||
</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-badge
|
||||
v-for="tag in props.row.tags"
|
||||
|
@ -439,12 +425,11 @@ export default defineComponent({
|
|||
void store.updateDrink(drink);
|
||||
}
|
||||
|
||||
async function deleteDrink() {
|
||||
function deleteDrink() {
|
||||
if (editDrink.value) {
|
||||
await store.deleteDrink(editDrink.value);
|
||||
store.deleteDrink(editDrink.value);
|
||||
}
|
||||
editDrink.value = undefined;
|
||||
onRequest({ pagination: pagination.value, filter: search.value });
|
||||
}
|
||||
|
||||
const showNewDrink = ref(false);
|
||||
|
@ -537,7 +522,6 @@ export default defineComponent({
|
|||
}
|
||||
editDrink.value = undefined;
|
||||
notLoading.value = true;
|
||||
onRequest({ pagination: pagination.value, filter: search.value });
|
||||
}
|
||||
|
||||
function get_volumes(drink_id: number) {
|
||||
|
@ -562,8 +546,6 @@ export default defineComponent({
|
|||
return 'no-image.svg';
|
||||
}
|
||||
|
||||
const showPic = ref(true);
|
||||
|
||||
return {
|
||||
drinks: computed(() => store.drinks),
|
||||
pagination,
|
||||
|
@ -592,7 +574,6 @@ export default defineComponent({
|
|||
image,
|
||||
loading,
|
||||
onRequest,
|
||||
showPic,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
|
|
@ -42,8 +42,8 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="q-pa-sm">
|
||||
<div v-for="(price, index) in filterPublic(volume.prices)" :key="price.id">
|
||||
<div class="fit row justify-around q-py-sm">
|
||||
<div v-for="(price, index) in volume.prices" :key="price.id">
|
||||
<div v-if="isPublic(price, volume)" class="fit row justify-around q-py-sm">
|
||||
<div
|
||||
v-if="!editable || !hasPermission(PERMISSIONS.EDIT_PRICE)"
|
||||
class="text-body1 col-3"
|
||||
|
@ -93,7 +93,7 @@
|
|||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
<q-separator v-if="index < filterPublic(volume.prices).length - 1" />
|
||||
<q-separator v-if="index < volume.prices.length - 1" />
|
||||
</div>
|
||||
<div
|
||||
v-if="!public && !nodetails && isUnderMinPrice"
|
||||
|
@ -294,11 +294,13 @@ export default defineComponent({
|
|||
emit('update:modelValue', volumes.value);
|
||||
}
|
||||
|
||||
function filterPublic(prices: Array<FG.DrinkPrice>) {
|
||||
function isPublic(price: FG.DrinkPrice, drink) {
|
||||
console.log('drink', drink);
|
||||
if (props.public) {
|
||||
return prices.filter((price) => price.public);
|
||||
console.log(price);
|
||||
return price.public;
|
||||
}
|
||||
return prices;
|
||||
return true;
|
||||
}
|
||||
|
||||
const isUnderMinPrice = computed(() => {
|
||||
|
@ -335,7 +337,7 @@ export default defineComponent({
|
|||
isUnderMinPrice,
|
||||
hasPermission,
|
||||
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