mirror of
https://github.com/grocy/grocy.git
synced 2025-08-17 11:06:36 +00:00
Add flow to add a new product with prefilled barcode
This commit is contained in:
@@ -1 +1 @@
|
|||||||
1.1.0
|
1.2.0
|
@@ -134,6 +134,8 @@ $(function()
|
|||||||
message: '<strong>' + input + '</strong> could not be resolved to a product, how do you want to proceed?',
|
message: '<strong>' + input + '</strong> could not be resolved to a product, how do you want to proceed?',
|
||||||
title: 'Create or assign product',
|
title: 'Create or assign product',
|
||||||
onEscape: function() { },
|
onEscape: function() { },
|
||||||
|
size: 'large',
|
||||||
|
backdrop: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
cancel: {
|
cancel: {
|
||||||
label: 'Cancel',
|
label: 'Cancel',
|
||||||
@@ -155,6 +157,14 @@ $(function()
|
|||||||
{
|
{
|
||||||
window.location.href = '/inventory?addbarcodetoselection=' + encodeURIComponent(input);
|
window.location.href = '/inventory?addbarcodetoselection=' + encodeURIComponent(input);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
addnewproductwithbarcode: {
|
||||||
|
label: '<u><strong>A</strong></u>dd as new product + prefill barcode',
|
||||||
|
className: 'btn-warning add-new-product-with-barcode-dialog-button',
|
||||||
|
callback: function()
|
||||||
|
{
|
||||||
|
window.location.href = '/product/new?prefillbarcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).on('keypress', function(e)
|
}).on('keypress', function(e)
|
||||||
@@ -167,6 +177,10 @@ $(function()
|
|||||||
{
|
{
|
||||||
$('.add-new-product-dialog-button').click();
|
$('.add-new-product-dialog-button').click();
|
||||||
}
|
}
|
||||||
|
if (e.key === 'a' || e.key === 'A')
|
||||||
|
{
|
||||||
|
$('.add-new-product-with-barcode-dialog-button').click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -75,6 +75,13 @@ $(function()
|
|||||||
$('#name').val(prefillName);
|
$('#name').val(prefillName);
|
||||||
$('#name').focus();
|
$('#name').focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var prefillBarcode = Grocy.GetUriParam('prefillbarcode');
|
||||||
|
if (prefillBarcode !== undefined)
|
||||||
|
{
|
||||||
|
$('#barcode-taginput').tagsManager('pushTag', prefillBarcode);
|
||||||
|
$('#name').focus();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.input-group-qu').on('change', function(e)
|
$('.input-group-qu').on('change', function(e)
|
||||||
|
@@ -139,6 +139,8 @@ $(function()
|
|||||||
message: '<strong>' + input + '</strong> could not be resolved to a product, how do you want to proceed?',
|
message: '<strong>' + input + '</strong> could not be resolved to a product, how do you want to proceed?',
|
||||||
title: 'Create or assign product',
|
title: 'Create or assign product',
|
||||||
onEscape: function() { },
|
onEscape: function() { },
|
||||||
|
size: 'large',
|
||||||
|
backdrop: true,
|
||||||
buttons: {
|
buttons: {
|
||||||
cancel: {
|
cancel: {
|
||||||
label: 'Cancel',
|
label: 'Cancel',
|
||||||
@@ -160,6 +162,14 @@ $(function()
|
|||||||
{
|
{
|
||||||
window.location.href = '/purchase?addbarcodetoselection=' + encodeURIComponent(input);
|
window.location.href = '/purchase?addbarcodetoselection=' + encodeURIComponent(input);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
addnewproductwithbarcode: {
|
||||||
|
label: '<u><strong>A</strong></u>dd as new product + prefill barcode',
|
||||||
|
className: 'btn-warning add-new-product-with-barcode-dialog-button',
|
||||||
|
callback: function()
|
||||||
|
{
|
||||||
|
window.location.href = '/product/new?prefillbarcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(window.location.pathname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).on('keypress', function(e)
|
}).on('keypress', function(e)
|
||||||
@@ -172,6 +182,10 @@ $(function()
|
|||||||
{
|
{
|
||||||
$('.add-new-product-dialog-button').click();
|
$('.add-new-product-dialog-button').click();
|
||||||
}
|
}
|
||||||
|
if (e.key === 'a' || e.key === 'A')
|
||||||
|
{
|
||||||
|
$('.add-new-product-with-barcode-dialog-button').click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user