[QSO Entry] Add summary for more awards

This commit is contained in:
Andreas Kristiansen
2025-03-24 10:01:41 +01:00
parent 005246882c
commit a313d261a7
5 changed files with 279 additions and 46 deletions

View File

@@ -668,7 +668,7 @@ class QSO extends CI_Controller {
/**
* Open the API url which causes the browser to open the QSO live logging and populate the callsign with the data from the API
*
*
* Usage example:
* https://<URL to Wavelog>/index.php/qso/log_qso?callsign=4W7EST
*/
@@ -697,7 +697,7 @@ class QSO extends CI_Controller {
}
/**
* Easy modal Loader
* Easy modal Loader
* Used for Share Modal in QSO Details view
*/
function getShareModal() {
@@ -711,4 +711,8 @@ class QSO extends CI_Controller {
$this->load->view('qso/components/share_modal', $data, false);
}
function getAwardTabs() {
$this->load->view('qso/award_tabs');
}
}

View File

@@ -24,44 +24,42 @@ foreach ($result as $mode => $value) {
}
if ($showRow) {
echo '<tr>
<td>'. strtoupper($mode) .'</td>';
echo '<tr><td>' . strtoupper($mode) . '</td>';
$typeMapping = [
'dxcc' => $dxcc,
'iota' => $iota,
'vucc' => substr(trim($grid), 0, 4),
'cq' => $cqz,
'was' => $was,
'sota' => $sota,
'wwff' => $wwff,
'itu' => $ituz,
'continent' => $continent,
'pota' => $pota,
];
foreach ($value as $key => $val) {
switch($type) {
// function displayContacts(searchphrase, band, sat, orbit, mode, type, qsl) {
$searchPhrase = isset($typeMapping[$type]) ? str_replace("&", "%26", $typeMapping[$type]) : '';
case 'dxcc': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $dxcc).'","' . $key . '","All","All","' . $mode . '","DXCC2")\'>' . $val . '</a>'; break;
case 'iota': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $iota).'","' . $key . '","All","All","' . $mode . '","IOTA")\'>' . $val . '</a>'; break;
case 'vucc': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $grid).'","' . $key . '","All","All","' . $mode . '","VUCC")\'>' . $val . '</a>'; break;
case 'cq': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $cqz).'","' . $key . '","All","All","' . $mode . '","CQZone")\'>' . $val . '</a>'; break;
case 'was': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $was).'","' . $key . '","All","All","' . $mode . '","WAS")\'>' . $val . '</a>'; break;
case 'sota': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $sota).'","' . $key . '","All","All","' . $mode . '","SOTA")\'>' . $val . '</a>'; break;
case 'pota': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $pota).'","' . $key . '","All","All","' . $mode . '","POTA")\'>' . $val . '</a>'; break;
case 'wwff': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $wwff).'","' . $key . '","All","All","' . $mode . '","WWFF")\'>' . $val . '</a>'; break;
case 'itu': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $ituz).'","' . $key . '","All","All","' . $mode . '","ITU")\'>' . $val . '</a>'; break;
case 'continent': $linkinfo = '<a href=\'javascript:displayContacts("'.str_replace("&", "%26", $continent).'","' . $key . '","All","All","' . $mode . '","WAC")\'>' . $val . '</a>'; break;
$linkinfo = $searchPhrase
? "<a href='javascript:displayContacts(\"$searchPhrase\",\"$key\",\"All\",\"All\",\"$mode\",\"" . strtoupper($type) . "\")'>$val</a>"
: $val;
$tdClass = ($current_band == $key && strtoupper($current_mode) == strtoupper($mode))
? "class='border-3 border-danger'"
: '';
$content = $val;
if ($val === 'W') {
$content = "<div class='bg-danger awardsBgDanger'>$linkinfo</div>";
} elseif ($val === 'C') {
$content = "<div class='bg-success awardsBgSuccess'>$linkinfo</div>";
}
if ($current_band == $key && strtoupper($current_mode )== strtoupper($mode)) {
$info = '<td class=\'border-3 border-danger\'>';
} else {
$info = '<td>';
}
if ($val == 'W') {
$info .= '<div class=\'bg-danger awardsBgDanger\'>' . $linkinfo . '</div>';
}
else if ($val == 'C') {
$info .= '<div class=\'bg-success awardsBgSuccess\'>' . $linkinfo . '</div>';
}
else {
$info .= $val;
}
$info .= '</td>';
echo $info;
echo "<td $tdClass>$content</td>";
}
echo '</tr>';
}
}

