Default shopping list item amount to 1

This commit is contained in:
Bernd Bestel 2021-03-31 22:22:28 +02:00
parent dabc48fed3
commit 791a17fcad
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,8 @@
- Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape)
- Fixed that the transfer page was not fully populated when opening it from the stock entries page
### Shopping list fixes
### Shopping list improvements/fixes
- The amount now defaults to `1` for adding items quicker
- Fixed that shopping list prints had a grey background (thanks @Forceu)
- Fixed the form validation on the shopping list item page (thanks @Forceu)

View File

@ -162,6 +162,12 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
Grocy.Components.ProductAmountPicker.SetQuantityUnit(productDetails.default_quantity_unit_purchase.id);
}
if ($("#display_amount").val().toString().isEmpty())
{
$("#display_amount").val(1);
$("#display_amount").trigger("change");
}
$('#display_amount').focus();
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
Grocy.ShoppingListItemFormInitialLoadDone = true;
@ -244,8 +250,8 @@ if (GetUriParam("embedded") !== undefined)
}
var eitherRequiredFields = $("#product_id,#product_id_text_input,#note");
eitherRequiredFields.prop('required',"");
eitherRequiredFields.on('input', function ()
eitherRequiredFields.prop('required', "");
eitherRequiredFields.on('input', function()
{
eitherRequiredFields.not(this).prop('required', !$(this).val().length);
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');