mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-04 13:48:32 -05:00
improvements to recipe tab
This commit is contained in:
@@ -67,11 +67,13 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
|
||||
|
||||
return ordered_structure
|
||||
},
|
||||
|
||||
/**
|
||||
* list of options available for grouping entry display
|
||||
* @return {[{id: *, translatable_label: string},{id: *, translatable_label: string},{id: *, translatable_label: string}]}
|
||||
*/
|
||||
grouping_options: function () {
|
||||
return [{'id': this.GROUP_CATEGORY, 'translatable_label': 'Category'}, {'id': this.GROUP_CREATED_BY, 'translatable_label': 'created_by'}, {'id': this.GROUP_RECIPE, 'translatable_label': 'Recipe'}]
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
// TODO implement shopping list recipes
|
||||
@@ -148,6 +150,21 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
|
||||
StandardToasts.makeStandardToast(this, StandardToasts.FAIL_DELETE, err)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* returns a distinct list of recipes associated with unchecked shopping list entries
|
||||
*/
|
||||
getAssociatedRecipes: function () {
|
||||
let recipes = {}
|
||||
|
||||
for (let i in this.entries) {
|
||||
let e = this.entries[i]
|
||||
if (e.recipe_mealplan !== null) {
|
||||
Vue.set(recipes, e.recipe_mealplan.recipe, {'shopping_list_recipe_id': e.list_recipe, 'recipe_id': e.recipe_mealplan.recipe, 'recipe_name': e.recipe_mealplan.recipe_name, 'servings': e.recipe_mealplan.servings})
|
||||
}
|
||||
}
|
||||
|
||||
return recipes
|
||||
},
|
||||
// convenience methods
|
||||
/**
|
||||
* function to set entry to its proper place in the data structure to perform grouping
|
||||
|
||||
Reference in New Issue
Block a user