[chore] Run prettier

This commit is contained in:
Ferdinand Thiessen 2021-05-26 21:28:41 +02:00
parent 4a0a5b9ec6
commit 840fcb56d1
4 changed files with 12 additions and 35 deletions

8
src/shims.d.ts vendored
View File

@ -1,5 +1,5 @@
declare module '*.vue' { declare module '*.vue' {
import { ComponentOptions } from 'vue' import { ComponentOptions } from 'vue';
const component: ComponentOptions const component: ComponentOptions;
export default component export default component;
} }

View File

@ -1,10 +1,6 @@
import { api } from '@flaschengeist/api'; import { api } from '@flaschengeist/api';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import { import { calc_volume, calc_cost_per_volume, calc_all_min_prices } from './utils/utils';
calc_volume,
calc_cost_per_volume,
calc_all_min_prices,
} from './utils/utils';
interface DrinkPriceVolume extends Omit<FG.DrinkPriceVolume, 'volume'> { interface DrinkPriceVolume extends Omit<FG.DrinkPriceVolume, 'volume'> {
_volume: number; _volume: number;
@ -110,16 +106,11 @@ export const usePricelistStore = defineStore({
if (itm.length > 0) itm[0].name = drinkType.name; if (itm.length > 0) itm[0].name = drinkType.name;
}, },
async getExtraIngredients() { async getExtraIngredients() {
const { data } = await api.get<Array<FG.ExtraIngredient>>( const { data } = await api.get<Array<FG.ExtraIngredient>>('pricelist/ingredients/extraIngredients');
'pricelist/ingredients/extraIngredients'
);
this.extraIngredients = data; this.extraIngredients = data;
}, },
async setExtraIngredient(ingredient: FG.ExtraIngredient) { async setExtraIngredient(ingredient: FG.ExtraIngredient) {
const { data } = await api.post<FG.ExtraIngredient>( const { data } = await api.post<FG.ExtraIngredient>('pricelist/ingredients/extraIngredients', ingredient);
'pricelist/ingredients/extraIngredients',
ingredient
);
this.extraIngredients.push(data); this.extraIngredients.push(data);
}, },
async updateExtraIngredient(ingredient: FG.ExtraIngredient) { async updateExtraIngredient(ingredient: FG.ExtraIngredient) {
@ -277,9 +268,7 @@ export const usePricelistStore = defineStore({
this.pricelist_view = data; this.pricelist_view = data;
}, },
async getPriceListColumnOrder(userid: string) { async getPriceListColumnOrder(userid: string) {
const { data } = await api.get<Array<Order>>( const { data } = await api.get<Array<Order>>(`pricelist/users/${userid}/pricecalc_columns_order`);
`pricelist/users/${userid}/pricecalc_columns_order`
);
this.pricelist_columns_order = data; this.pricelist_columns_order = data;
}, },
async updatePriceListColumnOrder(userid: string, data: Array<Order>) { async updatePriceListColumnOrder(userid: string, data: Array<Order>) {

View File

@ -1,11 +1,6 @@
import { Drink } from '../store'; import { Drink } from '../store';
function filter( function filter(rows: Array<Drink>, terms: Search, cols: Array<Col>, cellValue: { (col: Col, row: Drink): string }) {
rows: Array<Drink>,
terms: Search,
cols: Array<Col>,
cellValue: { (col: Col, row: Drink): string }
) {
if (terms.value) { if (terms.value) {
return rows.filter((row) => { return rows.filter((row) => {
if (!terms.key || terms.key === '') { if (!terms.key || terms.key === '') {

View File

@ -17,8 +17,7 @@ function calc_volume(volume: DrinkPriceVolume) {
function calc_cost_per_volume(drink: Drink) { function calc_cost_per_volume(drink: Drink) {
let retVal = drink._cost_per_volume; let retVal = drink._cost_per_volume;
if (!!drink.volume && !!drink.package_size && !!drink.cost_per_package) { if (!!drink.volume && !!drink.package_size && !!drink.cost_per_package) {
retVal = retVal = ((drink.cost_per_package || 0) / ((drink.volume || 0) * (drink.package_size || 0))) * 1.19;
((drink.cost_per_package || 0) / ((drink.volume || 0) * (drink.package_size || 0))) * 1.19;
} }
return retVal ? Math.round(retVal * 1000) / 1000 : retVal; return retVal ? Math.round(retVal * 1000) / 1000 : retVal;
@ -37,9 +36,7 @@ function helper(volume: DrinkPriceVolume, min_price: number) {
let extraIngredientPrice = 0; let extraIngredientPrice = 0;
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?.ingredient_id);
(a) => a.id === ingredient.drink_ingredient?.ingredient_id
);
retVal += ingredient.drink_ingredient.volume * <number>(<unknown>_drink?.cost_per_volume); retVal += ingredient.drink_ingredient.volume * <number>(<unknown>_drink?.cost_per_volume);
} }
if (ingredient.extra_ingredient) { if (ingredient.extra_ingredient) {
@ -49,11 +46,7 @@ function helper(volume: DrinkPriceVolume, min_price: number) {
return (retVal * min_price) / 100 + extraIngredientPrice; return (retVal * min_price) / 100 + extraIngredientPrice;
} }
function calc_min_prices( function calc_min_prices(volume: DrinkPriceVolume, cost_per_volume: number | undefined, min_prices: Array<number>) {
volume: DrinkPriceVolume,
cost_per_volume: number | undefined,
min_prices: Array<number>
) {
const retVal: Array<FG.MinPrices> = []; const retVal: Array<FG.MinPrices> = [];
volume.min_prices = []; volume.min_prices = [];
if (min_prices) { if (min_prices) {