Update tpos.html
This commit is contained in:
parent
ce46e8eb31
commit
f40ead9701
1 changed files with 10 additions and 88 deletions
|
|
@ -6,16 +6,13 @@
|
||||||
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>sparkpos</title>
|
<title>TPoS</title>
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<meta name="mobile-web-app-capable" content="yes">
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="theme-color" content="#363636">
|
<meta name="theme-color" content="#363636">
|
||||||
|
|
||||||
<script
|
|
||||||
src="{{ url_for('static', filename='plugins/jscam/qrcode.min.js') }}"
|
|
||||||
type="text/javascript"
|
|
||||||
></script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -159,94 +156,19 @@
|
||||||
return xhr
|
return xhr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log( "{{ tpos.wallet }}" )
|
||||||
|
|
||||||
var total = "";
|
postAjax(
|
||||||
field1 = "field1"
|
"{{ url_for('tpos.api_tpos_create_invoice') }}",
|
||||||
field2 = "field2"
|
JSON.stringify({"amount": "100"}),
|
||||||
document.getElementById(field1).innerHTML = "<p style='font-size: 30px;' id=sats></p>"
|
|
||||||
document.getElementById(field2).innerHTML = "<p style='font-size: 50px;' id=fiat></p>"
|
|
||||||
|
|
||||||
function keys(num){
|
|
||||||
if(Number.isInteger(num)){
|
|
||||||
total = total + String(num)
|
|
||||||
document.getElementById("fiat").innerHTML = String(parseInt(total)/100) + " " + "{{ ratee }}"
|
|
||||||
|
|
||||||
document.getElementById("sats").innerHTML = parseInt( (parseInt(total)/100) * parseInt( {{exchange}} )) + " " + "Sats"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(num == "DEL"){
|
|
||||||
total = "0";
|
|
||||||
}
|
|
||||||
else if(num == "C"){
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
else if(num == "<->"){
|
|
||||||
field1 = field2
|
|
||||||
field2 = field1
|
|
||||||
document.getElementById(field1).innerHTML = "<p style='font-size: 30px;' id=sats></p>"
|
|
||||||
document.getElementById(field2).innerHTML = "<p style='font-size: 50px;' id=fiat></p>"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(num == "OK"){
|
|
||||||
submitforticket(parseInt((parseInt(total)/100)* parseInt( {{exchange}} )))
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function submitforticket(sats){
|
|
||||||
console.log(sats)
|
|
||||||
|
|
||||||
postAjax(
|
|
||||||
"{{ url_for('tpos.api_tpos') }}",
|
|
||||||
JSON.stringify({"pos": "{{ pos }}", "sats": String(sats)}),
|
|
||||||
"filla",
|
"filla",
|
||||||
|
|
||||||
function(data) {
|
function(data) {
|
||||||
theinvoice = JSON.parse(data).pay_req
|
console.log(data)
|
||||||
thehash = JSON.parse(data).payment_hash
|
}
|
||||||
|
);
|
||||||
new QRCode(document.getElementById('qrcode'), {
|
|
||||||
text: theinvoice,
|
|
||||||
width: 300,
|
|
||||||
height: 300,
|
|
||||||
colorDark: '#000000',
|
|
||||||
colorLight: '#ffffff',
|
|
||||||
correctLevel: QRCode.CorrectLevel.M
|
|
||||||
})
|
|
||||||
document.getElementById("sats").innerHTML = ""
|
|
||||||
document.getElementById("fiat").innerHTML = ""
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("qrcode").style.backgroundColor = "white";
|
|
||||||
document.getElementById("qrcode").style.padding = "20px";
|
|
||||||
|
|
||||||
|
|
||||||
var refreshId = setInterval(function(){
|
|
||||||
|
|
||||||
getAjax('/api/v1/invoice/' + thehash, "{{wave}}", function(datab) {
|
|
||||||
console.log(JSON.parse(datab).PAID)
|
|
||||||
if (JSON.parse(datab).PAID == 'TRUE') {
|
|
||||||
|
|
||||||
document.getElementById("qrcode").innerHTML = ""
|
|
||||||
document.getElementById("qrcode").style.padding = "0px";
|
|
||||||
document.getElementById("qrcode").style.backgroundColor = "#363636";
|
|
||||||
document.getElementById("qrcode").innerHTML = "<h1 style='color:green;font-size: 100px;'>PAID!</h1>"
|
|
||||||
console.log("theinvoice");
|
|
||||||
|
|
||||||
setTimeout(function(){
|
|
||||||
|
|
||||||
|
|
||||||
location.reload();
|
|
||||||
}, 4000);
|
|
||||||
|
|
||||||
}
|
|
||||||
})}, 3000);
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue