diff --git a/application/controllers/Awards.php b/application/controllers/Awards.php index d1e4d9cf..6e01f71c 100644 --- a/application/controllers/Awards.php +++ b/application/controllers/Awards.php @@ -369,6 +369,19 @@ class Awards extends CI_Controller { $this->load->view('interface_assets/footer'); } + public function was_details_ajax() { + $this->load->model('logbook_model'); + + $state = str_replace('"', "", $this->input->post("State")); + $band = str_replace('"', "", $this->input->post("Band")); + $data['results'] = $this->logbook_model->was_qso_details($state, $band); + + // Render Page + $data['page_title'] = "Log View - WAS"; + $data['filter'] = "state ".$state. " and ".$band; + $this->load->view('awards/was/details_ajax', $data); + } + public function iota () { $this->load->model('iota'); $data['worked_bands'] = $this->iota->get_worked_bands(); // Used in the view for band select diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 846e5741..4b50ccc8 100755 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -124,6 +124,36 @@ class QSO extends CI_Controller { $this->load->view('qso/edit_done'); } } + + function edit_ajax() { + + $this->load->model('logbook_model'); + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + $id = str_replace('"', "", $this->input->post("id")); + $query = $this->logbook_model->qso_info($id); + + $this->load->library('form_validation'); + + $this->form_validation->set_rules('time_on', 'Start Date', 'required'); + $this->form_validation->set_rules('time_off', 'End Date', 'required'); + $this->form_validation->set_rules('callsign', 'Callsign', 'required'); + + $data['qso'] = $query->row(); + $data['dxcc'] = $this->logbook_model->fetchDxcc(); + $data['iota'] = $this->logbook_model->fetchIota(); + + if ($this->form_validation->run() == FALSE) + { + $this->load->view('qso/edit', $data); + } + else + { + $this->logbook_model->edit(); + $this->session->set_flashdata('notice', 'Record Updated'); + $this->load->view('qso/edit_done'); + } + } function qsl_rcvd($id, $method) { $this->load->model('logbook_model'); @@ -138,6 +168,27 @@ class QSO extends CI_Controller { redirect('logbook'); } + + function qsl_rcvd_ajax() { + $id = str_replace('"', "", $this->input->post("id")); + $method = str_replace('"', "", $this->input->post("method")); + + $this->load->model('logbook_model'); + $this->load->model('user_model'); + + header('Content-Type: application/json'); + + if(!$this->user_model->authorize(2)) { + echo json_encode(array('message' => 'Error')); + + } + else { + // Update Logbook to Mark Paper Card Received + $this->logbook_model->paperqsl_update($id, $method); + + echo json_encode(array('message' => 'OK')); + } + } /* Delete QSO */ function delete($id) { @@ -156,6 +207,18 @@ class QSO extends CI_Controller { redirect($_SERVER['HTTP_REFERER']); } } + + /* Delete QSO */ + function delete_ajax() { + $id = str_replace('"', "", $this->input->post("id")); + + $this->load->model('logbook_model'); + + $this->logbook_model->delete($id); + header('Content-Type: application/json'); + echo json_encode(array('message' => 'OK')); + return; + } function band_to_freq($band, $mode) { diff --git a/application/models/Was.php b/application/models/Was.php index 451e342d..b366661e 100644 --- a/application/models/Was.php +++ b/application/models/Was.php @@ -87,14 +87,14 @@ class was extends CI_Model { if ($postdata['worked'] != NULL) { $wasBand = $this->getWasWorked($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = '
'; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } if ($postdata['confirmed'] != NULL) { $wasBand = $this->getWasConfirmed($station_id, $band, $postdata); foreach ($wasBand as $line) { - $bandWas[$line->col_state][$band] = ''; + $bandWas[$line->col_state][$band] = ''; $states[$line->col_state]['count']++; } } diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 9344c130..22515671 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -1437,34 +1437,93 @@ $(document).ready(function(){