mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Added functionality for rejecting an OQRS
This commit is contained in:
@@ -202,6 +202,12 @@ class Oqrs extends CI_Controller {
|
||||
$this->oqrs_model->delete_oqrs_line($id);
|
||||
}
|
||||
|
||||
public function reject_oqrs_line() {
|
||||
$id = $this->input->post('id', TRUE);
|
||||
$this->load->model('oqrs_model');
|
||||
$this->oqrs_model->reject_oqrs_line($id);
|
||||
}
|
||||
|
||||
public function search_log() {
|
||||
$this->load->model('oqrs_model');
|
||||
$callsign = $this->input->post('callsign', TRUE);
|
||||
|
||||
@@ -214,6 +214,28 @@ class Oqrs_model extends CI_Model {
|
||||
return true;
|
||||
}
|
||||
|
||||
function reject_oqrs_line($id) {
|
||||
$sql = 'update ' . $this->config->item('table_name') . ' set COL_QSL_SENT = "N", COL_QSLSDATE = "", COL_QSL_SENT_VIA = ""
|
||||
where COL_PRIMARY_KEY = (select oqrs.qsoid from oqrs join station_profile on station_profile.station_id = oqrs.station_id where oqrs.id = ? and station_profile.user_id = ?)';
|
||||
$binding = [$id, $this->session->userdata('user_id')];
|
||||
|
||||
$this->db->query($sql, $binding);
|
||||
|
||||
$binding = [];
|
||||
|
||||
$binding = [$id, $this->session->userdata('user_id')];
|
||||
|
||||
$sql = 'UPDATE oqrs
|
||||
JOIN station_profile ON station_profile.station_id = oqrs.station_id
|
||||
SET oqrs.status = 4
|
||||
WHERE oqrs.id = ?
|
||||
AND station_profile.user_id = ?';
|
||||
|
||||
$query = $this->db->query($sql, $binding);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Status:
|
||||
// 0 = open request
|
||||
// 1 = not in log request
|
||||
|
||||
@@ -457,6 +457,8 @@ function echo_status(status) {
|
||||
case '0': return 'Open request'; break;
|
||||
case '1': return 'Not in log request'; break;
|
||||
case '2': return 'Request done'; break;
|
||||
case '3': return 'Request pending'; break;
|
||||
case '4': return 'Request rejected'; break;
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
@@ -556,6 +558,44 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
$('#rejectOqrs').click(function (event) {
|
||||
var elements = $('.oqrstable tbody input:checked');
|
||||
var nElements = elements.length;
|
||||
if (nElements == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$('#rejectOqrs').prop("disabled", true);
|
||||
|
||||
var table = $('.oqrstable').DataTable();
|
||||
|
||||
BootstrapDialog.confirm({
|
||||
title: 'WARNING',
|
||||
message: 'Warning! Are you sure you want to reject the marked OQRS request(s)?' ,
|
||||
type: BootstrapDialog.TYPE_WARNING,
|
||||
closable: true,
|
||||
draggable: true,
|
||||
btnOKClass: 'btn-warning',
|
||||
callback: function(result) {
|
||||
if(result) {
|
||||
elements.each(function() {
|
||||
let id = $(this).first().closest('tr').attr('id')?.replace(/\D/g, '');
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/oqrs/reject_oqrs_line',
|
||||
type: 'post',
|
||||
data: {'id': id
|
||||
},
|
||||
success: function(data) {
|
||||
$('#searchForm').submit();
|
||||
}
|
||||
});
|
||||
})
|
||||
$('#rejectOqrs').prop("disabled", false);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#markOqrs').click(function (event) {
|
||||
var elements = $('.oqrstable tbody input:checked');
|
||||
var nElements = elements.length;
|
||||
@@ -587,9 +627,9 @@ $(document).ready(function () {
|
||||
$('#searchForm').submit();
|
||||
}
|
||||
});
|
||||
$('#markOqrs').prop("disabled", false);
|
||||
})
|
||||
}
|
||||
$('#markOqrs').prop("disabled", false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user