Add flow to add a new product with prefilled barcode

This commit is contained in:
Bernd Bestel 2017-04-21 22:50:16 +02:00
parent 8e40c50cc1
commit 96209c852c
4 changed files with 36 additions and 1 deletions

View File

@ -1 +1 @@
1.1.0
1.2.0

View File

@ -134,6 +134,8 @@ $(function()
message: '<strong>' + input + '</strong> could not be resolved to a product, how do you want to proceed?',
title: 'Create or assign product',
onEscape: function() { },
size: 'large',
backdrop: true,
buttons: {
cancel: {
label: 'Cancel',
@ -155,6 +157,14 @@ $(function()
{
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)
@ -167,6 +177,10 @@ $(function()
{
$('.add-new-product-dialog-button').click();
}
if (e.key === 'a' || e.key === 'A')
{
$('.add-new-product-with-barcode-dialog-button').click();
}
});
}
}

View File

@ -75,6 +75,13 @@ $(function()
$('#name').val(prefillName);
$('#name').focus();
}
var prefillBarcode = Grocy.GetUriParam('prefillbarcode');
if (prefillBarcode !== undefined)
{
$('#barcode-taginput').tagsManager('pushTag', prefillBarcode);
$('#name').focus();
}
});
$('.input-group-qu').on('change', function(e)

View File

@ -139,6 +139,8 @@ $(function()
message: '<strong>' + input + '</strong> could not be resolved to a product, how do you want to proceed?',
title: 'Create or assign product',
onEscape: function() { },
size: 'large',
backdrop: true,
buttons: {
cancel: {
label: 'Cancel',
@ -160,6 +162,14 @@ $(function()
{
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)
@ -172,6 +182,10 @@ $(function()
{
$('.add-new-product-dialog-button').click();
}
if (e.key === 'a' || e.key === 'A')
{
$('.add-new-product-with-barcode-dialog-button').click();
}
});
}
}