Attempt to clear pickers to only allow either product or recipe selection

This commit is contained in:
Kurt Riddlesperger 2020-01-24 00:57:45 -06:00
parent 52698e43b0
commit 222d089872

View File

@ -215,6 +215,7 @@ $(document).on("click", ".add-recipe-button", function(e)
$("#add-recipe-modal-title").text(__t("Add recipe to %s", day.toString()));
$("#day").val(day.toString());
Grocy.Components.RecipePicker.Clear();
Grocy.Components.ProductPicker.Clear();
$("#add-recipe-modal").modal("show");
Grocy.FrontendHelpers.ValidateForm("add-recipe-form");
});
@ -538,6 +539,27 @@ $(window).on("resize", function()
calendar.fullCalendar("changeView", "basicWeek");
}
});
Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
{
var productId = $(e.target).val();
if (productId)
{
Grocy.Components.RecipePicker.SetValue('');
}
});
Grocy.Components.RecipePicker.GetPicker().on('change', function(e)
{
var recipeId = $(e.target).val();
if (recipeId)
{
Grocy.Components.ProductPicker.SetValue('');
}
});
function UndoStockTransaction(transactionId)
{
Grocy.Api.Post('stock/transactions/' + transactionId.toString() + '/undo', { },