Added button to show qso list in state

This commit is contained in:
Andreas Kristiansen
2025-12-07 22:38:51 +01:00
parent 0fad755ce6
commit 46fad667bc
5 changed files with 92 additions and 5 deletions

View File

@@ -920,4 +920,18 @@ class Logbookadvanced extends CI_Controller {
header("Content-Type: application/json");
echo json_encode($result);
}
public function openStateList() {
if(!clubaccess_check(9)) return;
$this->load->model('logbook_model');
$this->load->model('logbookadvanced_model');
$data['dxcc'] = $this->input->post('dxcc', true);
// Process for batch QSO state fix
$data['qsos'] = $this->logbookadvanced_model->getStateListQsos($data['dxcc']);
$this->load->view('logbookadvanced/showStateQsos', $data);
}
}

View File

@@ -1578,4 +1578,17 @@ class Logbookadvanced_model extends CI_Model {
return $results;
}
function getStateListQsos($dxcc) {
$sql = "SELECT col_call, col_time_on, col_mode, col_submode, col_band, col_state, col_gridsquare FROM " . $this->config->item('table_name') . " qsos
JOIN station_profile ON qsos.station_id = station_profile.station_id
WHERE qsos.COL_DXCC = ? AND station_profile.user_id = ?
AND (qsos.COL_STATE IS NULL OR qsos.COL_STATE = '')
AND LENGTH(COALESCE(qsos.COL_GRIDSQUARE, '')) >= 6
ORDER BY COL_TIME_ON DESC";
$query = $this->db->query($sql, [$dxcc, $this->session->userdata('user_id')]);
return $query->result();
}
}

View File

@@ -26,9 +26,10 @@
<td><?php echo $name; ?></td>
<td><?php echo $qsos; ?></td>
<td>
<button type="button" class="btn btn-sm btn-primary ld-ext-right" onclick="fixState(<?php echo $item->col_dxcc; ?>)">
<button type="button" class="btn btn-sm btn-primary ld-ext-right" id="fixStateBtn_<?php echo $item->col_dxcc; ?>" onclick="fixState(<?php echo $item->col_dxcc; ?>)">
<?= __("Run fix") ?><div class="ld ld-ring ld-spin"></div>
</button>
<button id="openStateListBtn_<?php echo $item->col_dxcc; ?>" onclick="openStateList(<?php echo $item->col_dxcc; ?>)" class="btn btn-sm btn-success"><i class="fas fa-search"></i></button>
</td>
</tr>
<?php endforeach; ?>

View File

@@ -0,0 +1,38 @@
<h4>QSOs Missing State Information</h4>
<?php if (!empty($qsos) && count($qsos) > 0): ?>
<table class="table table-sm table-striped table-hover">
<thead>
<tr>
<th>Call</th>
<th>Date/Time</th>
<th>Mode</th>
<th>Submode</th>
<th>Band</th>
<th>State</th>
<th>Gridsquare</th>
</tr>
</thead>
<tbody>
<?php foreach ($qsos as $qso): ?>
<tr>
<td><?php echo $qso->col_call; ?></td>
<td><?php echo date('Y-m-d H:i', strtotime($qso->col_time_on)); ?></td>
<td><?php echo $qso->col_mode; ?></td>
<td><?php echo $qso->col_submode ?? ''; ?></td>
<td><?php echo $qso->col_band; ?></td>
<td><?php echo $qso->col_state; ?></td>
<td><?php echo $qso->col_gridsquare; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<div>
<p class="text-muted">
Found <?php echo count($qsos); ?> QSO(s) missing state information for DXCC <?php echo $dxcc; ?>.
</p>
</div>
<?php else: ?>
<div class="alert alert-success">
<h4>No Issues Found</h4>
</div>
<?php endif; ?>

View File

@@ -2250,7 +2250,7 @@ function saveOptions() {
}
function fixState(dxcc) {
$('#fixStateButton').prop("disabled", true).addClass("running");
$('#fixStateBtn_' + dxcc).prop("disabled", true).addClass("running");
$.ajax({
url: base_url + 'index.php/logbookadvanced/fixStateBatch',
@@ -2259,13 +2259,34 @@ function saveOptions() {
'dxcc': dxcc
},
success: function (response) {
$('#fixStateButton').prop("disabled", false).removeClass("running");
$('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running");
},
error: function () {
$('#fixStateButton').prop("disabled", false).removeClass("running");
$('#fixStateBtn_' + dxcc).prop("disabled", false).removeClass("running");
}
});
}
function openStateList(dxcc) {
$('#openStateListBtn_' + dxcc).prop("disabled", true).addClass("running");
$.ajax({
url: base_url + 'index.php/logbookadvanced/OpenStateList',
type: 'post',
data: {
'dxcc': dxcc
},
success: function (response) {
$('#openStateListBtn_' + dxcc).prop("disabled", false).removeClass("running");
BootstrapDialog.show({
title: 'QSO List',
message: response,
size: BootstrapDialog.SIZE_WIDE,
type: BootstrapDialog.TYPE_INFO
});
},
error: function () {
$('#openStateListBtn_' + dxcc).prop("disabled", false).removeClass("running");
}
});
}