diff --git a/public/viewjs/components/productcard.js b/public/viewjs/components/productcard.js index 13e18445..4f063b42 100644 --- a/public/viewjs/components/productcard.js +++ b/public/viewjs/components/productcard.js @@ -18,6 +18,27 @@ Grocy.Components.ProductCard.Refresh = function(productId) $('#productcard-product-location').text(productDetails.location.name); $('#productcard-product-spoil-rate').text(parseFloat(productDetails.spoil_rate_percent).toLocaleString(undefined, { style: "percent" })); + if (productDetails.is_aggregated_amount == 1) + { + $('#productcard-product-stock-amount-aggregated').text(productDetails.stock_amount_aggregated); + $('#productcard-product-stock-qu-name-aggregated').text(__n(productDetails.stock_amount_aggregated, productDetails.quantity_unit_stock.name, productDetails.quantity_unit_stock.name_plural)); + + if (productDetails.stock_amount_opened_aggregated > 0) + { + $('#productcard-product-stock-opened-amount-aggregated').text(__t('%s opened', productDetails.stock_amount_opened_aggregated)); + } + else + { + $('#productcard-product-stock-opened-amount-aggregated').text(""); + } + + $("#productcard-aggregated-amounts").removeClass("d-none"); + } + else + { + $("#productcard-aggregated-amounts").addClass("d-none"); + } + if (productDetails.product.description != null && !productDetails.product.description.isEmpty()) { $("#productcard-product-description-wrapper").removeClass("d-none"); diff --git a/views/components/productcard.blade.php b/views/components/productcard.blade.php index fc229409..edd0058d 100644 --- a/views/components/productcard.blade.php +++ b/views/components/productcard.blade.php @@ -18,7 +18,8 @@ - {{ $__t('Stock amount') . ' / ' . $__t('Quantity unit') }}:
+ {{ $__t('Stock amount') . ' / ' . $__t('Quantity unit') }}: +
{{ $__t('Location') }}:
{{ $__t('Last purchased') }}:
{{ $__t('Last used') }}:
diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index 11bc55ce..8bc4adfb 100644 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -143,7 +143,7 @@ {{ $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 @if($currentStockEntry->is_aggregated_amount == 1) - + {{ $currentStockEntry->amount_aggregated }} {{ $__n($currentStockEntry->amount_aggregated, 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_aggregated > 0){{ $__t('%s opened', $currentStockEntry->amount_opened_aggregated) }}@endif