mirror of
https://github.com/magicbug/Cloudlog
synced 2024-11-22 08:13:41 +00:00
[QSLPrint] Added checkboxes for multiselect
This commit is contained in:
parent
d2b5e24115
commit
c3c1ab2a13
@ -13,9 +13,10 @@ if (empty($station_id)) {
|
||||
}
|
||||
|
||||
if ($qsos->result() != NULL) {
|
||||
echo '<table style="width:100%" class="table table-sm table-bordered table-hover table-striped table-condensed">
|
||||
echo '<table style="width:100%" class="table table-sm table-bordered table-hover table-striped table-condensed qslprint">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style=\'text-align: center\'><div class="form-check" style="margin-top: -1.5em"><input class="form-check-input" type="checkbox" id="checkBoxAll" /></div></th>
|
||||
<th style=\'text-align: center\'>'.lang('gen_hamradio_callsign').'</th>
|
||||
<th style=\'text-align: center\'>' . lang('general_word_date') . '</th>
|
||||
<th style=\'text-align: center\'>'. lang('general_word_time') .'</th>
|
||||
@ -25,7 +26,7 @@ if ($qsos->result() != NULL) {
|
||||
<th style=\'text-align: center\'>' . lang('gen_hamradio_station') . '</th>
|
||||
<th style=\'text-align: center\'>Sent method</th>
|
||||
<th style=\'text-align: center\'>Mark as sent</th>
|
||||
<th style=\'text-align: center\'>Delete</th>
|
||||
<th style=\'text-align: center\'>Remove</th>
|
||||
<th style=\'text-align: center\'>QSO List</th>
|
||||
</tr>
|
||||
</thead><tbody>';
|
||||
@ -41,6 +42,7 @@ if ($qsos->result() != NULL) {
|
||||
|
||||
foreach ($qsos->result() as $qsl) {
|
||||
echo '<tr id="qslprint_'.$qsl->COL_PRIMARY_KEY.'">';
|
||||
echo '<td style=\'text-align: center\'><div class="form-check"><input class="form-check-input" type="checkbox" /></div></td>';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_CALL . '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';
|
||||
@ -57,11 +59,15 @@ if ($qsos->result() != NULL) {
|
||||
echo '</tbody></table>';
|
||||
?>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportcsv/' . $station_id); ?>" title="Export CSV-file" class="btn btn-primary">Export requested QSLs to CSV-file</a></p>
|
||||
<p><button onclick="markSelectedQsos();" title="Mark selected QSOs as printed" class="btn btn-success markallprinted">Mark selected QSOs as printed</button>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/exportadif/' . $station_id); ?>" title="Export ADIF" class="btn btn-primary">Export requested QSLs to ADIF-file</a></p>
|
||||
<button onclick="removeSelectedQsos();" title="Remove seleced QSOS from print queue" class="btn btn-danger removeall">Remove selected QSOs from the queue</button></p>
|
||||
|
||||
<p><a href="<?php echo site_url('qslprint/qsl_printed/' . $station_id); ?>" title="Mark QSLs as printed" class="btn btn-primary">Mark requested QSLs as sent</a></p>
|
||||
<p><a href="<?php echo site_url('qslprint/exportcsv/' . $station_id); ?>" title="Export CSV-file" class="btn btn-primary">Export requested QSLs to CSV-file</a>
|
||||
|
||||
<a href="<?php echo site_url('qslprint/exportadif/' . $station_id); ?>" title="Export ADIF" class="btn btn-primary">Export requested QSLs to ADIF-file</a>
|
||||
|
||||
<a href="<?php echo site_url('qslprint/qsl_printed/' . $station_id); ?>" title="Mark QSLs as printed" class="btn btn-primary">Mark requested QSLs as sent</a></p>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
|
@ -126,3 +126,91 @@ function mark_qsl_sent(id, method) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('#checkBoxAll').change(function (event) {
|
||||
if (this.checked) {
|
||||
$('.qslprint tbody tr').each(function (i) {
|
||||
$(this).closest('tr').addClass('activeRow');
|
||||
$(this).closest('tr').find("input[type=checkbox]").prop("checked", true);
|
||||
});
|
||||
} else {
|
||||
$('.qslprint tbody tr').each(function (i) {
|
||||
$(this).closest('tr').removeClass('activeRow');
|
||||
$(this).closest('tr').find("input[type=checkbox]").prop("checked", false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('.qslprint').on('click', 'input[type="checkbox"]', function() {
|
||||
if ($(this).is(":checked")) {
|
||||
$(this).closest('tr').addClass('activeRow');
|
||||
} else {
|
||||
$(this).closest('tr').removeClass('activeRow');
|
||||
}
|
||||
});
|
||||
|
||||
function markSelectedQsos() {
|
||||
var elements = $('.qslprint tbody input:checked');
|
||||
var nElements = elements.length;
|
||||
if (nElements == 0) {
|
||||
return;
|
||||
}
|
||||
$('.markallprinted').prop("disabled", true);
|
||||
var id_list=[];
|
||||
elements.each(function() {
|
||||
let id = $(this).first().closest('tr').attr('id');
|
||||
id = id.match(/\d/g);
|
||||
id = id.join("");
|
||||
id_list.push(id);
|
||||
});
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/logbookadvanced/update_qsl',
|
||||
type: 'post',
|
||||
data: {'id': JSON.stringify(id_list, null, 2),
|
||||
'sent' : 'Y',
|
||||
'method' : 'B'
|
||||
},
|
||||
success: function(data) {
|
||||
if (data !== []) {
|
||||
$.each(data, function(k, v) {
|
||||
$("#qslprint_"+this.qsoID).remove();
|
||||
});
|
||||
}
|
||||
$('.markallprinted').prop("disabled", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function removeSelectedQsos() {
|
||||
var elements = $('.qslprint tbody input:checked');
|
||||
var nElements = elements.length;
|
||||
if (nElements == 0) {
|
||||
return;
|
||||
}
|
||||
$('.removeall').prop("disabled", true);
|
||||
|
||||
var id_list=[];
|
||||
elements.each(function() {
|
||||
let id = $(this).first().closest('tr').attr('id');
|
||||
id = id.match(/\d/g);
|
||||
id = id.join("");
|
||||
id_list.push(id);
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/logbookadvanced/update_qsl',
|
||||
type: 'post',
|
||||
data: {'id': JSON.stringify(id_list, null, 2),
|
||||
'sent' : 'N',
|
||||
'method' : ''
|
||||
},
|
||||
success: function(data) {
|
||||
if (data !== []) {
|
||||
$.each(data, function(k, v) {
|
||||
$("#qslprint_"+this.qsoID).remove();
|
||||
});
|
||||
}
|
||||
$('.removeall').prop("disabled", false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user