From 356c89c0fddf8175627a65954244fcd1d3ed806a Mon Sep 17 00:00:00 2001 From: phl0 Date: Sat, 27 Apr 2024 22:50:02 +0200 Subject: [PATCH] Also calc distance and bearing while editing VUCC grids --- assets/js/sections/common.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/assets/js/sections/common.js b/assets/js/sections/common.js index 1eb9f6d30..87cba790d 100644 --- a/assets/js/sections/common.js +++ b/assets/js/sections/common.js @@ -252,6 +252,42 @@ function qso_edit(id) { } }); + $('#vucc_grids').change(function(){ + if ($(this).val().length >= 9) { + $.ajax({ + url: base_url + 'index.php/logbook/searchbearing', + type: 'post', + data: { + grid: $(this).val(), + stationProfile: $('#stationProfile').val() + }, + success: function(data) { + $('#locator_info').html(data).fadeIn("slow"); + }, + error: function() { + $('#locator_info').text("Error loading bearing!").fadeIn("slow"); + }, + }); + $.ajax({ + url: base_url + 'index.php/logbook/searchdistance', + type: 'post', + data: { + grid: $(this).val(), + stationProfile: $('#stationProfile').val() + }, + success: function(data) { + document.getElementById("distance").value = data; + }, + error: function() { + document.getElementById("distance").value = null; + }, + }); + } else if ($(this).val().length == 0) { + $('#locator_info').fadeOut("slow"); + document.getElementById("distance").value = null; + } + }); + $('#sota_ref_edit').selectize({ maxItems: 1, closeAfterSelect: true,