mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Implemented tare weight handling (closes #132)
This commit is contained in:
@@ -12,10 +12,11 @@
|
||||
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
|
||||
@php if(empty($additionalAttributes)) { $additionalAttributes = ''; } @endphp
|
||||
@php if(empty($additionalHtmlElements)) { $additionalHtmlElements = ''; } @endphp
|
||||
@php if(empty($additionalHtmlContextHelp)) { $additionalHtmlContextHelp = ''; } @endphp
|
||||
@php if(!isset($isRequired)) { $isRequired = true; } @endphp
|
||||
|
||||
<div class="form-group {{ $additionalGroupCssClasses }}">
|
||||
<label for="{{ $id }}">{{ $L($label) }} <span id="{{ $hintId }}" class="small text-muted">{{ $hint }}</span></label>
|
||||
<label for="{{ $id }}">{{ $L($label) }} <span id="{{ $hintId }}" class="small text-muted">{{ $hint }}</span>{!! $additionalHtmlContextHelp !!}</label>
|
||||
<div class="input-group">
|
||||
<input {!! $additionalAttributes !!} type="number" class="form-control numberpicker {{ $additionalCssClasses }}" id="{{ $id }}" name="{{ $id }}" value="{{ $value }}" min="{{ $min }}" max="{{ $max }}" step="{{ $step }}" @if($isRequired) required @endif>
|
||||
<div class="input-group-append">
|
||||
|
@@ -23,7 +23,8 @@
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 1,
|
||||
'value' => 1,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1')
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1'),
|
||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" class="text-info font-italic d-none">' . $L('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
|
@@ -22,9 +22,10 @@
|
||||
'hintId' => 'new_amount_qu_unit',
|
||||
'min' => 0,
|
||||
'value' => 1,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1'),
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '0'),
|
||||
'additionalAttributes' => 'data-notequal="notequal" not-equal="-1"',
|
||||
'additionalHtmlElements' => '<div id="inventory-change-info" class="form-text text-muted small d-none"></div>'
|
||||
'additionalHtmlElements' => '<div id="inventory-change-info" class="form-text text-muted small d-none"></div>',
|
||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" class="text-small text-info font-italic d-none">' . $L('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||
))
|
||||
|
||||
@include('components.datetimepicker', array(
|
||||
|
@@ -134,6 +134,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input type="hidden" name="enable_tare_weight_handling" value="0">
|
||||
<input @if($mode == 'edit' && $product->enable_tare_weight_handling == 1) checked @endif class="form-check-input" type="checkbox" id="enable_tare_weight_handling" name="enable_tare_weight_handling" value="1">
|
||||
<label class="form-check-label" for="enable_tare_weight_handling">{{ $L('Enable tare weight handling') }}
|
||||
<span class="text-muted small">{{ $L('This is useful e.g. for flour in jars - on purchase/consume/inventory you always weigh the whole jar, the amount to be posted is then automatically calculated based on what is in stock and the tare weight defined below') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php if($mode == 'edit') { $value = $product->tare_weight; } else { $value = 0; } @endphp
|
||||
@php if(($mode == 'edit' && $product->enable_tare_weight_handling == 0) || $mode == 'create') { $additionalAttributes = 'disabled'; } else { $additionalAttributes = ''; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'tare_weight',
|
||||
'label' => 'Tare weight',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $L('This cannot be lower than #1', '0'),
|
||||
'additionalAttributes' => $additionalAttributes,
|
||||
'hintId' => 'tare_weight_qu_info'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="product-picture">{{ $L('Product picture') }}
|
||||
<span class="text-muted small">{{ $L('If you don\'t select a file, the current picture will not be altered') }}</span>
|
||||
|
@@ -35,7 +35,8 @@
|
||||
'label' => 'Amount',
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 1,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1')
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1'),
|
||||
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info" class="text-info font-italic d-none">' . $L('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
|
||||
))
|
||||
|
||||
@include('components.numberpicker', array(
|
||||
|
@@ -88,7 +88,7 @@
|
||||
<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 }}
|
||||
<span class="locale-number-format" data-format="currency">{{ $totalRecipeCosts }}</span> {{ GROCY_CURRENCY }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user