mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Optimized embedded productpicker workflows (references #1226)
This commit is contained in:
parent
9f1692e31f
commit
d79adc4660
@ -172,6 +172,12 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
addProductWorkflowsAdditionalCssClasses = "d-none";
|
||||
}
|
||||
|
||||
var embedded = "";
|
||||
if (GetUriParam("embedded") !== undefined)
|
||||
{
|
||||
embedded = "embedded";
|
||||
}
|
||||
|
||||
var buttons = {
|
||||
cancel: {
|
||||
label: __t('Cancel'),
|
||||
@ -187,8 +193,9 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
className: 'btn-success add-new-product-dialog-button responsive-button ' + addProductWorkflowsAdditionalCssClasses,
|
||||
callback: function()
|
||||
{
|
||||
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithName&name=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceNewProductWithName"));
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithName&name=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceNewProductWithName&" + embedded) + "&" + embedded);
|
||||
}
|
||||
},
|
||||
addbarcode: {
|
||||
@ -206,7 +213,7 @@ $('#product_id_text_input').on('blur', function(e)
|
||||
callback: function()
|
||||
{
|
||||
Grocy.Components.ProductPicker.PopupOpen = false;
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithBarcode&barcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceAddBarcodeToExistingProduct&barcode=" + input));
|
||||
window.location.href = U('/product/new?flow=InplaceNewProductWithBarcode&barcode=' + encodeURIComponent(input) + '&returnto=' + encodeURIComponent(Grocy.CurrentUrlRelative + "?flow=InplaceAddBarcodeToExistingProduct&barcode=" + input + "&" + embedded) + "&" + embedded);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -250,4 +250,9 @@ eitherRequiredFields.on("input", function()
|
||||
Grocy.FrontendHelpers.ValidateForm('shoppinglist-form');
|
||||
});
|
||||
|
||||
if (GetUriParam("product-name") != null)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
}
|
||||
|
||||
Grocy.Components.UserfieldsForm.Load();
|
||||
|
Loading…
x
Reference in New Issue
Block a user