working on tag handling in accounting module

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-04-10 00:02:54 +02:00
parent 85efb0ec02
commit ec3add70c6
11 changed files with 114 additions and 31 deletions

View File

@@ -62,6 +62,7 @@
{/each}
<th>{t('other party')}</th>
<th>{t('purpose')}</th>
<th>{t('tags')}</th>
</tr>
</thead>
<tbody>
@@ -78,7 +79,7 @@
{/if}
</td>
{/each}
<td>
<td class="party">
{#if !transaction.source.id}
{transaction.source.value}
{/if}
@@ -86,7 +87,10 @@
{transaction.destination.value}
{/if}
</td>
<td>{transaction.purpose}</td>
<td class="purpose">{transaction.purpose}</td>
<td class="tags">
{transaction.tags.join(', ')}
</td>
</tr>
{/each}
<tr>
@@ -109,5 +113,7 @@
</table>
</fieldset>
<span class="warn">TODO: Bearbeiten von Umsätzen</span>
<EntryForm {account} {onSave} />
{/if}

View File

@@ -29,16 +29,6 @@
});
let router = useTinyRouter();
function mapDisplay(object){
if (object.display){
return object;
} else if (object.name) {
return {...object, display: object.name};
} else {
return { display : object }
}
}
async function getTerminal(text,url){
var res = await post(url,text);
if (res.ok){
@@ -51,6 +41,11 @@
}
}
async function getAccountTags(text){
var url = api(`accounting/${entry.account.id}/tags`)
return await getTerminal(text,url);
}
async function getDestinations(text){
var url = api('accounting/destinations');
return await getTerminal(text,url);
@@ -66,6 +61,16 @@
return await getTerminal(text,url);
}
function mapDisplay(object){
if (object.display){
return object;
} else if (object.name) {
return {...object, display: object.name};
} else {
return { display : object }
}
}
async function save(){
let data = {
...entry,
@@ -75,6 +80,10 @@
let res = await post(url, data);
if (res.ok) {
yikes();
if (new_account){
router.navigate('/accounting');
return;
}
entry.tags = [];
onSave();
document.getElementById('date-input').focus();
@@ -93,8 +102,6 @@
}
</style>
<span class="warn">TODO: Tagging von Umsätzen</span>
<fieldset class="grid2">
{#if new_account}
<legend>{t('create_new_object',{object:t('account')})}</legend>
@@ -134,7 +141,7 @@
<Autocomplete bind:candidate={entry.purpose} getCandidates={getPurposes} />
<span>{t('tags')}</span>
<Tags module={null} bind:tags={entry.tags} />
<Tags getCandidates={getAccountTags} module={null} bind:tags={entry.tags} />
<span></span>
<span>

View File

@@ -11,6 +11,7 @@
let {
id = null,
getCandidates = getCandidateTags,
module,
tags = $bindable([]),
user_list = [],
@@ -64,7 +65,7 @@
return false;
}
async function getCandidates(input){
async function getCandidateTags(input){
if (!input || input.length <3) return [];
const url = api(`tags/search/${encodeURI(input)}`);
const res = await get(url);