Compare commits

..

2 Commits

Author SHA1 Message Date
bel
bb11214180 always highlight all inbox transactions
All checks were successful
cicd / ci (push) Successful in 50s
2024-07-21 08:43:09 -06:00
bel
6c66b6debb highlight original on amend... 2024-07-21 08:36:16 -06:00

View File

@@ -5,6 +5,12 @@
input[type="text"] {
border: 1px solid black;
}
.amended {
border: 2px solid red;
}
.revised {
border: 2px solid green;
}
</style>
<script>
function http(method, remote, callback, body) {
@@ -40,12 +46,15 @@
load()
}
function load() {
function load(callback) {
http("GET", "/api/transactions" /*?f="+f*/, (body, status) => {
var d = JSON.parse(body)
console.log("loading", d)
loadBalances(d.balances)
loadTransactions(d.transactions)
if (callback != null) {
callback()
}
})
}
@@ -65,7 +74,7 @@
var result = `<table>`
for (var t of transactions) {
result += `<tr transaction='${btoa(JSON.stringify(t))}' style="cursor: crosshair;" onclick="stageEdit(this); return false;">`
result += `<tr name="transaction-${t[0].Date}-${t[0].Description}" transaction='${btoa(JSON.stringify(t))}' style="cursor: crosshair;" onclick="stageEdit(this); return false;" class="${t[0].Transaction.includes("inbox") ? "revised" : ""}">`
result += ` <td style="width: 6em;">${t[0].Date}</td>`
result += ` <td style="width: 10em;">${t[0].Description}</td>`
result += ` <td><table style="margin: 0;">`
@@ -150,7 +159,16 @@
http("PUT", "/api/amend", (body, status) => {
if (status != 200)
throw(`Unexpected status ${status}: ${body}`)
load()
load(() => {
/*
var elements = document.getElementsByName(`transaction-${old.Date}-${old.Description}`)
for (var ele of elements)
ele.className = "amended"
var elements = document.getElementsByName(`transaction-${now.Date}-${now.Description}`)
for (var ele of elements)
ele.className = "revised"
*/
})
}, JSON.stringify({
old: old,
now: now,