Merge branch 'accounting' into dev
This commit is contained in:
@@ -42,6 +42,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getAccountTags(text){
|
async function getAccountTags(text){
|
||||||
|
if (!text) return [];
|
||||||
var url = api(`accounting/${entry.account.id}/tags`)
|
var url = api(`accounting/${entry.account.id}/tags`)
|
||||||
return await getTerminal(text,url);
|
return await getTerminal(text,url);
|
||||||
}
|
}
|
||||||
@@ -141,7 +142,7 @@
|
|||||||
<Autocomplete bind:candidate={entry.purpose} getCandidates={getPurposes} />
|
<Autocomplete bind:candidate={entry.purpose} getCandidates={getPurposes} />
|
||||||
|
|
||||||
<span>{t('tags')}</span>
|
<span>{t('tags')}</span>
|
||||||
<Tags getCandidates={getAccountTags} module={null} bind:tags={entry.tags} />
|
<Tags getCandidates={getAccountTags} module={null} bind:tags={entry.tags} onEmptyCommit={save} />
|
||||||
|
|
||||||
<span></span>
|
<span></span>
|
||||||
<span>
|
<span>
|
||||||
|
|||||||
@@ -21,16 +21,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function getCandidates(key){
|
async function getCandidates(key){
|
||||||
|
if (!key) return;
|
||||||
var url = api(`accounting/${account.id}/tags`)
|
var url = api(`accounting/${account.id}/tags`)
|
||||||
var res = await post(url,key);
|
var res = await post(url,key);
|
||||||
if (res.ok){
|
if (res.ok){
|
||||||
yikes();
|
yikes();
|
||||||
const input = await res.json();
|
const input = await res.json();
|
||||||
return Object.values(input).map(mapDisplay);
|
return Object.values(input).map(mapDisplay);
|
||||||
} else {
|
} else {
|
||||||
error(res);
|
error(res);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDisplay(object){
|
function mapDisplay(object){
|
||||||
@@ -127,4 +128,4 @@
|
|||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
id = null,
|
id = null,
|
||||||
getCandidates = getCandidateTags,
|
getCandidates = getCandidateTags,
|
||||||
module,
|
module,
|
||||||
|
onEmptyCommit = () => {},
|
||||||
tags = $bindable([]),
|
tags = $bindable([]),
|
||||||
user_list = [],
|
user_list = [],
|
||||||
} = $props();
|
} = $props();
|
||||||
@@ -89,7 +90,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function onCommit(wrapped){
|
async function onCommit(wrapped){
|
||||||
addTag(wrapped.display);
|
if (!wrapped.display) {
|
||||||
|
onEmptyCommit();
|
||||||
|
} else addTag(wrapped.display);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSelect(dummy){}
|
function onSelect(dummy){}
|
||||||
|
|||||||
Reference in New Issue
Block a user