diff --git a/src/plugins/pricelist/components/DrinkTypes.vue b/src/plugins/pricelist/components/DrinkTypes.vue index 1107d2b..8502da0 100644 --- a/src/plugins/pricelist/components/DrinkTypes.vue +++ b/src/plugins/pricelist/components/DrinkTypes.vue @@ -7,12 +7,12 @@ style="height: 100%" > - - - - - Getränkeart hinzufügen - + + + + Getränkeart hinzufügen + + diff --git a/src/plugins/pricelist/components/ExtraIngredients.vue b/src/plugins/pricelist/components/ExtraIngredients.vue index 209a59e..b8252b3 100644 --- a/src/plugins/pricelist/components/ExtraIngredients.vue +++ b/src/plugins/pricelist/components/ExtraIngredients.vue @@ -28,33 +28,59 @@ - - - + + + + + Zutat hinzufügen + + - - - - - + + + + {{ props.row.name }} + + + + + + + + {{ props.row.price.toFixed(2) }}€ + + + + + @@ -75,8 +101,6 @@ export default defineComponent({ id: -1, }; const newExtraIngredient = ref(emptyExtraIngredient); - const edittype = ref(false); - const actualExtraIngredient = ref(emptyExtraIngredient); const rows = computed(() => store.extraIngredients); const columns = [ @@ -93,6 +117,7 @@ export default defineComponent({ field: 'price', sortable: true, format: (val: number) => `${val.toFixed(2)}€`, + align: 'right', }, { name: 'actions', @@ -108,21 +133,18 @@ export default defineComponent({ discardChanges(); } - function editType(extraIngredient: FG.ExtraIngredient) { - edittype.value = true; - actualExtraIngredient.value = extraIngredient; - } - - async function saveChanges() { - await store.updateExtraIngredient(actualExtraIngredient.value); - setTimeout(() => discardChanges(), 200); + function saveChanges(ingredient: FG.ExtraIngredient) { + setTimeout(() => { + const _ingredient = store.extraIngredients.find((a) => a.id === ingredient.id); + if (_ingredient) { + void store.updateExtraIngredient(_ingredient); + } + }, 50); } function discardChanges() { - actualExtraIngredient.value = emptyExtraIngredient; newExtraIngredient.value.name = ''; newExtraIngredient.value.price = 0; - edittype.value = false; } function deleteType(extraIngredient: FG.ExtraIngredient) { @@ -135,9 +157,6 @@ export default defineComponent({ addExtraIngredient, newExtraIngredient, deleteType, - edittype, - editType, - actualExtraIngredient, discardChanges, saveChanges, };