diff --git a/application/controllers/Lookup.php b/application/controllers/Lookup.php index 933fa4ff7..60079ac02 100644 --- a/application/controllers/Lookup.php +++ b/application/controllers/Lookup.php @@ -129,4 +129,26 @@ class Lookup extends CI_Controller { } } + public function get_state_list() { + $this->load->library('subdivisions'); + + $dxcc = xss_clean($this->input->post('dxcc')); + $states_result = $this->subdivisions->get_state_list($dxcc); + $subdivision_name = $this->subdivisions->get_primary_subdivision_name($dxcc); + + if ($states_result->num_rows() > 0) { + $states_array = $states_result->result_array(); + $result = array( + 'status' => 'ok', + 'subdivision_name' => $subdivision_name, + 'data' => $states_array + ); + header('Content-Type: application/json'); + echo json_encode($result); + } else { + header('Content-Type: application/json'); + echo json_encode(array('status' => 'No States for this DXCC in Database')); + } + } + } diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index a3ae8a020..f212b83d0 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -1,12 +1,5 @@ load->model('logbook_model'); + + $states = $CI->logbook_model->get_states_by_dxcc($dxcc); + + return $states; + } } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 37f7101f4..9e5a6158f 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -145,8 +145,8 @@ class Logbook_model extends CI_Model { $submode = $this->input->post('mode'); } - if($this->input->post('county') && $this->input->post('usa_state')) { - $clean_county_input = trim($this->input->post('usa_state')) . "," . trim($this->input->post('county')); + if($this->input->post('county') && $this->input->post('input_state_edit')) { + $clean_county_input = trim($this->input->post('input_state_edit')) . "," . trim($this->input->post('county')); } else { $clean_county_input = null; } @@ -234,7 +234,7 @@ class Logbook_model extends CI_Model { 'COL_LON' => null, 'COL_DXCC' => $dxcc_id, 'COL_CQZ' => $cqz, - 'COL_STATE' => $this->input->post('usa_state') == null ? '' : trim($this->input->post('usa_state')), + 'COL_STATE' => $this->input->post('input_state_edit') == null ? '' : trim($this->input->post('input_state_edit')), 'COL_CNTY' => $clean_county_input, 'COL_SOTA_REF' => $this->input->post('sota_ref') == null ? '' : trim($this->input->post('sota_ref')), 'COL_WWFF_REF' => $this->input->post('wwff_ref') == null ? '' : trim($this->input->post('wwff_ref')), @@ -1083,8 +1083,8 @@ class Logbook_model extends CI_Model { if (stristr($this->input->post('usa_county') ?? '', ',')) { // Already comma-seperated Conuty? $uscounty = $this->input->post('usa_county'); - } elseif ($this->input->post('usa_county') && $this->input->post('usa_state')) { // Both filled (and no comma - because that fits one above) - $uscounty = trim($this->input->post('usa_state') . "," . $this->input->post('usa_county')); + } elseif ($this->input->post('usa_county') && $this->input->post('input_state_edit')) { // Both filled (and no comma - because that fits one above) + $uscounty = trim($this->input->post('input_state_edit') . "," . $this->input->post('usa_county')); } else { // nothing from above? $uscounty = null; } @@ -1231,7 +1231,7 @@ class Logbook_model extends CI_Model { 'station_id' => $stationId, 'COL_STATION_CALLSIGN' => $stationCallsign, 'COL_OPERATOR' => $this->input->post('operator_callsign'), - 'COL_STATE' =>$this->input->post('usa_state'), + 'COL_STATE' =>$this->input->post('input_state_edit'), 'COL_CNTY' => $uscounty, 'COL_MY_IOTA' => $iotaRef, 'COL_MY_SOTA_REF' => $sotaRef, @@ -4669,7 +4669,7 @@ function lotw_last_qsl_date($user_id) { $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); - $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); + $this->db->join('lotw_users', 'lotw_users.callsign = '.$this->config->item('table_name').'.col_call', 'left outer'); $this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array); $this->db->where('COL_STATE', $state); $this->db->where('COL_CNTY', $county); @@ -4751,6 +4751,11 @@ function lotw_last_qsl_date($user_id) { } return $json; } + + public function get_states_by_dxcc($dxcc) { + $this->db->where('adif', $dxcc); + return $this->db->get('primary_subdivisions'); + } } function validateADIFDate($date, $format = 'Ymd') diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index cb73ebcb5..46c7a1eab 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -596,9 +596,9 @@ $(function () { @@ -2134,63 +2134,64 @@ $(document).ready(function(){ + }); +} + +function qso_save() { + var baseURL= ""; + var myform = document.getElementById("qsoform"); + var fd = new FormData(myform); + $.ajax({ + url: baseURL + 'index.php/qso/qso_save_ajax', + data: fd, + cache: false, + processData: false, + contentType: false, + type: 'POST', + success: function (dataofconfirm) { + $(".edit-dialog").modal('hide'); + $(".qso-dialog").modal('hide'); + uri->segment(1) != "search" && $this->uri->segment(2) != "filter" && $this->uri->segment(1) != "qso" && $this->uri->segment(1) != "logbookadvanced") { ?>location.reload(); + }, + error: function(xhr, status, error) { + console.log(xhr.responseText); + } + }); +} + uri->segment(1) == "timeline") { ?> +
+ + + +
- -
- - - -
- - -
- - station_cnty; } ?>"> - -
+ +
+ + station_cnty; } ?>"> + +
diff --git a/assets/css/cyborg/overrides.css b/assets/css/cyborg/overrides.css index 9cec76a56..c12430c90 100644 --- a/assets/css/cyborg/overrides.css +++ b/assets/css/cyborg/overrides.css @@ -20,7 +20,13 @@ .border-top { --bs-border-color: #282828; } -/* + +.form-select:disabled { + color: #7f7f7f; + background-color: #151515; +} + +/* * Dark Maps */ diff --git a/assets/css/cyborg_wide/overrides.css b/assets/css/cyborg_wide/overrides.css index 4bae67ba2..2c4d4266c 100644 --- a/assets/css/cyborg_wide/overrides.css +++ b/assets/css/cyborg_wide/overrides.css @@ -20,6 +20,12 @@ .border-top { --bs-border-color: #282828; } + +.form-select:disabled { + color: #7f7f7f; + background-color: #151515; +} + /* * Dark Maps */ diff --git a/assets/css/darkly/overrides.css b/assets/css/darkly/overrides.css index 3e7aad461..bfe4b2a2b 100644 --- a/assets/css/darkly/overrides.css +++ b/assets/css/darkly/overrides.css @@ -39,6 +39,10 @@ color: white; } +.form-select:disabled { + background-color: #222222; +} + /* * Dark Maps */ diff --git a/assets/css/darkly_wide/overrides.css b/assets/css/darkly_wide/overrides.css index 61193b761..da852084b 100644 --- a/assets/css/darkly_wide/overrides.css +++ b/assets/css/darkly_wide/overrides.css @@ -39,6 +39,10 @@ color: white; } +.form-select:disabled { + background-color: #222222; +} + /* * Dark Maps */ diff --git a/assets/css/superhero/overrides.css b/assets/css/superhero/overrides.css index 44c1ece81..692b3ea5b 100644 --- a/assets/css/superhero/overrides.css +++ b/assets/css/superhero/overrides.css @@ -28,6 +28,11 @@ body { --bs-border-color: #253544; } +.form-select:disabled { + color: #7f7f7f; + background-color: #2b3e50; +} + /* * Maps */ diff --git a/assets/css/superhero_wide/overrides.css b/assets/css/superhero_wide/overrides.css index 09ae1c3cf..f4a74c8c5 100644 --- a/assets/css/superhero_wide/overrides.css +++ b/assets/css/superhero_wide/overrides.css @@ -39,6 +39,11 @@ body { overflow-y: auto; } +.form-select:disabled { + color: #7f7f7f; + background-color: #2b3e50; +} + /* * Maps */ diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index c1b88ac62..0249d5bf4 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -133,14 +133,14 @@ function qso_edit(id) { nl2br: false, message: html, onshown: function(dialog) { - var state = $("#input_usa_state_edit option:selected").text(); + var state = $("#stateDropdown option:selected").text(); if (state != "") { $("#stationCntyInputEdit").prop('disabled', false); selectize_usa_county(); } - $('#input_usa_state_edit').change(function(){ - var state = $("#input_usa_state_edit option:selected").text(); + $('#stateDropdown').change(function(){ + var state = $("#stateDropdown option:selected").text(); if (state != "") { $("#stationCntyInputEdit").prop('disabled', false); @@ -308,12 +308,48 @@ function qso_edit(id) { $('.modal-content #qslmsg').keyup(function(event) { calcRemainingChars(event, '.modal-content'); }); + + $("#dxcc_id").change(function () { + updateStateDropdown(); + }); }, }); } }); } +function updateStateDropdown() { + console.log('dropdown triggered'); + var selectedDxcc = $("#dxcc_id"); + + if (selectedDxcc.val() !== "") { + $.ajax({ + url: base_url + "index.php/lookup/get_state_list", + type: "POST", + data: { dxcc: selectedDxcc.val() }, + success: function (response) { + if (response.status === "ok") { + statesDropdown(response, set_state); + $('#stateInputLabel').html(response.subdivision_name); + } else { + statesDropdown(response); + $('#stateInputLabel').html('State'); + } + }, + error: function () { + console.log('ERROR', response.status); + }, + }); + } + + if (selectedDxcc.val() == '291' || selectedDxcc.val() == '110' || selectedDxcc.val() == '6') { + $("#location_us_county").show(); + } else { + $("#location_us_county").hide(); + $("#stationCntyInputEdit").val(); + } +} + function spawnQrbCalculator(locator1, locator2) { $.ajax({ url: base_url + 'index.php/qrbcalc', @@ -627,6 +663,7 @@ function showQsoActionsMenu(_this) { } }); } + if ($('.table-responsive .dropdown-toggle').length>0) { $('.table-responsive .dropdown-toggle').off('mouseenter').on('mouseenter', function () { showQsoActionsMenu($(this).closest('.dropdown')); @@ -637,6 +674,34 @@ function getDataTablesLanguageUrl() { return "../assets/json/datatables_languages/" + lang_datatables_language + ".json"; } +var set_state; +function statesDropdown(states, set_state = null) { + var dropdown = $('#stateDropdown'); + dropdown.empty(); + dropdown.append($('