mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 16:44:55 +00:00
37 lines
650 B
JavaScript
37 lines
650 B
JavaScript
![]() |
$('#save-quantityunit-button').on('click', function(e)
|
|||
|
{
|
|||
|
e.preventDefault();
|
|||
|
|
|||
|
if (Grocy.EditMode === 'create')
|
|||
|
{
|
|||
|
Grocy.PostJson('/api/add-object/quantity_units', $('#quantityunit-form').serializeJSON(),
|
|||
|
function(result)
|
|||
|
{
|
|||
|
window.location.href = '/quantityunits';
|
|||
|
},
|
|||
|
function(xhr)
|
|||
|
{
|
|||
|
console.error(xhr);
|
|||
|
}
|
|||
|
);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Grocy.PostJson('/api/edit-object/quantity_units/' + Grocy.EditObjectId, $('#quantityunit-form').serializeJSON(),
|
|||
|
function(result)
|
|||
|
{
|
|||
|
window.location.href = '/quantityunits';
|
|||
|
},
|
|||
|
function(xhr)
|
|||
|
{
|
|||
|
console.error(xhr);
|
|||
|
}
|
|||
|
);
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
$(function()
|
|||
|
{
|
|||
|
$('#name').focus();
|
|||
|
});
|