diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 74b779bc..b46a41bc 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -18,10 +18,38 @@ class Logbook_model extends CI_Model { // Contest exchange, need to separate between serial and other type of exchange if($this->input->post('exchangetype')) { - $srx_string = $this->input->post('exch_rcvd') == '' ? null : $this->input->post('exch_rcvd'); - $stx_string = $this->input->post('exch_sent') == '' ? null : $this->input->post('exch_sent'); - $srx = $this->input->post('exch_serial_r') == '' ? null : $this->input->post('exch_serial_r'); - $stx = $this->input->post('exch_serial_s') == '' ? null : $this->input->post('exch_serial_s'); + switch ($this->input->post('exchangetype')) { + case 'Exchange': + $srx_string = $this->input->post('exch_rcvd') == '' ? null : $this->input->post('exch_rcvd'); + $stx_string = $this->input->post('exch_sent') == '' ? null : $this->input->post('exch_sent'); + $srx = null; + $stx = null; + break; + case 'Gridsquare': + $srx_string = null; + $stx_string = null; + $srx = null; + $stx = null; + break; + case 'Serial': + $srx = $this->input->post('exch_serial_r') == '' ? null : $this->input->post('exch_serial_r'); + $stx = $this->input->post('exch_serial_s') == '' ? null : $this->input->post('exch_serial_s'); + $srx_string = null; + $stx_string = null; + break; + case 'Serialexchange': + $srx_string = $this->input->post('exch_rcvd') == '' ? null : $this->input->post('exch_rcvd'); + $stx_string = $this->input->post('exch_sent') == '' ? null : $this->input->post('exch_sent'); + $srx = $this->input->post('exch_serial_r') == '' ? null : $this->input->post('exch_serial_r'); + $stx = $this->input->post('exch_serial_s') == '' ? null : $this->input->post('exch_serial_s'); + break; + case 'Serialgridsquare': + $srx = $this->input->post('exch_serial_r') == '' ? null : $this->input->post('exch_serial_r'); + $stx = $this->input->post('exch_serial_s') == '' ? null : $this->input->post('exch_serial_s'); + $srx_string = null; + $stx_string = null; + break; + } } else { $srx_string = null; $stx_string = null; diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index e22c9e01..1df60607 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -354,6 +354,8 @@ function logQso() { $('.callsign-suggestions').text(""); var table = $('.qsotable').DataTable(); + var exchangetype = $("#exchangetype").val(); + var gridsquare = $("#exch_gridsquare_r").val(); var vucc = ''; @@ -362,6 +364,44 @@ function logQso() { gridsquare = ''; } + var gridr = ''; + var vuccr = ''; + var exchsent = ''; + var exchrcvd = ''; + var serials = ''; + var serialr = ''; + + switch (exchangetype) { + case 'Exchange': + exchsent = $("#exch_sent").val(); + exchrcvd = $("#exch_rcvd").val(); + break; + + case 'Gridsquare': + gridr = gridsquare; + vuccr = vucc; + break; + + case 'Serial': + serials = $("#exch_serial_s").val(); + serialr = $("#exch_serial_r").val(); + break; + + case 'Serialexchange': + exchsent = $("#exch_sent").val(); + exchrcvd = $("#exch_rcvd").val(); + serials = $("#exch_serial_s").val(); + serialr = $("#exch_serial_r").val(); + break; + + case 'Serialgridsquare': + gridr = gridsquare; + vuccr = vucc; + serials = $("#exch_serial_s").val(); + serialr = $("#exch_serial_r").val(); + break; + } + var data = [[ $("#start_date").val() + ' ' + $("#start_time").val(), $("#callsign").val().toUpperCase(), @@ -369,12 +409,12 @@ function logQso() { $("#mode").val(), $("#rst_sent").val(), $("#rst_rcvd").val(), - $("#exch_sent").val(), - $("#exch_rcvd").val(), - $("#exch_serial_s").val(), - $("#exch_serial_r").val(), - gridsquare, - vucc, + exchsent, + exchrcvd, + serials, + serialr, + gridr, + vuccr, ]]; table.rows.add(data).draw();