Compare commits
2 Commits
518909b7f7
...
bb11214180
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb11214180 | ||
|
|
6c66b6debb |
@@ -5,6 +5,12 @@
|
|||||||
input[type="text"] {
|
input[type="text"] {
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
}
|
}
|
||||||
|
.amended {
|
||||||
|
border: 2px solid red;
|
||||||
|
}
|
||||||
|
.revised {
|
||||||
|
border: 2px solid green;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
function http(method, remote, callback, body) {
|
function http(method, remote, callback, body) {
|
||||||
@@ -40,12 +46,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 +74,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 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: 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 +159,16 @@
|
|||||||
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(() => {
|
||||||
|
/*
|
||||||
|
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({
|
}, JSON.stringify({
|
||||||
old: old,
|
old: old,
|
||||||
now: now,
|
now: now,
|
||||||
|
|||||||
Reference in New Issue
Block a user