From f40ead9701953848b97cd69f2f03d508bbb5c368 Mon Sep 17 00:00:00 2001 From: Arc <33088785+arcbtc@users.noreply.github.com> Date: Fri, 10 Apr 2020 22:06:36 +0100 Subject: [PATCH] Update tpos.html --- .../extensions/tpos/templates/tpos/tpos.html | 98 ++----------------- 1 file changed, 10 insertions(+), 88 deletions(-) diff --git a/lnbits/extensions/tpos/templates/tpos/tpos.html b/lnbits/extensions/tpos/templates/tpos/tpos.html index 632f8f7f9..e39182295 100644 --- a/lnbits/extensions/tpos/templates/tpos/tpos.html +++ b/lnbits/extensions/tpos/templates/tpos/tpos.html @@ -6,16 +6,13 @@ - sparkpos + TPoS - + @@ -159,94 +156,19 @@ return xhr } +console.log( "{{ tpos.wallet }}" ) - var total = ""; - field1 = "field1" - field2 = "field2" - document.getElementById(field1).innerHTML = "

" - document.getElementById(field2).innerHTML = "

" - - 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 = "

" - document.getElementById(field2).innerHTML = "

" - - } - - 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)}), + postAjax( + "{{ url_for('tpos.api_tpos_create_invoice') }}", + JSON.stringify({"amount": "100"}), "filla", - function(data) { - theinvoice = JSON.parse(data).pay_req - 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 = "" + function(data) { + console.log(data) + } + ); - 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 = "

PAID!

" - console.log("theinvoice"); - - setTimeout(function(){ - - - location.reload(); - }, 4000); - - } - })}, 3000); - - -}) -}