[Dashboard] QSO Today Notice now updates every 30 seconds

This addresses #3116
This commit is contained in:
Peter Goodhall 2024-05-23 22:03:59 +01:00
parent 1a3f4c90cb
commit 3ad075d3d6
2 changed files with 28 additions and 0 deletions

View File

@ -188,6 +188,23 @@ class Dashboard extends CI_Controller
}
}
public function todays_qso_component() {
$this->load->model('user_model');
if ($this->user_model->validate_session() == 0) {
// User is not logged in
} else {
$this->load->model('logbook_model');
$this->load->model('logbooks_model');
}
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$data['todays_qsos'] = $this->logbook_model->todays_qsos($logbooks_locations_array);
$this->load->view('components/dashboard_todays_qsos', $data);
}
public function logbook_display_component() {
$this->load->model('user_model');

View File

@ -0,0 +1,11 @@
<div hx-get="<?php echo site_url('dashboard/todays_qso_component'); ?>" hx-trigger="every 30s">
<?php if ($todays_qsos >= 1) { ?>
<div class="alert alert-success" role="alert">
<?php echo lang('dashboard_you_have_had'); ?> <strong><?php echo $todays_qsos; ?></strong> <?php echo $todays_qsos != 1 ? lang('dashboard_qsos_today') : str_replace('QSOs', 'QSO', lang('dashboard_qsos_today')); ?>
</div>
<?php } else { ?>
<div class="alert alert-warning" role="alert">
<span class="badge text-bg-info"><?php echo lang('general_word_important'); ?></span> <i class="fas fa-broadcast-tower"></i> <?php echo lang('notice_turn_the_radio_on'); ?>
</div>
<?php } ?>
</div>