Fixed badgesetting on DXCC.

这个提交包含在:
AndreasK79 2020-04-13 19:23:19 +02:00
父节点 4877ac7564
当前提交 f1fa575178
共有 2 个文件被更改,包括 48 次插入44 次删除

查看文件

@ -58,6 +58,7 @@ class Logbook extends CI_Controller {
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
$return['dxcc'] = $this->getentity($adif);
header('Content-Type: application/json');
echo json_encode($return, JSON_PRETTY_PRINT);
}

查看文件

@ -426,6 +426,8 @@ $(document).on('keypress',function(e) {
$('#callsign_info').attr('title', '');
$('#callsign_info').text(convert_case(result.dxcc.name));
changebadge(result.dxcc.name);
// Set Map to Lat/Long it locator is not empty
if($('#locator').val() == "") {
markers.clearLayers();
@ -437,6 +439,50 @@ $(document).on('keypress',function(e) {
});
});
function changebadge(entityname) {
if($("#sat_name" ).val() != "") {
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(entityname) + '/SAT/0/0', function(result)
{
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
} else {
$.getJSON('logbook/jsonlookupdxcc/' + convert_case(entityname) + '/0/' + $("#band").val() +'/' + $("#mode").val(), function(result)
{
// Reset CSS values before updating
$('#callsign_info').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
}
}
$("#callsign").focusout(function() {
if ($(this).val().length >= 3) {
@ -501,51 +547,8 @@ $(document).on('keypress',function(e) {
}
})
}
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').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#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').removeClass("badge-secondary");
$('#callsign_info').removeClass("badge-success");
$('#callsign_info').removeClass("badge-danger");
$('#callsign_info').attr('title', '');
if (result.workedBefore)
{
$('#callsign_info').addClass("badge-success");
$('#callsign_info').attr('title', 'DXCC was already worked in the past on this band and mode!');
}
else
{
$('#callsign_info').addClass("badge-danger");
$('#callsign_info').attr('title', 'New DXCC, not worked on this band and mode!');
}
})
}
changebadge(result.dxcc.entity);
}
if(result.lotw_member == "active") {