mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 19:16:37 +00:00
Fixed the consume success message on stock overview page (fixes #302)
This commit is contained in:
@@ -89,8 +89,6 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
Grocy.FrontendHelpers.BeginUiBusy();
|
Grocy.FrontendHelpers.BeginUiBusy();
|
||||||
|
|
||||||
var productId = $(e.currentTarget).attr('data-product-id');
|
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');
|
var consumeAmount = $(e.currentTarget).attr('data-consume-amount');
|
||||||
|
|
||||||
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount },
|
Grocy.Api.Post('stock/products/' + productId + '/consume', { 'amount': consumeAmount },
|
||||||
@@ -127,8 +125,9 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
}
|
}
|
||||||
else
|
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').parent().effect('highlight', { }, 500);
|
||||||
$('#product-' + productId + '-amount').fadeOut(500, function()
|
$('#product-' + productId + '-amount').fadeOut(500, function ()
|
||||||
{
|
{
|
||||||
$(this).text(newAmount).fadeIn(500);
|
$(this).text(newAmount).fadeIn(500);
|
||||||
});
|
});
|
||||||
@@ -157,7 +156,7 @@ $(document).on('click', '.product-consume-button', function(e)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Grocy.FrontendHelpers.EndUiBusy();
|
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();
|
RefreshContextualTimeago();
|
||||||
RefreshStatistics();
|
RefreshStatistics();
|
||||||
},
|
},
|
||||||
|
@@ -129,7 +129,7 @@
|
|||||||
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}
|
{{ FindObjectInArrayByPropertyValue($products, 'id', $currentStockEntry->product_id)->name }}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span id="product-{{ $currentStockEntry->product_id }}-amount">{{ $currentStockEntry->amount }}</span> {{ $__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) }}
|
<span id="product-{{ $currentStockEntry->product_id }}-amount">{{ $currentStockEntry->amount }}</span> <span id="product-{{ $currentStockEntry->product_id }}-qu-name">{{ $__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) }}</span>
|
||||||
<span id="product-{{ $currentStockEntry->product_id }}-opened-amount" class="small font-italic">@if($currentStockEntry->amount_opened > 0){{ $__t('%s opened', $currentStockEntry->amount_opened) }}@endif</span>
|
<span id="product-{{ $currentStockEntry->product_id }}-opened-amount" class="small font-italic">@if($currentStockEntry->amount_opened > 0){{ $__t('%s opened', $currentStockEntry->amount_opened) }}@endif</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
Reference in New Issue
Block a user