implemented purpose proposals based on source, dest and amount
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -42,7 +42,10 @@
|
||||
}
|
||||
|
||||
function focusOnEnter(ev,id){
|
||||
if (ev.key == 'Enter') document.getElementById(id).focus();
|
||||
if (ev.key == 'Enter') {
|
||||
proposePurpose();
|
||||
document.getElementById(id).focus();
|
||||
}
|
||||
}
|
||||
|
||||
async function getAccountTags(text){
|
||||
@@ -93,6 +96,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function proposePurpose(){
|
||||
const source = entry.source;
|
||||
const destination = entry.destination;
|
||||
const amount = entry.amount;
|
||||
const url = api(`accounting/${account.id}/purposes`);
|
||||
const res = await post(url,{source,destination,amount});
|
||||
if (res.ok) {
|
||||
yikes();
|
||||
var lastTransaction = await res.json();
|
||||
entry.purpose = { display: lastTransaction.purpose};
|
||||
entry.tags = lastTransaction.tags;
|
||||
} else error(res);
|
||||
}
|
||||
|
||||
async function save(){
|
||||
let data = {
|
||||
...entry,
|
||||
@@ -169,4 +186,4 @@
|
||||
<span>
|
||||
<button onclick={save}>{t('save')}</button>
|
||||
</span>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user