From d44831d3f581ef3324f02144c67369db37d63ea4 Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Sat, 16 Oct 2021 16:03:54 +0200 Subject: [PATCH] [Contesting] Added selection for copying received exchange over to DOK field in the database. --- application/controllers/Contesting.php | 1 - application/models/Logbook_model.php | 8 ++++++- application/views/contesting/index.php | 22 +++++++------------ assets/js/sections/contesting.js | 29 +++++++------------------- 4 files changed, 23 insertions(+), 37 deletions(-) diff --git a/application/controllers/Contesting.php b/application/controllers/Contesting.php index 0200380a..6beb4edf 100644 --- a/application/controllers/Contesting.php +++ b/application/controllers/Contesting.php @@ -22,7 +22,6 @@ class Contesting extends CI_Controller { $this->load->model('contesting_model'); $data['my_gridsquare'] = $this->stations->find_gridsquare(); - $data['my_dok'] = ""; // For now, this is set to blank, but need function to get $data['radios'] = $this->cat->radios(); $data['modes'] = $this->modes->active(); $data['contestnames'] = $this->contesting_model->getActivecontests(); diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index ab98d8d6..72fc2dd0 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -98,6 +98,12 @@ class Logbook_model extends CI_Model { $clean_county_input = null; } + if($this->input->post('copyexchangetodok')) { + $dark_dok = $this->input->post('exch_recv'); + } else { + $dark_dok = $this->input->post('darc_dok'); + } + // Create array with QSO Data $data = array( 'COL_TIME_ON' => $datetime, @@ -154,7 +160,7 @@ class Logbook_model extends CI_Model { 'COL_SOTA_REF' => trim($this->input->post('sota_ref')), 'COL_SIG' => trim($this->input->post('sig')), 'COL_SIG_INFO' => trim($this->input->post('sig_info')), - 'COL_DARC_DOK' => trim($this->input->post('darc_dok')), + 'COL_DARC_DOK' => trim($dark_dok), 'COL_NOTES' => $this->input->post('notes'), ); diff --git a/application/views/contesting/index.php b/application/views/contesting/index.php index 140d9a04..599658ed 100644 --- a/application/views/contesting/index.php +++ b/application/views/contesting/index.php @@ -13,9 +13,6 @@
- - - - @@ -226,5 +221,4 @@ diff --git a/assets/js/sections/contesting.js b/assets/js/sections/contesting.js index ff64a89e..8f6086d9 100644 --- a/assets/js/sections/contesting.js +++ b/assets/js/sections/contesting.js @@ -26,6 +26,7 @@ function reset_contest_session() { setExchangetype("None"); $("#contestname").val("Other").change(); $(".contest_qso_table_contents").empty(); + $('#copyexchangetodok').prop('checked', false); localStorage.removeItem("contestid"); localStorage.removeItem("exchangetype"); @@ -36,6 +37,7 @@ function reset_contest_session() { localStorage.removeItem("serialsent"); localStorage.removeItem("gridsquarereceived"); localStorage.removeItem("gridsquaresent"); + localStorage.removeItem("copytodok"); } // Storing the contestid in contest session @@ -240,8 +242,6 @@ function setExchangetype(exchangetype) { $(".serialr").hide(); $(".gridsquarer").hide(); $(".gridsquares").hide(); - $(".doks").hide(); - $(".dokr").hide(); $("#exch_serial_s").val(""); var serialsent = localStorage.getItem("serialsent"); @@ -258,23 +258,6 @@ function setExchangetype(exchangetype) { $(".serials").show(); $(".serialr").show(); } - else if (exchangetype == 'Dok') { - $(".doks").show(); - $(".dokr").show(); - } - else if (exchangetype == 'Serialdok') { - $("#exch_serial_s").val(serialsent); - $(".serials").show(); - $(".serialr").show(); - $(".doks").show(); - $(".dokr").show(); - } - else if (exchangetype == 'Dokgridsquare') { - $(".gridsquarer").show(); - $(".gridsquares").show(); - $(".doks").show(); - $(".dokr").show(); - } else if (exchangetype == 'Serialexchange') { $("#exch_serial_s").val(serialsent); $(".exchanger").show(); @@ -365,6 +348,7 @@ function logQso() { localStorage.setItem("serialsent", $("#exch_serial_s").val()); localStorage.setItem("gridsquarereceived", $("#exch_gridsquare_r").val()); localStorage.setItem("gridsquaresent", $("#exch_gridsquare_s").val()); + localStorage.setItem("copytodok", $('#copyexchangetodok').is(":checked")); } }); } @@ -372,14 +356,17 @@ function logQso() { // We are restoring the settings in the contest logging form here function restoreContestSession() { - var contestname = localStorage.getItem("contestid"); + var dokcopy = localStorage.getItem("copytodok"); + if (dokcopy != null) { + $('#copyexchangetodok').prop('checked', true); + } + var contestname = localStorage.getItem("contestid"); if (contestname != null) { $("#contestname").val(contestname); } var exchangetype = localStorage.getItem("exchangetype"); - if (exchangetype != null) { $("#exchangetype").val(exchangetype); setExchangetype(exchangetype);