mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Fixed the "Shopping list to stock workflow" with disabled FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING (fixes #537)
This commit is contained in:
@@ -163,7 +163,7 @@ function animateCSS(selector, animationName, callback, speed = "faster")
|
||||
{
|
||||
nodes.removeClass('animated').removeClass(speed).removeClass(animationName);
|
||||
nodes.unbind('animationend', handleAnimationEnd);
|
||||
|
||||
|
||||
if (typeof callback === 'function')
|
||||
{
|
||||
callback();
|
||||
|
@@ -178,6 +178,11 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
$("#tare-weight-handling-info").addClass("d-none");
|
||||
}
|
||||
|
||||
if (!Grocy.FeatureFlags.GROCY_FEATURE_FLAG_STOCK_BEST_BEFORE_DATE_TRACKING)
|
||||
{
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD'));
|
||||
}
|
||||
|
||||
if (productDetails.product.default_best_before_days.toString() !== '0')
|
||||
{
|
||||
if (productDetails.product.default_best_before_days == -1)
|
||||
@@ -192,12 +197,6 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().add(productDetails.product.default_best_before_days, 'days').format('YYYY-MM-DD'));
|
||||
}
|
||||
$('#amount').focus();
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
|
||||
{
|
||||
$("#save-purchase-button").click();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,11 +206,16 @@ if (Grocy.Components.ProductPicker !== undefined)
|
||||
}
|
||||
else
|
||||
{
|
||||
Grocy.Components.DateTimePicker.SetValue(moment().format('YYYY-MM-DD'));
|
||||
$('#amount').focus();
|
||||
}
|
||||
}
|
||||
|
||||
Grocy.FrontendHelpers.ValidateForm('purchase-form');
|
||||
if (GetUriParam("flow") === "shoppinglistitemtostock" && BoolVal(Grocy.UserSettings.shopping_list_to_stock_workflow_auto_submit_when_prefilled) && document.getElementById("purchase-form").checkValidity() === true)
|
||||
{
|
||||
$("#save-purchase-button").click();
|
||||
}
|
||||
|
||||
if (BoolVal(Grocy.UserSettings.scan_mode_purchase_enabled))
|
||||
{
|
||||
$("#amount").val(1);
|
||||
|
@@ -95,7 +95,7 @@ $(document).on('click', '.shoppinglist-delete-button', function(e)
|
||||
var shoppingListItemId = $(e.currentTarget).attr('data-shoppinglist-id');
|
||||
Grocy.FrontendHelpers.BeginUiBusy();
|
||||
|
||||
Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, {},
|
||||
Grocy.Api.Delete('objects/shopping_list/' + shoppingListItemId, { },
|
||||
function(result)
|
||||
{
|
||||
animateCSS("#shoppinglistitem-" + shoppingListItemId + "-row", "fadeOut", function()
|
||||
|
Reference in New Issue
Block a user