Display total cost of recipes based on last purchase prices (closes #128)

This commit is contained in:
Bernd Bestel
2019-03-03 16:33:48 +01:00
parent 8c11d0f15d
commit bb5daa5f8b
6 changed files with 124 additions and 21 deletions

View File

@@ -66,7 +66,7 @@
<div class="form-check">
<input type="hidden" name="not_check_shoppinglist" value="0">
<input @if($mode == 'edit' && $recipe->not_check_shoppinglist == 1) checked @endif class="form-check-input" type="checkbox" id="not_check_shoppinglist" name="not_check_shoppinglist" value="1">
<label class="form-check-label" for="not_check_shoppinglist">{{ $L('Do not check against the shopping list when adding missing items to it') }}
<label class="form-check-label" for="not_check_shoppinglist">{{ $L('Do not check against the shopping list when adding missing items to it') }}&nbsp;&nbsp;
<span class="small text-muted">{{ $L('By default the amount to be added to the shopping list is "needed amount - stock amount - shopping list amount". When this is enabled, it is only checked against the stock amount, not against what is already on the shopping list.') }}</span>
</label>
</div>

View File

@@ -71,17 +71,27 @@
</a>
</div>
<div class="card-body">
@include('components.numberpicker', array(
'id' => 'servings-scale',
'label' => 'Servings',
'min' => 1,
'value' => $selectedRecipe->desired_servings,
'invalidFeedback' => $L('This cannot be lower than #1', '1'),
'additionalGroupCssClasses' => 'mb-0',
'additionalCssClasses' => 'col-2',
'additionalAttributes' => 'data-recipe-id="' . $selectedRecipe->id . '"'
))
<div class="card-body mb-0 pb-0">
<div class="row">
<div class="col-3">
@include('components.numberpicker', array(
'id' => 'servings-scale',
'label' => 'Servings',
'min' => 1,
'value' => $selectedRecipe->desired_servings,
'invalidFeedback' => $L('This cannot be lower than #1', '1'),
'additionalAttributes' => 'data-recipe-id="' . $selectedRecipe->id . '"'
))
</div>
<div class="col-9">
<label>{{ $L('Costs') }}&nbsp;&nbsp;
<span class="small text-muted">{{ $L('Based on the prices of the last purchase per product') }}</span>
</label>
<p class="font-weight-bold font-italic">
<span class="local-number-format" data-format="currency">{{ $totalRecipeCosts }}</span> {{ GROCY_CURRENCY }}
</p>
</div>
</div>
</div>
<!-- Subrecipes first -->