diff --git a/vue3/src/components/dialogs/AddToShoppingDialog.vue b/vue3/src/components/dialogs/AddToShoppingDialog.vue index ef3f99b11..c8a570d11 100644 --- a/vue3/src/components/dialogs/AddToShoppingDialog.vue +++ b/vue3/src/components/dialogs/AddToShoppingDialog.vue @@ -27,10 +27,10 @@ - + - {{ $t('Add_to_Shopping') }} + {{ $t('Add_to_Shopping') }} @@ -40,7 +40,7 @@ import {computed, onMounted, PropType, ref} from "vue"; import VClosableCardTitle from "@/components/dialogs/VClosableCardTitle.vue"; -import {ApiApi, Recipe, RecipeFlat, RecipeOverview, type ShoppingListEntryBulkCreate, ShoppingListRecipe} from "@/openapi"; +import {ApiApi, MealPlan, Recipe, RecipeFlat, RecipeOverview, type ShoppingListEntryBulkCreate, ShoppingListRecipe} from "@/openapi"; import {ErrorMessageType, PreparedMessage, useMessageStore} from "@/stores/MessageStore"; import {ShoppingDialogRecipe, ShoppingDialogRecipeEntry} from "@/types/Shopping"; import {calculateFoodAmount} from "@/utils/number_utils"; @@ -51,6 +51,7 @@ const emit = defineEmits(['created']) const props = defineProps({ recipe: {type: Object as PropType, required: true}, + mealPlan: {type: Object as PropType, required: false}, }) const dialog = ref(false) @@ -77,6 +78,7 @@ onMounted(() => { function loadRecipeData() { let api = new ApiApi() let promises: Promise[] = [] + loading.value = true let recipeRequest = api.apiRecipeRetrieve({id: props.recipe.id!}).then(r => { recipe.value = r @@ -108,7 +110,7 @@ function loadRecipeData() { recipe.steps.forEach(step => { step.ingredients.forEach(ingredient => { - if(!ingredient.isHeader){ + if (!ingredient.isHeader) { dialogRecipe.entries.push({ amount: ingredient.amount, food: ingredient.food, @@ -138,6 +140,10 @@ function createShoppingListRecipe() { servings: servings.value, } as ShoppingListRecipe + if (props.mealPlan && props.mealPlan.id) { + shoppingListRecipe.mealplan = props.mealPlan.id! + } + let shoppingListEntries = { entries: [] } as ShoppingListEntryBulkCreate diff --git a/vue3/src/components/display/MealPlanView.vue b/vue3/src/components/display/MealPlanView.vue index 447bd650d..58bc4ced0 100644 --- a/vue3/src/components/display/MealPlanView.vue +++ b/vue3/src/components/display/MealPlanView.vue @@ -82,7 +82,7 @@ const planItems = computed(() => { startDate.setHours(hour, minutes, seconds) endDate.setHours(hour, minutes, seconds) } - console.log(startDate, endDate) + items.push({ startDate: startDate, endDate: endDate, diff --git a/vue3/src/components/display/RecipeImage.vue b/vue3/src/components/display/RecipeImage.vue index c90b8a185..7302a4e43 100644 --- a/vue3/src/components/display/RecipeImage.vue +++ b/vue3/src/components/display/RecipeImage.vue @@ -29,10 +29,6 @@ const image = computed(() => { } }) -watch(() => props.recipe, () => { - console.log('changed') -}) -