fixed some exports

This commit is contained in:
vabene1111
2024-01-23 17:49:03 +01:00
parent c118dca2c0
commit 5842022d0a
2 changed files with 23 additions and 34 deletions

View File

@@ -100,7 +100,7 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
this.total_checked_food = total_checked_food
// ordering
if (this.UNDEFINED_CATEGORY in structure) {
if (this.UNDEFINED_CATEGORY in structure) {
ordered_structure.push(structure[this.UNDEFINED_CATEGORY])
Vue.delete(structure, this.UNDEFINED_CATEGORY)
}
@@ -125,6 +125,22 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
return ordered_structure
},
get_flat_entries: function () {
//{amount: x.amount, unit: x.unit?.name ?? "", food: x.food?.name ?? ""}
let items = []
for (let i in this.get_entries_by_group) {
for (let f in this.get_entries_by_group[i]['foods']) {
for (let e in this.get_entries_by_group[i]['foods'][f]['entries']) {
items.push({
amount: this.get_entries_by_group[i]['foods'][f]['entries'][e].amount,
unit: this.get_entries_by_group[i]['foods'][f]['entries'][e].unit?.name ?? '',
food: this.get_entries_by_group[i]['foods'][f]['entries'][e].food?.name ?? '',
})
}
}
}
return items
},
/**
* list of options available for grouping entry display
* @return {[{id: *, translatable_label: string},{id: *, translatable_label: string},{id: *, translatable_label: string}]}