mirror of
https://github.com/magicbug/Cloudlog
synced 2026-08-13 17:49:35 -04:00
Clear satellite fields when not SAT and on reset
Ensure satellite fields are cleared whenever propagation mode is not 'SAT' and when the QSO form is reset. In Qso.php, sat_name and sat_mode are set to empty strings if prop_mode != 'SAT' (added in two handling points). In assets/js/sections/qso.js, added clearSatelliteFields() to clear sat_name, sat_mode, satellite_modes_list and related state, call it from reset_fields(), and invoke the form reset flow to ensure no stale satellite data remains after resetting or changing propagation mode.
This commit is contained in:
parent
fcd1b6242e
commit
8716e6caae
2 changed files with 27 additions and 0 deletions
|
|
@ -122,6 +122,12 @@ class QSO extends CI_Controller {
|
|||
'operator_callsign' => $this->input->post('operator_callsign'),
|
||||
'transmit_power' => $this->input->post('transmit_power')
|
||||
);
|
||||
|
||||
$propMode = strtoupper(trim((string)($qso_data['prop_mode'] ?? '')));
|
||||
if ($propMode !== 'SAT') {
|
||||
$qso_data['sat_name'] = '';
|
||||
$qso_data['sat_mode'] = '';
|
||||
}
|
||||
// ];
|
||||
|
||||
setcookie("radio", $qso_data['radio'], time()+3600*24*99);
|
||||
|
|
@ -214,6 +220,12 @@ class QSO extends CI_Controller {
|
|||
'transmit_power' => $this->input->post('transmit_power')
|
||||
);
|
||||
|
||||
$propMode = strtoupper(trim((string)($qso_data['prop_mode'] ?? '')));
|
||||
if ($propMode !== 'SAT') {
|
||||
$qso_data['sat_name'] = '';
|
||||
$qso_data['sat_mode'] = '';
|
||||
}
|
||||
|
||||
setcookie("radio", $qso_data['radio'], time() + 3600 * 24 * 99);
|
||||
setcookie("station_profile_id", $qso_data['station_profile_id'], time() + 3600 * 24 * 99);
|
||||
|
||||
|
|
|
|||
|
|
@ -846,6 +846,18 @@ function resetSubmissionState() {
|
|||
}
|
||||
}
|
||||
|
||||
function clearSatelliteFields() {
|
||||
$('#sat_name').val('');
|
||||
$('#sat_mode').val('');
|
||||
$('.satellite_modes_list').find('option').remove().end();
|
||||
selected_sat = '';
|
||||
selected_sat_mode = '';
|
||||
|
||||
if ($('#selectPropagation').val() === 'SAT') {
|
||||
$('#selectPropagation').val('');
|
||||
}
|
||||
}
|
||||
|
||||
/* Function: reset_fields is used to reset the fields on the QSO page */
|
||||
function reset_fields() {
|
||||
// Reset submission state
|
||||
|
|
@ -897,6 +909,8 @@ function reset_fields() {
|
|||
selectize = $select[0] ? $select[0].selectize : null;
|
||||
if (selectize) selectize.clear();
|
||||
|
||||
clearSatelliteFields();
|
||||
|
||||
mymap.setView(pos, 12);
|
||||
mymap.removeLayer(markers);
|
||||
$('.callsign-suggest').hide();
|
||||
|
|
@ -1195,6 +1209,7 @@ function resetToPreviousContactsTab() {
|
|||
// Reset to Previous Contacts tab when form is reset
|
||||
$('#qso_input').on('reset', function() {
|
||||
setTimeout(function() {
|
||||
reset_fields();
|
||||
resetToPreviousContactsTab();
|
||||
}, 100);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue