From 9d73c30f916e8c56a55c8240b9178a79f3945bf6 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Wed, 5 Jul 2023 09:29:13 +0200 Subject: [PATCH] [Advanced Logbook] Added Quickfilter search. Mark one line and click filter button --- application/controllers/Logbookadvanced.php | 1 + application/models/Logbookadvanced_model.php | 5 ++ application/views/logbookadvanced/index.php | 57 +++++++++++++----- assets/js/sections/logbookadvanced.js | 63 ++++++++++++++++++++ src/QSLManager/QSO.php | 4 +- 5 files changed, 112 insertions(+), 18 deletions(-) diff --git a/application/controllers/Logbookadvanced.php b/application/controllers/Logbookadvanced.php index 736fc077..1bb0432c 100644 --- a/application/controllers/Logbookadvanced.php +++ b/application/controllers/Logbookadvanced.php @@ -104,6 +104,7 @@ class Logbookadvanced extends CI_Controller { 'propmode' => xss_clean($this->input->post('propmode')), 'gridsquare' => xss_clean($this->input->post('gridsquare')), 'state' => xss_clean($this->input->post('state')), + 'cqzone' => xss_clean($this->input->post('cqzone')), 'qsoresults' => xss_clean($this->input->post('qsoresults')), 'sats' => xss_clean($this->input->post('sats')), 'lotwSent' => xss_clean($this->input->post('lotwSent')), diff --git a/application/models/Logbookadvanced_model.php b/application/models/Logbookadvanced_model.php index cc361181..8fb7f61d 100644 --- a/application/models/Logbookadvanced_model.php +++ b/application/models/Logbookadvanced_model.php @@ -89,6 +89,11 @@ class Logbookadvanced_model extends CI_Model { $binding[] = $searchCriteria['state']; } + if ($searchCriteria['cqzone'] !== '') { + $conditions[] = "COL_CQZ = ?"; + $binding[] = $searchCriteria['cqzone']; + } + if ($searchCriteria['gridsquare'] !== '') { $conditions[] = "(COL_GRIDSQUARE like ? or COL_VUCC_GRIDS like ?)"; $binding[] = '%' . $searchCriteria['gridsquare'] . '%'; diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index 671ba95c..894e2483 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -144,6 +144,18 @@ +
+ + +
@@ -216,28 +228,41 @@
+
+ With selected : + + + + + + + + + + + + + + +
+
+
- With selected : - - - - - - - - - - - - - - - + Quick search with selected : + + + + + + + +
+ diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 16c76ea3..5babec70 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -188,6 +188,7 @@ $(document).ready(function () { state: this.state.value, qsoresults: this.qsoResults.value, sats: this.sats.value, + cqzone: this.cqzone.value, lotwSent: this.lotwSent.value, lotwReceived: this.lotwReceived.value, eqslSent: this.eqslSent.value, @@ -359,6 +360,68 @@ $(document).ready(function () { handleQslReceived('Y','D', 'receivedDirect'); }); + $('#searchGridsquare').click(function (event) { + quickSearch('gridsquare'); + }); + + $('#searchState').click(function (event) { + quickSearch('state'); + }); + + $('#searchIota').click(function (event) { + quickSearch('iota'); + }); + + $('#searchDxcc').click(function (event) { + quickSearch('dxcc'); + }); + + $('#searchCallsign').click(function (event) { + quickSearch('dx'); + }); + + $('#searchCqZone').click(function (event) { + quickSearch('cqzone'); + }); + + $('#searchMode').click(function (event) { + quickSearch('mode'); + }); + + $('#searchBand').click(function (event) { + quickSearch('band'); + }); + + function quickSearch(type) { + var elements = $('#qsoList tbody input:checked'); + var nElements = elements.length; + if (nElements == 0) { + return; + } + if (nElements > 1) { + alert("Only 1 row can be selected"); + //popup message that only 1 row can be selected + } + elements.each(function() { + var currentRow = $(this).first().closest('tr'); + var col1 = ''; + switch (type) { + case 'dxcc': col1 = currentRow.find("td:eq(16)").html(); col1 = col1.match(/\d/g); col1 = col1.join("");break; + case 'dx': col1 = currentRow.find("td:eq(3)").text(); col1 = col1.match(/^([^\s]+)/gm); break; + case 'iota': col1 = currentRow.find("td:eq(19)").text(); col1 = col1.trim(); break; + case 'state': col1 = currentRow.find("td:eq(17)").text(); break; + case 'cqzone': col1 = currentRow.find("td:eq(18)").text(); break; + case 'gridsquare': col1 = $(currentRow).find('#dxgrid').text(); col1 = col1.substring(0, 4); break; + case 'mode': col1 = currentRow.find("td:eq(4)").text(); break; + case 'band': col1 = currentRow.find("td:eq(7)").text(); col1 = col1.match(/\S\w*/); break; + } + if (col1.length == 0) return; + $('#searchForm').trigger("reset"); + $("#"+type).val(col1); + $('#searchForm').submit(); + }); + } + $('#printLabel').click(function (event) { var elements = $('#qsoList tbody input:checked'); var nElements = elements.length; diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index 0e96988a..472fe629 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -841,9 +841,9 @@ class QSO { $refs = []; if ($this->dxVUCCGridsquares !== '') { - $refs[] = $this->dxVUCCGridsquares . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); + $refs[] = '' . $this->dxVUCCGridsquares . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); } else if ($this->dxGridsquare !== '') { - $refs[] = $this->dxGridsquare . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); + $refs[] = '' . $this->dxGridsquare . ' ' .$this->getQrbLink($this->stationGridsquare, $this->dxVUCCGridsquares, $this->dxGridsquare); } if ($this->dxSOTAReference !== '') { $refs[] = "SOTA:" . $this->dxSOTAReference;