Use producamountpicker "everywhere" (closes #1015)

This commit is contained in:
Bernd Bestel
2020-11-09 19:25:46 +01:00
parent 5f920e2cc6
commit 8bd157ca9d
12 changed files with 243 additions and 221 deletions

View File

@@ -19,8 +19,12 @@
<div id="datetimepicker-wrapper"
class="form-group {{ $additionalGroupCssClasses }}">
<label for="{{ $id }}">{{ $__t($label) }}
@if(!empty($hint))
&nbsp;<i class="fas fa-question-circle"
data-toggle="tooltip"
title="{{ $hint }}"></i>
@endif
<span class="small text-muted">
@if(!empty($hint)){{ $__t($hint) }}@endif
<time id="datetimepicker-timeago"
class="timeago timeago-contextual"></time>
</span>
@@ -63,13 +67,21 @@
<div id="datetimepicker-earlier-than-info"
class="form-text text-info font-italic d-none">{{ $earlierThanInfoText }}</div>
@if(isset($shortcutValue) && isset($shortcutLabel))
<div class="form-check w-100">
<input class="form-check-input"
type="checkbox"
id="datetimepicker-shortcut"
data-datetimepicker-shortcut-value="{{ $shortcutValue }}">
<label class="form-check-label"
for="datetimepicker-shortcut">{{ $__t($shortcutLabel) }}</label>
<div class="form-group my-0">
<div class="custom-control custom-checkbox">
<input type="hidden"
name="datetimepicker-shortcut"
value="0">
<input class="form-check-input custom-control-input"
type="checkbox"
id="datetimepicker-shortcut"
name="datetimepicker-shortcut"
value="1"
data-datetimepicker-shortcut-value="{{ $shortcutValue }}">
<label class="form-check-label custom-control-label"
for="datetimepicker-shortcut">{{ $__t($shortcutLabel) }}
</label>
</div>
</div>
@endif
</div>

View File

@@ -18,8 +18,12 @@
<div id="datetimepicker2-wrapper"
class="form-group {{ $additionalGroupCssClasses }}">
<label for="{{ $id }}">{{ $__t($label) }}
@if(!empty($hint))
&nbsp;<i class="fas fa-question-circle"
data-toggle="tooltip"
title="{{ $hint }}"></i>
@endif
<span class="small text-muted">
@if(!empty($hint)){{ $__t($hint) }}@endif
<time id="datetimepicker2-timeago"
class="timeago timeago-contextual"></time>
</span>

View File

@@ -3,10 +3,13 @@
@endpush
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
@php if(empty($additionalHtmlContextHelp)) { $additionalHtmlContextHelp = ''; } @endphp
<div class="form-group row {{ $additionalGroupCssClasses }}">
<div class="form-group row mb-0 {{ $additionalGroupCssClasses }}">
<div class="col">
<div class="row">
{!! $additionalHtmlContextHelp !!}
<div class="row my-0">
@include('components.numberpicker', array(
'id' => 'display_amount',
@@ -15,11 +18,12 @@
'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value,
'invalidFeedback' => $__t('This cannot be negative and must be an integral number'),
'additionalGroupCssClasses' => 'col-4 mb-1',
'additionalCssClasses' => 'input-group-productamountpicker'
'additionalGroupCssClasses' => 'col-5 mb-1',
'additionalCssClasses' => 'input-group-productamountpicker',
'additionalHtmlContextHelp' => ''
))
<div class="form-group col-8 mb-1">
<div class="form-group col-7 mb-1">
<label for="qu_id">{{ $__t('Quantity unit') }}</label>
<select required
class="form-control input-group-productamountpicker"

View File

@@ -6,15 +6,19 @@
@php if(empty($prefillById)) { $prefillById = ''; } @endphp
@php if(!isset($isRequired)) { $isRequired = true; } @endphp
@php if(empty($hint)) { $hint = ''; } @endphp
@php if(empty($hintId)) { $hintId = ''; } @endphp
@php if(empty($nextInputSelector)) { $nextInputSelector = ''; } @endphp
<div class="form-group"
data-next-input-selector="{{ $nextInputSelector }}"
data-prefill-by-name="{{ $prefillByName }}"
data-prefill-by-id="{{ $prefillById }}">
<label for="recipe_id">{{ $__t('Recipe') }}&nbsp;&nbsp;<span id="{{ $hintId }}"
class="small text-muted">{{ $hint }}</span></label>
<label for="recipe_id">{{ $__t('Recipe') }}
@if(!empty($hint))
&nbsp;<i class="fas fa-question-circle"
data-toggle="tooltip"
title="{{ $hint }}"></i>
@endif
</label>
<select class="form-control recipe-combobox"
id="recipe_id"
name="recipe_id"

View File

@@ -9,6 +9,11 @@
@endpush
@section('content')
<script>
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
</script>
<div class="row">
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<div class="title-related-links">
@@ -51,33 +56,31 @@
'nextInputSelector' => '#amount',
'disallowAddProductWorkflows' => true
))
<label for="consume-exact-amount"
class="d-none">
<input type="checkbox"
id="consume-exact-amount"
name="exact_amount">
{{ $__t('Consume exact amount') }}
</label>
@include('components.numberpicker', array(
'id' => 'amount',
'label' => 'Amount',
'hintId' => 'amount_qu_unit',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => 0,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
<div id="consume-exact-amount-group"
class="form-group d-none">
<div class="custom-control custom-checkbox">
<input type="hidden"
name="consume-exact-amount"
value="0">
<input class="form-check-input custom-control-input"
type="checkbox"
id="consume-exact-amount"
name="consume-exact-amount"
value="1">
<label class="form-check-label custom-control-label"
for="consume-exact-amount">{{ $__t('Consume exact amount') }}
</label>
</div>
</div>
@include('components.productamountpicker', array(
'value' => 1,
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
))
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@php /*@include('components.locationpicker', array(
'id' => 'location_id',
'locations' => $locations,
'isRequired' => true,
'label' => 'Location'
))*/ @endphp
<div class="form-group">
<label for="location_id">{{ $__t('Location') }}</label>
<select required
@@ -94,26 +97,44 @@
@endif
<div class="form-group">
<label for="use_specific_stock_entry">
<input type="checkbox"
<div class="custom-control custom-checkbox">
<input type="hidden"
name="use_specific_stock_entry"
value="0">
<input class="form-check-input custom-control-input"
type="checkbox"
id="use_specific_stock_entry"
name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
<span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span>
</label>
name="use_specific_stock_entry"
value="1">
<label class="form-check-label custom-control-label"
for="use_specific_stock_entry">{{ $__t('Use a specific stock item') }}
&nbsp;<i class="fas fa-question-circle"
data-toggle="tooltip"
title="{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}"></i>
</label>
</div>
<select disabled
class="form-control"
class="form-control mt-2"
id="specific_stock_entry"
name="specific_stock_entry">
<option></option>
</select>
</div>
<div class="checkbox">
<label for="spoiled">
<input type="checkbox"
<div class="form-group">
<div class="custom-control custom-checkbox">
<input type="hidden"
name="spoiled"
value="0">
<input class="form-check-input custom-control-input"
type="checkbox"
id="spoiled"
name="spoiled"> {{ $__t('Spoiled') }}
</label>
name="spoiled"
value="1">
<label class="form-check-label custom-control-label"
for="spoiled">{{ $__t('Spoiled') }}
</label>
</div>
</div>
@if (GROCY_FEATURE_FLAG_RECIPES)

View File

@@ -9,6 +9,11 @@
@endpush
@section('content')
<script>
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
</script>
<div class="row">
<div class="col-xs-12 col-md-6 col-xl-4">
<div class="title-related-links">
@@ -48,16 +53,11 @@
@include('components.productpicker', array(
'products' => $products,
'barcodes' => $barcodes,
'nextInputSelector' => '#amount'
'nextInputSelector' => '#display_amount'
))
@include('components.numberpicker', array(
'id' => 'amount',
'label' => 'Amount',
'hintId' => 'amount_qu_unit',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_amounts'],
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
@include('components.productamountpicker', array(
'value' => 1,
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
))
@@ -139,18 +139,6 @@
value="0">
@endif
@include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_amounts'],
'additionalGroupCssClasses' => 'd-none',
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalCssClasses' => 'input-group-qu',
'additionalHtmlElements' => '<p id="qu-conversion-info"
class="form-text text-muted small d-none"></p>'
))
@if(GROCY_FEATURE_FLAG_STOCK_LOCATION_TRACKING)
@include('components.locationpicker', array(
'locations' => $locations,

View File

@@ -5,6 +5,11 @@
@section('viewJsName', 'transfer')
@section('content')
<script>
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
</script>
<div class="row">
<div class="col-xs-12 col-md-6 col-xl-4 pb-3">
<h2 class="title">@yield('title')</h2>
@@ -21,13 +26,6 @@
'disallowAddProductWorkflows' => true
))
@php /*@include('components.locationpicker', array(
'id' => 'location_from',
'locations' => $locations,
'isRequired' => true,
'label' => 'Transfer From Location'
))*/ @endphp
<div class="form-group">
<label for="location_id_from">{{ $__t('From location') }}</label>
<select required
@@ -43,39 +41,37 @@
<div class="invalid-feedback">{{ $__t('A location is required') }}</div>
</div>
@include('components.numberpicker', array(
'id' => 'amount',
'label' => 'Amount',
'hintId' => 'amount_qu_unit',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1',
'decimals' => $userSettings['stock_decimal_places_amounts'],
@include('components.productamountpicker', array(
'value' => 1,
'invalidFeedback' => $__t('The amount cannot be lower than %s', '1'),
'additionalHtmlContextHelp' => '<div id="tare-weight-handling-info"
class="text-info font-italic d-none">' . $__t('Tare weight handling enabled - please weigh the whole container, the amount to be posted will be automatically calculcated') . '</div>'
))
<div class="form-group">
<label for="use_specific_stock_entry">
<input type="checkbox"
<div class="custom-control custom-checkbox">
<input type="hidden"
name="use_specific_stock_entry"
value="0">
<input class="form-check-input custom-control-input"
type="checkbox"
id="use_specific_stock_entry"
name="use_specific_stock_entry"> {{ $__t('Use a specific stock item') }}
<span class="small text-muted">{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}</span>
</label>
name="use_specific_stock_entry"
value="1">
<label class="form-check-label custom-control-label"
for="use_specific_stock_entry">{{ $__t('Use a specific stock item') }}
&nbsp;<i class="fas fa-question-circle"
data-toggle="tooltip"
title="{{ $__t('The first item in this list would be picked by the default rule which is "First expiring first, then first in first out"') }}"></i>
</label>
</div>
<select disabled
class="form-control"
class="form-control mt-2"
id="specific_stock_entry"
name="specific_stock_entry">
<option></option>
</select>
</div>
@php /*@include('components.locationpicker', array(
'locations' => $locations,
'isRequired' => true,
'label' => 'Transfer to Location'
))*/ @endphp
<div class="form-group">
<label for="location_id_to">{{ $__t('To location') }}</label>
<select required