Show amount of opened products on stock overview page and in product card

This commit is contained in:
Bernd Bestel
2018-11-18 13:17:36 +01:00
parent 5966a3d678
commit a403bb687a
7 changed files with 34 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ Grocy.Components.ProductCard.Refresh = function(productId)
function(productDetails)
{
var stockAmount = productDetails.stock_amount || '0';
var stockAmountOpened = productDetails.stock_amount_opened || '0';
$('#productcard-product-name').text(productDetails.product.name);
$('#productcard-product-stock-amount').text(stockAmount);
$('#productcard-product-stock-qu-name').text(productDetails.quantity_unit_stock.name);
@@ -15,6 +16,15 @@ Grocy.Components.ProductCard.Refresh = function(productId)
$('#productcard-product-last-used').text((productDetails.last_used || L('never')).substring(0, 10));
$('#productcard-product-last-used-timeago').text($.timeago(productDetails.last_used || ''));
if (stockAmountOpened > 0)
{
$('#productcard-product-stock-opened-amount').text(L('#1 opened', stockAmountOpened));
}
else
{
$('#productcard-product-stock-opened-amount').text("");
}
$('#productcard-product-edit-button').attr("href", U("/product/" + productDetails.product.id.toString()));
$('#productcard-product-edit-button').removeClass("disabled");