diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js index e5a1f91e..254040c0 100644 --- a/public/viewjs/components/productcard.js +++ b/public/viewjs/components/productcard.js @@ -96,6 +96,15 @@ Grocy.Components.ProductCard.Refresh = function(productId) $('#productcard-product-last-price').text(__t('Unknown')); } + if (productDetails.avg_price !== null) + { + $('#productcard-product-average-price').text(Number.parseFloat(productDetails.avg_price).toLocaleString() + ' ' + Grocy.Currency); + } + else + { + $('#productcard-product-average-price').text(__t('Unknown')); + } + if (productDetails.product.picture_file_name !== null && !productDetails.product.picture_file_name.isEmpty()) { $("#productcard-product-picture").removeClass("d-none"); diff --git a/views/components/productcard.blade.php b/views/components/productcard.blade.php index 0c5f765b..3ccddcec 100644 --- a/views/components/productcard.blade.php +++ b/views/components/productcard.blade.php @@ -28,6 +28,7 @@ {{ $__t('Last purchased') }}:
{{ $__t('Last used') }}:
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING){{ $__t('Last price') }}:
@endif + @if (GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING){{ $__t('Average price') }}:
@endif @if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING){{ $__t('Average shelf life') }}:
@endif {{ $__t('Spoil rate') }}: