[Station setup] Shows if location belongs to active logbook

This commit is contained in:
Andreas Kristiansen
2024-07-02 08:12:07 +02:00
parent a9dd2032b7
commit 74c8851834
4 changed files with 15 additions and 4 deletions

View File

@@ -312,11 +312,19 @@ class Stationsetup extends CI_Controller {
$single->station_copylog = $this->stationcopy2html($entry->station_id);
$single->station_delete = $this->stationdelete2html($entry->station_id, $entry->station_profile_name, $entry->station_active);
$single->station_favorite = $this->stationfavorite2html($entry->station_id, $quickswitch_enabled);
$single->station_linked = $this->stationlinked2html($entry->linked);
array_push($hres,$single);
}
echo json_encode($hres);
}
private function stationlinked2html($linked) {
if ($linked == 1) {
return '<i class="fa fa-check text-success" aria-hidden="true"></i>';
}
return '<i class="fa fa-times text-danger" aria-hidden="true"></i>';
}
private function stationfavorite2html($id, $quickswitch_enabled) {
if ($quickswitch_enabled == 'false') {
return '';

View File

@@ -5,14 +5,13 @@ class Stations extends CI_Model {
public function __construct() {
}
function all_with_count() {
$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end, count('.$this->config->item('table_name').'.station_id) as qso_total');
$this->db->select('station_profile.*, dxcc_entities.name as station_country, dxcc_entities.end as dxcc_end, count('.$this->config->item('table_name').'.station_id) as qso_total, exists(select 1 from station_logbooks_relationship where station_location_id = station_profile.station_id and station_logbook_id = '.$this->session->userdata('active_station_logbook').') as linked');
$this->db->from('station_profile');
$this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id','left');
$this->db->join('dxcc_entities','station_profile.station_dxcc = dxcc_entities.adif','left outer');
$this->db->group_by('station_profile.station_id');
$this->db->group_by('station_profile.station_id');
$this->db->where('station_profile.user_id', $this->session->userdata('user_id'));
$this->db->or_where('station_profile.user_id =', NULL);
return $this->db->get();

View File

@@ -121,6 +121,7 @@
<th scope="col"><?= __("Country"); ?></th>
<th scope="col"><?= __("Gridsquare"); ?></th>
<th></th>
<th scope="col"><?= __("Linked"); ?></th>
<th scope="col"><?= __("Edit"); ?></th>
<th scope="col"><?= __("Copy"); ?></th>
<?php
@@ -156,6 +157,7 @@
<span class="badge bg-info">ID: <?php echo $row->station_id;?></span>
<span class="badge bg-light"><?php echo $row->qso_total;?> <?= __("QSO"); ?></span>
</td>
<td></td>
<td>
<a href="<?php echo site_url('station/edit')."/".$row->station_id; ?>" title=<?= __("Edit"); ?> class="btn btn-outline-primary btn-sm"><i class="fas fa-edit"></i></a>
</td>
@@ -182,7 +184,7 @@
<a href="<?php echo site_url('station/deletelog')."/".$row->station_id; ?>" class="btn btn-danger btn-sm" title=<?= __("Empty Log"); ?> onclick="return confirm('<?php echo $cnfmsg; ?>');"><i class="fas fa-trash-alt"></i></a></td>
</td>
<td>
<?php if($row->station_active != 1) {
<?php if($row->station_active != 1) {
$cnfmsg = sprintf(__("Are you sure you want delete station profile '%s'? This will delete all QSOs within this station profile."), $row->station_profile_name); ?>?>
<a href="<?php echo site_url('station/delete')."/".$row->station_id; ?>" class="btn btn-danger btn-sm" title=<?= __("Delete"); ?> onclick="return confirm('<?= $cnfmsg ?>');"><i class="fas fa-trash-alt"></i></a>
<?php } ?>

View File

@@ -378,6 +378,7 @@ function reloadLogbooks() {
dataType: 'json',
success: function (data) {
loadLogbookTable(data);
reloadStations();
},
error: function (data) {
BootstrapDialog.alert({
@@ -572,6 +573,7 @@ function loadLocationTable(rows) {
data.push(locations.station_country);
data.push(locations.station_gridsquare);
data.push(locations.station_badge);
data.push(locations.station_linked);
data.push(locations.station_edit);
data.push(locations.station_copylog);
if (locations.station_favorite != ''){