Minor meals adjustments
This commit is contained in:
parent
da61a2daa3
commit
e16614c060
3 changed files with 16 additions and 2 deletions
|
|
@ -74,6 +74,7 @@ li > div {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import data from '@/data.js'
|
import data from '@/data.js'
|
||||||
import IngredientLine from './IngredientLine.vue'
|
import IngredientLine from './IngredientLine.vue'
|
||||||
import CompactParsedIngredient from './CompactParsedIngredient.vue'
|
import CompactParsedIngredient from './CompactParsedIngredient.vue'
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ingredients">
|
<div class="ingredients">
|
||||||
<h2>Sides & Additional Ingredients</h2>
|
<h2>Sides & Additional Ingredients</h2>
|
||||||
<editable-ingredients-panel :ingredients="meal.extra_ingredients" @on-add="addIngredient" @on-delete="deleteIngredient" @on-update-ingredient="updateIngredient" />
|
<editable-ingredients-panel :ingredients="meal.extra_ingredients" @on-add="addIngredient" @on-delete="deleteIngredient" @on-update-ingredient="updateIngredient" @on-editing="onEditAdditionalIngredients" />
|
||||||
</div>
|
</div>
|
||||||
<button @click="saveMeal" v-if="!meal.purchase_date">Save</button>
|
<button @click="saveMeal" v-if="!meal.purchase_date">Save</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -69,6 +69,10 @@ export default {
|
||||||
if (this.id >= 0) {
|
if (this.id >= 0) {
|
||||||
this.meal = await data.getMeal(this.id);
|
this.meal = await data.getMeal(this.id);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
const self = await data.currentUser();
|
||||||
|
this.meal = {...this.meal, chefs: [self], consumers: [self], cleanup: [self], };
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async selectRecipe(recipe) {
|
async selectRecipe(recipe) {
|
||||||
|
|
@ -115,6 +119,14 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
alert('Failed to save meal');
|
alert('Failed to save meal');
|
||||||
|
},
|
||||||
|
onEditAdditionalIngredients(editing) {
|
||||||
|
if (editing && this.meal.extra_ingredients.length === 0) {
|
||||||
|
this.addIngredient();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.meal.extra_ingredients = this.meal.extra_ingredients.filter(i => i.line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ ul.actions {
|
||||||
.actions li {
|
.actions li {
|
||||||
display: block;
|
display: block;
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
padding: 2ex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.actions li:hover {
|
.actions li:hover {
|
||||||
|
|
@ -73,6 +72,8 @@ ul.actions {
|
||||||
color: #000;
|
color: #000;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
padding-top: 2ex;
|
||||||
|
padding-bottom: 2ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue