invert
This commit is contained in:
@@ -136,22 +136,41 @@
|
||||
}
|
||||
http("put", "/api/transactions", () => {init()}, JSON.stringify(kvs))
|
||||
}
|
||||
function setRowKeyValue(row, wantkey, wantvalue) {
|
||||
function getRowKeyValue(row, wantkey) {
|
||||
const inputs = row.getElementsByTagName("td")
|
||||
for (var i = 0; i < inputs.length; i++) {
|
||||
const key = inputs[i].getAttribute("key")
|
||||
if (key == wantkey) {
|
||||
return inputs[i].innerText + ""
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
function setRowKeyValues(row, wantKeysWantValues) {
|
||||
const inputs = row.getElementsByTagName("td")
|
||||
var kvs = {}
|
||||
for (var i = 0; i < inputs.length; i++) {
|
||||
const key = inputs[i].getAttribute("key")
|
||||
if (key == wantkey) {
|
||||
inputs[i].innerHTML = wantvalue
|
||||
break
|
||||
if (key in wantKeysWantValues) {
|
||||
inputs[i].innerHTML = wantKeysWantValues[key]
|
||||
}
|
||||
}
|
||||
saveTransaction(row)
|
||||
}
|
||||
zachsPayment = (x) => setRowKeyValue(x, "Payer", "AssetAccount:Zach")
|
||||
belsPayment = (x) => setRowKeyValue(x, "Payer", "AssetAccount:Bel")
|
||||
zachsCharge = (x) => setRowKeyValue(x, "Payee", "AssetAccount:Zach")
|
||||
belsCharge = (x) => setRowKeyValue(x, "Payee", "AssetAccount:Bel")
|
||||
zachsPayment = (x) => {
|
||||
setRowKeyValues(x, {
|
||||
"Payee": getRowKeyValue(x, "Payer"),
|
||||
"Payer": "AssetAccount:Zach",
|
||||
})
|
||||
}
|
||||
belsPayment = (x) => {
|
||||
setRowKeyValues(x, {
|
||||
"Payee": getRowKeyValue(x, "Payer"),
|
||||
"Payer": "AssetAccount:Bel",
|
||||
})
|
||||
}
|
||||
zachsCharge = (x) => setRowKeyValues(x, {"Payee": "AssetAccount:Zach"})
|
||||
belsCharge = (x) => setRowKeyValues(x, {"Payee": "AssetAccount:Bel"})
|
||||
function http(method, remote, callback, body) {
|
||||
var xmlhttp = new XMLHttpRequest();
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
|
||||
Reference in New Issue
Block a user