add modal fucnc
This commit is contained in:
@@ -78,10 +78,13 @@ nav{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.table{
|
table{
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
|
border-collapse: separate!important;
|
||||||
|
}
|
||||||
|
td{
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aud{
|
.aud{
|
||||||
width: 110px;
|
width: 110px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +1,156 @@
|
|||||||
|
|
||||||
$(document).ready(function() {
|
function getAllData(){
|
||||||
|
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
||||||
|
i = 0;
|
||||||
|
$.getJSON("/getall", function(data) {
|
||||||
|
$.each(data, function(index, item) {
|
||||||
|
let newRow = tableBody.insertRow(tableBody.rows.length);
|
||||||
|
let cell1 = newRow.insertCell(0);
|
||||||
|
let cell2 = newRow.insertCell(1);
|
||||||
|
let cell3 = newRow.insertCell(2);
|
||||||
|
let cell4 = newRow.insertCell(3);
|
||||||
|
let cell5 = newRow.insertCell(4);
|
||||||
|
let cell6 = newRow.insertCell(5);
|
||||||
|
let cell7 = newRow.insertCell(6);
|
||||||
|
let cell8 = newRow.insertCell(7);
|
||||||
|
|
||||||
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
i++;
|
||||||
tableBody.innerHTML = '';
|
|
||||||
i = 0;
|
|
||||||
|
|
||||||
$.getJSON("/getall", function(data) {
|
cell1.innerText = i;
|
||||||
$.each(data, function(index, item) {
|
cell2.innerText = item.numberved;
|
||||||
let newRow = tableBody.insertRow(tableBody.rows.length);
|
cell3.innerText = item.invNumber;
|
||||||
let cell1 = newRow.insertCell(0);
|
cell4.innerText = item.nazvanie;
|
||||||
let cell2 = newRow.insertCell(1);
|
cell5.innerText = item.kolichestvo;
|
||||||
let cell3 = newRow.insertCell(2);
|
cell6.innerText = item.balancenumber;
|
||||||
let cell4 = newRow.insertCell(3);
|
cell7.innerText= item.aud;
|
||||||
let cell5 = newRow.insertCell(4);
|
cell8.innerText = item.raspologenie;
|
||||||
let cell6 = newRow.insertCell(5);
|
|
||||||
let cell7 = newRow.insertCell(6);
|
|
||||||
i++;
|
|
||||||
|
|
||||||
cell1.innerText = i;
|
|
||||||
cell2.innerText = item.invNumber;
|
$(newRow).data('itemData', i);
|
||||||
cell4.innerText = item.nazvanie;
|
|
||||||
cell3.innerText = item.kolichestvo;
|
|
||||||
cell5.innerText = item.numberved;
|
$(newRow).on("click", function() {
|
||||||
cell6.innerText = item.raspologenie;
|
|
||||||
cell7.innerText = item.aud;
|
|
||||||
|
|
||||||
$(newRow).data('itemData', i);
|
let vednumbertxt = newRow.cells[1].innerText;
|
||||||
|
let invnomertxt = newRow.cells[2].innerText;
|
||||||
|
let nazvanietxt = newRow.cells[3].innerText;
|
||||||
|
let kolvotxt = newRow.cells[4].innerText;
|
||||||
|
let schettxt = newRow.cells[5].innerText;
|
||||||
|
let raspologtxt = newRow.cells[7].innerText;
|
||||||
|
|
||||||
|
|
||||||
$(newRow).on("click", function() {
|
$('#getmodal').modal('show');
|
||||||
let ind = newRow.cells[0].innerText;
|
|
||||||
let invNumber = newRow.cells[1].innerText;
|
|
||||||
|
let vedomost = document.getElementById('modal_vednumber')
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
let kolvo = document.getElementById('modal_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
|
||||||
$('#getmodal').modal('show')
|
invnom.innerText = invnomertxt
|
||||||
});
|
matcen.innerText = nazvanietxt.substring(0,15)
|
||||||
|
|
||||||
|
if (vednumbertxt.length>0){
|
||||||
|
vedomost.value = vednumbertxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kolvotxt.length>0){
|
||||||
|
kolvo.value = kolvotxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (schettxt.length>0){
|
||||||
|
balancenumber.value = kolvotxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (raspologtxt.length>0){
|
||||||
|
rasp.value = raspologtxt;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$( document ).ready(function() {
|
||||||
|
|
||||||
|
getAllData();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
|
|
||||||
|
let vednumber = document.getElementById('modal_vednumber')
|
||||||
|
let kolvo = document.getElementById('modal_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vednumber = '';
|
||||||
|
kolvo = '';
|
||||||
|
balancenumber = '';
|
||||||
|
matcen = '';
|
||||||
|
rasp = '';
|
||||||
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} )
|
||||||
|
|
||||||
|
$('#modalsavetodb').click(function(){
|
||||||
|
|
||||||
|
let invnom = document.getElementById('modal_invnom')
|
||||||
|
let vednumber = document.getElementById('modal_vednumber')
|
||||||
|
let kolvo = document.getElementById('modal_kolvo')
|
||||||
|
let balancenumber = document.getElementById('modal_balance')
|
||||||
|
let matcen = document.getElementById('modal_matcenn')
|
||||||
|
let rasp = document.getElementById('modal_rapolog')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let changeddata = new Array()
|
||||||
|
|
||||||
|
changeddata[0] = invnom.text;
|
||||||
|
changeddata[1] = vednumber.value;
|
||||||
|
changeddata[2] = kolvo.value;
|
||||||
|
changeddata[3] = balancenumber.value;
|
||||||
|
changeddata[4] = rasp.value;
|
||||||
|
|
||||||
|
|
||||||
|
let sendData = changeddata.join(',')
|
||||||
|
console.log(sendData)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addraspved",
|
||||||
|
type: "POST",
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
dataType: "json",
|
||||||
|
data: sendData,
|
||||||
|
|
||||||
|
success: function(){
|
||||||
|
|
||||||
|
invnom = '';
|
||||||
|
vednumber = '';
|
||||||
|
kolvo = '';
|
||||||
|
balancenumber = '';
|
||||||
|
matcen = '';
|
||||||
|
rasp = '';
|
||||||
|
changeddata = []
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide')
|
||||||
|
|
||||||
|
getAllData();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
@@ -9,38 +9,37 @@
|
|||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-body" id="textarea">
|
<div class="modal-body" id="textarea">
|
||||||
|
|
||||||
|
|
||||||
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из веломости">
|
|
||||||
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form method="POST" action="/addraspved">
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
№ из ведомости
|
№ из ведомости
|
||||||
<input type="text" class="form-control" name="modal_vednumber" id ='modal_vednumber' placeholder="Номер из ведомости">
|
<input type="text" class="form-control" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
Расположение
|
Количество
|
||||||
<input type="text" class="form-control" name="modal_rapolog" id ='modal_rapolog' placeholder="Введите расположение">
|
<input type="text" class="form-control" id ='modal_kolvo' placeholder="Количество">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Балансовый счёт
|
||||||
|
<input type="text" class="form-control" id ='modal_balance' placeholder="Балансовый счёт">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
Расположение
|
||||||
|
<input type="text" class="form-control" id ='modal_rapolog' placeholder="Введите расположение">
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||||
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,17 +56,19 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="card col-md-11">
|
<div class="card col-md-11 table-responsive">
|
||||||
<table id="alldatatable" class="alldatable table pagebreak" >
|
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">№ п/п</th>
|
<th scope="col">№ <br>п/п <br>АСУ</th>
|
||||||
<th scope="col">№ п/п вед</th>
|
<th scope="col">№ п/п <br>вед</th>
|
||||||
<th scope="col">Инв. номер</th>
|
<th scope="col">Инв. номер</th>
|
||||||
<th scope="col">Название</th>
|
<th scope="col">Название</th>
|
||||||
<th scope="col">Кол-во</th>
|
<th scope="col">Кол-во</th>
|
||||||
<th scope="col">Счёт</th>
|
<th scope="col">Счёт</th>
|
||||||
<th scope="col">Аудитория</th>
|
<th scope="col">Ауд - я</th>
|
||||||
|
<th scope="col">Расположение</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user