Also show calories per serving on the meal plan (references #502)

This commit is contained in:
Bernd Bestel 2020-01-21 22:02:53 +01:00
parent 5793f6b041
commit ca6c2b0af8
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 8 additions and 3 deletions

View File

@ -24,6 +24,7 @@
- When adding or editing a recipe ingredient, a dialog is now used instead of switching between pages (thanks @kriddles)
### Meal plan fixes
- Added that the calories per serving are now also shown
- Fixed that when `FEATURE_FLAG_STOCK_PRICE_TRACKING` was set to `false`, prices were still shown (thanks @kriddles)
- Fixed that the week costs were missing for the weeks 1 - 9 of a year

View File

@ -97,10 +97,14 @@ var calendar = $("#calendar").fullCalendar({
fulfillmentInfoHtml = __t('Not enough in stock');
var fulfillmentIconHtml = '<i class="fas fa-times text-danger"></i>';
}
var costPerServing = ""
var costAndCaloriesPerServing = ""
if (Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
{
costPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + resolvedRecipe.costs + '</span> ' + __t('per serving') + '<h5>';
costAndCaloriesPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-currency">' + resolvedRecipe.costs + '</span> / <span class="locale-number locale-number-generic">' + resolvedRecipe.calories + '</span> kcal ' + __t('per serving') + '<h5>';
}
else
{
costAndCaloriesPerServing = '<h5 class="small text-truncate"><span class="locale-number locale-number-generic">' + resolvedRecipe.calories + '</span> kcal ' + __t('per serving') + '<h5>';
}
element.html(' \
@ -108,7 +112,7 @@ var calendar = $("#calendar").fullCalendar({
<h5 class="text-truncate">' + recipe.name + '<h5> \
<h5 class="small text-truncate">' + __n(mealPlanEntry.servings, "%s serving", "%s servings") + '</h5> \
<h5 class="small timeago-contextual text-truncate">' + fulfillmentIconHtml + " " + fulfillmentInfoHtml + '</h5> \
' + costPerServing + ' \
' + costAndCaloriesPerServing + ' \
<h5> \
<a class="ml-1 btn btn-outline-danger btn-xs remove-recipe-button" href="#"><i class="fas fa-trash"></i></a> \
<a class="ml-1 btn btn-outline-primary btn-xs recipe-order-missing-button ' + recipeOrderMissingButtonDisabledClasses + '" href="#" data-toggle="tooltip" title="' + __t("Put missing products on shopping list") + '" data-recipe-id="' + recipe.id.toString() + '" data-recipe-name="' + recipe.name + '" data-recipe-type="' + recipe.type + '"><i class="fas fa-cart-plus"></i></a> \