added mealplan info to recipes tab

This commit is contained in:
vabene1111 2024-01-23 18:09:13 +01:00
parent f431e18336
commit 64e54ceaec
3 changed files with 15 additions and 4 deletions

View File

@ -115,8 +115,8 @@
<b-button-group class="w-100 mt-2">
<b-button variant="dark" block class="btn btn-block text-left">
<span>{{ r.recipe_name }}</span> <br/>
<span><small class="text-muted">{{ r.recipe_name }}</small></span>
<!-- TODO show meal plan date/type -->
<span v-if="r.mealplan_type"><small class="text-muted">{{ r.mealplan_type }} {{ formatDate(r.mealplan_from_date) }}</small></span>
</b-button>
<b-button variant="danger" @click="deleteRecipe(r.shopping_list_recipe_id)"><i
class="fas fa-trash fa-fw"></i></b-button>
@ -550,6 +550,15 @@ export default {
methods: {
useUserPreferenceStore,
useShoppingListStore,
// TODO move to utils
formatDate: function (datetime) {
if (!datetime) {
return
}
return Intl.DateTimeFormat(window.navigator.language, {
dateStyle: "short",
}).format(Date.parse(datetime))
},
/**
* recursive function calling autosync after set amount of time has passed
*/

View File

@ -247,7 +247,7 @@ export default {
useUserPreferenceStore,
useShoppingListStore,
resolveDjangoUrl,
// TODO move to utils
formatDate: function (datetime) {
if (!datetime) {
return

View File

@ -294,7 +294,9 @@ export const useShoppingListStore = defineStore(_STORE_ID, {
'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
'servings': e.recipe_mealplan.servings,
'mealplan_from_date': e.recipe_mealplan.mealplan_from_date,
'mealplan_type': e.recipe_mealplan.mealplan_type,
})
}
}