diff --git a/web/vue/src/App.vue b/web/vue/src/App.vue index 9fbf6e2..239261c 100644 --- a/web/vue/src/App.vue +++ b/web/vue/src/App.vue @@ -59,9 +59,8 @@ export default { closeActiveView: function() { this.active_view = -1; }, - addToPlanning: function(idx) { - let mealKey = ["Lundi", "Lunch"]; - let mealData = this.items[idx]; + addToPlanning: function(mealKey, id) { + let mealData = this.items.find((recipe) => recipe.id == id); this.$refs.weekPlanning.setMeal(mealKey, mealData); }, deleteRecipe: function(id) { diff --git a/web/vue/src/components/RecipeDetails.vue b/web/vue/src/components/RecipeDetails.vue index 1fafacd..fa9d8a1 100644 --- a/web/vue/src/components/RecipeDetails.vue +++ b/web/vue/src/components/RecipeDetails.vue @@ -8,7 +8,7 @@
- +

{{ item.title }}

@@ -51,6 +51,11 @@ export default { return { categories: categories, } + }, + methods: { + addToPlanning: function(slotKey) { + this.$emit('add', slotKey, this.item.id); + } } } diff --git a/web/vue/src/components/planner/SlotSelect.vue b/web/vue/src/components/planner/SlotSelect.vue index f54bbd6..a299dab 100644 --- a/web/vue/src/components/planner/SlotSelect.vue +++ b/web/vue/src/components/planner/SlotSelect.vue @@ -1,22 +1,36 @@ @@ -24,6 +38,16 @@