File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed
Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ In case you want to use multiple mite accounts please open up a [change request]
7878
7979## Advanced Configuration Options
8080
81+ - ` currency `
82+ defines the currency used for displaying money values
8183- ` customersColumns `
8284 defines the default columns to be used when running ` mite customers list ` .
8385- ` listColumns `
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const usersCommand = require('./lib/commands/users');
1919nconf . file ( configFilename ) ;
2020
2121nconf . defaults ( {
22+ currency : '€' ,
2223 applicationName : `mite-cli/${ pkg . version } ` ,
2324 customersColumns : customersCommand . columns . default ,
2425 listColumns : listCommand . columns . default ,
Original file line number Diff line number Diff line change @@ -4,12 +4,8 @@ const chalk = require('chalk');
44
55const { USER_ROLES , BUDGET_TYPE } = require ( './constants' ) ;
66
7- // @TODO use currency from getAccount endpoint
8- const DEFAULT_CURRENCY = '€' ;
9-
107module . exports = {
118 BUDGET_TYPE : BUDGET_TYPE ,
12- CURRENCY : DEFAULT_CURRENCY ,
139
1410 note (
1511 note ,
@@ -90,15 +86,18 @@ module.exports = {
9086 } ,
9187
9288 budget ( type , value ) {
89+ // @TODO resolve circular dependency
90+ const config = require ( './../config' ) ;
91+ const CURRENCY = config . get ( ) . currency ;
9392 switch ( type ) {
9493 case BUDGET_TYPE . MINUTES_PER_MONTH :
9594 return this . minutesToDuration ( value ) + ' h/m' ;
9695 case BUDGET_TYPE . MINUTES :
9796 return this . minutesToDuration ( value ) + ' h' ;
9897 case BUDGET_TYPE . CENTS :
99- return this . price ( value / 100 ) + ' ' + this . CURRENCY ;
98+ return this . price ( value / 100 ) + ' ' + CURRENCY ;
10099 case BUDGET_TYPE . CENTS_PER_MONTH :
101- return this . price ( value / 100 ) + ' ' + this . CURRENCY + '/m' ;
100+ return this . price ( value / 100 ) + ' ' + CURRENCY + '/m' ;
102101 default :
103102 throw new Error ( `Unknown budget format type: "${ type } "` ) ;
104103 }
You can’t perform that action at this time.
0 commit comments