[Station Location][Edit] Allows selecting and editing Canadian Provinces

Fixes issue #2190
pull/2204/head
Peter Goodhall 2023-06-15 13:14:10 +01:00
rodzic 028825f107
commit b319b190f3
3 zmienionych plików z 43 dodań i 3 usunięć

Wyświetl plik

@ -97,6 +97,12 @@ class Stations extends CI_Model {
}
function edit() {
if ($this->input->post('dxcc') == 1 && $this->input->post('station_ca_state') !="") {
$state = $this->input->post('station_ca_state');
} else {
$state = $this->input->post('station_state');
}
$data = array(
'station_profile_name' => xss_clean($this->input->post('station_profile_name', true)),
'station_gridsquare' => xss_clean($this->input->post('gridsquare', true)),
@ -113,7 +119,7 @@ class Stations extends CI_Model {
'station_cnty' => xss_clean($this->input->post('station_cnty', true)),
'station_cq' => xss_clean($this->input->post('station_cq', true)),
'station_itu' => xss_clean($this->input->post('station_itu', true)),
'state' => xss_clean($this->input->post('station_state', true)),
'state' => $state,
'eqslqthnickname' => xss_clean($this->input->post('eqslnickname', true)),
'qrzapikey' => xss_clean($this->input->post('qrzapikey', true)),
'qrzrealtime' => xss_clean($this->input->post('qrzrealtime', true)),

Wyświetl plik

@ -87,7 +87,7 @@
</div>
<!-- US State -->
<div class="form-group">
<div class="form-group" id="us_state">
<label for="stateInput">Station State</label>
<select class="form-control custom-select" name="station_state" id="StateHelp" aria-describedby="stationCntyInputHelp">
<option value=""></option>
@ -142,6 +142,15 @@
<option value="WI" <?php if($my_station_profile->state == "WI") { echo "selected"; } ?>>Wisconsin</option>
<option value="WV" <?php if($my_station_profile->state == "WV") { echo "selected"; } ?>>West Virginia</option>
<option value="WY" <?php if($my_station_profile->state == "WY") { echo "selected"; } ?>>Wyoming</option>
</select>
<small id="StateHelp" class="form-text text-muted">Station state. Applies to certain countries only. Leave blank if not applicable.</small>
</div>
<!-- Canada State -->
<div class="form-group" id="canada_state">
<label for="stateInput">Canadian Province</label>
<select class="form-control custom-select" name="station_ca_state" id="StateHelp" aria-describedby="stationCntyInputHelp">
<option value=""></option>
<option value="AB" <?php if($my_station_profile->state == "AB") { echo "selected"; } ?>>Alberta</option>
<option value="BC" <?php if($my_station_profile->state == "BC") { echo "selected"; } ?>>British Columbia</option>
<option value="MB" <?php if($my_station_profile->state == "MB") { echo "selected"; } ?>>Manitoba</option>
@ -157,7 +166,7 @@
<option value="YT" <?php if($my_station_profile->state == "YT") { echo "selected"; } ?>>Yukon</option>
</select>
<small id="StateHelp" class="form-text text-muted">Station state. Applies to certain countries only. Leave blank if not applicable.</small>
</div>
</div>
<!-- US County -->
<div class="form-group">

Wyświetl plik

@ -1,5 +1,30 @@
$(document).ready( function () {
// Use Jquery to hide div ca_state
$('#station_locations_table').DataTable({
"stateSave": true
});
$("#canada_state").hide();
var selectedDXCCID = $('#dxcc_select').find(":selected").val();
console.log(selectedDXCCID);
if(selectedDXCCID == '1'){
$("#canada_state").show();
$("#us_state").hide();
}
$('#dxcc_select').change(function(){
if($(this).val() == '1'){ // or this.value == 'volvo'
console.log("CANADA!");
$("#canada_state").show();
$("#us_state").hide();
} else {
$("#canada_state").hide();
$("#us_state").show();
}
});
} );