diff --git a/views/inventory.js b/views/inventory.js index 203277bf..98938620 100644 --- a/views/inventory.js +++ b/views/inventory.js @@ -140,22 +140,32 @@ $(function() callback: function() { } }, addnewproduct: { - label: 'Add as new product', - className: 'btn-success', + label: 'Add as new product', + className: 'btn-success add-new-product-dialog-button', callback: function() { window.location.href = '/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname); } }, addbarcode: { - label: 'Add as barcode to existing product', - className: 'btn-info', + label: 'Add as barcode to existing product', + className: 'btn-info add-new-barcode-dialog-button', callback: function() { window.location.href = '/inventory?addbarcodetoselection=' + encodeURIComponent(input); } } } + }).on('keypress', function(e) + { + if (e.key === 'B' || e.key === 'b') + { + $('.add-new-barcode-dialog-button').click(); + } + if (e.key === 'p' || e.key === 'P') + { + $('.add-new-product-dialog-button').click(); + } }); } } diff --git a/views/purchase.js b/views/purchase.js index b403c45e..96be3e6f 100644 --- a/views/purchase.js +++ b/views/purchase.js @@ -145,22 +145,32 @@ $(function() callback: function() { } }, addnewproduct: { - label: 'Add as new product', - className: 'btn-success', + label: 'Add as new product', + className: 'btn-success add-new-product-dialog-button', callback: function() { window.location.href = '/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname); } }, addbarcode: { - label: 'Add as barcode to existing product', - className: 'btn-info', + label: 'Add as barcode to existing product', + className: 'btn-info add-new-barcode-dialog-button', callback: function() { window.location.href = '/purchase?addbarcodetoselection=' + encodeURIComponent(input); } } } + }).on('keypress', function(e) + { + if (e.key === 'B' || e.key === 'b') + { + $('.add-new-barcode-dialog-button').click(); + } + if (e.key === 'p' || e.key === 'P') + { + $('.add-new-product-dialog-button').click(); + } }); } }