From 682f606d3fa1f9815a543404283c8072850f6bc3 Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 14 Jan 2025 10:03:53 +0100 Subject: [PATCH] Add units and make sortable --- application/views/logbookadvanced/index.php | 6 +++--- assets/js/sections/logbookadvanced.js | 24 +++++++++++++++------ src/QSLManager/QSO.php | 6 +++--- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/application/views/logbookadvanced/index.php b/application/views/logbookadvanced/index.php index dd780c95a..ba2df3af6 100644 --- a/application/views/logbookadvanced/index.php +++ b/application/views/logbookadvanced/index.php @@ -736,16 +736,16 @@ $options = json_decode($options); echo '' . __("Distance") . ''; } ?> antennaazimuth->show ?? "true") == "true") { - echo '' . __("Ant az") . ''; + echo '' . __("Ant az") . ''; } ?> antennaelevation->show ?? "true") == "true") { - echo '' . __("Ant el") . ''; + echo '' . __("Ant el") . ''; } ?> profilename->show ?? "true") == "true") { echo '' . __("Profile name") . ''; } ?> stationpower->show ?? "true") == "true") { - echo '' . __("Station power") . ''; + echo '' . __("Station power") . ''; } ?> diff --git a/assets/js/sections/logbookadvanced.js b/assets/js/sections/logbookadvanced.js index 9b9f71c34..abab63dd4 100644 --- a/assets/js/sections/logbookadvanced.js +++ b/assets/js/sections/logbookadvanced.js @@ -169,11 +169,23 @@ function loadQSOTable(rows) { url: getDataTablesLanguageUrl(), }, "columnDefs": [ - { - "targets": $(".distance-column-sort").index(), - "type": "distance", // use the custom sort type from the previous example - } - ] + { + "targets": $(".distance-column-sort").index(), + "type": "numbersort", // use the custom sort type from the previous example + }, + { + "targets": $(".antennaazimuth-column-sort").index(), + "type": "numbersort", + }, + { + "targets": $(".antennaelevation-column-sort").index(), + "type": "numbersort", + }, + { + "targets": $(".stationpower-column-sort").index(), + "type": "numbersort", + }, + ] // colReorder: { // order: [0, 2,1,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18] // // order: [0, customsortorder] @@ -337,7 +349,7 @@ function loadQSOTable(rows) { $('[data-bs-toggle="tooltip"]').tooltip(); } -$.fn.dataTable.ext.type.order['distance-pre'] = function(data) { +$.fn.dataTable.ext.type.order['numbersort-pre'] = function(data) { var num = parseFloat(data); return isNaN(num) ? 0 : num; }; diff --git a/src/QSLManager/QSO.php b/src/QSLManager/QSO.php index a28002591..f0b95f5ac 100644 --- a/src/QSLManager/QSO.php +++ b/src/QSLManager/QSO.php @@ -1224,11 +1224,11 @@ class QSO 'sig' => $this->getFormattedSig(), 'continent' => $this->continent, 'profilename' => $this->profilename, - 'stationpower' => $this->stationpower, + 'stationpower' => empty($this->stationpower) ? null : $this->stationpower.' W', 'distance' => $this->getFormattedDistance(), 'region' => $this->region, - 'antennaelevation' => $this->antennaelevation, - 'antennaazimuth' => $this->antennaazimuth + 'antennaelevation' => empty($this->antennaelevation) ? null : $this->antennaelevation.'°', + 'antennaazimuth' => empty($this->antennaazimuth) ? null : $this->antennaazimuth.'°' ]; }