mirror of
https://github.com/grocy/grocy.git
synced 2025-08-28 09:01:14 +00:00
Add a quantity unit conversion hint on product form
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('#qu_factor_purchase_to_stock').trigger('change');
|
||||
$('#name').focus();
|
||||
$('#product-form').validator();
|
||||
$('#product-form').validator('validate');
|
||||
@@ -45,3 +46,17 @@ $('#barcode').keydown(function(event)
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.input-group-qu').on('change', function(e)
|
||||
{
|
||||
var factor = $('#qu_factor_purchase_to_stock').val();
|
||||
if (factor > 1)
|
||||
{
|
||||
$('#qu-conversion-info').text('This means 1 ' + $("#qu_id_purchase option:selected").text() + ' purchased will be converted into ' + (1 * factor).toString() + ' ' + $("#qu_id_stock option:selected").text() + ' in stock.');
|
||||
$('#qu-conversion-info').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#qu-conversion-info').hide();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user