mirror of
https://github.com/grocy/grocy.git
synced 2025-10-26 14:07:38 +00:00
37 lines
620 B
JavaScript
37 lines
620 B
JavaScript
|
|
$('#save-location-button').on('click', function(e)
|
|||
|
|
{
|
|||
|
|
e.preventDefault();
|
|||
|
|
|
|||
|
|
if (Grocy.EditMode === 'create')
|
|||
|
|
{
|
|||
|
|
Grocy.PostJson('/api/add-object/locations', $('#location-form').serializeJSON(),
|
|||
|
|
function(result)
|
|||
|
|
{
|
|||
|
|
window.location.href = '/locations';
|
|||
|
|
},
|
|||
|
|
function(xhr)
|
|||
|
|
{
|
|||
|
|
console.error(xhr);
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
Grocy.PostJson('/api/edit-object/locations/' + Grocy.EditObjectId, $('#location-form').serializeJSON(),
|
|||
|
|
function(result)
|
|||
|
|
{
|
|||
|
|
window.location.href = '/locations';
|
|||
|
|
},
|
|||
|
|
function(xhr)
|
|||
|
|
{
|
|||
|
|
console.error(xhr);
|
|||
|
|
}
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
$(function()
|
|||
|
|
{
|
|||
|
|
$('#name').focus();
|
|||
|
|
});
|