Added indicators, if callsign/dxcc is worked on band and mode

like the locator-input the callsign-input is colored in red or green
the country-label is enabled with a label that tells us about worked/not wkd
pull/373/head
Kim Huebel 2019-10-13 22:42:41 +02:00
rodzic 1462e4fc5e
commit 192a63ad4b
2 zmienionych plików z 143 dodań i 0 usunięć

Wyświetl plik

@ -221,6 +221,74 @@ class Logbook extends CI_Controller {
return;
}
function jsonlookupdxcc($country, $type, $band, $mode) {
$return = [
"workedBefore" => false,
];
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
}
$this->db->where('station_id', $station_id);
$this->db->where('COL_COUNTRY', urldecode($country));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
$return['workedBefore'] = true;
}
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
function jsonlookupcallsign($callsign, $type, $band, $mode) {
$return = [
"workedBefore" => false,
];
$CI =& get_instance();
$CI->load->model('Stations');
$station_id = $CI->Stations->find_active();
if($type == "SAT") {
$this->db->where('COL_PROP_MODE', 'SAT');
} else {
$this->db->where('COL_MODE', $mode);
$this->db->where('COL_BAND', $band);
$this->db->where('COL_PROP_MODE !=','SAT');
}
$this->db->where('station_id', $station_id);
$this->db->where('COL_CALL', strtoupper($callsign));
$query = $this->db->get($this->config->item('table_name'), 1, 0);
foreach ($query->result() as $workedBeforeRow)
{
$return['workedBefore'] = true;
}
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
return;
}
/* Used to generate maps for displaying on /logbook/ */
function qso_map() {

Wyświetl plik

@ -389,6 +389,81 @@ $(document).on('keypress',function(e) {
if(result.dxcc.entity != undefined) {
$('#country').val(convert_case(result.dxcc.entity));
$('#callsign_info').text(convert_case(result.dxcc.entity));
if($("#sat_name" ).val() != "") {
//logbook/jsonlookupgrid/io77/SAT/0/0
$.getJSON('logbook/jsonlookupcallsign/' + $("#callsign").val().toUpperCase() + '/SAT/0/0', function(result)
{
// Reset CSS values before updating
$('#callsign').removeClass("workedGrid");
$('#callsign').removeClass("newGrid");
$('#callsign').attr('title', '');
if (result.workedBefore)
{
$('#callsign').addClass("workedGrid");
$('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!');
}
else
{
$('#callsign').addClass("newGrid");
$('#callsign').attr('title', 'New Callsign!');
}
})
} else {
$.getJSON('logbook/jsonlookupcallsign/' + $("#callsign").val().toUpperCase() + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{
// Reset CSS values before updating
$('#callsign').removeClass("workedGrid");
$('#callsign').removeClass("newGrid");
$('#callsign').attr('title', '');
if (result.workedBefore)
{
$('#callsign').addClass("workedGrid");
$('#callsign').attr('title', 'Callsign was already worked in the past on this band and mode!');
}
else
{
$('#callsign').addClass("newGrid");
$('#callsign').attr('title', 'New Callsign!');
}
})
}
if($("#sat_name" ).val() != "") {
//logbook/jsonlookupgrid/io77/SAT/0/0
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(result.dxcc.entity) + '/SAT/0/0', function(result)
{
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
} else {
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(result.dxcc.entity) + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{
// Reset CSS values before updating
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
}
}
if(result.lotw_member == "active") {