From f2fbe48b6fb7ee06237d5836d4ba36003786402c Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 20 Sep 2022 10:49:49 +0200 Subject: [PATCH] [Bands] Now saves when clicking checkbox --- application/views/bands/index.php | 5 ----- assets/js/sections/bands.js | 12 ++++++------ 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/application/views/bands/index.php b/application/views/bands/index.php index bc3e5f4f..0c9faefd 100644 --- a/application/views/bands/index.php +++ b/application/views/bands/index.php @@ -43,8 +43,6 @@ CW QRG - - @@ -70,9 +68,6 @@ - - -
diff --git a/assets/js/sections/bands.js b/assets/js/sections/bands.js index 98bdab4c..7e686941 100644 --- a/assets/js/sections/bands.js +++ b/assets/js/sections/bands.js @@ -1,3 +1,9 @@ +$('.bandtable').on('click', 'input[type="checkbox"]', function() { + var clickedbandid = $(this).closest('td').attr("class"); + clickedbandid = clickedbandid.match(/\d+/)[0]; + saveBand(clickedbandid); +}); + $('.bandtable').DataTable({ "pageLength": 25, responsive: false, @@ -171,8 +177,6 @@ function deactivateAllBands() { } function saveBand(id) { - $(".btnband_"+id).addClass('running'); - $(".btnband_"+id).prop('disabled', true); $.ajax({ url: base_url + 'index.php/band/saveBand', type: 'post', @@ -189,10 +193,6 @@ function saveBand(id) { 'vucc': $(".vucc_"+id+" input[type='checkbox']").is(":checked") }, success: function (html) { - $(".alert").remove(); - $('.card-body').prepend(''); - $(".btnband_"+id).removeClass('running'); - $(".btnband_"+id).prop('disabled', false); } }); } \ No newline at end of file