makes slot selection work
This commit is contained in:
@@ -59,9 +59,8 @@ export default {
|
|||||||
closeActiveView: function() {
|
closeActiveView: function() {
|
||||||
this.active_view = -1;
|
this.active_view = -1;
|
||||||
},
|
},
|
||||||
addToPlanning: function(idx) {
|
addToPlanning: function(mealKey, id) {
|
||||||
let mealKey = ["Lundi", "Lunch"];
|
let mealData = this.items.find((recipe) => recipe.id == id);
|
||||||
let mealData = this.items[idx];
|
|
||||||
this.$refs.weekPlanning.setMeal(mealKey, mealData);
|
this.$refs.weekPlanning.setMeal(mealKey, mealData);
|
||||||
},
|
},
|
||||||
deleteRecipe: function(id) {
|
deleteRecipe: function(id) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<br class="is-hidden-mobile"/>
|
<br class="is-hidden-mobile"/>
|
||||||
<SlotSelect />
|
<SlotSelect v-on:add="addToPlanning" />
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<h4 class="title">{{ item.title }}</h4>
|
<h4 class="title">{{ item.title }}</h4>
|
||||||
@@ -51,6 +51,11 @@ export default {
|
|||||||
return {
|
return {
|
||||||
categories: categories,
|
categories: categories,
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
addToPlanning: function(slotKey) {
|
||||||
|
this.$emit('add', slotKey, this.item.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,22 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="box">
|
||||||
<a @click="$emit('add', item.id)"
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<div class="field">
|
||||||
|
<div class="control is-expanded">
|
||||||
|
<div class="select is-small is-fullwidth">
|
||||||
|
<select v-model="selected_day">
|
||||||
|
<option value="Lundi">Lundi</option>
|
||||||
|
<option value="Mardi">Mardi</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="field">
|
||||||
|
<p class="control">
|
||||||
|
<div class="select is-small">
|
||||||
|
<select v-model="selected_meal">
|
||||||
|
<option value="Breakfast">Breakfast</option>
|
||||||
|
<option value="Lunch">Lunch</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<a @click="$emit('add', getSelectedKey)"
|
||||||
class="has-text-success">
|
class="has-text-success">
|
||||||
<span class="icon is-large">
|
<span class="icon is-large">
|
||||||
<i class="mdi mdi-36px mdi-table-plus"></i>
|
<i class="mdi mdi-36px mdi-table-plus"></i>
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<div class="select">
|
|
||||||
<select>
|
|
||||||
<option>Lundi</option>
|
|
||||||
<option>Mardi</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="select">
|
|
||||||
<select>
|
|
||||||
<option>Breakfast</option>
|
|
||||||
<option>Lunch</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -24,6 +38,16 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: 'SlotSelect',
|
name: 'SlotSelect',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
selected_day: "Lundi",
|
||||||
|
selected_meal: "Breakfast",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
getSelectedKey: function() {
|
||||||
|
return [this.selected_day, this.selected_meal];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user