diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index b8ac1e3d..018469d2 100644 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -89,8 +89,6 @@ $(document).on('click', '.product-consume-button', function(e) Grocy.FrontendHelpers.BeginUiBusy(); var productId = $(e.currentTarget).attr('data-product-id'); - var productName = $(e.currentTarget).attr('data-product-name'); - var productQuName = $(e.currentTarget).attr('data-product-qu-name'); var consumeAmount = $(e.currentTarget).attr('data-consume-amount'); Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount }, @@ -127,8 +125,9 @@ $(document).on('click', '.product-consume-button', function(e) } else { + $('#product-' + productId + '-qu-name').text(__n(newAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural)); $('#product-' + productId + '-amount').parent().effect('highlight', { }, 500); - $('#product-' + productId + '-amount').fadeOut(500, function() + $('#product-' + productId + '-amount').fadeOut(500, function () { $(this).text(newAmount).fadeIn(500); }); @@ -157,7 +156,7 @@ $(document).on('click', '.product-consume-button', function(e) } Grocy.FrontendHelpers.EndUiBusy(); - toastr.success(__t('Removed %1$s of %2$s from stock', consumeAmount, productQuName, productName)); + toastr.success(__t('Removed %1$s of %2$s from stock', consumeAmount.toString() + " " + __n(consumeAmount, result.quantity_unit_stock.name, result.quantity_unit_stock.name_plural), result.product.name)); RefreshContextualTimeago(); RefreshStatistics(); }, diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 8425b887..44e7002b 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -129,7 +129,7 @@ {{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }} - {{ $currentStockEntry->amount }} {{ $__n($currentStockEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name_plural) }} + {{ $currentStockEntry->amount }} {{ $__n($currentStockEntry->amount, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name, FindObjectInArrayByPropertyValue($quantityunits, 'id', FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->qu_id_stock)->name_plural) }} @if($currentStockEntry->amount_opened > 0){{ $__t('%s opened', $currentStockEntry->amount_opened) }}@endif