ingredient checking

This commit is contained in:
vabene1111
2021-01-13 20:12:20 +01:00
parent 082a656210
commit a431031c04
4 changed files with 31 additions and 10 deletions

View File

@ -1,7 +1,8 @@
<template>
<tr>
<tr @click="$emit('checked-state-changed', ingredient)">
<td>
<input type="checkbox">
<i class="far fa-check-circle text-success" v-if="ingredient.checked"></i>
<i class="far fa-check-circle text-primary" v-if="!ingredient.checked"></i>
</td>
<td>
<span v-if="ingredient.amount !== 0">{{ calculateAmount(ingredient.amount) }}</span>
@ -39,6 +40,11 @@ export default {
default: 1,
}
},
data() {
return {
checked: false
}
},
methods: {
calculateAmount: function (x) {
return calculateAmount(x, this.servings)

View File

@ -34,7 +34,7 @@
<table class="table table-sm">
<!-- eslint-disable vue/no-v-for-template-key-on-child -->
<template v-for="i in step.ingredients">
<Ingredient v-bind:ingredient="i" v-bind:servings="servings" :key="i.id"></Ingredient>
<Ingredient v-bind:ingredient="i" v-bind:servings="servings" :key="i.id" @checked-state-changed="$emit('checked-state-changed', i)"></Ingredient>
</template>
<!-- eslint-enable vue/no-v-for-template-key-on-child -->
</table>