Add possibility to skip items in "all shopping list items to stock workflow" (closes #116)

This commit is contained in:
Bernd Bestel 2018-11-26 20:02:01 +01:00
parent 02163c4305
commit 5c25e91984
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
3 changed files with 22 additions and 1 deletions

View File

@ -325,5 +325,6 @@ return array(
'Show clock in header' => 'Show clock in header',
'Stock settings' => 'Stock settings',
'Shopping list to stock workflow' => 'Shopping list to stock workflow',
'Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set' => 'Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set'
'Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set' => 'Automatically do the booking using the last price and the amount of the shopping list item, if the product has "Default best before days" set',
'Skip' => 'Überspringen'
);

View File

@ -149,6 +149,11 @@ $(document).on('click', '.shopping-list-stock-add-workflow-list-item-button', fu
{
$("#shopping-list-stock-add-workflow-purchase-item-count").removeClass("d-none");
$("#shopping-list-stock-add-workflow-purchase-item-count").text(L("Adding shopping list item #1 of #2", Grocy.ShoppingListToStockWorkflowCurrent, Grocy.ShoppingListToStockWorkflowCount));
$("#shopping-list-stock-add-workflow-skip-button").removeClass("d-none");
}
else
{
$("#shopping-list-stock-add-workflow-skip-button").addClass("d-none");
}
});
@ -163,6 +168,13 @@ $(document).on('click', '#add-all-items-to-stock-button', function(e)
$(".shopping-list-stock-add-workflow-list-item-button").first().click();
});
$("#shopping-list-stock-add-workflow-modal").on("hidden.bs.modal", function(e)
{
Grocy.ShoppingListToStockWorkflowAll = false;
Grocy.ShoppingListToStockWorkflowCount = 0;
Grocy.ShoppingListToStockWorkflowCurrent = 0;
})
$(window).on("message", function(e)
{
var data = e.originalEvent.data;
@ -196,6 +208,13 @@ $(window).on("message", function(e)
}
});
$(document).on('click', '#shopping-list-stock-add-workflow-skip-button', function(e)
{
e.preventDefault();
window.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
});
function OnListItemRemoved()
{
if ($(".shopping-list-stock-add-workflow-list-item-button").length === 0)

View File

@ -108,6 +108,7 @@
</div>
<div class="modal-footer">
<span id="shopping-list-stock-add-workflow-purchase-item-count" class="d-none mr-auto"></span>
<button id="shopping-list-stock-add-workflow-skip-button" type="button" class="btn btn-primary"><i class="fas fa-angle-double-right"></i> {{ $L('Skip') }}</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ $L('Close') }}</button>
</div>
</div>