mirror of
https://github.com/grocy/grocy.git
synced 2025-10-22 20:46:33 +00:00
Add journal and undo UI for stock bookings, chore executions and battery charge cycles (closes #63, closes #97)
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
Grocy.Api.Get('batteries/track-charge-cycle/' + jsonForm.battery_id + '?tracked_time=' + $('#tracked_time').find('input').val(),
|
||||
function(result)
|
||||
{
|
||||
toastr.success(L('Tracked charge cylce of battery #1 on #2', batteryDetails.battery.name, $('#tracked_time').find('input').val()));
|
||||
toastr.success(L('Tracked charge cycle of battery #1 on #2', batteryDetails.battery.name, $('#tracked_time').find('input').val()) + '<br><a class="btn btn-secondary btn-sm mt-2" href="#" onclick="UndoChargeCycle(' + result.charge_cycle_id + ')"><i class="fas fa-undo"></i> ' + L("Undo") + '</a>');
|
||||
|
||||
$('#battery_id').val('');
|
||||
$('#battery_id_text_input').focus();
|
||||
@@ -86,3 +86,16 @@ $('#tracked_time').find('input').on('keypress', function (e)
|
||||
Grocy.FrontendHelpers.ValidateForm('batterytracking-form');
|
||||
});
|
||||
|
||||
function UndoChargeCycle(chargeCycleId)
|
||||
{
|
||||
Grocy.Api.Get('batteries/undo-charge-cycle/' + chargeCycleId.toString(),
|
||||
function(result)
|
||||
{
|
||||
toastr.success(L("Charge cycle successfully undone"));
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
console.error(xhr);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user