mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Replaced the default number input arrow buttons with own ones to better support touch input (references #44)
This commit is contained in:
@@ -37,11 +37,15 @@
|
||||
<input type="text" class="form-control" id="used_in" name="used_in" value="@if($mode == 'edit'){{ $battery->used_in }}@endif">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="charge_interval_days">{{ $L('Charge cycle interval (days)') }}<br><span class="small text-muted">{{ $L('0 means suggestions for the next charge cycle are disabled') }}</span></label>
|
||||
<input required min="0" step="1" type="number" class="form-control" id="charge_interval_days" name="charge_interval_days" value="@if($mode == 'edit'){{ $battery->charge_interval_days }}@else{{0}}@endif">
|
||||
<div class="invalid-feedback">{{ $L('This cannot be negative') }}</div>
|
||||
</div>
|
||||
@php if($mode == 'edit') { $value = $battery->charge_interval_days; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'charge_interval_days',
|
||||
'label' => 'Charge cycle interval (days)',
|
||||
'value' => $value,
|
||||
'min' => '0',
|
||||
'hint' => $L('0 means suggestions for the next charge cycle are disabled'),
|
||||
'invalidFeedback' => $L('This cannot be negative')
|
||||
))
|
||||
|
||||
<button id="save-battery-button" type="submit" class="btn btn-success">{{ $L('Save') }}</button>
|
||||
|
||||
|
27
views/components/numberpicker.blade.php
Normal file
27
views/components/numberpicker.blade.php
Normal file
@@ -0,0 +1,27 @@
|
||||
@push('componentScripts')
|
||||
<script src="{{ $U('/viewjs/components/numberpicker.js', true) }}?v={{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@php if(!isset($value)) { $value = 1; } @endphp
|
||||
@php if(empty($min)) { $min = 0; } @endphp
|
||||
@php if(empty($max)) { $max = 999999; } @endphp
|
||||
@php if(empty($step)) { $step = 1; } @endphp
|
||||
@php if(empty($hint)) { $hint = ''; } @endphp
|
||||
@php if(empty($hintId)) { $hintId = ''; } @endphp
|
||||
@php if(empty($additionalCssClasses)) { $additionalCssClasses = ''; } @endphp
|
||||
@php if(empty($additionalGroupCssClasses)) { $additionalGroupCssClasses = ''; } @endphp
|
||||
@php if(empty($additionalAttributes)) { $additionalAttributes = ''; } @endphp
|
||||
|
||||
<div class="form-group {{ $additionalGroupCssClasses }}">
|
||||
<label for="{{ $id }}">{{ $L($label) }} <span id="{{ $hintId }}" class="small text-muted">{{ $hint }}</span></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 }}" required>
|
||||
<div class="input-group-append"">
|
||||
<div class="input-group-text numberpicker-up-button"><i class="fas fa-arrow-up"></i></div>
|
||||
</div>
|
||||
<div class="input-group-append"">
|
||||
<div class="input-group-text numberpicker-down-button"><i class="fas fa-arrow-down"></i></div>
|
||||
</div>
|
||||
<div class="invalid-feedback">{{ $invalidFeedback }}</div>
|
||||
</div>
|
||||
</div>
|
@@ -1,5 +1,5 @@
|
||||
@push('componentScripts')
|
||||
<script src="{{ $U('/node_modules/chart.js//dist/Chart.min.js?v=', true) }}{{ $version }}"></script>
|
||||
<script src="{{ $U('/node_modules/chart.js/dist/Chart.min.js?v=', true) }}{{ $version }}"></script>
|
||||
<script src="{{ $U('/viewjs/components/productcard.js', true) }}?v={{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
|
@@ -17,11 +17,14 @@
|
||||
'disallowAddProductWorkflows' => true
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount">{{ $L('Amount') }} <span id="amount_qu_unit" class="small text-muted"></span></label>
|
||||
<input type="number" class="form-control" id="amount" name="amount" value="1" min="1" required>
|
||||
<div class="invalid-feedback">{{ $L('The amount cannot be lower than #1', '0') }}</div>
|
||||
</div>
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'amount',
|
||||
'label' => 'Amount',
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 1,
|
||||
'value' => 1,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1')
|
||||
))
|
||||
|
||||
<div class="checkbox">
|
||||
<label for="spoiled">
|
||||
|
@@ -42,11 +42,15 @@
|
||||
<div class="invalid-feedback">{{ $L('A period type is required') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="period_days">{{ $L('Period days') }}</label>
|
||||
<input type="number" class="form-control input-group-habit-period-type" id="period_days" name="period_days" min="0" value="@if($mode == 'edit'){{ $habit->period_days }}@endif">
|
||||
<div class="invalid-feedback">{{ $L('This cannot be negative') }}</div>
|
||||
</div>
|
||||
@php if($mode == 'edit') { $value = $habit->period_days; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'period_days',
|
||||
'label' => 'Period days',
|
||||
'value' => $value,
|
||||
'min' => '0',
|
||||
'additionalCssClasses' => 'input-group-habit-period-type',
|
||||
'invalidFeedback' => $L('This cannot be negative')
|
||||
))
|
||||
|
||||
<p id="habit-period-type-info" class="form-text text-muted small d-none"></p>
|
||||
|
||||
|
@@ -16,12 +16,16 @@
|
||||
'nextInputSelector' => '#new_amount'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="new_amount">{{ $L('New amount') }} <span id="new_amount_qu_unit" class="small text-muted"></span></label>
|
||||
<input type="number" data-notequal="notequal" class="form-control" id="new_amount" name="new_amount" min="0" not-equal="-1" required>
|
||||
<div class="invalid-feedback">{{ $L('The amount cannot be lower than #1', '0') }}</div>
|
||||
<div id="inventory-change-info" class="form-text text-muted small d-none"></div>
|
||||
</div>
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'new_amount',
|
||||
'label' => 'New amount',
|
||||
'hintId' => 'new_amount_qu_unit',
|
||||
'min' => 0,
|
||||
'value' => 1,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1'),
|
||||
'additionalAttributes' => ' data-notequal="notequal" not-equal="-1"'
|
||||
))
|
||||
<div id="inventory-change-info" class="form-text text-muted small d-none"></div>
|
||||
|
||||
@include('components.datetimepicker', array(
|
||||
'id' => 'best_before_date',
|
||||
|
@@ -48,17 +48,24 @@
|
||||
<div class="invalid-feedback">{{ $L('A location is required') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="min_stock_amount">{{ $L('Minimum stock amount') }}</label>
|
||||
<input required min="0" type="number" class="form-control" id="min_stock_amount" name="min_stock_amount" value="@if($mode == 'edit'){{ $product->min_stock_amount }}@else{{0}}@endif">
|
||||
<div class="invalid-feedback">{{ $L('The amount cannot be lower than #1', '0') }}</div>
|
||||
</div>
|
||||
@php if($mode == 'edit') { $value = $product->min_stock_amount; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'min_stock_amount',
|
||||
'label' => 'Minimum stock amount',
|
||||
'min' => 0,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '0')
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="default_best_before_days">{{ $L('Default best before days') }}<br><span class="small text-muted">{{ $L('For purchases this amount of days will be added to today for the best before date suggestion') }} ({{ $L('-1 means that this product never expires') }})</span></label>
|
||||
<input required min="-1" type="number" class="form-control" id="default_best_before_days" name="default_best_before_days" value="@if($mode == 'edit'){{ $product->default_best_before_days }}@else{{0}}@endif">
|
||||
<div class="invalid-feedback">{{ $L('This cannot be lower than #1', '-1') }}</div>
|
||||
</div>
|
||||
@php if($mode == 'edit') { $value = $product->default_best_before_days; } else { $value = 0; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'default_best_before_days',
|
||||
'label' => 'Default best before days',
|
||||
'min' => -1,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '-1'),
|
||||
'hint' => $L('For purchases this amount of days will be added to today for the best before date suggestion') . ' (' . $L('-1 means that this product never expires') . ')'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="qu_id_purchase">{{ $L('Quantity unit purchase') }}</label>
|
||||
@@ -80,11 +87,15 @@
|
||||
<div class="invalid-feedback">{{ $L('A quantity unit is required') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="qu_factor_purchase_to_stock">{{ $L('Factor purchase to stock quantity unit') }}</label>
|
||||
<input required min="1" type="number" class="form-control input-group-qu" id="qu_factor_purchase_to_stock" name="qu_factor_purchase_to_stock" value="@if ($mode == 'edit'){{ $product->qu_factor_purchase_to_stock }}@else{{1}}@endif">
|
||||
<div class="invalid-feedback">{{ $L('The amount cannot be lower than #1', '1') }}</div>
|
||||
</div>
|
||||
@php if($mode == 'edit') { $value = $product->qu_factor_purchase_to_stock; } else { $value = 1; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'qu_factor_purchase_to_stock',
|
||||
'label' => 'Factor purchase to stock quantity unit',
|
||||
'min' => 1,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1'),
|
||||
'additionalCssClasses' => 'input-group-qu'
|
||||
))
|
||||
|
||||
<p id="qu-conversion-info" class="form-text text-muted small d-none"></p>
|
||||
|
||||
|
@@ -30,17 +30,23 @@
|
||||
'shortcutLabel' => 'Never expires'
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount">{{ $L('Amount') }} <span id="amount_qu_unit" class="small text-muted"></span></label>
|
||||
<input type="number" class="form-control" id="amount" name="amount" value="1" min="1" step="1.00" required>
|
||||
<div class="invalid-feedback">{{ $L('The amount cannot be lower than #1', '1') }}</div>
|
||||
</div>
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'amount',
|
||||
'label' => 'Amount',
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 1,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1')
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="price">{{ $L('Price') }} <span id="amount_qu_unit" class="small text-muted">{{ $L('in #1 per purchase quantity unit', GROCY_CURRENCY) }}</span></label>
|
||||
<input type="number" class="form-control" id="price" name="price" min="0" step="0.01">
|
||||
<div class="invalid-feedback">{{ $L('The price cannot be lower than #1', '0') }}</div>
|
||||
</div>
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'price',
|
||||
'label' => 'Price',
|
||||
'min' => 0,
|
||||
'step' => 0.01,
|
||||
'value' => '',
|
||||
'hint' => $L('in #1 per purchase quantity unit', GROCY_CURRENCY),
|
||||
'invalidFeedback' => $L('The price cannot be lower than #1', '0')
|
||||
))
|
||||
|
||||
<button id="save-purchase-button" type="submit" class="btn btn-success">{{ $L('OK') }}</button>
|
||||
|
||||
|
@@ -35,11 +35,17 @@
|
||||
<div class="form-group row">
|
||||
<div class="col">
|
||||
<div class="row">
|
||||
<div class="form-group col-4">
|
||||
<label for="amount">{{ $L('Amount') }}</label>
|
||||
<input type="number" class="form-control" id="amount" name="amount" value="@if($mode == 'edit'){{ $recipePos->amount }}@else{{1}}@endif" min="0" required>
|
||||
<div class="invalid-feedback">{{ $L('This cannot be negative') }}</div>
|
||||
</div>
|
||||
|
||||
@php if($mode == 'edit') { $value = $recipePos->amount; } else { $value = 1; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'amount',
|
||||
'label' => 'Amount',
|
||||
'min' => 0,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $L('This cannot be negative'),
|
||||
'additionalGroupCssClasses' => 'col-4'
|
||||
))
|
||||
|
||||
<div class="form-group col-8">
|
||||
<label for="qu_id">{{ $L('Quantity unit') }}</label>
|
||||
<select required @if($mode == 'create' || ($mode == 'edit' && $recipePos->only_check_single_unit_in_stock != 1)) disabled @endif class="form-control" id="qu_id" name="qu_id">
|
||||
|
@@ -27,11 +27,15 @@
|
||||
'isRequired' => false
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="amount">{{ $L('Amount') }} <span id="amount_qu_unit" class="small text-muted"></span><br><span class="small text-muted">@if($mode == 'edit' && $listItem->amount_autoadded > 0){{ Pluralize($listItem->amount_autoadded, $L('#1 units were automatically added and will apply in addition to the amount entered here', $listItem->amount_autoadded), $L('#1 units were automatically added and will apply in addition to the amount entered here', $listItem->amount_autoadded)) }}@endif</span></label>
|
||||
<input type="number" class="form-control" id="amount" name="amount" value="@if($mode == 'edit'){{ $listItem->amount }}@else{{1}}@endif" min="0" required>
|
||||
<div class="invalid-feedback">{{ $L('This cannot be negative') }}</div>
|
||||
</div>
|
||||
@php if($mode == 'edit') { $value = $listItem->amount; } else { $value = 1; } @endphp
|
||||
@include('components.numberpicker', array(
|
||||
'id' => 'amount',
|
||||
'label' => 'Amount',
|
||||
'hintId' => 'amount_qu_unit',
|
||||
'min' => 0,
|
||||
'value' => $value,
|
||||
'invalidFeedback' => $L('The amount cannot be lower than #1', '1')
|
||||
))
|
||||
|
||||
<div class="form-group">
|
||||
<label for="note">{{ $L('Note') }}</label>
|
||||
|
Reference in New Issue
Block a user