code refactor
This commit is contained in:
+13
-1
@@ -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
|
||||
};
|
||||
|
||||
@@ -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 {
|
||||
|
||||
+2
-1
@@ -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: {
|
||||
|
||||
@@ -51,10 +51,10 @@
|
||||
:title="$t('Currency Display Mode')"
|
||||
smart-select :smart-select-params="{ openIn: 'sheet', closeOnSelect: true, sheetCloseLinkText: $t('Done') }">
|
||||
<select v-model="currencyDisplayMode">
|
||||
<option value="none">{{ $t('None') }}</option>
|
||||
<option value="symbol">{{ $t('Currency Symbol') }}</option>
|
||||
<option value="code">{{ $t('Currency Code') }}</option>
|
||||
<option value="name">{{ $t('Currency Name') }}</option>
|
||||
<option :value="$constants.currency.allCurrencyDisplayModes.None">{{ $t('None') }}</option>
|
||||
<option :value="$constants.currency.allCurrencyDisplayModes.Symbol">{{ $t('Currency Symbol') }}</option>
|
||||
<option :value="$constants.currency.allCurrencyDisplayModes.Code">{{ $t('Currency Code') }}</option>
|
||||
<option :value="$constants.currency.allCurrencyDisplayModes.Name">{{ $t('Currency Name') }}</option>
|
||||
</select>
|
||||
</f7-list-item>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user