mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 03:25:50 +00:00
Added keyboard shortcuts for add product/barcode dialogs
This commit is contained in:
@@ -140,22 +140,32 @@ $(function()
|
|||||||
callback: function() { }
|
callback: function() { }
|
||||||
},
|
},
|
||||||
addnewproduct: {
|
addnewproduct: {
|
||||||
label: 'Add as new product',
|
label: 'Add as new <u><strong>p</strong></u>roduct',
|
||||||
className: 'btn-success',
|
className: 'btn-success add-new-product-dialog-button',
|
||||||
callback: function()
|
callback: function()
|
||||||
{
|
{
|
||||||
window.location.href = '/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname);
|
window.location.href = '/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addbarcode: {
|
addbarcode: {
|
||||||
label: 'Add as barcode to existing product',
|
label: 'Add as <u><strong>b</strong></u>arcode to existing product',
|
||||||
className: 'btn-info',
|
className: 'btn-info add-new-barcode-dialog-button',
|
||||||
callback: function()
|
callback: function()
|
||||||
{
|
{
|
||||||
window.location.href = '/inventory?addbarcodetoselection=' + encodeURIComponent(input);
|
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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -145,22 +145,32 @@ $(function()
|
|||||||
callback: function() { }
|
callback: function() { }
|
||||||
},
|
},
|
||||||
addnewproduct: {
|
addnewproduct: {
|
||||||
label: 'Add as new product',
|
label: 'Add as new <u><strong>p</strong></u>roduct',
|
||||||
className: 'btn-success',
|
className: 'btn-success add-new-product-dialog-button',
|
||||||
callback: function()
|
callback: function()
|
||||||
{
|
{
|
||||||
window.location.href = '/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname);
|
window.location.href = '/product/new?prefillname=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addbarcode: {
|
addbarcode: {
|
||||||
label: 'Add as barcode to existing product',
|
label: 'Add as <u><strong>b</strong></u>arcode to existing product',
|
||||||
className: 'btn-info',
|
className: 'btn-info add-new-barcode-dialog-button',
|
||||||
callback: function()
|
callback: function()
|
||||||
{
|
{
|
||||||
window.location.href = '/purchase?addbarcodetoselection=' + encodeURIComponent(input);
|
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();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user