dialogs for shopping list (#1103)

This commit is contained in:
kriddles
2020-10-29 11:09:35 -05:00
committed by GitHub
parent 1563870021
commit 64a2f5b25e
4 changed files with 31 additions and 10 deletions

View File

@@ -10,12 +10,14 @@
Grocy.Api.Post('objects/shopping_lists', jsonData,
function(result)
{
window.location.href = U('/shoppinglist?list=' + result.created_object_id);
window.parent.postMessage(WindowMessageBag("ShoppingListChanged", result.created_object_id), Grocy.BaseUrl);
window.parent.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("shopping-list-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}
);
}
@@ -24,12 +26,14 @@
Grocy.Api.Put('objects/shopping_lists/' + Grocy.EditObjectId, jsonData,
function(result)
{
window.location.href = U('/shoppinglist');
window.parent.postMessage(WindowMessageBag("ShoppingListChanged", Grocy.EditObjectId), Grocy.BaseUrl);
window.parent.postMessage(WindowMessageBag("Ready"), Grocy.BaseUrl);
window.parent.postMessage(WindowMessageBag("CloseAllModals"), Grocy.BaseUrl);
},
function(xhr)
{
Grocy.FrontendHelpers.EndUiBusy("shopping-list-form");
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response)
Grocy.FrontendHelpers.ShowGenericError('Error while saving, probably this item already exists', xhr.response);
}
);
}