83 lines
2.2 KiB
JavaScript
83 lines
2.2 KiB
JavaScript
let numbergak = document.getElementById("gaknumber")
|
|
let predsel = document.getElementById('predesdatel')
|
|
let uch1 = document.getElementById('uchgak1')
|
|
let uch2 = document.getElementById('uchgak2')
|
|
let uch3 = document.getElementById('uchgak3')
|
|
let uch4 = document.getElementById('uchgak4')
|
|
let addcom = document.getElementById("addcom")
|
|
|
|
let secretar = document.getElementById('secretar')
|
|
|
|
let preds = []
|
|
let alluchs = []
|
|
let secretars = []
|
|
|
|
$(document).ready(function () {
|
|
console.log("page Load!!")
|
|
|
|
$.getJSON("/gu", function (data) {
|
|
data.forEach(function (element) {
|
|
if (element.secretar == 0) {
|
|
alluchs.push(element.fio)
|
|
} else {
|
|
secretars.push(element.fio)
|
|
}
|
|
if (element.predsed == 1) {
|
|
preds.push(element.fio)
|
|
}
|
|
|
|
});
|
|
|
|
|
|
for (i = 0; i < preds.length; i++) {
|
|
let newOption = new Option(preds[i], preds[i])
|
|
predsel.appendChild(newOption)
|
|
}
|
|
|
|
alluchs.forEach(function (item) {
|
|
let newOption = new Option(item, item)
|
|
uch1.appendChild(newOption);
|
|
})
|
|
alluchs.forEach(function (item) {
|
|
let newOption = new Option(item, item)
|
|
uch2.appendChild(newOption);
|
|
})
|
|
alluchs.forEach(function (item) {
|
|
let newOption = new Option(item, item)
|
|
uch3.appendChild(newOption);
|
|
})
|
|
alluchs.forEach(function (item) {
|
|
let newOption = new Option(item, item)
|
|
uch4.appendChild(newOption);
|
|
})
|
|
secretars.forEach(function (item) {
|
|
let newOption = new Option(item, item)
|
|
secretar.appendChild(newOption)
|
|
})
|
|
});
|
|
|
|
});
|
|
|
|
addcom.onclick = function () {
|
|
console.log('PRESSEDD')
|
|
|
|
$.ajax({
|
|
url: "/addcommision",
|
|
type: "get",
|
|
contentType: "application/json",
|
|
dataType: "json",
|
|
data: {
|
|
'predsdatel': predsel.value,
|
|
'uchastnik1': uch1.value,
|
|
'uchastnik2': uch2.value,
|
|
'uchastnik3': uch3.value,
|
|
'uchastnik4': uch4.value,
|
|
'secretar': secretar.value
|
|
},
|
|
error: function (error) {
|
|
console.log(error);
|
|
}
|
|
})
|
|
|
|
|
|
} |