add new func
This commit is contained in:
83
static/js/createcommision.js
Normal file
83
static/js/createcommision.js
Normal file
@@ -0,0 +1,83 @@
|
||||
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);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
@@ -6,11 +6,8 @@ btnadd.onclick = function (){
|
||||
fio = document.getElementById("fio").value;
|
||||
predsed = document.getElementById("predsedatel").checked;
|
||||
recent = document.getElementById("recentzent").checked;
|
||||
secretar = document.getElementById("secretar").checked;
|
||||
|
||||
|
||||
console.log(fio);
|
||||
console.log(predsed);
|
||||
console.log(recent);
|
||||
$.ajax(
|
||||
{
|
||||
url: "/addperson",
|
||||
@@ -21,6 +18,7 @@ btnadd.onclick = function (){
|
||||
'fio': fio,
|
||||
'predsed': predsed,
|
||||
'recent': recent,
|
||||
'secretar': secretar
|
||||
},
|
||||
error: function(error){
|
||||
console.log(error);
|
||||
|
||||
Reference in New Issue
Block a user