working on usability

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-04-03 01:22:26 +02:00
parent a933ced8d8
commit 3d840b9f8a
6 changed files with 57 additions and 23 deletions

View File

@@ -27,8 +27,7 @@
});
let router = useTinyRouter();
async function getUsers(text){
var url = api('user/search');
async function getTerminal(text,url){
var res = await post(url,text);
if (res.ok){
yikes();
@@ -40,6 +39,16 @@
}
}
async function getDestinations(text){
var url = api('accounting/destinations');
return await getTerminal(text,url);
}
async function getSources(text){
var url = api('accounting/sources');
return await getTerminal(text,url);
}
async function save(){
let data = {
...entry,
@@ -68,24 +77,32 @@
<fieldset class="grid2">
{#if new_account}
<legend>{t('create_new_object',{object:t('account')})}</legend>
<span style="display:none"></span>
<span>{t('account name')}</span>
<input type="text" bind:value={entry.account.name} />
<span>
<input type="text" bind:value={entry.account.name} />
</span>
<span>{t('currency')}</span>
<input type="text" bind:value={entry.account.currency} />
<span>
<input type="text" bind:value={entry.account.currency} />
</span>
<hr/>
<span style="grid-column-end: span 2">{t('first transaction')}</span>
{:else}
<legend>{t('add_object',{object:t('entry')})}</legend>
<legend>{t('add_object',{object:t('transaction')})}</legend>
<span style="display:none"></span>
{/if}
<span>{t('date')}</span>
<input type="date" value={entry.date} />
<span>
<input type="date" value={entry.date} />
</span>
<span>{t('source')}</span>
<Autocomplete bind:candidate={entry.source} getCandidates={getUsers} />
<Autocomplete bind:candidate={entry.source} getCandidates={getSources} />
<span>{t('destination')}</span>
<Autocomplete bind:candidate={entry.destination} getCandidates={getUsers} />
<Autocomplete bind:candidate={entry.destination} getCandidates={getDestinations} />
<span>{t('amount')}</span>
<span>
@@ -100,14 +117,3 @@
<button onclick={save}>{t('save')}</button>
</span>
</fieldset>
<pre>
<code>
{JSON.stringify(entry,null,2)}
</code>
</pre>
<pre>
<code>
{JSON.stringify(user,null,2)}
</code>
</pre>

View File

@@ -33,7 +33,6 @@
</script>
<fieldset>
<legend>{t('accounts')}</legend>
<span></span>
<span>
@@ -47,4 +46,6 @@
</li>
{/each}
</ul>
<legend>{t('accounts')}</legend>
</fieldset>