updated index2.html to display data

This commit is contained in:
kicap 2024-06-10 16:48:48 +08:00
parent 927d265bd3
commit 9273d712bb
2 changed files with 22 additions and 8 deletions

2
app.py
View File

@ -483,7 +483,7 @@ async def check_jumlah_kenderaan():
kenderaan_kiri = result[0][4]
kenderaan_kanan = result[0][5]
waktu_sekarang = result[0][3]
return jsonify({'jumlah_kenderaan': jumlah_kenderaan, 'kenderaan_kiri': kenderaan_kiri, 'kenderaan_kanan': kenderaan_kanan, 'waktu_sekarang':waktu_sekarang})
return jsonify({'jumlah_kenderaan': jumlah_kenderaan, 'kenderaan_kiri': kenderaan_kiri, 'kenderaan_kanan': kenderaan_kanan, 'waktu_sekarang':waktu_sekarang , selesainya: selesainya})
# return jsonify({'jumlah_kenderaan': jumlah_kenderaan, 'kenderaan_kiri': kenderaan_kiri, 'kenderaan_kanan': kenderaan_kanan})

View File

@ -133,13 +133,15 @@
<div class="col-lg-8 col-md-10 col-xs-12">
<div class="box-content">
<h4 class="box-title">Hasil Pengolahan Video {% if stat != "Belum Ada Data" %} <i>({{ stat[6] }}) </i>{% endif %}</h4>
<h4 class="box-title">Hasil Pengolahan Video {% if stat != "Belum Ada Data" %} <i>({{ stat[6]
}}) </i>{% endif %}</h4>
<div class="card-content" id="div-ini-data">
<div id="data-video" style="display: none;"></div>
{% if stat == "Belum Ada Data" %}
<div class="form-group">
<p id="p-ket">{{ stat }}</p>
<button type="button" class="btn btn-primary" onclick="proses_video('{{ video }}')" id="btn-proses">Proses</button>
<button type="button" class="btn btn-primary" onclick="proses_video('{{ video }}')"
id="btn-proses">Proses</button>
</div>
{% else %}
<div class="form-group text-center">
@ -167,7 +169,8 @@
</table>
</div>
<div class="form-group text-center">
<button type="button" class="btn btn-primary" onclick="proses_video('{{ video }}')" id="btn-proses">Proses</button>
<button type="button" class="btn btn-primary" onclick="proses_video('{{ video }}')"
id="btn-proses">Proses</button>
</div>
{% endif %}
</div>
@ -262,14 +265,14 @@
document.getElementById('kanan').innerHTML = data.kenderaan_kanan
document.getElementById('total').innerHTML = data.jumlah_kenderaan
if(document.getElementById('example')){
if (document.getElementById('example')) {
$("#td-waktu-sekarang").text(data.waktu_sekarang);
$("#td-jumlah").text(data.jumlah_kenderaan);
$("#td-kiri").text(data.kenderaan_kiri);
$("#td-kanan").text(data.kenderaan_kanan);
}
if(data.selesainya == true){
if (data.selesainya == true) {
// reload page
window.location.reload();
}
@ -286,9 +289,20 @@
$("#btn-proses").attr("disabled", true)
$("#btn-proses").html("Memproses ....")
if(document.getElementById('p-ket')){
if (document.getElementById('p-ket')) {
$("#p-ket").html("Window pengolahan video sedang berjalan....")
}
document.getElementById('kiri').innerHTML = 0
document.getElementById('kanan').innerHTML = 0
document.getElementById('total').innerHTML = 0
if (document.getElementById('example')) {
$("#td-waktu-sekarang").text(0);
$("#td-jumlah").text(0);
$("#td-kiri").text(0);
$("#td-kanan").text(0);
}
}
// run check_jumlah_kenderaan every 1.5 seconds\