[pricelist] Fixed warnings

This commit is contained in:
Ferdinand Thiessen 2021-03-20 22:16:37 +01:00
parent c5a34ce63f
commit 17460a8543
4 changed files with 27 additions and 20 deletions

View File

@ -166,11 +166,11 @@ export default defineComponent({
setup(_, { emit }) { setup(_, { emit }) {
const store = usePricelistStore(); const store = usePricelistStore();
const emptyIngredient: FG.Ingredient = { /*const emptyIngredient: FG.Ingredient = {
id: -1, id: -1,
drink_ingredient: undefined, drink_ingredient: undefined,
extra_ingredient: undefined, extra_ingredient: undefined,
}; };*/
const newIngredient = ref<FG.Drink | FG.ExtraIngredient>(); const newIngredient = ref<FG.Drink | FG.ExtraIngredient>();
const newIngredientVolume = ref<number>(0); const newIngredientVolume = ref<number>(0);
function addIngredient(volume: DrinkPriceVolume) { function addIngredient(volume: DrinkPriceVolume) {

View File

@ -62,20 +62,20 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import {computed, ComputedRef, defineComponent, ref} from 'vue'; import { computed, ComputedRef, defineComponent, ref } from 'vue';
import {usePricelistStore} from 'src/plugins/pricelist/store'; import { usePricelistStore } from 'src/plugins/pricelist/store';
export default defineComponent({ export default defineComponent({
name: 'DrinkTypes', name: 'DrinkTypes',
setup() { setup() {
const store = usePricelistStore() const store = usePricelistStore();
const emptyExtraIngredient: FG.ExtraIngredient = { const emptyExtraIngredient: FG.ExtraIngredient = {
name: '', name: '',
price: 0, price: 0,
id: -1, id: -1,
}; };
const newExtraIngredient = ref<FG.ExtraIngredient>(emptyExtraIngredient); const newExtraIngredient = ref<FG.ExtraIngredient>(emptyExtraIngredient);
const newDrinkTypeName = ref<string>(''); /*const newDrinkTypeName = ref<string>('');*/
const edittype = ref(false); const edittype = ref(false);
const actualExtraIngredient = ref(emptyExtraIngredient); const actualExtraIngredient = ref(emptyExtraIngredient);

View File

@ -52,23 +52,27 @@ import DrinkTypes from 'src/plugins/pricelist/components/DrinkTypes.vue';
import CalculationTable from 'src/plugins/pricelist/components/CalculationTable.vue'; import CalculationTable from 'src/plugins/pricelist/components/CalculationTable.vue';
import ExtraIngredients from 'src/plugins/pricelist/components/ExtraIngredients.vue'; import ExtraIngredients from 'src/plugins/pricelist/components/ExtraIngredients.vue';
import { usePricelistStore } from 'src/plugins/pricelist/store'; import { usePricelistStore } from 'src/plugins/pricelist/store';
export default defineComponent({ export default defineComponent({
name: 'Settings', name: 'Settings',
//components: { DrinkTypes, ExtraIngredients, CalculationTable }, //components: { DrinkTypes, ExtraIngredients, CalculationTable },
components: { ExtraIngredients, DrinkTypes, CalculationTable }, components: { ExtraIngredients, DrinkTypes, CalculationTable },
setup(_) { setup() {
interface Tab { interface Tab {
name: string; name: string;
label: string; label: string;
} }
const store = usePricelistStore() const store = usePricelistStore();
onBeforeMount(() => { onBeforeMount(() => {
store.getExtraIngredients().then(() => { store
console.log(store.extraIngredients) .getExtraIngredients()
}).catch(err => console.log(err)) .then(() => {
void store.getDrinkTypes() console.log(store.extraIngredients);
store.getDrinks()
}) })
.catch((err) => console.log(err));
void store.getDrinkTypes();
store.getDrinks();
});
const drawer = ref<boolean>(false); const drawer = ref<boolean>(false);
@ -78,19 +82,19 @@ export default defineComponent({
}, },
set: (val: boolean) => { set: (val: boolean) => {
drawer.value = val; drawer.value = val;
} },
}); });
const tabs: Tab[] = [ const tabs: Tab[] = [
{ name: 'pricelist', label: 'Getränke' }, { name: 'pricelist', label: 'Getränke' },
{ name: 'extra_ingredients', label: 'Zutaten' }, { name: 'extra_ingredients', label: 'Zutaten' },
{ name: 'drink_types', label: 'Getränketypen' } { name: 'drink_types', label: 'Getränketypen' },
]; ];
const tab = ref<string>('pricelist'); const tab = ref<string>('pricelist');
return { tabs, tab, showDrawer }; return { tabs, tab, showDrawer };
} },
}); });
</script> </script>

View File

@ -18,7 +18,10 @@ interface Drink extends Omit<Omit<FG.Drink, 'cost_price_pro_volume'>, 'volumes'>
} }
class DrinkPriceVolume implements DrinkPriceVolume { class DrinkPriceVolume implements DrinkPriceVolume {
constructor({ id, volume, min_prices, prices, ingredients }: FG.DrinkPriceVolume, drink: Drink) { constructor(
{ id, volume, /*min_prices,*/ prices, ingredients }: FG.DrinkPriceVolume,
drink: Drink
) {
this.id = id; this.id = id;
this._volume = volume; this._volume = volume;
this.prices = prices; this.prices = prices;
@ -68,8 +71,8 @@ class Drink {
cost_price_package_netto, cost_price_package_netto,
tags, tags,
type, type,
volumes, }: /*volumes,*/
}: FG.Drink) { FG.Drink) {
this.id = id; this.id = id;
this.article_id = article_id; this.article_id = article_id;
this.package_size = package_size; this.package_size = package_size;