diff --git a/views/consume.js b/views/consume.js index a85e2d25..1a84cd27 100644 --- a/views/consume.js +++ b/views/consume.js @@ -124,6 +124,10 @@ $(function() { $('#product_id_text_input').focus(); } + else + { + $(this).select(); + } }); $('#consume-form input').keydown(function(event) diff --git a/views/inventory.js b/views/inventory.js index 29af91c3..7154d968 100644 --- a/views/inventory.js +++ b/views/inventory.js @@ -228,6 +228,10 @@ $(function() { $('#product_id_text_input').focus(); } + else + { + $(this).select(); + } }); $('#inventory-form input').keydown(function(event) @@ -274,6 +278,11 @@ $('#best_before_date-datepicker-button').on('click', function(e) $('.datepicker').datepicker('show'); }); +$('#new_amount').on('keypress', function(e) +{ + $('#new_amount').trigger('change'); +}); + $('#best_before_date').on('change', function(e) { var value = $('#best_before_date').val(); @@ -336,6 +345,14 @@ $('#best_before_date').on('keypress', function(e) $('#inventory-form').validator('validate'); }); +$('#best_before_date').on('keydown', function(e) +{ + if (e.keyCode === 13) //Enter + { + $('#best_before_date').trigger('change'); + } +}); + $('#new_amount').on('change', function(e) { if ($('#product_id').parent().hasClass('has-error')) diff --git a/views/purchase.js b/views/purchase.js index be89dc7d..eab1711d 100644 --- a/views/purchase.js +++ b/views/purchase.js @@ -232,6 +232,18 @@ $(function() } }); + $('#amount').on('focus', function(e) + { + if ($('#product_id_text_input').val().length === 0) + { + $('#product_id_text_input').focus(); + } + else + { + $(this).select(); + } + }); + $('#purchase-form input').keydown(function(event) { if (event.keyCode === 13) //Enter