mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 12:20:22 +00:00
Make it possible to round up shopping list and recipe ingredient amounts (closes #902, closes #2644)
This commit is contained in:
@@ -80,6 +80,14 @@
|
||||
id="variable_amount"
|
||||
name="variable_amount"
|
||||
value="@if($mode == 'edit'){{ $recipePos->variable_amount }}@endif">
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input @if($mode=='edit'
|
||||
&&
|
||||
$recipePos->round_up == 1) checked @endif class="form-check-input custom-control-input" type="checkbox" id="round_up" name="round_up" value="1">
|
||||
<label class="form-check-label custom-control-label"
|
||||
for="round_up">{{ $__t('Round up quantity amounts to the nearest whole number') }}</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group @if(!GROCY_FEATURE_FLAG_STOCK) d-none @endif">
|
||||
|
@@ -254,6 +254,11 @@
|
||||
$listItem->amount = $listItem->amount * $productQuConversion->factor;
|
||||
}
|
||||
}
|
||||
|
||||
if(boolval($userSettings['shopping_list_round_up']))
|
||||
{
|
||||
$listItem->amount = ceil($listItem->amount);
|
||||
}
|
||||
@endphp
|
||||
@endif
|
||||
<td>
|
||||
|
@@ -14,6 +14,7 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-12">
|
||||
<h4 class="mt-2">{{ $__t('Shopping list') }}</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox"
|
||||
@@ -25,7 +26,22 @@
|
||||
{{ $__t('Show a month-view calendar') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox"
|
||||
class="form-check-input custom-control-input user-setting-control"
|
||||
id="shopping_list_round_up"
|
||||
data-setting-key="shopping_list_round_up">
|
||||
<label class="form-check-label custom-control-label"
|
||||
for="shopping_list_round_up">
|
||||
{{ $__t('Round up quantity amounts to the nearest whole number') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox"
|
||||
class="form-check-input custom-control-input user-setting-control"
|
||||
@@ -48,7 +64,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h4 class="mt-2">{{ $__t('Shopping list to stock workflow') }}</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox"
|
||||
|
Reference in New Issue
Block a user