Add a quantity unit conversion hint on product form

This commit is contained in:
Bernd Bestel
2017-04-18 19:54:51 +02:00
parent 2b8c672279
commit 3ed6c9b28a
2 changed files with 19 additions and 3 deletions

View File

@@ -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();
}
});