From 78c7185439623d6dd53b8f4b12871a463d604cdf Mon Sep 17 00:00:00 2001 From: bel Date: Mon, 2 Aug 2021 23:14:58 -0600 Subject: [PATCH] btns --- public/index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/public/index.html b/public/index.html index b681bea..bcb526b 100644 --- a/public/index.html +++ b/public/index.html @@ -82,6 +82,22 @@ } http("put", "/api/transactions", () => {init()}, JSON.stringify(kvs)) } + function setRowKeyValue(row, wantkey, wantvalue) { + 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 + } + } + saveTransaction(row) + } + zachsPayment = (x) => setRowKeyValue(x, "Payer", "AssetAccount:Zach") + belsPayment = (x) => setRowKeyValue(x, "Payer", "AssetAccount:Bel") + zachsCharge = (x) => setRowKeyValue(x, "Payee", "DebtAccount:Zach") + belsCharge = (x) => setRowKeyValue(x, "belsCharge", "DebtAccount:Bel") function http(method, remote, callback, body) { var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() {