qrlist.html (1560B)
1 <html> 2 <head> 3 <title>qr list</title> 4 <style type="text/css"> 5 #qrlist td { 6 font-size: 0.5em; 7 } 8 th { 9 text-align: left; 10 } 11 </style> 12 <script> 13 window.addEventListener('load', () => { 14 const v = localStorage.getItem("craftNftQr.act.serial"); 15 const serialMax = parseInt(v); 16 const list = document.getElementById("qrlist"); 17 for (let i = 0; i < serialMax; i++) { 18 const j = localStorage.getItem("craftNftQr.act." + i); 19 const o = JSON.parse(j); 20 21 let st = 'pending'; 22 if (o > 0) { 23 st = 'success'; 24 } else if (o < 0) { 25 st = 'failure'; 26 } 27 28 const tr = document.createElement("tr"); 29 if ((i % 2) > 0) { 30 tr.setAttribute("bgColor", "#eee"); 31 } 32 let td = document.createElement("td"); 33 td.innerHTML = i; 34 tr.appendChild(td); 35 36 td = document.createElement("td"); 37 td.innerHTML = o.recipient; 38 tr.appendChild(td); 39 40 td = document.createElement("td"); 41 td.innerHTML = o.tokenId; 42 tr.appendChild(td); 43 44 td = document.createElement("td"); 45 td.innerHTML = o.voucherValue; 46 tr.appendChild(td); 47 48 td = document.createElement("td"); 49 td.innerHTML = st; 50 tr.appendChild(td); 51 52 td = document.createElement("td"); 53 td.innerHTML = new Date(o.dateCreated); 54 tr.appendChild(td); 55 56 td = document.createElement("td"); 57 td.innerHTML = new Date(o.dateUpdated); 58 tr.appendChild(td); 59 60 list.appendChild(tr); 61 } 62 }); 63 </script> 64 </head> 65 <body> 66 <table id="qrlist"> 67 <tr> 68 <th>serial</th> 69 <th>recipient</th> 70 <th>tokenId</th> 71 <th>value</th> 72 <th>status</th> 73 <th>created</th> 74 <th>updated</th> 75 </tr> 76 </table> 77 </body> 78 </html> 79