kopia lustrzana https://github.com/magicbug/Cloudlog
[Bands] Now saves when clicking checkbox
rodzic
66a54078e6
commit
f2fbe48b6f
|
@ -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>
|
||||
|
||||
|
|
|
@ -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">×</a>'+$(".band_"+id).parent("tr:first").find("td:first").text()+' band has been saved!</div>');
|
||||
$(".btnband_"+id).removeClass('running');
|
||||
$(".btnband_"+id).prop('disabled', false);
|
||||
}
|
||||
});
|
||||
}
|
Ładowanie…
Reference in New Issue