release v2.0.0 #4
|
@ -77,8 +77,8 @@ declare namespace FG {
|
|||
package_size?: number;
|
||||
name: string;
|
||||
volume?: number;
|
||||
cost_price_pro_volume?: number;
|
||||
cost_price_package_netto?: number;
|
||||
cost_per_volume?: number;
|
||||
cost_per_package?: number;
|
||||
tags?: Array<Tag>;
|
||||
type?: DrinkType;
|
||||
volumes: Array<DrinkPriceVolume>;
|
||||
|
@ -86,7 +86,7 @@ declare namespace FG {
|
|||
interface DrinkIngredient {
|
||||
id: number;
|
||||
volume: number;
|
||||
drink_ingredient_id: number;
|
||||
ingredient_id: number;
|
||||
}
|
||||
interface DrinkPrice {
|
||||
id: number;
|
||||
|
|
|
@ -179,7 +179,7 @@ export default defineComponent({
|
|||
id: -1,
|
||||
drink_ingredient: {
|
||||
id: -1,
|
||||
drink_ingredient_id: newIngredient.value.id,
|
||||
ingredient_id: newIngredient.value.id,
|
||||
volume: newIngredientVolume.value,
|
||||
},
|
||||
extra_ingredient: undefined,
|
||||
|
|
|
@ -41,14 +41,14 @@
|
|||
type="number"
|
||||
/>
|
||||
<q-input
|
||||
v-model.number="newDrink.cost_price_package_netto"
|
||||
v-model.number="newDrink.cost_per_package"
|
||||
class="col-sm-4 col-xs-6 q-pa-sm"
|
||||
filled
|
||||
label="Preis Netto/Gebinde"
|
||||
type="number"
|
||||
/>
|
||||
<q-input
|
||||
v-model="cost_price_pro_volume"
|
||||
v-model="cost_per_volume"
|
||||
class="col-sm-4 col-xs-6 q-pa-sm"
|
||||
filled
|
||||
label="Preis mit 19%/Liter"
|
||||
|
@ -78,8 +78,8 @@ export default defineComponent({
|
|||
package_size: undefined,
|
||||
name: '',
|
||||
volume: undefined,
|
||||
cost_price_pro_volume: undefined,
|
||||
cost_price_package_netto: undefined,
|
||||
cost_per_volume: undefined,
|
||||
cost_per_package: undefined,
|
||||
tags: [],
|
||||
type: undefined,
|
||||
volumes: [],
|
||||
|
@ -87,24 +87,24 @@ export default defineComponent({
|
|||
|
||||
const calc_price_pro_volume = computed(
|
||||
() =>
|
||||
!!newDrink.value.cost_price_package_netto &&
|
||||
!!newDrink.value.cost_per_package &&
|
||||
!!newDrink.value.volume &&
|
||||
!!newDrink.value.package_size
|
||||
);
|
||||
const cost_price_pro_volume = computed({
|
||||
const cost_per_volume = computed({
|
||||
get: () => {
|
||||
if (calc_price_pro_volume.value) {
|
||||
const retVal =
|
||||
((newDrink.value.cost_price_package_netto || 0) /
|
||||
((newDrink.value.cost_per_package || 0) /
|
||||
((newDrink.value.volume || 0) * (newDrink.value.package_size || 0))) *
|
||||
1.19;
|
||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||
newDrink.value.cost_price_pro_volume = Math.round(retVal * 1000) / 1000;
|
||||
newDrink.value.cost_per_volume = Math.round(retVal * 1000) / 1000;
|
||||
}
|
||||
return newDrink.value.cost_price_pro_volume;
|
||||
return newDrink.value.cost_per_volume;
|
||||
},
|
||||
set: (val) => {
|
||||
newDrink.value.cost_price_pro_volume = val;
|
||||
newDrink.value.cost_per_volume = val;
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -123,7 +123,7 @@ export default defineComponent({
|
|||
drinkTypes: computed(() => store.drinkTypes),
|
||||
newDrink,
|
||||
calc_price_pro_volume,
|
||||
cost_price_pro_volume,
|
||||
cost_per_volume,
|
||||
addDrink,
|
||||
cancelAddDrink,
|
||||
notEmpty,
|
||||
|
|
|
@ -1,37 +1,39 @@
|
|||
<template>
|
||||
<div>
|
||||
<q-table title="Getränke" :columns="columns_drinks" :rows="drinks" row-key="name">
|
||||
<template #body-cell-volumes="props">
|
||||
<q-td :props="props">
|
||||
<q-table
|
||||
:columns="columns_volumes"
|
||||
:rows="props.row.volumes"
|
||||
hide-header
|
||||
:hide-bottom="props.row.volumes.length < 5"
|
||||
flat
|
||||
>
|
||||
<template #body-cell-prices="props_volumes">
|
||||
<q-td :props="props_volumes">
|
||||
<q-table
|
||||
:columns="columns_prices"
|
||||
:rows="props_volumes.row.prices"
|
||||
hide-header
|
||||
:hide-bottom="props_volumes.row.prices.length < 5"
|
||||
flat
|
||||
>
|
||||
<template #body-cell-public="props_prices">
|
||||
<q-td :props="props_prices">
|
||||
<q-toggle v-model="props_prices.row.public" disable />
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</div>
|
||||
<q-page padding>
|
||||
<q-card>
|
||||
<q-table title="Getränke" :columns="columns_drinks" :rows="drinks" row-key="name">
|
||||
<template #body-cell-volumes="props">
|
||||
<q-td :props="props">
|
||||
<q-table
|
||||
:columns="columns_volumes"
|
||||
:rows="props.row.volumes"
|
||||
hide-header
|
||||
:hide-bottom="props.row.volumes.length < 5"
|
||||
flat
|
||||
>
|
||||
<template #body-cell-prices="props_volumes">
|
||||
<q-td :props="props_volumes">
|
||||
<q-table
|
||||
:columns="columns_prices"
|
||||
:rows="props_volumes.row.prices"
|
||||
hide-header
|
||||
:hide-bottom="props_volumes.row.prices.length < 5"
|
||||
flat
|
||||
>
|
||||
<template #body-cell-public="props_prices">
|
||||
<q-td :props="props_prices">
|
||||
<q-toggle v-model="props_prices.row.public" disable />
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-td>
|
||||
</template>
|
||||
</q-table>
|
||||
</q-card>
|
||||
</q-page>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, onBeforeMount, computed } from 'vue';
|
||||
|
@ -39,17 +41,6 @@ import { usePricelistStore } from '../store';
|
|||
|
||||
export default defineComponent({
|
||||
name: 'Pricelist',
|
||||
filters: {
|
||||
setVolume(volume: number) {
|
||||
if (volume * 10 > 1) {
|
||||
return `${volume}l`;
|
||||
}
|
||||
return `${volume * 100}cl`;
|
||||
},
|
||||
setCurrency(price: number) {
|
||||
return `${price.toFixed(2)}€`;
|
||||
},
|
||||
},
|
||||
setup() {
|
||||
const store = usePricelistStore();
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
<template>
|
||||
<Pricelist />
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import Pricelist from '../components/Pricelist.vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'PricelistPage',
|
||||
components: { Pricelist },
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
|
@ -19,7 +19,7 @@ export const innerRoutes: FG_Plugin.MenuRoute[] = [
|
|||
route: {
|
||||
path: 'pricelist',
|
||||
name: 'drinks-pricelist',
|
||||
component: () => import('../pages/PricelistP.vue'),
|
||||
component: () => import('../pages/Pricelist.vue'),
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -51,8 +51,8 @@ class Drink {
|
|||
package_size,
|
||||
name,
|
||||
volume,
|
||||
cost_price_pro_volume,
|
||||
cost_price_package_netto,
|
||||
cost_per_volume,
|
||||
cost_per_package,
|
||||
tags,
|
||||
type,
|
||||
}: FG.Drink) {
|
||||
|
@ -61,15 +61,13 @@ class Drink {
|
|||
this.package_size = package_size;
|
||||
this.name = name;
|
||||
this.volume = volume;
|
||||
this.cost_price_package_netto = cost_price_package_netto;
|
||||
this._cost_price_pro_volume = cost_price_pro_volume;
|
||||
this.cost_per_package = cost_per_package;
|
||||
this.cost_per_volume = cost_per_volume;
|
||||
this.cost_price_pro_volume = computed({
|
||||
get: () => {
|
||||
if (!!this.volume && !!this.package_size && !!this.cost_price_package_netto) {
|
||||
if (!!this.volume && !!this.package_size && !!this.cost_per_package) {
|
||||
const retVal =
|
||||
((this.cost_price_package_netto || 0) /
|
||||
((this.volume || 0) * (this.package_size || 0))) *
|
||||
1.19;
|
||||
((this.cost_per_package || 0) / ((this.volume || 0) * (this.package_size || 0))) * 1.19;
|
||||
this._cost_price_pro_volume = Math.round(retVal * 1000) / 1000;
|
||||
}
|
||||
|
||||
|
@ -282,7 +280,7 @@ export const usePricelistStore = defineStore({
|
|||
volume.ingredients.forEach((ingredient) => {
|
||||
if (ingredient.drink_ingredient) {
|
||||
const _drink = usePricelistStore().drinks.find(
|
||||
(a) => a.id === ingredient.drink_ingredient?.drink_ingredient_id
|
||||
(a) => a.id === ingredient.drink_ingredient?.ingredient_id
|
||||
);
|
||||
retVal +=
|
||||
ingredient.drink_ingredient.volume *
|
||||
|
|
Loading…
Reference in New Issue