[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

6
src/shims.d.ts vendored
View File

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

View File

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

View File

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

View File

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