[Bands] Now saves when clicking checkbox

pull/1609/head
Andreas 2022-09-20 10:49:49 +02:00
rodzic 66a54078e6
commit f2fbe48b6f
2 zmienionych plików z 6 dodań i 11 usunięć

Wyświetl plik

@ -43,8 +43,6 @@
<th>CW QRG</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@ -70,9 +68,6 @@
</td>
<td>
<a href="javascript:deleteBand('<?php echo $band->id . '\',\'' . $band->band ?>');" class="btn btn-danger btn-sm" title="Delete"><i class="fas fa-trash-alt"></i></a>
</td>
<td>
<a href="javascript:saveBand('<?php echo $band->id . '\',\'' . $band->band ?>');" class="btn btn-primary btn-sm ld-ext-right btnband_<?php echo $band->id ?>" title="Save band"><i class="fas fa-save"></i></i><div class="ld ld-ring ld-spin"></div></a>
</td>
</tr>

Wyświetl plik

@ -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('<div class="alert alert-success" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>'+$(".band_"+id).parent("tr:first").find("td:first").text()+' band has been saved!</div>');
$(".btnband_"+id).removeClass('running');
$(".btnband_"+id).prop('disabled', false);
}
});
}