From 209356b8ade1920b50d1d3a1a5e121c6623d167b Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 11 Nov 2022 23:47:49 +0100 Subject: Update --- app/bits/static/delete.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 app/bits/static/delete.js (limited to 'app/bits/static/delete.js') diff --git a/app/bits/static/delete.js b/app/bits/static/delete.js new file mode 100755 index 0000000..0c6ce5e --- /dev/null +++ b/app/bits/static/delete.js @@ -0,0 +1,14 @@ +async function deleteTransaction(id) { + let transaction = transactions.filter(i => i.date.absolute === id)[0]; + console.log(transaction); + showConfirm("This will remove the transaction made by " + transaction.author.name + " " + transaction.date.relative + ".\nIt will be removed from the list and the global balance will be recalculated without this transaction."); + confirmAction = async () => { + if (isNodeJS) { + await (await window.fetch("https://ponies.equestria.horse/bits/Application/RemoveTransaction/index.php?Transaction=" + Buffer.from(id).toString("base64url"))).text(); + } else { + await (await window.fetch("https://ponies.equestria.horse/bits/Application/RemoveTransaction/index.php?Transaction=" + btoa(id).replaceAll("+", "-").replaceAll("/", "_"))).text(); + } + await refresh(); + deleteDialog.close(); + } +} \ No newline at end of file -- cgit