Added CryptoCurrency table to budget site
This commit is contained in:
parent
cc160b7e0e
commit
47076b0833
45
index.html
45
index.html
@ -49,6 +49,9 @@
|
|||||||
<table class="table-formatting" id="budget-table"></table>
|
<table class="table-formatting" id="budget-table"></table>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<table class="table-formatting" id="crypto-table"></table>
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<table class="table-formatting" id="transaction-table"></table>
|
<table class="table-formatting" id="transaction-table"></table>
|
||||||
@ -58,6 +61,7 @@
|
|||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
loadBudgetBalanceCheck();
|
loadBudgetBalanceCheck();
|
||||||
|
loadRecentCryptoCheck();
|
||||||
loadRecentTransactionsCheck();
|
loadRecentTransactionsCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +92,33 @@
|
|||||||
document.getElementById("sum").innerHTML = formatBalance(summation);
|
document.getElementById("sum").innerHTML = formatBalance(summation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addToCryptoTable(jsonData) {
|
||||||
|
let header = "<tr>"
|
||||||
|
+ "<th>Coin Name</th>"
|
||||||
|
+ "<th>Coin Symbol</th>"
|
||||||
|
+ "<th>Account Coin Balance</th>"
|
||||||
|
+ "<th>Coin Current Price</th>"
|
||||||
|
+ "<th>Account Value</th>"
|
||||||
|
+ "<th>Number of Transactions</th>"
|
||||||
|
+ "</tr>"
|
||||||
|
|
||||||
|
document.getElementById("crypto-table").innerHTML = header;
|
||||||
|
|
||||||
|
for (const item of jsonData.body) {
|
||||||
|
|
||||||
|
let row = "<tr>";
|
||||||
|
row += "<td class=\"budget-name\">" + item.name + "</td>";
|
||||||
|
row += "<td class=\"budget-name\">" + item.symbol + "</td>";
|
||||||
|
row += "<td>" + item.balance + "</td>";
|
||||||
|
row += "<td>" + formatBalance(item.price_in_usd) + "</td>";
|
||||||
|
row += "<td>" + formatBalance(item.balance_in_usd) + "</td>";
|
||||||
|
row += "<td>" + item.number_of_transactions + "</td>";
|
||||||
|
row += "</tr>";
|
||||||
|
|
||||||
|
document.getElementById("crypto-table").innerHTML += row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addToTransactionTable(jsonData) {
|
function addToTransactionTable(jsonData) {
|
||||||
let header = "<tr>"
|
let header = "<tr>"
|
||||||
+ "<th>ID</th>"
|
+ "<th>ID</th>"
|
||||||
@ -157,7 +188,7 @@
|
|||||||
//maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
|
//maximumFractionDigits: 0, // (causes 2500.99 to be printed as $2,501)
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(formatter.format(num)); /* $2,500.00 */
|
//console.log(formatter.format(num)); /* $2,500.00 */
|
||||||
|
|
||||||
let string = "<span class=\"" + classStr + "\">" + prefix + formatter.format(num) + "</span>"
|
let string = "<span class=\"" + classStr + "\">" + prefix + formatter.format(num) + "</span>"
|
||||||
|
|
||||||
@ -175,6 +206,17 @@
|
|||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function loadRecentCryptoCheck() {
|
||||||
|
let value = null;
|
||||||
|
const xhttp = new XMLHttpRequest();
|
||||||
|
xhttp.onload = function() {
|
||||||
|
addToCryptoTable(JSON.parse(this.responseText))
|
||||||
|
};
|
||||||
|
xhttp.open("GET", "https://n8n.veritablevalor.com/webhook/btc-check", true);
|
||||||
|
/*xhttp.setRequestHeader("access-control-allow-origin", "https://n8n.veritablevalor.com");*/
|
||||||
|
xhttp.send();
|
||||||
|
}
|
||||||
|
|
||||||
function loadRecentTransactionsCheck() {
|
function loadRecentTransactionsCheck() {
|
||||||
let value = null;
|
let value = null;
|
||||||
const xhttp = new XMLHttpRequest();
|
const xhttp = new XMLHttpRequest();
|
||||||
@ -185,6 +227,7 @@
|
|||||||
/*xhttp.setRequestHeader("access-control-allow-origin", "https://n8n.veritablevalor.com");*/
|
/*xhttp.setRequestHeader("access-control-allow-origin", "https://n8n.veritablevalor.com");*/
|
||||||
xhttp.send();
|
xhttp.send();
|
||||||
}
|
}
|
||||||
|
//https://n8n.veritablevalor.com/webhook-test/btc-check
|
||||||
|
|
||||||
//document.getElementById("budget-table").innerHTML = value;
|
//document.getElementById("budget-table").innerHTML = value;
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user