diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 23e437ee..aaae4a4d 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -150,6 +150,7 @@ class Logbook_model extends CI_Model { 'COL_DXCC' => $dxcc_id, 'COL_CQZ' => $cqz, 'COL_STATE' => trim($this->input->post('usa_state')), + 'COL_USACA_COUNTIES' => trim($this->input->post('county')), 'COL_SOTA_REF' => trim($this->input->post('sota_ref')), 'COL_SIG' => trim($this->input->post('sig')), 'COL_SIG_INFO' => trim($this->input->post('sig_info')), @@ -529,7 +530,8 @@ class Logbook_model extends CI_Model { 'COL_QSL_VIA' => $this->input->post('qsl_via_callsign'), 'station_id' => $this->input->post('station_profile'), 'COL_OPERATOR' => $this->input->post('operator_callsign'), - 'COL_STATE' =>$this->input->post('usa_state') + 'COL_STATE' =>$this->input->post('usa_state'), + 'COL_USACA_COUNTIES' =>$this->input->post('usa_county'), ); if ($this->exists_qrz_api_key($data['station_id'])) { diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index f6727945..cd2cf1fa 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2040,6 +2040,26 @@ $(document).ready(function(){ nl2br: false, message: html, onshown: function(dialog) { + var state = $("#input_usa_state option:selected").text(); + if (state != "") { + $("#stationCntyInput").prop('disabled', false); + selectize_usa_county(); + } + + $('#input_usa_state').change(function(){ + var state = $("#input_usa_state option:selected").text(); + if (state != "") { + $("#stationCntyInput").prop('disabled', false); + + selectize_usa_county(); + + } else { + $("#stationCntyInput").prop('disabled', true); + $('#stationCntyInput')[0].selectize.destroy(); + $("#stationCntyInput").val(""); + } + }); + $('#sota_ref').selectize({ maxItems: 1, closeAfterSelect: true, @@ -2101,6 +2121,40 @@ $(document).ready(function(){ }); } + function selectize_usa_county() { + var baseURL= ""; + $('#stationCntyInput').selectize({ + maxItems: 1, + closeAfterSelect: true, + loadThrottle: 250, + valueField: 'name', + labelField: 'name', + searchField: 'name', + options: [], + create: false, + load: function(query, callback) { + var state = $("#input_usa_state option:selected").text(); + + if (!query || state == "") return callback(); + $.ajax({ + url: baseURL+'index.php/qso/get_county', + type: 'GET', + dataType: 'json', + data: { + query: query, + state: state, + }, + error: function() { + callback(); + }, + success: function(res) { + callback(res); + } + }); + } + }); + } + function qso_save() { var baseURL= ""; var myform = document.getElementById("qsoform"); diff --git a/application/views/qso/edit_ajax.php b/application/views/qso/edit_ajax.php index 44a6e557..5e07f867 100644 --- a/application/views/qso/edit_ajax.php +++ b/application/views/qso/edit_ajax.php @@ -371,6 +371,11 @@ +