Merge pull request #1112 from AndreasK79/qslprint_enhancement
[QSL Print] Added button to see list of QSOs with callsign. Can add t…
这个提交包含在:
当前提交
347327c3c9
共有 6 个文件被更改,包括 136 次插入 和 5 次删除
|
|
@ -149,6 +149,22 @@ class QSLPrint extends CI_Controller {
|
|||
$data['station_id'] = $station_id;
|
||||
$this->load->view('qslprint/qslprint', $data);
|
||||
}
|
||||
|
||||
public function open_qso_list() {
|
||||
$callsign = $this->input->post('callsign');
|
||||
$this->load->model('qslprint_model');
|
||||
|
||||
$data['qsos'] = $this->qslprint_model->open_qso_list($this->security->xss_clean($callsign));
|
||||
$this->load->view('qslprint/qsolist', $data);
|
||||
}
|
||||
|
||||
public function add_qso_to_print_queue() {
|
||||
$id = $this->input->post('id');
|
||||
$this->load->model('qslprint_model');
|
||||
|
||||
$this->qslprint_model->add_qso_to_print_queue($this->security->xss_clean($id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* End of file Qslprint.php */
|
||||
|
|
|
|||
|
|
@ -63,6 +63,28 @@ class Qslprint_model extends CI_Model {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
function add_qso_to_print_queue($id) {
|
||||
$data = array(
|
||||
'COL_QSL_SENT' => "R",
|
||||
);
|
||||
|
||||
$this->db->where("COL_PRIMARY_KEY", $id);
|
||||
$this->db->update($this->config->item('table_name'), $data);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function open_qso_list($callsign) {
|
||||
$this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id');
|
||||
$this->db->where('COL_CALL like "%'.$callsign.'%"');
|
||||
$this->db->where('coalesce(COL_QSL_SENT, "") not in ("R", "Q")');
|
||||
$this->db->order_by("COL_TIME_ON", "ASC");
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -2041,13 +2041,58 @@ function deleteQsl(id) {
|
|||
type: 'post',
|
||||
data: {'id': id },
|
||||
success: function(html) {
|
||||
location.reload();
|
||||
$("#qslprint_"+id).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function openQsoList(callsign) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/qslprint/open_qso_list',
|
||||
type: 'post',
|
||||
data: {'callsign': callsign},
|
||||
success: function(html) {
|
||||
BootstrapDialog.show({
|
||||
title: 'QSO List',
|
||||
size: BootstrapDialog.SIZE_WIDE,
|
||||
cssClass: 'qso-dialog',
|
||||
nl2br: false,
|
||||
message: html,
|
||||
buttons: [{
|
||||
label: 'Close',
|
||||
action: function (dialogItself) {
|
||||
dialogItself.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addQsoToPrintQueue(id) {
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/qslprint/add_qso_to_print_queue',
|
||||
type: 'post',
|
||||
data: {'id': id},
|
||||
success: function(html) {
|
||||
var line = '<tr id="qslprint_'+id+'">';
|
||||
line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(0)").text()+'</td>';
|
||||
line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(1)").text()+'</td>';
|
||||
line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(2)").text()+'</td>';
|
||||
line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(3)").text()+'</td>';
|
||||
line += '<td style=\'text-align: center\'>'+$("#qsolist_"+id).find("td:eq(4)").text()+'</td>';
|
||||
line += '<td style=\'text-align: center\'><span class="badge badge-light">'+$("#qsolist_"+id).find("td:eq(5)").text()+'</span></td>';
|
||||
line += '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue('+id+')" class="btn btn-sm btn-danger">Delete from queue</button></td></td>';
|
||||
line += '<td style=\'text-align: center\'><button onclick="openQsoList(\''+$("#qsolist_"+id).find("td:eq(0)").text()+'\')" class="btn btn-sm btn-success">Open QSO list</button></td>';
|
||||
line += '</tr>';
|
||||
$('.table tr:last').after(line);
|
||||
$("#qsolist_"+id).remove();''
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(".station_id").change(function(){
|
||||
var station_id = $(".station_id").val();
|
||||
$.ajax({
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@
|
|||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_band') . '</th>
|
||||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_station') . '</th>
|
||||
<th style=\'text-align: center\'></th>
|
||||
<th style=\'text-align: center\'></th>
|
||||
</tr>
|
||||
</thead><tbody>';
|
||||
|
||||
|
|
@ -55,14 +56,15 @@
|
|||
}
|
||||
|
||||
foreach ($qsos->result() as $qsl) {
|
||||
echo '<tr>';
|
||||
echo '<tr id="qslprint_'.$qsl->COL_PRIMARY_KEY.'">';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_CALL . '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>';
|
||||
echo '<td id="'.$qsl->COL_PRIMARY_KEY.'" style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger">Delete from queue</button></td>';
|
||||
echo '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger">Delete from queue</button></td>';
|
||||
echo '<td style=\'text-align: center\'><button onclick="openQsoList(\''.$qsl->COL_CALL.'\')" class="btn btn-sm btn-success">Open QSO list</button></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ if ($qsos->result() != NULL) {
|
|||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_band') . '</th>
|
||||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_station') . '</th>
|
||||
<th style=\'text-align: center\'></th>
|
||||
<th style=\'text-align: center\'></th>
|
||||
</tr>
|
||||
</thead><tbody>';
|
||||
|
||||
|
|
@ -23,14 +24,15 @@ if ($qsos->result() != NULL) {
|
|||
}
|
||||
|
||||
foreach ($qsos->result() as $qsl) {
|
||||
echo '<tr>';
|
||||
echo '<tr id="qslprint_'.$qsl->COL_PRIMARY_KEY.'">';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_CALL . '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>';
|
||||
echo '<td id="'.$qsl->COL_PRIMARY_KEY.'" style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger">Delete from queue</button></td>';
|
||||
echo '<td style=\'text-align: center\'><button onclick="deleteFromQslQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-danger">Delete from queue</button></td>';
|
||||
echo '<td style=\'text-align: center\'><button onclick="openQsoList(\''.$qsl->COL_CALL.'\')" class="btn btn-sm btn-success">Open QSO list</button></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
if ($qsos->result() != NULL) {
|
||||
echo '<table style="width:100%" class="qsolist table-sm table-bordered table-hover table-striped table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style=\'text-align: center\'>'.$this->lang->line('gen_hamradio_callsign').'</th>
|
||||
<th style=\'text-align: center\'>' . $this->lang->line('general_word_date') . '</th>
|
||||
<th style=\'text-align: center\'>'. $this->lang->line('general_word_time') .'</th>
|
||||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_mode') . '</th>
|
||||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_band') . '</th>
|
||||
<th style=\'text-align: center\'>' . $this->lang->line('gen_hamradio_station') . '</th>
|
||||
<th style=\'text-align: center\'></th>
|
||||
</tr>
|
||||
</thead><tbody>';
|
||||
|
||||
// Get Date format
|
||||
if($this->session->userdata('user_date_format')) {
|
||||
// If Logged in and session exists
|
||||
$custom_date_format = $this->session->userdata('user_date_format');
|
||||
} else {
|
||||
// Get Default date format from /config/cloudlog.php
|
||||
$custom_date_format = $this->config->item('qso_date_format');
|
||||
}
|
||||
|
||||
foreach ($qsos->result() as $qsl) {
|
||||
echo '<tr id ="qsolist_'.$qsl->COL_PRIMARY_KEY.'">';
|
||||
echo '<td style=\'text-align: center\'>' . $qsl->COL_CALL . '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'>'; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo '</td>';
|
||||
echo '<td style=\'text-align: center\'><span class="badge badge-light">' . $qsl->station_callsign . '</span></td>';
|
||||
echo '<td id="'.$qsl->COL_PRIMARY_KEY.'" style=\'text-align: center\'><button onclick="addQsoToPrintQueue(\''.$qsl->COL_PRIMARY_KEY.'\')" class="btn btn-sm btn-success">Add to print queue</button></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
echo '</tbody></table>';
|
||||
?>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="alert alert-danger"><a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>No additional QSO\'s were found. That means they are probably already in the queue.</div>';
|
||||
}
|
||||
?>
|
||||
正在加载…
在新工单中引用