release v2.0.0 #4

Merged
crimsen merged 481 commits from develop into master 2024-01-18 15:15:08 +00:00
7 changed files with 58 additions and 84 deletions
Showing only changes of commit c362843c8e - Show all commits

View File

@ -77,8 +77,8 @@ declare namespace FG {
package_size?: number; package_size?: number;
name: string; name: string;
volume?: number; volume?: number;
cost_price_pro_volume?: number; cost_per_volume?: number;
cost_price_package_netto?: number; cost_per_package?: number;
tags?: Array<Tag>; tags?: Array<Tag>;
type?: DrinkType; type?: DrinkType;
volumes: Array<DrinkPriceVolume>; volumes: Array<DrinkPriceVolume>;
@ -86,7 +86,7 @@ declare namespace FG {
interface DrinkIngredient { interface DrinkIngredient {
id: number; id: number;
volume: number; volume: number;
drink_ingredient_id: number; ingredient_id: number;
} }
interface DrinkPrice { interface DrinkPrice {
id: number; id: number;

View File

@ -179,7 +179,7 @@ export default defineComponent({
id: -1, id: -1,
drink_ingredient: { drink_ingredient: {
id: -1, id: -1,
drink_ingredient_id: newIngredient.value.id, ingredient_id: newIngredient.value.id,
volume: newIngredientVolume.value, volume: newIngredientVolume.value,
}, },
extra_ingredient: undefined, extra_ingredient: undefined,

View File

@ -41,14 +41,14 @@
type="number" type="number"
/> />
<q-input <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" class="col-sm-4 col-xs-6 q-pa-sm"
filled filled
label="Preis Netto/Gebinde" label="Preis Netto/Gebinde"
type="number" type="number"
/> />
<q-input <q-input
v-model="cost_price_pro_volume" v-model="cost_per_volume"
class="col-sm-4 col-xs-6 q-pa-sm" class="col-sm-4 col-xs-6 q-pa-sm"
filled filled
label="Preis mit 19%/Liter" label="Preis mit 19%/Liter"
@ -78,8 +78,8 @@ export default defineComponent({
package_size: undefined, package_size: undefined,
name: '', name: '',
volume: undefined, volume: undefined,
cost_price_pro_volume: undefined, cost_per_volume: undefined,
cost_price_package_netto: undefined, cost_per_package: undefined,
tags: [], tags: [],
type: undefined, type: undefined,
volumes: [], volumes: [],
@ -87,24 +87,24 @@ export default defineComponent({
const calc_price_pro_volume = computed( const calc_price_pro_volume = computed(
() => () =>
!!newDrink.value.cost_price_package_netto && !!newDrink.value.cost_per_package &&
!!newDrink.value.volume && !!newDrink.value.volume &&
!!newDrink.value.package_size !!newDrink.value.package_size
); );
const cost_price_pro_volume = computed({ const cost_per_volume = computed({
get: () => { get: () => {
if (calc_price_pro_volume.value) { if (calc_price_pro_volume.value) {
const retVal = const retVal =
((newDrink.value.cost_price_package_netto || 0) / ((newDrink.value.cost_per_package || 0) /
((newDrink.value.volume || 0) * (newDrink.value.package_size || 0))) * ((newDrink.value.volume || 0) * (newDrink.value.package_size || 0))) *
1.19; 1.19;
// eslint-disable-next-line vue/no-side-effects-in-computed-properties // 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) => { 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), drinkTypes: computed(() => store.drinkTypes),
newDrink, newDrink,
calc_price_pro_volume, calc_price_pro_volume,
cost_price_pro_volume, cost_per_volume,
addDrink, addDrink,
cancelAddDrink, cancelAddDrink,
notEmpty, notEmpty,

View File

@ -1,37 +1,39 @@
<template> <template>
<div> <q-page padding>
<q-table title="Getränke" :columns="columns_drinks" :rows="drinks" row-key="name"> <q-card>
<template #body-cell-volumes="props"> <q-table title="Getränke" :columns="columns_drinks" :rows="drinks" row-key="name">
<q-td :props="props"> <template #body-cell-volumes="props">
<q-table <q-td :props="props">
:columns="columns_volumes" <q-table
:rows="props.row.volumes" :columns="columns_volumes"
hide-header :rows="props.row.volumes"
:hide-bottom="props.row.volumes.length < 5" hide-header
flat :hide-bottom="props.row.volumes.length < 5"
> flat
<template #body-cell-prices="props_volumes"> >
<q-td :props="props_volumes"> <template #body-cell-prices="props_volumes">
<q-table <q-td :props="props_volumes">
:columns="columns_prices" <q-table
:rows="props_volumes.row.prices" :columns="columns_prices"
hide-header :rows="props_volumes.row.prices"
:hide-bottom="props_volumes.row.prices.length < 5" hide-header
flat :hide-bottom="props_volumes.row.prices.length < 5"
> flat
<template #body-cell-public="props_prices"> >
<q-td :props="props_prices"> <template #body-cell-public="props_prices">
<q-toggle v-model="props_prices.row.public" disable /> <q-td :props="props_prices">
</q-td> <q-toggle v-model="props_prices.row.public" disable />
</template> </q-td>
</q-table> </template>
</q-td> </q-table>
</template> </q-td>
</q-table> </template>
</q-td> </q-table>
</template> </q-td>
</q-table> </template>
</div> </q-table>
</q-card>
</q-page>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onBeforeMount, computed } from 'vue'; import { defineComponent, onBeforeMount, computed } from 'vue';
@ -39,17 +41,6 @@ import { usePricelistStore } from '../store';
export default defineComponent({ export default defineComponent({
name: 'Pricelist', 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() { setup() {
const store = usePricelistStore(); const store = usePricelistStore();

View File

@ -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>

View File

@ -19,7 +19,7 @@ export const innerRoutes: FG_Plugin.MenuRoute[] = [
route: { route: {
path: 'pricelist', path: 'pricelist',
name: 'drinks-pricelist', name: 'drinks-pricelist',
component: () => import('../pages/PricelistP.vue'), component: () => import('../pages/Pricelist.vue'),
}, },
}, },
{ {

View File

@ -51,8 +51,8 @@ class Drink {
package_size, package_size,
name, name,
volume, volume,
cost_price_pro_volume, cost_per_volume,
cost_price_package_netto, cost_per_package,
tags, tags,
type, type,
}: FG.Drink) { }: FG.Drink) {
@ -61,15 +61,13 @@ class Drink {
this.package_size = package_size; this.package_size = package_size;
this.name = name; this.name = name;
this.volume = volume; this.volume = volume;
this.cost_price_package_netto = cost_price_package_netto; this.cost_per_package = cost_per_package;
this._cost_price_pro_volume = cost_price_pro_volume; this.cost_per_volume = cost_per_volume;
this.cost_price_pro_volume = computed({ this.cost_price_pro_volume = computed({
get: () => { get: () => {
if (!!this.volume && !!this.package_size && !!this.cost_price_package_netto) { if (!!this.volume && !!this.package_size && !!this.cost_per_package) {
const retVal = const retVal =
((this.cost_price_package_netto || 0) / ((this.cost_per_package || 0) / ((this.volume || 0) * (this.package_size || 0))) * 1.19;
((this.volume || 0) * (this.package_size || 0))) *
1.19;
this._cost_price_pro_volume = Math.round(retVal * 1000) / 1000; this._cost_price_pro_volume = Math.round(retVal * 1000) / 1000;
} }
@ -282,7 +280,7 @@ export const usePricelistStore = defineStore({
volume.ingredients.forEach((ingredient) => { volume.ingredients.forEach((ingredient) => {
if (ingredient.drink_ingredient) { if (ingredient.drink_ingredient) {
const _drink = usePricelistStore().drinks.find( const _drink = usePricelistStore().drinks.find(
(a) => a.id === ingredient.drink_ingredient?.drink_ingredient_id (a) => a.id === ingredient.drink_ingredient?.ingredient_id
); );
retVal += retVal +=
ingredient.drink_ingredient.volume * ingredient.drink_ingredient.volume *