mirror of
https://github.com/grocy/grocy.git
synced 2026-04-07 13:26:14 +02:00
add average price to product card
This commit is contained in:
parent
e6c54d61d0
commit
f3e6d24910
|
|
@ -96,6 +96,15 @@ Grocy.Components.ProductCard.Refresh = function(productId)
|
||||||
$('#productcard-product-last-price').text(__t('Unknown'));
|
$('#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())
|
if (productDetails.product.picture_file_name !== null && !productDetails.product.picture_file_name.isEmpty())
|
||||||
{
|
{
|
||||||
$("#productcard-product-picture").removeClass("d-none");
|
$("#productcard-product-picture").removeClass("d-none");
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
<strong>{{ $__t('Last purchased') }}:</strong> <span id="productcard-product-last-purchased"></span> <time id="productcard-product-last-purchased-timeago" class="timeago timeago-contextual"></time><br>
|
<strong>{{ $__t('Last purchased') }}:</strong> <span id="productcard-product-last-purchased"></span> <time id="productcard-product-last-purchased-timeago" class="timeago timeago-contextual"></time><br>
|
||||||
<strong>{{ $__t('Last used') }}:</strong> <span id="productcard-product-last-used"></span> <time id="productcard-product-last-used-timeago" class="timeago timeago-contextual"></time><br>
|
<strong>{{ $__t('Last used') }}:</strong> <span id="productcard-product-last-used"></span> <time id="productcard-product-last-used-timeago" class="timeago timeago-contextual"></time><br>
|
||||||
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Last price') }}:</strong> <span id="productcard-product-last-price"></span><br>@endif
|
@if(GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Last price') }}:</strong> <span id="productcard-product-last-price"></span><br>@endif
|
||||||
|
@if (GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING)<strong>{{ $__t('Average price') }}:</strong> <span id="productcard-product-average-price"></span><br>@endif
|
||||||
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)<strong>{{ $__t('Average shelf life') }}:</strong> <span id="productcard-product-average-shelf-life"></span><br>@endif
|
@if (GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)<strong>{{ $__t('Average shelf life') }}:</strong> <span id="productcard-product-average-shelf-life"></span><br>@endif
|
||||||
<strong>{{ $__t('Spoil rate') }}:</strong> <span id="productcard-product-spoil-rate"></span>
|
<strong>{{ $__t('Spoil rate') }}:</strong> <span id="productcard-product-spoil-rate"></span>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user