select accounts

This commit is contained in:
Gwenhael Le Moine 2019-11-25 11:51:02 +01:00
parent 53bc76aeab
commit 0efc88e71d
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -94,6 +94,16 @@
Controls.period.set( current_period );
},
},
accounts: {
init: async () => {
let accounts = await API.accounts();
let account_to_option = ( account ) => `<option value="${account.join(':')}">${account.join(':')}</option>`;
document.querySelector("#accounts").innerHTML = `<select multiple name="accounts" id="lstaccounts">
${accounts.map( account => account_to_option( account )).join('')}
</select>`;
}
}
/* granularity: {
* set: ( value ) => {
* if ( !isNaN( parseInt( value ) ) ) {
@ -134,12 +144,19 @@
<input oninput="Controls.granularity.set( this.value );">
</div> -->
</div>
<div id="accounts">
</div>
<div id="month">
<div id="donut" style="height: 256; width: 256;"></div>
</div>
<script>
Controls.period.set( new Date() );
(async () => {
await Controls.accounts.init();
console.log( await API.graph_values( "", ["Expenses", "Income"].join(" "), "monthly" ) )
await Controls.period.set( new Date() );
})();
</script>
</body>
</html>