View File

@@ -0,0 +1,49 @@
<div class="card">
<div class="card-header">
<ul style="font-size: 15px;" class="nav nav-tabs card-header-tabs pull-right" id="awardTab" role="tablist">
<li class="nav-item">
<a class="nav-link active" id="dxcc-summary-tab" data-bs-toggle="tab" href="#dxcc-summary" role="tab" aria-controls="dxcc-summary" aria-selected="true"><?= __("DXCC"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="cq-summary-tab" data-bs-toggle="tab" href="#cq-summary" role="tab" aria-controls="cq-summary" aria-selected="false"><?= __("CQ"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="state-summary-tab" data-bs-toggle="tab" href="#state-summary" role="tab" aria-controls="state-summary" aria-selected="false"><?= __("State"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="pota-summary-tab" data-bs-toggle="tab" href="#pota-summary" role="tab" aria-controls="pota-summary" aria-selected="false"><?= __("Pota"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="continent-summary-tab" data-bs-toggle="tab" href="#continent-summary" role="tab" aria-controls="continent-summary" aria-selected="false"><?= __("Continent"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="sota-summary-tab" data-bs-toggle="tab" href="#sota-summary" role="tab" aria-controls="sota-summary" aria-selected="false"><?= __("Sota"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="gridsquare-summary-tab" data-bs-toggle="tab" href="#gridsquare-summary" role="tab" aria-controls="gridsquare-summary" aria-selected="false"><?= __("Gridsquare"); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" id="wwff-summary-tab" data-bs-toggle="tab" href="#wwff-summary" role="tab" aria-controls="wwff-summary" aria-selected="false"><?= __("WWFF"); ?></a>
</li>
</ul>
</div>
<div class="card-body">
<div class="tab-content">
<div class="tab-pane fade show active" id="dxcc-summary" role="tabpanel" aria-labelledby="dxcc-summary-tab"></div>
<div class="tab-pane fade" id="cq-summary" role="tabpanel" aria-labelledby="cq-summary-tab"></div>
<div class="tab-pane fade" id="state-summary" role="tabpanel" aria-labelledby="state-summary-tab"></div>
<div class="tab-pane fade" id="pota-summary" role="tabpanel" aria-labelledby="pota-summary-tab"></div>
<div class="tab-pane fade" id="continent-summary" role="tabpanel" aria-labelledby="continent-summary-tab"></div>
<div class="tab-pane fade" id="sota-summary" role="tabpanel" aria-labelledby="sota-summary-tab"></div>
<div class="tab-pane fade" id="gridsquare-summary" role="tabpanel" aria-labelledby="gridsquare-summary-tab"></div>
<div class="tab-pane fade" id="wwff-summary" role="tabpanel" aria-labelledby="wwff-summary-tab"></div>
</div>
</div>
</div>

View File

@@ -842,12 +842,8 @@ function getDxccResult(dxcc, name) {
current_mode: $('#mode').val(),
},
success: function (html) {
$('.dxccsummary').remove();
$('.qsopane').append('<div class="dxccsummary col-sm-12"><br><div class="card"><div class="card-header dxccsummaryheader" data-bs-toggle="collapse" data-bs-target=".dxccsummarybody">' + lang_dxccsummary_for + name + '</div><div class="card-body collapse dxccsummarybody"></div></div></div>');
$('.dxccsummarybody').append(html);
$('.dxccsummaryheader').click(function(){
$('.dxccsummaryheader').toggleClass('dxccsummaryheaderopened');
});
$('#dxcc-summary').empty();
$('#dxcc-summary').append(html);
}
});
}

View File

@@ -697,7 +697,7 @@ $("#callsign").on("focusout", function () {
$('#lotw_link').attr('href', "https://lotw.arrl.org/lotwuser/act?act=" + callsign.replace('Ø', '0'));
$('#lotw_link').attr('target', "_blank");
$('#lotw_info').attr('data-bs-toggle', "tooltip");
if (result.lotw_days == 1) {
if (result.lotw_days == 1) {
$('#lotw_info').attr('data-bs-original-title', lang_lotw_upload_day_ago);
} else {
$('#lotw_info').attr('data-bs-original-title', lang_lotw_upload_days_ago.replace('%x', result.lotw_days));
@@ -853,9 +853,11 @@ $("#callsign").on("focusout", function () {
/* display past QSOs */
$('#partial_view').html(result.partial);
// Get DXX Summary
getDxccResult(result.dxcc.adif, convert_case(result.dxcc.entity));
}
// Get DXCC Summary
loadAwardTabs(function() {
getDxccResult(result.dxcc.adif, convert_case(result.dxcc.entity));
});
}
// else {
// console.log("Callsigns do not match, skipping lookup");
// console.log("Typed Callsign: " + $('#callsign').val());
@@ -868,6 +870,190 @@ $("#callsign").on("focusout", function () {
}
})
// This function executes the call to the backend for fetching cq summary and inserted table below qso entry
function getCqResult() {
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'cq',
cqz: $('#cqz').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#cq-summary').empty();
$('#cq-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching was summary and inserted table below qso entry
function getWasResult() {
if ($('#stateDropdown').val() === '') return;
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'was',
was: $('#stateDropdown').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#state-summary').empty();
$('#state-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching sota summary and inserted table below qso entry
function getSotaResult() {
if ($('#sota_ref').val() === '') return;
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'sota',
sota: $('#sota_ref').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#sota-summary').empty();
$('#sota-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching pota summary and inserted table below qso entry
function getPotaResult() {
if ($('#pota_ref').val() === '') return;
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'pota',
pota: $('#pota_ref').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#pota-summary').empty();
$('#pota-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching continent summary and inserted table below qso entry
function getContinentResult() {
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'continent',
continent: $('#continent').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#continent-summary').empty();
$('#continent-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching wwff summary and inserted table below qso entry
function getWwffResult() {
if ($('#wwff_ref').val() === '') return;
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'wwff',
wwff: $('#wwff_ref').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#wwff-summary').empty();
$('#wwff-summary').append(html);
}
});
}
// This function executes the call to the backend for fetching gridsquare summary and inserted table below qso entry
function getGridsquareResult() {
if ($('#locator').val() === '') return;
$.ajax({
url: base_url + 'index.php/lookup/search',
type: 'post',
data: {
type: 'vucc',
grid: $('#locator').val(),
reduced_mode: true,
current_band: $('#band').val(),
current_mode: $('#mode').val(),
},
success: function (html) {
$('#gridsquare-summary').empty();
$('#gridsquare-summary').append(html);
}
});
}
function loadAwardTabs(callback) {
$.ajax({
url: base_url + 'index.php/qso/getAwardTabs',
type: 'post',
data: {},
success: function (html) {
$('.awardpane').remove();
$('.qsopane').append('<div class="awardpane col-sm-12"></div>');
$('.awardpane').append(html);
// Execute callback if provided
if (typeof callback === "function") {
callback();
}
$("a[href='#cq-summary']").on('shown.bs.tab', function(e) {
getCqResult();
});
$("a[href='#state-summary']").on('shown.bs.tab', function(e) {
getWasResult();
});
$("a[href='#pota-summary']").on('shown.bs.tab', function(e) {
getPotaResult();
});
$("a[href='#continent-summary']").on('shown.bs.tab', function(e) {
getContinentResult();
});
$("a[href='#sota-summary']").on('shown.bs.tab', function(e) {
getSotaResult();
});
$("a[href='#gridsquare-summary']").on('shown.bs.tab', function(e) {
getGridsquareResult();
});
$("a[href='#wwff-summary']").on('shown.bs.tab', function(e) {
getWwffResult();
});
}
});
}
/* time input shortcut */
$('#start_time').on('change', function () {
var raw_time = $(this).val();
@@ -1219,7 +1405,7 @@ function resetDefaultQSOFields() {
$('#stateDropdown').val("");
$('#callsign-image').attr('style', 'display: none;');
$('#callsign-image-content').text("");
$('.dxccsummary').remove();
$('.awardpane').remove();
$('#timesWorked').html(lang_qso_title_previous_contacts);
}