Allow 0 for shopping list item amounts (references #2712)

This commit is contained in:
Bernd Bestel
2025-04-02 20:50:40 +02:00
parent 21aa5eab21
commit 8de5700310
3 changed files with 68 additions and 2 deletions

View File

@@ -0,0 +1,57 @@
> ⚠️ xxxBREAKING CHANGESxxx
> ❗ xxxImportant upgrade informationXXX
> 💡 xxxMinor upgrade informationXXX
### New Feature: xxxx
- xxx
### Stock
- xxx
### Shopping list
- An amount of `0` is now allowed for shopping list items (just a convenience optimization, it was already possible to leave the amount field empty which implicitly resulted in an amount of `0`)
### Recipes
- xxx
### Meal plan
- xxx
### Chores
- xxx
### Calendar
- xxx
### Tasks
- xxx
### Batteries
- xxx
### Equipment
- xxx
### Userfields
- xxx
### General
- xxx
### API
- xxx

View File

@@ -10,6 +10,15 @@
@php if(empty($label)) { $label = 'Amount'; } @endphp
@php if(empty($initialQuId)) { $initialQuId = '-1'; } @endphp
@php if(!isset($isRequired)) { $isRequired = true; } @endphp
@php if(!isset($allowZero)) { $allowZero = false; } @endphp
@php
$minLocal = $DEFAULT_MIN_AMOUNT;
if ($allowZero)
{
$minLocal = 0;
}
@endphp
<div class="form-group row {{ $additionalGroupCssClasses }}">
<div class="col">
@@ -20,7 +29,7 @@
@include('components.numberpicker', array(
'id' => 'display_amount',
'label' => $label,
'min' => $DEFAULT_MIN_AMOUNT,
'min' => $minLocal,
'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value,
'additionalGroupCssClasses' => 'col-sm-5 col-12 my-0',

View File

@@ -72,7 +72,7 @@
@include('components.productamountpicker', array(
'value' => $value,
'initialQuId' => $initialQuId,
'min' => $DEFAULT_MIN_AMOUNT,
'allowZero' => true,
'isRequired' => false
))