shopping stuff

This commit is contained in:
vabene1111
2024-04-21 11:49:07 +02:00
parent faf025d2c4
commit ce6c43fb62
2 changed files with 17 additions and 13 deletions

View File

@@ -13,11 +13,11 @@
<v-col> <v-col>
<v-list lines="two" density="compact"> <v-list lines="two" density="compact">
<template v-for="(value, key) in useShoppingStore().getEntriesByGroup.categories.entries()"> <template v-for="category in useShoppingStore().getEntriesByGroup">
<v-list-subheader>{{ value[0] }}</v-list-subheader> <v-list-subheader>{{ category.name }}</v-list-subheader>
<v-divider></v-divider>
<template v-for="item in value[1].foods"> <template v-for="item in category.foods">
<v-list-item> <v-list-item>
{{ item[1].food.name }} {{ item[1].food.name }}
@@ -29,7 +29,6 @@
></v-btn> ></v-btn>
</template> </template>
</v-list-item> </v-list-item>
</template> </template>
</template> </template>
</v-list> </v-list>

View File

@@ -44,7 +44,7 @@ export const useShoppingStore = defineStore(_STORE_ID, () => {
let structure = {} as IShoppingList let structure = {} as IShoppingList
structure.categories = new Map<number, IShoppingListCategory> structure.categories = new Map<number, IShoppingListCategory>
let ordered_structure = [] let ordered_structure = [] as IShoppingListCategory[]
// build structure // build structure
for (let i in entries.value.keys()) { for (let i in entries.value.keys()) {
@@ -103,12 +103,17 @@ export const useShoppingStore = defineStore(_STORE_ID, () => {
// ordering // ordering
// if (UNDEFINED_CATEGORY in structure) { if (structure.categories.has(UNDEFINED_CATEGORY)) {
// ordered_structure.push(structure[this.UNDEFINED_CATEGORY]) ordered_structure.push(structure.categories.get(UNDEFINED_CATEGORY))
// Vue.delete(structure, this.UNDEFINED_CATEGORY) structure.categories.delete(UNDEFINED_CATEGORY)
// } }
//
// if (useUserPreferenceStore().device_settings.shopping_selected_grouping === this.GROUP_CATEGORY && useUserPreferenceStore().device_settings.shopping_selected_supermarket !== null) { structure.categories.forEach(category => {
ordered_structure.push(category)
})
// TODO implement ordering
// if (useUserPreferenceStore().device_settings.shopping_selected_grouping === this.GROUP_CATEGORY && 'useUserPreferenceStore().device_settings.shopping_selected_supermarket' !== null) {
// for (let c of useUserPreferenceStore().device_settings.shopping_selected_supermarket.category_to_supermarket) { // for (let c of useUserPreferenceStore().device_settings.shopping_selected_supermarket.category_to_supermarket) {
// if (c.category.name in structure) { // if (c.category.name in structure) {
// ordered_structure.push(structure[c.category.name]) // ordered_structure.push(structure[c.category.name])
@@ -126,7 +131,7 @@ export const useShoppingStore = defineStore(_STORE_ID, () => {
// } // }
// } // }
return structure return ordered_structure
}) })
/** /**