Added a new field calories for products (closes #268)

This commit is contained in:
Bernd Bestel
2019-09-20 20:06:24 +02:00
parent 1ae5f552d1
commit c228126c3a
8 changed files with 144 additions and 5 deletions

View File

@@ -201,6 +201,17 @@
</label>
</div>
</div>
@php if($mode == 'edit') { $value = $product->calories; } else { $value = ''; } @endphp
@include('components.numberpicker', array(
'id' => 'calories',
'label' => 'Energy (kcal)',
'min' => 0,
'step' => 1,
'value' => $value,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '0'),
'hint' => $__t('Per stock quantity unit')
))
@endif
<div class="form-group">

View File

@@ -151,7 +151,7 @@
<div class="card-body mb-0 pb-0">
<div class="row">
<div class="col-5">
<div class="col-4">
@include('components.numberpicker', array(
'id' => 'servings-scale',
'label' => 'Servings',
@@ -161,8 +161,14 @@
'additionalAttributes' => 'data-recipe-id="' . $selectedRecipe->id . '"'
))
</div>
<div class="col-2">
<label>{{ $__t('Energy (kcal)') }}</label>
<p class="font-weight-bold font-italic">
<span class="locale-number-format" data-format="generic">{{ $selectedRecipeTotalCalories }}</span>
</p>
</div>
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)
<div class="col-7">
<div class="col-6">
<label>{{ $__t('Costs') }}&nbsp;&nbsp;
<span class="small text-muted">{{ $__t('Based on the prices of the last purchase per product') }}</span>
</label>