implemented removal of transactions

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-04-14 22:37:19 +02:00
parent f6b854a227
commit 1b6f65e123
5 changed files with 55 additions and 11 deletions
@@ -4,7 +4,9 @@
import { api, drop, patch, post } from '../../urls.svelte';
import { error, yikes } from '../../warn.svelte';
import { t } from '../../translations.svelte';
let { account, addToFilter = tag => {}, transaction, users } = $props();
let hidden = $state(false);
async function dropTag(tag){
var url = api(`accounting/transaction/${transaction.id}/tag`)
@@ -47,6 +49,7 @@
if (res.ok) {
yikes();
transaction.tags.push(tag.display);
transaction.tags.sort();
return true;
}
error(res);
@@ -54,7 +57,9 @@
}
async function setAmount(amount){
return await update({amount});
let result = await update({amount});
hidden = (amount == 0);
return result;
}
async function setDate(date){
return await update({date});
@@ -85,6 +90,7 @@
}
</script>
{#if !hidden}
<tr>
<td>
<LineEditor type="date" wrapper="span" editable="true" value={transaction.date} onSet={setDate} />
@@ -92,10 +98,10 @@
{#each Object.entries(users) as [id,user]}
<td class="amount">
{#if id == transaction.source.id}
-<LineEditor type="number" wrapper="span" editable="true" value={(+transaction.amount).toFixed(2)} onSet={setAmount} />&nbsp;{account.currency}
-<LineEditor type="number" wrapper="span" editable="true" value={(+transaction.amount).toFixed(2)} onSet={setAmount} title={t('Set to zero in order to drop the transaction')} />&nbsp;{account.currency}
{/if}
{#if id == transaction.destination.id}
<LineEditor type="number" wrapper="span" editable="true" value={(+transaction.amount).toFixed(2)} onSet={setAmount} />&nbsp;{account.currency}
<LineEditor type="number" wrapper="span" editable="true" value={(+transaction.amount).toFixed(2)} onSet={setAmount} title={t('Set to zero in order to drop the transaction')} />&nbsp;{account.currency}
{/if}
</td>
{/each}
@@ -121,3 +127,4 @@
</span>
</td>
</tr>
{/if}