mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Store the list of buttons at the workflow start and iterate over that as the workflow progresses. (#1599)
This commit is contained in:
parent
616e1dd5d7
commit
30e1a5c9b0
@ -264,10 +264,12 @@ $(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', fu
|
|||||||
Grocy.ShoppingListToStockWorkflowAll = false;
|
Grocy.ShoppingListToStockWorkflowAll = false;
|
||||||
Grocy.ShoppingListToStockWorkflowCount = 0;
|
Grocy.ShoppingListToStockWorkflowCount = 0;
|
||||||
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
||||||
|
Grocy.ShoppingListAddToStockButtonList = [];
|
||||||
$(document).on('click', '#add-all-items-to-stock-button', function(e)
|
$(document).on('click', '#add-all-items-to-stock-button', function(e)
|
||||||
{
|
{
|
||||||
Grocy.ShoppingListToStockWorkflowAll = true;
|
Grocy.ShoppingListToStockWorkflowAll = true;
|
||||||
Grocy.ShoppingListToStockWorkflowCount = $(".shopping-list-stock-add-workflow-list-item-button").length;
|
Grocy.ShoppingListAddToStockButtonList = $(".shopping-list-stock-add-workflow-list-item-button");
|
||||||
|
Grocy.ShoppingListToStockWorkflowCount = Grocy.ShoppingListAddToStockButtonList.length;
|
||||||
Grocy.ShoppingListToStockWorkflowCurrent++;
|
Grocy.ShoppingListToStockWorkflowCurrent++;
|
||||||
$(".shopping-list-stock-add-workflow-list-item-button").first().click();
|
$(".shopping-list-stock-add-workflow-list-item-button").first().click();
|
||||||
});
|
});
|
||||||
@ -277,6 +279,7 @@ $("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e)
|
|||||||
Grocy.ShoppingListToStockWorkflowAll = false;
|
Grocy.ShoppingListToStockWorkflowAll = false;
|
||||||
Grocy.ShoppingListToStockWorkflowCount = 0;
|
Grocy.ShoppingListToStockWorkflowCount = 0;
|
||||||
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
Grocy.ShoppingListToStockWorkflowCurrent = 0;
|
||||||
|
Grocy.ShoppingListAddToStockButtonList = [];
|
||||||
})
|
})
|
||||||
|
|
||||||
$(window).on("message", function(e)
|
$(window).on("message", function(e)
|
||||||
@ -298,7 +301,7 @@ $(window).on("message", function(e)
|
|||||||
Grocy.ShoppingListToStockWorkflowCurrent++;
|
Grocy.ShoppingListToStockWorkflowCurrent++;
|
||||||
if (Grocy.ShoppingListToStockWorkflowCurrent <= Grocy.ShoppingListToStockWorkflowCount)
|
if (Grocy.ShoppingListToStockWorkflowCurrent <= Grocy.ShoppingListToStockWorkflowCount)
|
||||||
{
|
{
|
||||||
$(".shopping-list-stock-add-workflow-list-item-button")[Grocy.ShoppingListToStockWorkflowCurrent - 1].click();
|
Grocy.ShoppingListAddToStockButtonList[Grocy.ShoppingListToStockWorkflowCurrent - 1].click();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user