implemented proper messages for accounting events

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-05-05 10:01:03 +02:00
parent cfd5362b1d
commit cc3a3a23a2
13 changed files with 99 additions and 40 deletions
@@ -57,13 +57,9 @@
window.setTimeout(scrollToBottom,100);
}
function handleEvent(evt,method){
let event_data = JSON.parse(evt.data);
console.log({method, event_data});
}
function handleDeleteEvent(evt){
handleEvent(evt,'delete');
const event_data = JSON.parse(evt.data);
transactions = transactions.filter(t => t.id != event_data.transaction.id);
}
function handleUpdateEvent(evt){
@@ -139,6 +135,7 @@
<th>{t('other party')}</th>
<th>{t('purpose')}</th>
<th>{t('tags')}</th>
<th></th>
</tr>
</thead>
<tbody>
@@ -160,7 +157,7 @@
<br/>
{sums[0].toFixed(2)}&nbsp;{account.currency}
</td>
<td colspan="2"></td>
<td colspan="3"></td>
</tr>
</tbody>
</table>
@@ -8,6 +8,16 @@
let { account, addToFilter = tag => {}, transaction, users } = $props();
let hidden = $state(false);
function deleteTransaction(ev){
if (confirm(t('confirm_delete',{element:transaction.purpose}))){
const url = api(`accounting/transaction/${transaction.id}`);
const res = drop(url);
if (res.ok){
yikes();
} else error(res);
}
}
async function dropTag(tag){
var url = api(`accounting/transaction/${transaction.id}/tag`)
var res = await drop(url,{tag});
@@ -127,5 +137,8 @@
<Autocomplete {getCandidates} {onCommit} />
</span>
</td>
<td class="actions">
<button class="symbol" onclick={deleteTransaction}></button>
</td>
</tr>
{/if}