working on tag handling in accounting module
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user