mirror of
https://github.com/grocy/grocy.git
synced 2025-08-15 10:14:39 +00:00
Fixed product picker workflows
This commit is contained in:
@@ -58,18 +58,17 @@
|
||||
Grocy.UISound.Success();
|
||||
}
|
||||
|
||||
var addBarcode = GetUriParam('addbarcodetoselection');
|
||||
if (addBarcode !== undefined)
|
||||
if (GetUriParam("flow") == "InplaceAddBarcodeToExistingProduct")
|
||||
{
|
||||
var jsonDataBarcode = {};
|
||||
jsonDataBarcode.barcode = addBarcode;
|
||||
jsonDataBarcode.barcode = GetUriParam("barcode");
|
||||
jsonDataBarcode.product_id = jsonForm.product_id;
|
||||
jsonDataBarcode.shopping_location_id = jsonForm.shopping_location_id;
|
||||
|
||||
Grocy.Api.Post('objects/product_barcodes', jsonDataBarcode,
|
||||
function(result)
|
||||
{
|
||||
$("#flow-info-addbarcodetoselection").addClass("d-none");
|
||||
$("#flow-info-InplaceAddBarcodeToExistingProduct").addClass("d-none");
|
||||
$('#barcode-lookup-disabled-hint').addClass('d-none');
|
||||
$('#barcode-lookup-hint').removeClass('d-none');
|
||||
window.history.replaceState({}, document.title, U("/purchase"));
|
||||
@@ -96,6 +95,7 @@
|
||||
{
|
||||
Grocy.FrontendHelpers.EndUiBusy("purchase-form");
|
||||
toastr.success(successMessage);
|
||||
Grocy.Components.ProductPicker.FinishFlow();
|
||||
|
||||
Grocy.Components.ProductAmountPicker.Reset();
|
||||
$("#display_amount").attr("min", "1");
|
||||
@@ -325,13 +325,18 @@ Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
|
||||
if (Grocy.Components.ProductPicker)
|
||||
{
|
||||
if (Grocy.Components.ProductPicker.InProductAddWorkflow() === false)
|
||||
if (Grocy.Components.ProductPicker.InAnyFlow() === false)
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetPicker().trigger('change');
|
||||
|
||||
if (Grocy.Components.ProductPicker.InProductModifyWorkflow())
|
||||
{
|
||||
Grocy.Components.ProductPicker.GetInputElement().focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user