fixed checking food always works
This commit is contained in:
parent
d1c4e51842
commit
ae3818611d
@ -12,13 +12,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-row">
|
|
||||||
<span v-if="info_row"><br/><small class="text-muted">{{ info_row }} INFO</small></span>
|
<span v-if="info_row"><small class="text-muted">{{ info_row }}</small></span>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
</b-button>
|
</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>
|
</b-button-group>
|
||||||
|
|
||||||
|
|
||||||
@ -35,7 +37,7 @@
|
|||||||
|
|
||||||
<b-button variant="success" block @click="detail_modal_visible = false;"> {{ $t("Edit_Food") }}</b-button> <!-- TODO implement -->
|
<b-button variant="success" block @click="detail_modal_visible = false;"> {{ $t("Edit_Food") }}</b-button> <!-- TODO implement -->
|
||||||
|
|
||||||
<b-button variant="info" block @click="detail_modal_visible = false;useShoppingListStore().delayFood(food)">{{$t('Delay')}}</b-button>
|
<b-button variant="info" block @click="detail_modal_visible = false;useShoppingListStore().delayFood(food)">{{ $t('Delay') }}</b-button>
|
||||||
|
|
||||||
<b-button variant="danger" block @click="detail_modal_visible = false;useShoppingListStore().deleteFood(food)">{{ $t('Delete_All') }}</b-button>
|
<b-button variant="danger" block @click="detail_modal_visible = false;useShoppingListStore().deleteFood(food)">{{ $t('Delete_All') }}</b-button>
|
||||||
|
|
||||||
@ -99,9 +101,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
is_checked: function (){
|
is_checked: function () {
|
||||||
for (let i in this.entries) {
|
for (let i in this.entries) {
|
||||||
if(!this.entries[i].checked){
|
if (!this.entries[i].checked) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,7 +174,7 @@ export default {
|
|||||||
return recipes.join(', ')
|
return recipes.join(', ')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entries.length === 123) {
|
if (Object.keys(this.entries ).length === 1) {
|
||||||
return "Abendessen 31.12" // TODO implement mealplan or manual
|
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)
|
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
|
* function to handle user checking or unchecking a food
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let entries = this.category_food_entries[this.getFoodCategory(food)]['foods'][food.id]['entries']
|
let entries = this.category_food_entries[this.getFoodCategory(food)]['foods'][food.id]['entries']
|
||||||
for (let i in entries) {
|
for (let i in entries) {
|
||||||
entries[i].checked = !entries[i].checked
|
entries[i].checked = checked
|
||||||
this.updateObject(entries[i])
|
this.updateObject(entries[i])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user