Merge pull request #2563 from szporwolik/dev_fix_qso_edit

[QSO Edit] Fix for CAT updating
This commit is contained in:
Joerg (DJ7NT)
2025-11-22 17:35:55 +01:00
committed by GitHub
3 changed files with 35 additions and 16 deletions

View File

@@ -119,7 +119,7 @@
<div class="row">
<div class="mb-3 col-sm-6">
<label for="freq"><?= __("Mode"); ?></label>
<select id="edit_mode" class="form-select mode" name="mode">
<select id="edit_mode" class="form-select" name="mode">
<?php
foreach ($modes->result() as $mode) {
var_dump($mode);

View File

@@ -744,7 +744,6 @@ $(document).ready(function() {
// Force update by clearing catValue (prevents cat2UI from blocking updates)
$frequency.removeData('catValue');
$mode.removeData('catValue'); // Also clear mode cache
cat_updating_frequency = true; // Set flag before CAT update
// Check if DX Waterfall's CAT frequency handler is available
@@ -757,6 +756,10 @@ $(document).ready(function() {
// Auto-update band based on frequency
if ($band.val() != newBand) {
$band.val(newBand).trigger('change'); // Trigger band change
// Update callsign status when band changes via CAT
if ($('#callsign').val().length >= 3) {
$('#callsign').blur();
}
}
});
});
@@ -767,6 +770,10 @@ $(document).ready(function() {
// Auto-update band based on frequency
if ($band.val() != frequencyToBand(d)) {
$band.val(frequencyToBand(d)).trigger('change');
// Update callsign status when band changes via CAT
if ($('#callsign').val().length >= 3) {
$('#callsign').blur();
}
}
});
}
@@ -791,6 +798,17 @@ $(document).ready(function() {
cat2UI($mode,newMode,false,false);
// Update RST fields when mode changes
// Check if mode was actually updated (catValue changed after cat2UI call)
var currentMode = $mode.data('catValue');
if (currentMode !== previousMode && typeof setRst === 'function') {
setRst(newMode);
// Update callsign status when mode changes via CAT
if ($('#callsign').val().length >= 3) {
$('#callsign').blur();
}
}
// Notify DX Waterfall of mode change for sideband display update
// Only refresh if mode actually changed (not on initial undefined → value transition)
if (modeChanged && typeof dxWaterfall !== 'undefined' && dxWaterfall.refresh) {

View File

@@ -2377,6 +2377,21 @@ $('#band').on('change', function () {
if ($('#radio').val() == 0) {
$.get(base_url + 'index.php/qso/band_to_freq/' + $(this).val() + '/' + $('.mode').val(), function (result) {
$('#frequency').val(result).trigger("change");
// Update virtual CAT state when not using CAT
if (typeof isCATAvailable === 'function' && !isCATAvailable()) {
if (typeof window.catState === 'undefined' || window.catState === null) {
window.catState = {};
}
window.catState.frequency = parseFloat(result); // Hz
window.catState.mode = $('.mode').val();
window.catState.lastUpdate = Date.now();
// Update relevant spots for the new band/frequency
if (typeof dxWaterfall !== 'undefined' && dxWaterfall && typeof dxWaterfall.collectAllBandSpots === 'function') {
dxWaterfall.collectAllBandSpots(true);
}
}
});
}
$('#frequency_rx').val("");
@@ -2387,20 +2402,6 @@ $('#band').on('change', function () {
set_qrg();
$("#callsign").blur();
stop_az_ele_ticker();
if (typeof isCATAvailable === 'function' && !isCATAvailable()) {
// Update virtual CAT state
if (typeof window.catState === 'undefined' || window.catState === null) {
window.catState = {};
}
window.catState.frequency = parseFloat(result); // Hz
window.catState.mode = currentMode;
window.catState.lastUpdate = Date.now();
// Update relevant spots for the new band/frequency
if (typeof dxWaterfall !== 'undefined' && dxWaterfall && typeof dxWaterfall.collectAllBandSpots === 'function') {
dxWaterfall.collectAllBandSpots(true);
}
}
});
/* On Key up Calculate Bearing and Distance */