add modal func
This commit is contained in:
32
app.py
32
app.py
@@ -132,8 +132,6 @@ def updateduplicate():
|
|||||||
aud = request.form.get('auditory_dubl')
|
aud = request.form.get('auditory_dubl')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/vneaud', methods=['GET', 'POST'])
|
@app.route('/vneaud', methods=['GET', 'POST'])
|
||||||
def vneaud():
|
def vneaud():
|
||||||
res = []
|
res = []
|
||||||
@@ -180,6 +178,36 @@ def zamsearch():
|
|||||||
for item in searchedZam:
|
for item in searchedZam:
|
||||||
zam.append([item.txtzam, item.created_date])
|
zam.append([item.txtzam, item.created_date])
|
||||||
return render_template('zametki.html', zam=zam)
|
return render_template('zametki.html', zam=zam)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/addraspved', methods=['GET', 'POST'])
|
||||||
|
def addraspved():
|
||||||
|
if request.method == 'POST':
|
||||||
|
query_string = request.data
|
||||||
|
# Convert the bytes object to a string
|
||||||
|
query_string_str = query_string.decode("utf-8")
|
||||||
|
|
||||||
|
# Split the query string by '&' to get individual key-value pairs
|
||||||
|
key_value_pairs = query_string_str.split("&")
|
||||||
|
|
||||||
|
# Create a dictionary to store the key-value pairs
|
||||||
|
query_dict = {}
|
||||||
|
for pair in key_value_pairs:
|
||||||
|
key, value = pair.split("=")
|
||||||
|
query_dict[key] = value
|
||||||
|
|
||||||
|
# Retrieve the values for specific keys
|
||||||
|
rasp_value = query_dict.get("rasp")
|
||||||
|
ved_value = query_dict.get("ved")
|
||||||
|
|
||||||
|
print(f"Value for 'rasp': {rasp_value}")
|
||||||
|
print(f"Value for 'ved': {ved_value}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return jsonify({'success': True}, 200, {'ContentType': 'application/json'})
|
||||||
|
|
||||||
|
|
||||||
# ==================================================================================
|
# ==================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
$("#searchbutton").click(function(){
|
function getData(){
|
||||||
|
|
||||||
const audid = document.getElementById('auditory')
|
const audid = document.getElementById('auditory')
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
||||||
url: "/searchonaud",
|
url: "/searchonaud",
|
||||||
@@ -15,19 +13,20 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
success: function(response){
|
success: function(response){
|
||||||
|
|
||||||
var data = response;
|
var data = response;
|
||||||
const table = document.getElementById('datatable')
|
const table = document.getElementById('datatable')
|
||||||
table.innerHTML = ''
|
table.innerHTML = ''
|
||||||
var headTable = '<tr> <td>Инв. номер</td><td>Название</td><td class="no-print">Аудитория</td><td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
var headTable = '<tr> <td >Номер в Инв. вед</td> <td>Инв. номер</td><td>Название</td><td class="no-print">Аудитория</td> <td >Расположение</td> <td id="proverka"class="hidden-column"> Проверено</td> </tr>'
|
||||||
table.innerHTML += headTable
|
table.innerHTML += headTable
|
||||||
var tr =""
|
var tr =""
|
||||||
|
|
||||||
data.forEach(element => {
|
data.forEach(element => {
|
||||||
tr += '<tr onclick="tableclick(this)">'
|
tr += '<tr onclick="tableclick(this)">'
|
||||||
|
tr += '<td> </td>'
|
||||||
tr += '<td>' + element.inv_number + '</td>'
|
tr += '<td>' + element.inv_number + '</td>'
|
||||||
tr += '<td>' + element.oboruds_id + '</td>'
|
tr += '<td>' + element.oboruds_id + '</td>'
|
||||||
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
tr += '<td class="no-print">' + element.auditory_name + '</td>'
|
||||||
|
tr += '<td> </td>'
|
||||||
tr += '<td>' + '\n' + '</td>'
|
tr += '<td>' + '\n' + '</td>'
|
||||||
|
|
||||||
tr += '</tr>'
|
tr += '</tr>'
|
||||||
@@ -35,26 +34,64 @@
|
|||||||
table.innerHTML += tr
|
table.innerHTML += tr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#searchbutton").click(function(){
|
||||||
|
getData();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
function tableclick(x){
|
function tableclick(x){
|
||||||
let roww = x.rowIndex
|
let roww = x.rowIndex
|
||||||
let data = document.getElementById(x.rowIndex)
|
let data = document.getElementById(x.rowIndex)
|
||||||
|
|
||||||
let datas = x.innerText.split('\t')
|
let datas = x.innerText.split('\t')
|
||||||
|
|
||||||
console.log(datas[0])
|
console.log(datas)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('#getmodal').modal('show')
|
$('#getmodal').modal('show')
|
||||||
|
|
||||||
|
let rasp = document.getElementById('rapolog')
|
||||||
|
let vedomost = document.getElementById('vednumber')
|
||||||
|
|
||||||
|
if (datas[0].length>0){
|
||||||
|
rasp.value=datas[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (datas[4].length>0){
|
||||||
|
vedomost.value=datas[4]
|
||||||
|
}
|
||||||
|
|
||||||
$('#modalclose').click(function(){
|
$('#modalclose').click(function(){
|
||||||
|
|
||||||
$('#getmodal').modal('hide');
|
$('#getmodal').modal('hide');
|
||||||
} )
|
} )
|
||||||
}
|
|
||||||
|
$('#modalsavetodb').click(function(){
|
||||||
|
|
||||||
|
console.log(datas)
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
|
||||||
|
url: "/addraspved",
|
||||||
|
type: "post",
|
||||||
|
contentType: 'application/json',
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
rasp: rasp.value,
|
||||||
|
ved: vedomost.value
|
||||||
|
},
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
rasp.value='';
|
||||||
|
|
||||||
|
vedomost.value='';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('#getmodal').modal('hide');
|
||||||
|
|
||||||
|
// getData();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,13 @@
|
|||||||
<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" placeholder="Введите расположение">
|
<input type="text" class="form-control" id ='rapolog' placeholder="Введите расположение">
|
||||||
<input type="text" class="form-control" placeholder="Номер из веломости">
|
<input type="text" class="form-control" id ='vednumber' placeholder="Номер из веломости">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<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">Сохранить изменения</button>
|
<button type="button" class="btn btn-primary" id="modalsavetodb" >Сохранить изменения</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -47,9 +47,12 @@
|
|||||||
|
|
||||||
<table class="table" id="datatable" col-md-10>
|
<table class="table" id="datatable" col-md-10>
|
||||||
|
|
||||||
|
<td >Номер в Инв. вед</td>
|
||||||
<td >Инв. номер</td>
|
<td >Инв. номер</td>
|
||||||
<td >Название</td>
|
<td >Название</td>
|
||||||
<td class="no-print">Аудитория</td>
|
<td class="no-print">Аудитория</td>
|
||||||
|
<td >Расположение</td>
|
||||||
|
|
||||||
|
|
||||||
{% for item in res: %}
|
{% for item in res: %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user