diff --git a/src/consts/currency.js b/src/consts/currency.js index 47995dfc..486ca364 100644 --- a/src/consts/currency.js +++ b/src/consts/currency.js @@ -629,8 +629,20 @@ const allCurrencies = { } }; + +const allCurrencyDisplayModes = { + None: 0, + Symbol: 1, + Code: 2, + Name: 3 +}; + +const defaultCurrencyDisplayMode = allCurrencyDisplayModes.Symbol; + export default { parentAccountCurrencyPlaceholder: parentAccountCurrencyPlaceholder, defaultCurrencySymbol: defaultCurrencySymbol, - all: allCurrencies + all: allCurrencies, + allCurrencyDisplayModes: allCurrencyDisplayModes, + defaultCurrencyDisplayMode: defaultCurrencyDisplayMode }; diff --git a/src/filters/currency.js b/src/filters/currency.js index 35704ce3..7628b6eb 100644 --- a/src/filters/currency.js +++ b/src/filters/currency.js @@ -25,7 +25,7 @@ export default function ({i18n}, value, currencyCode) { const currencyDisplayMode = settings.getCurrencyDisplayMode(); - if (currencyCode && currencyDisplayMode === 'symbol') { + if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Symbol) { const currencyInfo = currency.all[currencyCode]; let currencySymbol = currency.defaultCurrencySymbol; @@ -39,9 +39,9 @@ export default function ({i18n}, value, currencyCode) { amount: value, symbol: currencySymbol }); - } else if (currencyCode && currencyDisplayMode === 'code') { + } else if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Code) { return `${value} ${currencyCode}`; - } else if (currencyCode && currencyDisplayMode === 'name') { + } else if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Name) { const currencyName = i18n.t(`currency.${currencyCode}`); return `${value} ${currencyName}`; } else { diff --git a/src/lib/settings.js b/src/lib/settings.js index 2736ef89..0b2e4cba 100644 --- a/src/lib/settings.js +++ b/src/lib/settings.js @@ -1,5 +1,6 @@ import Cookies from 'js-cookie'; +import currencyConstants from '../consts/currency.js'; import statisticsConstants from '../consts/statistics.js'; const settingsLocalStorageKey = 'lab_app_settings'; @@ -12,7 +13,7 @@ const defaultSettings = { applicationLockWebAuthn: false, autoUpdateExchangeRatesData: true, thousandsSeparator: true, - currencyDisplayMode: 'symbol', // or 'none' or 'code' or 'name' + currencyDisplayMode: currencyConstants.defaultCurrencyDisplayMode, showAmountInHomePage: true, showAccountBalance: true, statistics: { diff --git a/src/views/mobile/Settings.vue b/src/views/mobile/Settings.vue index 5c6a6138..dfc77cad 100644 --- a/src/views/mobile/Settings.vue +++ b/src/views/mobile/Settings.vue @@ -51,10 +51,10 @@ :title="$t('Currency Display Mode')" smart-select :smart-select-params="{ openIn: 'sheet', closeOnSelect: true, sheetCloseLinkText: $t('Done') }">