Reorganize project part 1

This commit is contained in:
Bernd Bestel
2018-04-10 20:30:11 +02:00
parent 554a83fa01
commit bcd5092427
36 changed files with 771 additions and 499 deletions

View File

@@ -0,0 +1,38 @@
$('#save-battery-button').on('click', function(e)
{
e.preventDefault();
if (Grocy.EditMode === 'create')
{
Grocy.PostJson('/api/add-object/batteries', $('#battery-form').serializeJSON(),
function(result)
{
window.location.href = '/batteries';
},
function(xhr)
{
console.error(xhr);
}
);
}
else
{
Grocy.PostJson('/api/edit-object/batteries/' + Grocy.EditObjectId, $('#battery-form').serializeJSON(),
function(result)
{
window.location.href = '/batteries';
},
function(xhr)
{
console.error(xhr);
}
);
}
});
$(function()
{
$('#name').focus();
$('#battery-form').validator();
$('#battery-form').validator('validate');
});