From 27ba2bfd557ebdd71d59b6960abf0f7597f983a9 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 10 Mar 2019 14:10:25 +0100 Subject: [PATCH] Fixed display errors when consuming partial amounts from stock overview page (fixes #170) --- public/viewjs/stockoverview.js | 4 ++-- views/stockoverview.blade.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index 48a9e50a..d9a3a946 100644 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -115,9 +115,9 @@ $(document).on('click', '.product-consume-button', function(e) productRow.addClass("table-warning"); } - var oldAmount = parseInt($('#product-' + productId + '-amount').text()); + var oldAmount = parseFloat($('#product-' + productId + '-amount').text()); var newAmount = oldAmount - consumeAmount; - if (newAmount === 0) + if (newAmount <= 0) // When "consume all" of an amount < 1, the resulting amount here will be < 0, but the API newer books > current stock amount { $('#product-' + productId + '-row').fadeOut(500, function() { diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index bfb892f6..8a8a09b5 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -83,7 +83,7 @@ @foreach($currentStock as $currentStockEntry) amount > 0) table-warning @elseif (FindObjectInArrayByPropertyValue($missingProducts, 'id', $currentStockEntry->product_id) !== null) table-info @endif"> - {{ $L('All') }} -