bel 2021-08-02 22:49:35 -06:00
parent 8e470ae0bd
commit bf5428a680
1 changed files with 21 additions and 5 deletions

View File

@ -1,6 +1,24 @@
<html>
<header>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
<style>
#transactions > tbody > tr > td:first-child input {
padding: 1ch;
display: inline-block;
}
#transactions td[key="Amount"]:before {
content: "$";
}
#transactions table tr td:first-child {
display: none;
}
#transactions table tr td:nth-child(2) {
width: 12ch;
}
#transactions table tr td:last-child {
width: 12ch;
}
</style>
<script>
function init() {
http("get", "/ledger.json", (body, status) => {
@ -13,15 +31,11 @@
return
}
var innerHTML = ""
var keys = []
for(const key in transactions[0]) {
keys.push(key)
}
for(var i in transactions) {
const transaction = transactions[i]
var one = "<tr>"
one += "<td>"
one += "<td style=\"width: 20%;\">"
for(var foo of ["saveTransaction", "zachsPayment", "belsPayment", "zachsCharge", "belsCharge"]) {
one += `<input value="${foo}" type="button" onclick="${foo}(this.parentNode.parentNode)"/><br>`
}
@ -32,6 +46,7 @@
one += ` <td key="idx" disabled readonly>${i}</td>`
for(var key of ["Date", "Description"])
one += ` <td contenteditable key=${JSON.stringify(key)}>${transaction[key]}</td>`
one += " <td></td>"
one += " </tr>"
one += " <tr>"
one += " <td></td><td></td>"
@ -42,6 +57,7 @@
one += " <td></td><td></td>"
for(var key of ["Payer"])
one += ` <td contenteditable key=${JSON.stringify(key)}>${transaction[key]}</td>`
one += " <td></td>"
one += " </tr>"
one += "</table></td>"