fixed checking food always works
This commit is contained in:
parent
d1c4e51842
commit
ae3818611d
@ -12,13 +12,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-row">
|
||||
<span v-if="info_row"><br/><small class="text-muted">{{ info_row }} INFO</small></span>
|
||||
</div>
|
||||
|
||||
<span v-if="info_row"><small class="text-muted">{{ info_row }}</small></span>
|
||||
|
||||
|
||||
|
||||
</b-button>
|
||||
<b-button variant="success" @click="useShoppingListStore().toggleFoodCheckedState(food)" :class="{'btn-success': !is_checked, 'btn-warning': is_checked}"><i class="fas" :class="{'fa-check': !is_checked, 'fa-times': is_checked}"></i></b-button>
|
||||
<b-button variant="success" @click="useShoppingListStore().setFoodCheckedState(food, !is_checked)" :class="{'btn-success': !is_checked, 'btn-warning': is_checked}">
|
||||
<i class="fas" :class="{'fa-check': !is_checked, 'fa-times': is_checked}"></i>
|
||||
</b-button>
|
||||
</b-button-group>
|
||||
|
||||
|
||||
@ -172,7 +174,7 @@ export default {
|
||||
return recipes.join(', ')
|
||||
}
|
||||
|
||||
if (this.entries.length === 123) {
|
||||
if (Object.keys(this.entries ).length === 1) {
|
||||
return "Abendessen 31.12" // TODO implement mealplan or manual
|
||||
}
|
||||
|
||||
|
@ -115,14 +115,14 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
|
||||
}
|
||||
Vue.set(this.category_food_entries[category]['foods'][entry.food.id]['entries'], entry.id, entry)
|
||||
},
|
||||
toggleFoodCheckedState(food) {
|
||||
setFoodCheckedState(food, checked) {
|
||||
/**
|
||||
* function to handle user checking or unchecking a food
|
||||
*/
|
||||
|
||||
let entries = this.category_food_entries[this.getFoodCategory(food)]['foods'][food.id]['entries']
|
||||
for (let i in entries) {
|
||||
entries[i].checked = !entries[i].checked
|
||||
entries[i].checked = checked
|
||||
this.updateObject(entries[i])
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user