highlight original on amend...
parent
518909b7f7
commit
6c66b6debb
|
|
@ -5,6 +5,9 @@
|
||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
.amended {
|
||||||
|
border: 2px solid green;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
function http(method, remote, callback, body) {
|
function http(method, remote, callback, body) {
|
||||||
|
|
@ -40,12 +43,15 @@
|
||||||
load()
|
load()
|
||||||
}
|
}
|
||||||
|
|
||||||
function load() {
|
function load(callback) {
|
||||||
http("GET", "/api/transactions" /*?f="+f*/, (body, status) => {
|
http("GET", "/api/transactions" /*?f="+f*/, (body, status) => {
|
||||||
var d = JSON.parse(body)
|
var d = JSON.parse(body)
|
||||||
console.log("loading", d)
|
console.log("loading", d)
|
||||||
loadBalances(d.balances)
|
loadBalances(d.balances)
|
||||||
loadTransactions(d.transactions)
|
loadTransactions(d.transactions)
|
||||||
|
if (callback != null) {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -65,7 +71,7 @@
|
||||||
|
|
||||||
var result = `<table>`
|
var result = `<table>`
|
||||||
for (var t of transactions) {
|
for (var t of transactions) {
|
||||||
result += `<tr transaction='${btoa(JSON.stringify(t))}' style="cursor: crosshair;" onclick="stageEdit(this); return false;">`
|
result += `<tr id="transaction-${t[0].Transaction}" transaction='${btoa(JSON.stringify(t))}' style="cursor: crosshair;" onclick="stageEdit(this); return false;">`
|
||||||
result += ` <td style="width: 6em;">${t[0].Date}</td>`
|
result += ` <td style="width: 6em;">${t[0].Date}</td>`
|
||||||
result += ` <td style="width: 10em;">${t[0].Description}</td>`
|
result += ` <td style="width: 10em;">${t[0].Description}</td>`
|
||||||
result += ` <td><table style="margin: 0;">`
|
result += ` <td><table style="margin: 0;">`
|
||||||
|
|
@ -150,7 +156,9 @@
|
||||||
http("PUT", "/api/amend", (body, status) => {
|
http("PUT", "/api/amend", (body, status) => {
|
||||||
if (status != 200)
|
if (status != 200)
|
||||||
throw(`Unexpected status ${status}: ${body}`)
|
throw(`Unexpected status ${status}: ${body}`)
|
||||||
load()
|
load(() => {
|
||||||
|
document.getElementById(`transaction-${now.Transaction}`).className = "amended"
|
||||||
|
})
|
||||||
}, JSON.stringify({
|
}, JSON.stringify({
|
||||||
old: old,
|
old: old,
|
||||||
now: now,
|
now: now,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue