From 0efc88e71d4881779ee42cf50792e0bab67eb5ed Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Mon, 25 Nov 2019 11:51:02 +0100 Subject: [PATCH] select accounts --- public/pure.html | 71 ++++++++++++++++++++++++++++++------------------ 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/public/pure.html b/public/pure.html index 8afbb17..3e2e8af 100644 --- a/public/pure.html +++ b/public/pure.html @@ -58,42 +58,52 @@ ${dataset.map( line => data_to_donut_segment( line ) ).join("")} `; - } - }; + } + }; - let current_period; - let granularity = 3; + let current_period; + let granularity = 3; - const Controls = { - period: { + const Controls = { + period: { set: ( period ) => { - current_period = period; - const months = { 0: 'Janvier', - 1: 'Février', - 2: 'Mars', - 3: 'Avril', - 4: 'Mai', - 5: 'Juin', - 6: 'Juillet', - 7: 'Août', - 8: 'Septembre', - 9: 'Octobre', - 10: 'Novembre', - 11: 'Décembre' }; - document.querySelector( "#period #display" ).innerHTML = `${months[ current_period.getMonth() ]} ${current_period.getFullYear()}`; + current_period = period; + const months = { 0: 'Janvier', + 1: 'Février', + 2: 'Mars', + 3: 'Avril', + 4: 'Mai', + 5: 'Juin', + 6: 'Juillet', + 7: 'Août', + 8: 'Septembre', + 9: 'Octobre', + 10: 'Novembre', + 11: 'Décembre' }; + document.querySelector( "#period #display" ).innerHTML = `${months[ current_period.getMonth() ]} ${current_period.getFullYear()}`; - monthly(); + monthly(); }, get: () => current_period, prev: () => { - current_period.setMonth( current_period.getMonth() - 1 ); - Controls.period.set( current_period ); + current_period.setMonth( current_period.getMonth() - 1 ); + Controls.period.set( current_period ); }, next: () => { - current_period.setMonth( current_period.getMonth() + 1 ); - Controls.period.set( current_period ); + current_period.setMonth( current_period.getMonth() + 1 ); + Controls.period.set( current_period ); }, - }, + }, + accounts: { + init: async () => { + let accounts = await API.accounts(); + + let account_to_option = ( account ) => ``; + document.querySelector("#accounts").innerHTML = ``; + } + } /* granularity: { * set: ( value ) => { * if ( !isNaN( parseInt( value ) ) ) { @@ -134,12 +144,19 @@ --> +
+