Add class and value to QSO checkboxes for batch actions

Added a 'qso-checkbox' class and value attribute to QSO checkboxes in the QSL print table for easier selection and identification. Updated JavaScript to use the new class for batch selection, row highlighting, and QSO actions, improving code clarity and maintainability.
这个提交包含在:
Peter Goodhall 2025-07-30 17:06:13 +01:00
父节点 095bf32781
当前提交 b66261179c
共有 2 个文件被更改,包括 10 次插入10 次删除

查看文件

@ -45,7 +45,7 @@ if ($qsos->result() != NULL) {
foreach ($qsos->result() as $qsl) { foreach ($qsos->result() as $qsl) {
echo '<tr id="qslprint_'.$qsl->COL_PRIMARY_KEY.'">'; 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\'><div class="form-check"><input class="form-check-input qso-checkbox" type="checkbox" value="'.$qsl->COL_PRIMARY_KEY.'" /></div></td>';
?><td style='text-align: center'><span class="qso_call"><a id="edit_qso" href="javascript:displayQso(<?php echo $qsl->COL_PRIMARY_KEY; ?>);"><?php echo str_replace("0","&Oslash;",strtoupper($qsl->COL_CALL)); ?></a><a target="_blank" href="https://www.qrz.com/db/<?php echo strtoupper($qsl->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/qrz.png" alt="Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on QRZ.com"></a> <a target="_blank" href="https://www.hamqth.com/<?php echo strtoupper($qsl->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/hamqth.png" alt="Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on HamQTH"></a> <a target="_blank" href="http://www.eqsl.cc/Member.cfm?<?php echo strtoupper($qsl->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/eqsl.png" alt="Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on eQSL.cc"></a></td><?php ?><td style='text-align: center'><span class="qso_call"><a id="edit_qso" href="javascript:displayQso(<?php echo $qsl->COL_PRIMARY_KEY; ?>);"><?php echo str_replace("0","&Oslash;",strtoupper($qsl->COL_CALL)); ?></a><a target="_blank" href="https://www.qrz.com/db/<?php echo strtoupper($qsl->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/qrz.png" alt="Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on QRZ.com"></a> <a target="_blank" href="https://www.hamqth.com/<?php echo strtoupper($qsl->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/hamqth.png" alt="Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on HamQTH"></a> <a target="_blank" href="http://www.eqsl.cc/Member.cfm?<?php echo strtoupper($qsl->COL_CALL); ?>"><img width="16" height="16" src="<?php echo base_url(); ?>images/icons/eqsl.png" alt="Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on eQSL.cc"></a></td><?php
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($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>'; echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';

查看文件

@ -149,19 +149,19 @@ function mark_qsl_sent(id, method) {
$(document).on('change', '#checkBoxAll', function (event) { $(document).on('change', '#checkBoxAll', function (event) {
if (this.checked) { if (this.checked) {
$('#qslprint_table tbody tr').each(function (i) { $('#qslprint_table tbody tr .qso-checkbox').each(function (i) {
$(this).addClass('activeRow'); $(this).prop("checked", true);
$(this).find("input[type=checkbox]").prop("checked", true); $(this).closest('tr').addClass('activeRow');
}); });
} else { } else {
$('#qslprint_table tbody tr').each(function (i) { $('#qslprint_table tbody tr .qso-checkbox').each(function (i) {
$(this).removeClass('activeRow'); $(this).prop("checked", false);
$(this).find("input[type=checkbox]").prop("checked", false); $(this).closest('tr').removeClass('activeRow');
}); });
} }
}); });
$(document).on('click', '#qslprint_table input[type="checkbox"]', function() { $(document).on('click', '.qso-checkbox', function() {
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
$(this).closest('tr').addClass('activeRow'); $(this).closest('tr').addClass('activeRow');
} else { } else {
@ -170,7 +170,7 @@ $(document).on('click', '#qslprint_table input[type="checkbox"]', function() {
}); });
function markSelectedQsos() { function markSelectedQsos() {
var elements = $('#qslprint_table tbody input:checked'); var elements = $('.qso-checkbox:checked');
var nElements = elements.length; var nElements = elements.length;
if (nElements == 0) { if (nElements == 0) {
return; return;
@ -202,7 +202,7 @@ function markSelectedQsos() {
} }
function removeSelectedQsos() { function removeSelectedQsos() {
var elements = $('#qslprint_table tbody input:checked'); var elements = $('.qso-checkbox:checked');
var nElements = elements.length; var nElements = elements.length;
if (nElements == 0) { if (nElements == 0) {
return; return;