diff --git a/data/interfaces/default/info.html b/data/interfaces/default/info.html index 46465a92..04185bf5 100644 --- a/data/interfaces/default/info.html +++ b/data/interfaces/default/info.html @@ -409,13 +409,38 @@ DOCUMENTATION :: END clearSearchButton('history_table', history_table); - $('#row-edit-mode').click(function() { + $('#row-edit-mode').on('click', function() { + $('#row-edit-mode-alert').fadeIn(200); + if ($(this).hasClass('active')) { - $('.delete-control').each(function() { + if (history_to_delete.length > 0) { + $('#deleteCount').text(history_to_delete.length); + $('#confirm-modal').modal(); + $('#confirm-modal').one('click', '#confirm-delete', function () { + for (var i = 0; i < history_to_delete.length; i++) { + $.ajax({ + url: 'delete_history_rows', + data: { row_id: history_to_delete[i] }, + async: true, + success: function (data) { + var msg = "History deleted"; + showMsg(msg, false, true, 2000); + } + }); + } + history_table.draw(); + }); + } + + $('.delete-control').each(function () { $(this).addClass('hidden'); + $('#row-edit-mode-alert').fadeOut(200); }); + } else { + history_to_delete = []; $('.delete-control').each(function() { + $(this).find('button.btn-danger').toggleClass('btn-warning').toggleClass('btn-danger'); $(this).removeClass('hidden'); }); }