106 lines
2.6 KiB
JavaScript
106 lines
2.6 KiB
JavaScript
|
|
function getData(){
|
|
|
|
const audid = document.getElementById('auditory')
|
|
$.ajax({
|
|
|
|
url: "/searchonaud",
|
|
type: "get",
|
|
contentType: 'application/json',
|
|
dataType: 'json',
|
|
data: {
|
|
auditory: audid.value
|
|
},
|
|
|
|
success: function(response){
|
|
console.log(response)
|
|
var data = response;
|
|
const table = document.getElementById('datatable')
|
|
table.innerHTML = ''
|
|
var headTable = '<tr> <td >Номер в Инв. вед</td> <td id="invnomer">Инв. номер</td><td>Название</td><td class="no-print aud">Аудитория</td> <td >Расположение</td> <td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
|
table.innerHTML += headTable
|
|
var tr =""
|
|
|
|
|
|
data.forEach(element => {
|
|
tr += '<tr onclick="tableclick(this)">'
|
|
tr += '<td>' + element.num_ved + '</td>'
|
|
tr += '<td clas="inv">' + element.inv_number + '</td>'
|
|
tr += '<td>' + element.oboruds_id + '</td>'
|
|
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
|
tr += '<td class="rasp">' +element.raspolog + '</td>'
|
|
tr += '<td>' + '\n' + '</td>'
|
|
|
|
tr += '</tr>'
|
|
});
|
|
table.innerHTML += tr
|
|
}
|
|
})
|
|
}
|
|
|
|
$("#searchbutton").click(function(){
|
|
getData();
|
|
})
|
|
|
|
function tableclick(x){
|
|
let data = document.getElementById(x.rowIndex)
|
|
|
|
let datas = x.innerText.split('\t')
|
|
|
|
|
|
|
|
|
|
$('#getmodal').modal('show')
|
|
|
|
let rasp = document.getElementById('rapolog')
|
|
let vedomost = document.getElementById('vednumber')
|
|
let invnom = document.getElementById('modal_invnom')
|
|
let matcen = document.getElementById('modal_matcenn')
|
|
|
|
invnom.innerText=datas[1]+"\t"
|
|
matcen.innerText=datas[2].substring(0,15)
|
|
|
|
|
|
if (datas[4].length>0){
|
|
rasp.value=datas[4];
|
|
}
|
|
|
|
if (datas[0].length>0){
|
|
vedomost.value=datas[0]
|
|
}
|
|
|
|
$('#modalclose').click(function(){
|
|
|
|
$('#getmodal').modal('hide');
|
|
|
|
} )
|
|
|
|
$('#modalsavetodb').click(function(){
|
|
|
|
|
|
$.ajax({
|
|
|
|
url: "/addraspved",
|
|
type: "POST",
|
|
contentType: "application/json;charset=utf-8",
|
|
dataType: "json",
|
|
data: {
|
|
rasp: rasp.value,
|
|
ved: vedomost.value,
|
|
inv: datas[1]
|
|
},
|
|
|
|
})
|
|
rasp.value = '';
|
|
vedomost.value= '';
|
|
|
|
datas = [];
|
|
|
|
$('#getmodal').modal('hide');
|
|
|
|
getData();
|
|
})
|
|
|
|
}
|
|
|