summaryrefslogtreecommitdiff
path: root/app/bits/assets/delete.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
committerMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
commita2df9a69dcc14cb70118cda2ded499055e7ee358 (patch)
tree6dd283e4e9452d38bce81ddaaae49b5335755842 /app/bits/assets/delete.js
parent84dd0735820b16b60f600284d35183d76547a71f (diff)
downloadpluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip
m. update
Diffstat (limited to 'app/bits/assets/delete.js')
-rwxr-xr-xapp/bits/assets/delete.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/app/bits/assets/delete.js b/app/bits/assets/delete.js
new file mode 100755
index 0000000..0c6ce5e
--- /dev/null
+++ b/app/bits/assets/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