From b66261179c02d214da96b80b2821d325180d0f39 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 30 Jul 2025 17:06:13 +0100 Subject: [PATCH] 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. --- application/views/qslprint/qslprint.php | 2 +- assets/js/sections/qslprint.js | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/application/views/qslprint/qslprint.php b/application/views/qslprint/qslprint.php index 90cced00..1d434248 100644 --- a/application/views/qslprint/qslprint.php +++ b/application/views/qslprint/qslprint.php @@ -45,7 +45,7 @@ if ($qsos->result() != NULL) { foreach ($qsos->result() as $qsl) { echo ''; - echo '
'; + echo '
'; ?>COL_CALL)); ?>Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on QRZ.com Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on HamQTH Lookup <?php echo strtoupper($qsl->COL_CALL); ?> on eQSL.cc'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ''; echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ''; diff --git a/assets/js/sections/qslprint.js b/assets/js/sections/qslprint.js index 29beeb9f..cde42d91 100644 --- a/assets/js/sections/qslprint.js +++ b/assets/js/sections/qslprint.js @@ -149,19 +149,19 @@ function mark_qsl_sent(id, method) { $(document).on('change', '#checkBoxAll', function (event) { if (this.checked) { - $('#qslprint_table tbody tr').each(function (i) { - $(this).addClass('activeRow'); - $(this).find("input[type=checkbox]").prop("checked", true); + $('#qslprint_table tbody tr .qso-checkbox').each(function (i) { + $(this).prop("checked", true); + $(this).closest('tr').addClass('activeRow'); }); } else { - $('#qslprint_table tbody tr').each(function (i) { - $(this).removeClass('activeRow'); - $(this).find("input[type=checkbox]").prop("checked", false); + $('#qslprint_table tbody tr .qso-checkbox').each(function (i) { + $(this).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")) { $(this).closest('tr').addClass('activeRow'); } else { @@ -170,7 +170,7 @@ $(document).on('click', '#qslprint_table input[type="checkbox"]', function() { }); function markSelectedQsos() { - var elements = $('#qslprint_table tbody input:checked'); + var elements = $('.qso-checkbox:checked'); var nElements = elements.length; if (nElements == 0) { return; @@ -202,7 +202,7 @@ function markSelectedQsos() { } function removeSelectedQsos() { - var elements = $('#qslprint_table tbody input:checked'); + var elements = $('.qso-checkbox:checked'); var nElements = elements.length; if (nElements == 0) { return;