mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Show purchase to stock conversion factor on purchase page when QU units are different (closes #169)
This commit is contained in:
@@ -353,5 +353,6 @@ return array(
|
||||
'Show battery details' => 'Show battery details',
|
||||
'Journal for this battery' => 'Journal for this battery',
|
||||
'System info' => 'System info',
|
||||
'Changelog' => 'Changelog'
|
||||
'Changelog' => 'Changelog',
|
||||
'will be multiplied a factor of #1 to get #2' => 'will be multiplied a factor of #1 to get #2'
|
||||
);
|
||||
|
@@ -105,10 +105,18 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
|
||||
Grocy.Api.Get('stock/products/' + productId,
|
||||
function (productDetails)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
$('#price').val(productDetails.last_price);
|
||||
Grocy.Components.LocationPicker.SetId(productDetails.location.id);
|
||||
|
||||
if (productDetails.product.qu_id_purchase === productDetails.product.qu_id_stock)
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#amount_qu_unit').text(productDetails.quantity_unit_purchase.name + " (" + L("will be multiplied a factor of #1 to get #2", parseInt(productDetails.product.qu_factor_purchase_to_stock).toString(), productDetails.quantity_unit_stock.name) + ")");
|
||||
}
|
||||
|
||||
if (productDetails.product.allow_partial_units_in_stock == 1)
|
||||
{
|
||||
$("#amount").attr("min", "0.01");
|
||||
|
Reference in New Issue
Block a user