From 14faf57a9e7097ead2537d0c5b70e23db0afe0f1 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sat, 22 Apr 2017 11:36:05 +0200 Subject: [PATCH] Small productivity improvement (noticed on first own production use :D) --- views/purchase.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/purchase.js b/views/purchase.js index 24f5f08c..400e905e 100644 --- a/views/purchase.js +++ b/views/purchase.js @@ -43,7 +43,7 @@ } else { - $('#amount').val(1); + $('#amount').val(0); $('#best_before_date').val(''); $('#product_id').val(''); $('#product_id_text_input').focus(); @@ -87,6 +87,7 @@ $('#product_id').on('change', function(e) if (productDetails.product.default_best_before_days.toString() !== '0') { $('#best_before_date').val(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD')); + $('#best_before_date').trigger('change'); } Grocy.EmptyElementWhenMatches('#selected-product-last-purchased-timeago', 'NaN years ago'); @@ -191,7 +192,7 @@ $(function() } }); - $('#amount').val(1); + $('#amount').val(0); $('#best_before_date').val(''); $('#product_id').val(''); $('#product_id_text_input').focus();