diff --git a/application/controllers/Qslprint.php b/application/controllers/Qslprint.php index fc2f2c00..3de67e65 100644 --- a/application/controllers/Qslprint.php +++ b/application/controllers/Qslprint.php @@ -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 */ diff --git a/application/models/Qslprint_model.php b/application/models/Qslprint_model.php index 354e2460..b32ef8b5 100644 --- a/application/models/Qslprint_model.php +++ b/application/models/Qslprint_model.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; + } + } ?> diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 7eab74c4..c8195c33 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -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 = '
| '.$this->lang->line('gen_hamradio_callsign').' | +' . $this->lang->line('general_word_date') . ' | +'. $this->lang->line('general_word_time') .' | +' . $this->lang->line('gen_hamradio_mode') . ' | +' . $this->lang->line('gen_hamradio_band') . ' | +' . $this->lang->line('gen_hamradio_station') . ' | ++ |
|---|---|---|---|---|---|---|
| ' . $qsl->COL_CALL . ' | '; + echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); echo ' | '; + echo ''; $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); echo ' | '; + echo ''; echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; echo ' | '; + echo ''; if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; echo ' | '; + echo '' . $qsl->station_callsign . ' | '; + echo ''; + echo ' |