diff --git a/vue/src/apps/ImportView/ImportViewStepEditor.vue b/vue/src/apps/ImportView/ImportViewStepEditor.vue index ec2caf495..11fd91e8e 100644 --- a/vue/src/apps/ImportView/ImportViewStepEditor.vue +++ b/vue/src/apps/ImportView/ImportViewStepEditor.vue @@ -28,7 +28,7 @@ {{ i.unit.name }} {{ i.food.name }} {{ i.original_text }} - + @@ -62,25 +62,34 @@ - + - + - - + + - + - + + + + + + {{ $t('Ok') }} + {{ $t('Delete') }} + + + @@ -104,6 +113,7 @@ export default { return { recipe_json: undefined, current_edit_ingredient: null, + current_edit_step: null, } }, watch: { @@ -202,7 +212,30 @@ export default { found = true } }) + }, + /** + * Prepare variable that holds currently edited ingredient for modal to manipulate it + * add default placeholder for food/unit in case it is not present, so it can be edited as well + * @param ingredient + */ + prepareIngredientEditModal: function (step, ingredient) { + if (ingredient.unit === null) { + ingredient.unit = { + "name": "" + } + } + if (ingredient.food === null) { + ingredient.food = { + "name": "" + } + } + this.current_edit_ingredient = ingredient + this.current_edit_step = step + }, + removeIngredient: function (step, ingredient) { + step.ingredients = step.ingredients.filter((i) => i !== ingredient) } + } } diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json index 137c48b59..47ce0a5a7 100644 --- a/vue/src/locales/en.json +++ b/vue/src/locales/en.json @@ -118,7 +118,7 @@ "Image": "Image", "Delete": "Delete", "Open": "Open", - "Ok": "Open", + "Ok": "Ok", "Save": "Save", "Step": "Step", "Search": "Search",