diff --git a/application/views/bandmap/list.php b/application/views/bandmap/list.php index d37489220..0d9161e13 100644 --- a/application/views/bandmap/list.php +++ b/application/views/bandmap/list.php @@ -220,6 +220,7 @@ = __("New Callsign"); ?> = __("Worked Callsign"); ?> = __("Contest"); ?> + = __("DX Spot"); ?> = __("Additional Flags"); ?> @@ -396,6 +397,9 @@ "> = __("LoTW users"); ?> + "> + = __("DX Spot"); ?> + "> = __("Continent"); ?> diff --git a/assets/css/bandmap_list.css b/assets/css/bandmap_list.css index ca6a14641..7d81fef11 100644 --- a/assets/css/bandmap_list.css +++ b/assets/css/bandmap_list.css @@ -689,7 +689,8 @@ body.fullscreen-active { padding-right: 15px; } -.table-responsive { +/* Only apply custom table-responsive styling to bandmap container */ +#bandmapContainer .table-responsive { overflow: auto; margin: 0; padding: 0; diff --git a/assets/js/sections/bandmap_list.js b/assets/js/sections/bandmap_list.js index 21c6a8333..a228d81a6 100644 --- a/assets/js/sections/bandmap_list.js +++ b/assets/js/sections/bandmap_list.js @@ -243,6 +243,7 @@ $(function() { // Required flags buttons const requiredFlagButtons = [ { id: '#toggleLotwFilter', flag: 'lotw' }, + { id: '#toggleDxSpotFilter', flag: 'dxspot' }, { id: '#toggleNewContinentFilter', flag: 'newcontinent' }, { id: '#toggleDxccNeededFilter', flag: 'newcountry' }, { id: '#toggleNewCallsignFilter', flag: 'newcallsign' }, @@ -823,6 +824,12 @@ $(function() { if (reqFlag === 'lotw') { if (!single.dxcc_spotted || !single.dxcc_spotted.lotw_user) return; } + if (reqFlag === 'dxspot') { + // DX Spot: spotted continent must be different from spotter continent + let spottedCont = single.dxcc_spotted?.cont; + let spotterCont = single.dxcc_spotter?.cont; + if (!spottedCont || !spotterCont || spottedCont === spotterCont) return; + } if (reqFlag === 'newcontinent') { if (single.worked_continent !== false) return; // Only new continents } @@ -1069,11 +1076,21 @@ $(function() { continent_wked_info = "text-danger"; } let continent_value = (single.dxcc_spotted && single.dxcc_spotted.cont) ? single.dxcc_spotted.cont : ''; - continent_wked_info = continent_value ? ((continent_wked_info != '' ? '' : '') + continent_value + (continent_wked_info != '' ? '' : '')) : ''; + if (continent_value) { + let continent_display = (continent_wked_info != '' ? '' : '') + continent_value + (continent_wked_info != '' ? '' : ''); + continent_wked_info = '' + continent_display + ''; + } else { + continent_wked_info = ''; + } data[0].push(continent_wked_info); // CQ Zone column: show CQ Zone (moved here, right after Cont) - data[0].push((single.dxcc_spotted && single.dxcc_spotted.cqz) ? single.dxcc_spotted.cqz : ''); // Flag column: just the flag emoji without entity name + let cqz_value = (single.dxcc_spotted && single.dxcc_spotted.cqz) ? single.dxcc_spotted.cqz : ''; + if (cqz_value) { + data[0].push('' + cqz_value + ''); + } else { + data[0].push(''); + } // Flag column: just the flag emoji without entity name let flag_only = ''; if (single.dxcc_spotted && single.dxcc_spotted.flag) { flag_only = '' + single.dxcc_spotted.flag + ''; @@ -1478,6 +1495,7 @@ $(function() { // Count spots for quick filter badges let quickFilterCounts = { lotw: 0, + dxspot: 0, newcontinent: 0, newcountry: 0, newcallsign: 0, @@ -1531,6 +1549,11 @@ $(function() { if (spot.dxcc_spotted && spot.dxcc_spotted.lotw_user) { quickFilterCounts.lotw++; } + // DX Spot: spotted continent != spotter continent + if (spot.dxcc_spotted?.cont && spot.dxcc_spotter?.cont && + spot.dxcc_spotted.cont !== spot.dxcc_spotter.cont) { + quickFilterCounts.dxspot++; + } if (spot.worked_continent === false) { quickFilterCounts.newcontinent++; } @@ -1555,6 +1578,7 @@ $(function() { // Update quick filter badges const quickFilters = [ { id: 'toggleLotwFilter', count: quickFilterCounts.lotw }, + { id: 'toggleDxSpotFilter', count: quickFilterCounts.dxspot }, { id: 'toggleNewContinentFilter', count: quickFilterCounts.newcontinent }, { id: 'toggleDxccNeededFilter', count: quickFilterCounts.newcountry }, { id: 'toggleNewCallsignFilter', count: quickFilterCounts.newcallsign }, @@ -2781,6 +2805,29 @@ $(function() { applyFilters(false); }); + // Toggle DX Spot filter (spotted continent ≠ spotter continent) + $('#toggleDxSpotFilter').on('click', function() { + let currentValues = $('#requiredFlags').val() || []; + let btn = $(this); + + // Remove "None" if present + currentValues = currentValues.filter(v => v !== 'None'); + + if (currentValues.includes('dxspot')) { + // Remove DX Spot filter + currentValues = currentValues.filter(v => v !== 'dxspot'); + if (currentValues.length === 0) currentValues = ['None']; + btn.removeClass('btn-success').addClass('btn-secondary'); + } else { + // Add DX Spot filter + currentValues.push('dxspot'); + btn.removeClass('btn-secondary').addClass('btn-success'); + } + + $('#requiredFlags').val(currentValues).trigger('change'); + applyFilters(false); + }); + // Toggle New Continent filter $('#toggleNewContinentFilter').on('click', function() { let currentValues = $('#requiredFlags').val() || []; @@ -3281,11 +3328,11 @@ $(function() { function initResizeObserver() { const tableContainer = document.querySelector('.table-responsive'); const dataTable = document.querySelector('#DataTables_Table_0_wrapper'); - + if (tableContainer && dataTable) { // now we found the datatable and the table container is also available handleResponsiveColumns(); - + if (typeof ResizeObserver !== 'undefined') { const resizeObserver = new ResizeObserver(function(entries) { handleResponsiveColumns(); @@ -3297,7 +3344,7 @@ $(function() { handleResponsiveColumns(); }); } - + } else { // elements not ready yet, try again setTimeout(initResizeObserver, 50);