diff --git a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml index 78ee222c1..f758c25b2 100644 --- a/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml +++ b/BTCPayServer/Views/Shared/PointOfSale/Public/Cart.cshtml @@ -80,7 +80,15 @@
- +
diff --git a/BTCPayServer/wwwroot/cart/js/cart.jquery.js b/BTCPayServer/wwwroot/cart/js/cart.jquery.js index dfd23475f..b31772c2b 100644 --- a/BTCPayServer/wwwroot/cart/js/cart.jquery.js +++ b/BTCPayServer/wwwroot/cart/js/cart.jquery.js @@ -137,8 +137,17 @@ $(document).ready(function(){ cart.updateSummaryProducts(); cart.updateSummaryTotal(); + var $tipInput = $('.js-cart-tip'); + $tipInput[0].addEventListener('input', function(e) { + var value = parseFloat(e.target.value) + if (Number.isNaN(value) || value < 0) { + e.target.value = ''; + return; + } + }); + // Change total when tip is changed - $('.js-cart-tip').inputAmount(cart, 'tip'); + $tipInput.inputAmount(cart, 'tip'); // Remove tip $('.js-cart-tip-remove').removeAmount(cart, 'tip'); diff --git a/BTCPayServer/wwwroot/cart/js/cart.js b/BTCPayServer/wwwroot/cart/js/cart.js index d0a630a9a..873058dd7 100644 --- a/BTCPayServer/wwwroot/cart/js/cart.js +++ b/BTCPayServer/wwwroot/cart/js/cart.js @@ -340,7 +340,6 @@ Cart.prototype.updatePosData = function() { tip: this.tip? this.tip: 0, total: this.getTotal(true) }; - console.warn(result); $('#js-cart-posdata').val(JSON.stringify(result)); }