add click on row
This commit is contained in:
30
app.py
30
app.py
@@ -119,20 +119,26 @@ def alloborud():
|
||||
|
||||
@app.route('/getall')
|
||||
def getall():
|
||||
oboruds = Oboruds.query.all()
|
||||
oboruds_json = [{
|
||||
|
||||
'invNumber': oborud.invNumber,
|
||||
'nazvanie': oborud.nazvanie,
|
||||
'raspologenie': oborud.raspologenie,
|
||||
'balancenumber': oborud.balancenumber,
|
||||
'kolichestvo': oborud.kolichestvo,
|
||||
'balancenumber': oborud.balancenumber,
|
||||
'aud_id': oborud.aud_id
|
||||
} for oborud in oboruds]
|
||||
oborud = db.session.query(Auditory, Oboruds).filter(
|
||||
Oboruds.aud_id==Auditory.id
|
||||
).order_by(Oboruds.invNumber).all()
|
||||
|
||||
results = []
|
||||
for auditory, oboruds in oborud :
|
||||
results.append({
|
||||
'invNumber': oboruds.invNumber,
|
||||
'nazvanie': oboruds.nazvanie,
|
||||
'raspologenie': oboruds.raspologenie,
|
||||
'balancenumber': oboruds.balancenumber,
|
||||
'kolichestvo': oboruds.kolichestvo,
|
||||
'numberppasu': oboruds.numberppasu,
|
||||
'numberved': oboruds.numberved,
|
||||
'aud': auditory.audnazvanie
|
||||
|
||||
})
|
||||
|
||||
|
||||
return jsonify(oboruds_json)
|
||||
return jsonify(results)
|
||||
|
||||
@app.route('/updateduplicate', methods=['GET', 'POST'])
|
||||
def updateduplicate():
|
||||
|
||||
@@ -1,36 +1,43 @@
|
||||
function getAllData(){
|
||||
$.ajax({
|
||||
|
||||
url: "/getall",
|
||||
type: "get",
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
$(document).ready(function() {
|
||||
|
||||
success: function(response){
|
||||
console.log("1111")
|
||||
let data = response;
|
||||
var table = document.getElementById('alldatable');
|
||||
var tbody = table.getElementsByTagName('tbody')[0];
|
||||
let tableBody = document.getElementById('alldatatable').getElementsByTagName("tbody")[0];
|
||||
tableBody.innerHTML = '';
|
||||
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);
|
||||
i++;
|
||||
|
||||
cell1.innerText = i;
|
||||
cell2.innerText = item.invNumber;
|
||||
cell4.innerText = item.nazvanie;
|
||||
cell3.innerText = item.kolichestvo;
|
||||
cell5.innerText = item.numberved;
|
||||
cell6.innerText = item.raspologenie;
|
||||
cell7.innerText = item.aud;
|
||||
|
||||
// Clear existing data
|
||||
tbody.innerHTML = '';
|
||||
|
||||
// Loop through the data and create table rows
|
||||
data.forEach(function(item) {
|
||||
var row = document.createElement('tr');
|
||||
Object.values(item).forEach(function(value) {
|
||||
var cell = document.createElement('td');
|
||||
cell.textContent = value;
|
||||
row.appendChild(cell);
|
||||
});
|
||||
tbody.appendChild(row);
|
||||
});
|
||||
|
||||
|
||||
},
|
||||
|
||||
})
|
||||
}
|
||||
$(newRow).data('itemData', i);
|
||||
|
||||
|
||||
getAllData()
|
||||
$(newRow).on("click", function() {
|
||||
let ind = newRow.cells[0].innerText;
|
||||
let invNumber = newRow.cells[1].innerText;
|
||||
|
||||
$('#getmodal').modal('show')
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,53 @@
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="getmodal" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<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">
|
||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||
|
||||
</div>
|
||||
|
||||
<form method="POST" action="/addraspved">
|
||||
<div class="row">
|
||||
№ из ведомости
|
||||
<input type="text" class="form-control" name="modal_vednumber" id ='modal_vednumber' placeholder="Номер из ведомости">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
Расположение
|
||||
<input type="text" class="form-control" name="modal_rapolog" id ='modal_rapolog' placeholder="Введите расположение">
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="modalclose">Закрыть</button>
|
||||
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row col-12">
|
||||
<div class=" card col-11">
|
||||
<h3 class=" no-print"> Все мат. ценности </h3>
|
||||
<h3 id ='123' class=" no-print"> Все мат. ценности </h3>
|
||||
|
||||
</div>
|
||||
<div class="row col-12">
|
||||
@@ -14,8 +57,8 @@
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="card col-md-11" >
|
||||
<table id="datable" class="alldatable table pagebreak" >
|
||||
<div class="card col-md-11">
|
||||
<table id="alldatatable" class="alldatable table pagebreak" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">№ п/п</th>
|
||||
@@ -27,6 +70,16 @@
|
||||
<th scope="col">Аудитория</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>2</td>
|
||||
<td>3</td>
|
||||
<td>4</td>
|
||||
<td>5</td>
|
||||
<td>6</td>
|
||||
<td>7</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body" id="textarea">
|
||||
<<<<<<< HEAD
|
||||
|
||||
|
||||
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из веломости">
|
||||
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
||||
|
||||
=======
|
||||
|
||||
|
||||
<div class="row">
|
||||
<a id="modal_invnom"> </a><a id="modal_matcenn"></a>
|
||||
@@ -38,7 +38,6 @@
|
||||
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||
</div>
|
||||
|
||||
>>>>>>> 965695a6936eaf44348f73ca898f98c76b663157
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user