implemented removal of transactions
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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} /> {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')} /> {account.currency}
|
||||
{/if}
|
||||
{#if id == transaction.destination.id}
|
||||
<LineEditor type="number" wrapper="span" editable="true" value={(+transaction.amount).toFixed(2)} onSet={setAmount} /> {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')} /> {account.currency}
|
||||
{/if}
|
||||
</td>
|
||||
{/each}
|
||||
@@ -121,3 +127,4 @@
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user