mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-20 17:54:30 +08:00
code refactor
This commit is contained in:
+9
-8
@@ -14,6 +14,7 @@ import { useUserStore } from '@/stores/user.js';
|
|||||||
import { useTokensStore } from '@/stores/token.js';
|
import { useTokensStore } from '@/stores/token.js';
|
||||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||||
|
|
||||||
|
import { isProduction } from '@/lib/version.js';
|
||||||
import { loadMapAssets } from '@/lib/map/index.js';
|
import { loadMapAssets } from '@/lib/map/index.js';
|
||||||
import { getSystemTheme } from '@/lib/ui.js';
|
import { getSystemTheme } from '@/lib/ui.js';
|
||||||
|
|
||||||
@@ -22,8 +23,8 @@ export default {
|
|||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isProduction: self.$settings.isProduction(),
|
isProduction: isProduction(),
|
||||||
devCookiePath: self.$settings.isProduction() ? '' : '/dev/cookies'
|
devCookiePath: isProduction() ? '' : '/dev/cookies'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -33,16 +34,16 @@ export default {
|
|||||||
const self = this;
|
const self = this;
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
if (self.$settings.getTheme() === 'light') {
|
if (self.settingsStore.appSettings.theme === 'light') {
|
||||||
theme.global.name.value = 'light';
|
theme.global.name.value = 'light';
|
||||||
} else if (self.$settings.getTheme() === 'dark') {
|
} else if (self.settingsStore.appSettings.theme === 'dark') {
|
||||||
theme.global.name.value = 'dark';
|
theme.global.name.value = 'dark';
|
||||||
} else {
|
} else {
|
||||||
theme.global.name.value = getSystemTheme();
|
theme.global.name.value = getSystemTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function (e) {
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', function (e) {
|
||||||
if (self.$settings.getTheme() === 'auto') {
|
if (self.settingsStore.appSettings.theme === 'auto') {
|
||||||
if (e.matches) {
|
if (e.matches) {
|
||||||
theme.global.name.value = 'dark';
|
theme.global.name.value = 'dark';
|
||||||
} else {
|
} else {
|
||||||
@@ -51,11 +52,11 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage);
|
let localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage, self.settingsStore.appSettings.timeZone);
|
||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
|
|
||||||
if (self.$user.isUserLogined()) {
|
if (self.$user.isUserLogined()) {
|
||||||
if (!self.$settings.isEnableApplicationLock()) {
|
if (!self.settingsStore.appSettings.applicationLock) {
|
||||||
// refresh token if user is logined
|
// refresh token if user is logined
|
||||||
self.tokensStore.refreshTokenAndRevokeOldToken().then(response => {
|
self.tokensStore.refreshTokenAndRevokeOldToken().then(response => {
|
||||||
if (response.user && response.user.language) {
|
if (response.user && response.user.language) {
|
||||||
@@ -65,7 +66,7 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// auto refresh exchange rates data
|
// auto refresh exchange rates data
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-15
@@ -15,6 +15,8 @@ import { useUserStore } from '@/stores/user.js';
|
|||||||
import { useTokensStore } from '@/stores/token.js';
|
import { useTokensStore } from '@/stores/token.js';
|
||||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||||
|
|
||||||
|
import { isProduction } from '@/lib/version.js';
|
||||||
|
import { getTheme, isEnableAnimate } from '@/lib/settings.js';
|
||||||
import { loadMapAssets } from '@/lib/map/index.js';
|
import { loadMapAssets } from '@/lib/map/index.js';
|
||||||
import { isModalShowing, setAppFontSize } from '@/lib/ui.mobile.js';
|
import { isModalShowing, setAppFontSize } from '@/lib/ui.mobile.js';
|
||||||
|
|
||||||
@@ -23,15 +25,15 @@ export default {
|
|||||||
const self = this;
|
const self = this;
|
||||||
let darkMode = 'auto';
|
let darkMode = 'auto';
|
||||||
|
|
||||||
if (self.$settings.getTheme() === 'light') {
|
if (getTheme() === 'light') {
|
||||||
darkMode = false;
|
darkMode = false;
|
||||||
} else if (self.$settings.getTheme() === 'dark') {
|
} else if (getTheme() === 'dark') {
|
||||||
darkMode = true;
|
darkMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isProduction: self.$settings.isProduction(),
|
isProduction: isProduction(),
|
||||||
devCookiePath: self.$settings.isProduction() ? '' : '/dev/cookies',
|
devCookiePath: isProduction() ? '' : '/dev/cookies',
|
||||||
f7params: {
|
f7params: {
|
||||||
name: 'ezBookkeeping',
|
name: 'ezBookkeeping',
|
||||||
theme: 'ios',
|
theme: 'ios',
|
||||||
@@ -45,31 +47,31 @@ export default {
|
|||||||
tapHold: true
|
tapHold: true
|
||||||
},
|
},
|
||||||
serviceWorker: {
|
serviceWorker: {
|
||||||
path: self.$settings.isProduction() ? './sw.js' : undefined,
|
path: isProduction() ? './sw.js' : undefined,
|
||||||
scope: './',
|
scope: './',
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
animate: self.$settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
closeOnEscape: true
|
closeOnEscape: true
|
||||||
},
|
},
|
||||||
dialog: {
|
dialog: {
|
||||||
animate: self.$settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
backdrop: true
|
backdrop: true
|
||||||
},
|
},
|
||||||
popover: {
|
popover: {
|
||||||
animate: self.$settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
closeOnEscape: true
|
closeOnEscape: true
|
||||||
},
|
},
|
||||||
popup: {
|
popup: {
|
||||||
animate: self.$settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
swipeToClose: true
|
swipeToClose: true
|
||||||
},
|
},
|
||||||
sheet: {
|
sheet: {
|
||||||
animate: self.$settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
backdrop: true,
|
backdrop: true,
|
||||||
closeOnEscape: true
|
closeOnEscape: true
|
||||||
},
|
},
|
||||||
@@ -77,7 +79,7 @@ export default {
|
|||||||
routableModals: false
|
routableModals: false
|
||||||
},
|
},
|
||||||
view: {
|
view: {
|
||||||
animate: self.$settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
browserHistory: !self.isiOSHomeScreenMode(),
|
browserHistory: !self.isiOSHomeScreenMode(),
|
||||||
browserHistoryInitialMatch: true,
|
browserHistoryInitialMatch: true,
|
||||||
browserHistoryAnimate: false,
|
browserHistoryAnimate: false,
|
||||||
@@ -96,11 +98,11 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
let localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage);
|
let localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage, self.settingsStore.appSettings.timeZone);
|
||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
|
|
||||||
if (self.$user.isUserLogined()) {
|
if (self.$user.isUserLogined()) {
|
||||||
if (!self.$settings.isEnableApplicationLock()) {
|
if (!self.settingsStore.appSettings.applicationLock) {
|
||||||
// refresh token if user is logined
|
// refresh token if user is logined
|
||||||
self.tokensStore.refreshTokenAndRevokeOldToken().then(response => {
|
self.tokensStore.refreshTokenAndRevokeOldToken().then(response => {
|
||||||
if (response.user && response.user.language) {
|
if (response.user && response.user.language) {
|
||||||
@@ -110,14 +112,14 @@ export default {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// auto refresh exchange rates data
|
// auto refresh exchange rates data
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
setAppFontSize(this.$settings.getFontSize());
|
setAppFontSize(this.settingsStore.appSettings.fontSize);
|
||||||
|
|
||||||
f7ready((f7) => {
|
f7ready((f7) => {
|
||||||
this.isDarkMode = f7.darkMode;
|
this.isDarkMode = f7.darkMode;
|
||||||
|
|||||||
+3
-5
@@ -44,8 +44,7 @@ import '@vuepic/vue-datepicker/dist/main.css';
|
|||||||
|
|
||||||
import router from '@/router/desktop.js';
|
import router from '@/router/desktop.js';
|
||||||
|
|
||||||
import version from '@/lib/version.js';
|
import { getVersion, getBuildTime } from '@/lib/version.js';
|
||||||
import settings from '@/lib/settings.js';
|
|
||||||
import userstate from '@/lib/userstate.js';
|
import userstate from '@/lib/userstate.js';
|
||||||
import {
|
import {
|
||||||
getI18nOptions,
|
getI18nOptions,
|
||||||
@@ -324,10 +323,9 @@ app.component('VueDatePicker', VueDatePicker);
|
|||||||
app.component('AmountInput', AmountInput);
|
app.component('AmountInput', AmountInput);
|
||||||
app.component('ConfirmDialog', ConfirmDialog);
|
app.component('ConfirmDialog', ConfirmDialog);
|
||||||
|
|
||||||
app.config.globalProperties.$version = version.getVersion();
|
app.config.globalProperties.$version = getVersion();
|
||||||
app.config.globalProperties.$buildTime = version.getBuildTime();
|
app.config.globalProperties.$buildTime = getBuildTime();
|
||||||
|
|
||||||
app.config.globalProperties.$settings = settings;
|
|
||||||
app.config.globalProperties.$locale = i18nFunctions(i18n.global);
|
app.config.globalProperties.$locale = i18nFunctions(i18n.global);
|
||||||
app.config.globalProperties.$tIf = (text, isTranslate) => translateIf(text, isTranslate, i18n.global.t);
|
app.config.globalProperties.$tIf = (text, isTranslate) => translateIf(text, isTranslate, i18n.global.t);
|
||||||
app.config.globalProperties.$tError = (message) => translateError(message, i18n.global.t);
|
app.config.globalProperties.$tError = (message) => translateError(message, i18n.global.t);
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import settings from './settings.js';
|
import { isEnableThousandsSeparator } from './settings.js';
|
||||||
|
|
||||||
export function isFunction(val) {
|
export function isFunction(val) {
|
||||||
return typeof(val) === 'function';
|
return typeof(val) === 'function';
|
||||||
@@ -80,7 +80,7 @@ export function isEquals(obj1, obj2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function appendThousandsSeparator(value) {
|
export function appendThousandsSeparator(value) {
|
||||||
if (!settings.isEnableThousandsSeparator() || value.length <= 3) {
|
if (!isEnableThousandsSeparator() || value.length <= 3) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-12
@@ -24,7 +24,7 @@ import {
|
|||||||
} from './currency.js';
|
} from './currency.js';
|
||||||
|
|
||||||
import logger from './logger.js';
|
import logger from './logger.js';
|
||||||
import settings from './settings.js';
|
import { getCurrencyDisplayMode } from './settings.js';
|
||||||
import services from './services.js';
|
import services from './services.js';
|
||||||
|
|
||||||
const apiNotFoundErrorCode = 100001;
|
const apiNotFoundErrorCode = 100001;
|
||||||
@@ -530,7 +530,7 @@ function getDisplayCurrency(value, currencyCode, notConvertValue, translateFn) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const currencyDisplayMode = settings.getCurrencyDisplayMode();
|
const currencyDisplayMode = getCurrencyDisplayMode();
|
||||||
|
|
||||||
if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Symbol) {
|
if (currencyCode && currencyDisplayMode === currency.allCurrencyDisplayModes.Symbol) {
|
||||||
const currencyInfo = currency.all[currencyCode];
|
const currencyInfo = currency.all[currencyCode];
|
||||||
@@ -660,17 +660,15 @@ function setLanguage(i18nGlobal, locale, force) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTimezone(timezone) {
|
function setTimeZone(timezone) {
|
||||||
if (timezone) {
|
if (timezone) {
|
||||||
settings.setTimezone(timezone);
|
|
||||||
moment.tz.setDefault(timezone);
|
moment.tz.setDefault(timezone);
|
||||||
} else {
|
} else {
|
||||||
settings.setTimezone('');
|
|
||||||
moment.tz.setDefault();
|
moment.tz.setDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initLocale(i18nGlobal, lastUserLanguage) {
|
function initLocale(i18nGlobal, lastUserLanguage, timezone) {
|
||||||
let localeDefaultSettings = null;
|
let localeDefaultSettings = null;
|
||||||
|
|
||||||
if (lastUserLanguage && getLanguageInfo(lastUserLanguage)) {
|
if (lastUserLanguage && getLanguageInfo(lastUserLanguage)) {
|
||||||
@@ -680,9 +678,9 @@ function initLocale(i18nGlobal, lastUserLanguage) {
|
|||||||
localeDefaultSettings = setLanguage(i18nGlobal, null, true);
|
localeDefaultSettings = setLanguage(i18nGlobal, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.getTimezone()) {
|
if (timezone) {
|
||||||
logger.info(`Current timezone is ${settings.getTimezone()}`);
|
logger.info(`Current timezone is ${timezone}`);
|
||||||
setTimezone(settings.getTimezone());
|
setTimeZone(timezone);
|
||||||
} else {
|
} else {
|
||||||
logger.info(`No timezone is set, use browser default ${getTimezoneOffset()} (maybe ${moment.tz.guess(true)})`);
|
logger.info(`No timezone is set, use browser default ${getTimezoneOffset()} (maybe ${moment.tz.guess(true)})`);
|
||||||
}
|
}
|
||||||
@@ -771,8 +769,6 @@ export function i18nFunctions(i18nGlobal) {
|
|||||||
getAllWeekDays: () => getAllWeekDays(i18nGlobal.t),
|
getAllWeekDays: () => getAllWeekDays(i18nGlobal.t),
|
||||||
getDisplayCurrency: (value, currencyCode, notConvertValue) => getDisplayCurrency(value, currencyCode, notConvertValue, i18nGlobal.t),
|
getDisplayCurrency: (value, currencyCode, notConvertValue) => getDisplayCurrency(value, currencyCode, notConvertValue, i18nGlobal.t),
|
||||||
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
|
setLanguage: (locale, force) => setLanguage(i18nGlobal, locale, force),
|
||||||
getTimezone: settings.getTimezone,
|
initLocale: (lastUserLanguage, timezone) => initLocale(i18nGlobal, lastUserLanguage, timezone)
|
||||||
setTimezone: setTimezone,
|
|
||||||
initLocale: (lastUserLanguage) => initLocale(i18nGlobal, lastUserLanguage)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import settings from './settings.js';
|
import { isEnableDebug } from './settings.js';
|
||||||
|
|
||||||
function logDebug(msg, obj) {
|
function logDebug(msg, obj) {
|
||||||
if (settings.isEnableDebug()) {
|
if (isEnableDebug()) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
console.debug('[ezBookkeeping Debug] ' + msg, obj);
|
console.debug('[ezBookkeeping Debug] ' + msg, obj);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+10
-6
@@ -1,6 +1,10 @@
|
|||||||
import { asyncLoadAssets } from '@/lib/misc.js';
|
import { asyncLoadAssets } from '@/lib/misc.js';
|
||||||
import services from '@/lib/services.js';
|
import services from '@/lib/services.js';
|
||||||
import settings from '@/lib/settings.js';
|
import {
|
||||||
|
getAmapSecurityVerificationMethod,
|
||||||
|
getAmapApiExternalProxyUrl,
|
||||||
|
getAmapApplicationSecret
|
||||||
|
} from '@/lib/server_settings.js';
|
||||||
import logger from '@/lib/logger.js';
|
import logger from '@/lib/logger.js';
|
||||||
|
|
||||||
const amapHolder = {
|
const amapHolder = {
|
||||||
@@ -15,12 +19,12 @@ export function loadAmapAssets() {
|
|||||||
if (!window._AMapSecurityConfig) {
|
if (!window._AMapSecurityConfig) {
|
||||||
const amapSecurityConfig = {};
|
const amapSecurityConfig = {};
|
||||||
|
|
||||||
if (settings.getAmapSecurityVerificationMethod() === 'internalproxy') {
|
if (getAmapSecurityVerificationMethod() === 'internalproxy') {
|
||||||
amapSecurityConfig.serviceHost = services.generateAmapApiInternalProxyUrl();
|
amapSecurityConfig.serviceHost = services.generateAmapApiInternalProxyUrl();
|
||||||
} else if (settings.getAmapSecurityVerificationMethod() === 'externalproxy') {
|
} else if (getAmapSecurityVerificationMethod() === 'externalproxy') {
|
||||||
amapSecurityConfig.serviceHost = settings.getAmapApiExternalProxyUrl();
|
amapSecurityConfig.serviceHost = getAmapApiExternalProxyUrl();
|
||||||
} else if (settings.getAmapSecurityVerificationMethod() === 'plaintext') {
|
} else if (getAmapSecurityVerificationMethod() === 'plaintext') {
|
||||||
amapSecurityConfig.securityJsCode = settings.getAmapApplicationSecret();
|
amapSecurityConfig.securityJsCode = getAmapApplicationSecret();
|
||||||
}
|
}
|
||||||
|
|
||||||
window._AMapSecurityConfig = amapSecurityConfig;
|
window._AMapSecurityConfig = amapSecurityConfig;
|
||||||
|
|||||||
+19
-17
@@ -1,5 +1,7 @@
|
|||||||
import mapConstants from '@/consts/map.js';
|
import mapConstants from '@/consts/map.js';
|
||||||
import settings from '@/lib/settings.js';
|
import {
|
||||||
|
getMapProvider
|
||||||
|
} from '@/lib/server_settings.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
loadLeafletMapAssets,
|
loadLeafletMapAssets,
|
||||||
@@ -38,26 +40,26 @@ import {
|
|||||||
} from './amap.js';
|
} from './amap.js';
|
||||||
|
|
||||||
export function loadMapAssets(language) {
|
export function loadMapAssets(language) {
|
||||||
if (mapConstants.leafletTileSources[settings.getMapProvider()]) {
|
if (mapConstants.leafletTileSources[getMapProvider()]) {
|
||||||
return loadLeafletMapAssets(language);
|
return loadLeafletMapAssets(language);
|
||||||
} else if (settings.getMapProvider() === 'googlemap') {
|
} else if (getMapProvider() === 'googlemap') {
|
||||||
return loadGoogleMapAssets(language);
|
return loadGoogleMapAssets(language);
|
||||||
} else if (settings.getMapProvider() === 'baidumap') {
|
} else if (getMapProvider() === 'baidumap') {
|
||||||
return loadBaiduMapAssets(language);
|
return loadBaiduMapAssets(language);
|
||||||
} else if (settings.getMapProvider() === 'amap') {
|
} else if (getMapProvider() === 'amap') {
|
||||||
return loadAmapAssets(language);
|
return loadAmapAssets(language);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createMapHolder() {
|
export function createMapHolder() {
|
||||||
if (mapConstants.leafletTileSources[settings.getMapProvider()]) {
|
if (mapConstants.leafletTileSources[getMapProvider()]) {
|
||||||
return createLeafletMapHolder(settings.getMapProvider());
|
return createLeafletMapHolder(getMapProvider());
|
||||||
} else if (settings.getMapProvider() === 'googlemap') {
|
} else if (getMapProvider() === 'googlemap') {
|
||||||
return createGoogleMapHolder(settings.getMapProvider());
|
return createGoogleMapHolder(getMapProvider());
|
||||||
} else if (settings.getMapProvider() === 'baidumap') {
|
} else if (getMapProvider() === 'baidumap') {
|
||||||
return createBaiduMapHolder(settings.getMapProvider());
|
return createBaiduMapHolder(getMapProvider());
|
||||||
} else if (settings.getMapProvider() === 'amap') {
|
} else if (getMapProvider() === 'amap') {
|
||||||
return createAmapHolder(settings.getMapProvider());
|
return createAmapHolder(getMapProvider());
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -68,7 +70,7 @@ export function initMapInstance(mapHolder, mapContainer, options) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapConstants.leafletTileSources[settings.getMapProvider()]) {
|
if (mapConstants.leafletTileSources[getMapProvider()]) {
|
||||||
createLeafletMapInstance(mapHolder, mapContainer, options);
|
createLeafletMapInstance(mapHolder, mapContainer, options);
|
||||||
} else if (mapHolder.mapProvider === 'googlemap') {
|
} else if (mapHolder.mapProvider === 'googlemap') {
|
||||||
createGoogleMapInstance(mapHolder, mapContainer, options);
|
createGoogleMapInstance(mapHolder, mapContainer, options);
|
||||||
@@ -84,7 +86,7 @@ export function setMapCenterTo(mapHolder, center, zoomLevel) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapConstants.leafletTileSources[settings.getMapProvider()]) {
|
if (mapConstants.leafletTileSources[getMapProvider()]) {
|
||||||
setLeafletMapCenterTo(mapHolder, center, zoomLevel);
|
setLeafletMapCenterTo(mapHolder, center, zoomLevel);
|
||||||
} else if (mapHolder.mapProvider === 'googlemap') {
|
} else if (mapHolder.mapProvider === 'googlemap') {
|
||||||
setGoogleMapCenterTo(mapHolder, center, zoomLevel);
|
setGoogleMapCenterTo(mapHolder, center, zoomLevel);
|
||||||
@@ -100,7 +102,7 @@ export function setMapCenterMarker(mapHolder, position) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapConstants.leafletTileSources[settings.getMapProvider()]) {
|
if (mapConstants.leafletTileSources[getMapProvider()]) {
|
||||||
setLeafletMapCenterMaker(mapHolder, position);
|
setLeafletMapCenterMaker(mapHolder, position);
|
||||||
} else if (mapHolder.mapProvider === 'googlemap') {
|
} else if (mapHolder.mapProvider === 'googlemap') {
|
||||||
setGoogleMapCenterMaker(mapHolder, position);
|
setGoogleMapCenterMaker(mapHolder, position);
|
||||||
@@ -116,7 +118,7 @@ export function removeMapCenterMarker(mapHolder) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mapConstants.leafletTileSources[settings.getMapProvider()]) {
|
if (mapConstants.leafletTileSources[getMapProvider()]) {
|
||||||
removeLeafletMapCenterMaker(mapHolder);
|
removeLeafletMapCenterMaker(mapHolder);
|
||||||
} else if (mapHolder.mapProvider === 'googlemap') {
|
} else if (mapHolder.mapProvider === 'googlemap') {
|
||||||
removeGoogleMapCenterMaker(mapHolder);
|
removeGoogleMapCenterMaker(mapHolder);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import mapConstants from '@/consts/map.js';
|
import mapConstants from '@/consts/map.js';
|
||||||
import settings from '@/lib/settings.js';
|
import { isMapDataFetchProxyEnabled, getTomTomMapAPIKey } from '@/lib/server_settings.js';
|
||||||
import services from '@/lib/services.js';
|
import services from '@/lib/services.js';
|
||||||
|
|
||||||
const leafletHolder = {
|
const leafletHolder = {
|
||||||
@@ -48,7 +48,7 @@ export function createLeafletMapInstance(mapHolder, mapContainer, options) {
|
|||||||
});
|
});
|
||||||
let mapTileSource = Object.assign({}, mapConstants.leafletTileSources[mapHolder.mapProvider]);
|
let mapTileSource = Object.assign({}, mapConstants.leafletTileSources[mapHolder.mapProvider]);
|
||||||
|
|
||||||
if (settings.isMapDataFetchProxyEnabled()) {
|
if (isMapDataFetchProxyEnabled()) {
|
||||||
mapTileSource.tileUrlFormat = services.generateMapProxyTileImageUrl(mapHolder.mapProvider, options.language);
|
mapTileSource.tileUrlFormat = services.generateMapProxyTileImageUrl(mapHolder.mapProvider, options.language);
|
||||||
mapTileSource.tileUrlSubDomains = '';
|
mapTileSource.tileUrlSubDomains = '';
|
||||||
} else if (mapTileSource.tileUrlExtraParams) {
|
} else if (mapTileSource.tileUrlExtraParams) {
|
||||||
@@ -58,7 +58,7 @@ export function createLeafletMapInstance(mapHolder, mapContainer, options) {
|
|||||||
const param = mapTileSource.tileUrlExtraParams[i];
|
const param = mapTileSource.tileUrlExtraParams[i];
|
||||||
|
|
||||||
if (param.paramValueType === 'tomtom_key') {
|
if (param.paramValueType === 'tomtom_key') {
|
||||||
params.push('key=' + settings.getTomTomMapAPIKey());
|
params.push('key=' + getTomTomMapAPIKey());
|
||||||
} else if (param.paramValueType === 'language' && options.language) {
|
} else if (param.paramValueType === 'language' && options.language) {
|
||||||
params.push('language=' + options.language);
|
params.push('language=' + options.language);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import Cookies from 'js-cookie';
|
||||||
|
|
||||||
|
import { base64decode } from '@/lib/common.js';
|
||||||
|
|
||||||
|
const serverSettingsCookieKey = 'ebk_server_settings';
|
||||||
|
|
||||||
|
function getServerSetting(key) {
|
||||||
|
const settings = Cookies.get(serverSettingsCookieKey) || '';
|
||||||
|
const settingsArr = settings.split('_');
|
||||||
|
|
||||||
|
for (let i = 0; i < settingsArr.length; i++) {
|
||||||
|
const pairs = settingsArr[i].split('.');
|
||||||
|
|
||||||
|
if (pairs[0] === key) {
|
||||||
|
return pairs[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getServerDecodedSetting(key) {
|
||||||
|
const value = getServerSetting(key);
|
||||||
|
|
||||||
|
if (!value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return decodeURIComponent(base64decode(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isUserRegistrationEnabled() {
|
||||||
|
return getServerSetting('r') === '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isDataExportingEnabled() {
|
||||||
|
return getServerSetting('e') === '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getMapProvider() {
|
||||||
|
return getServerSetting('m');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isMapDataFetchProxyEnabled() {
|
||||||
|
return getServerSetting('mp') === '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTomTomMapAPIKey() {
|
||||||
|
return getServerDecodedSetting('tmak');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getGoogleMapAPIKey() {
|
||||||
|
return getServerDecodedSetting('gmak');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getBaiduMapAK() {
|
||||||
|
return getServerDecodedSetting('bmak');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAmapApplicationKey() {
|
||||||
|
return getServerDecodedSetting('amak');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAmapSecurityVerificationMethod() {
|
||||||
|
return getServerSetting('amsv');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAmapApiExternalProxyUrl() {
|
||||||
|
return getServerDecodedSetting('amep');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAmapApplicationSecret() {
|
||||||
|
return getServerDecodedSetting('amas');
|
||||||
|
}
|
||||||
+8
-4
@@ -2,7 +2,11 @@ import axios from 'axios';
|
|||||||
|
|
||||||
import api from '@/consts/api.js';
|
import api from '@/consts/api.js';
|
||||||
import userState from './userstate.js';
|
import userState from './userstate.js';
|
||||||
import settings from './settings.js';
|
import {
|
||||||
|
getGoogleMapAPIKey,
|
||||||
|
getBaiduMapAK,
|
||||||
|
getAmapApplicationKey
|
||||||
|
} from './server_settings.js';
|
||||||
import { getTimezoneOffsetMinutes } from './datetime.js';
|
import { getTimezoneOffsetMinutes } from './datetime.js';
|
||||||
|
|
||||||
let needBlockRequest = false;
|
let needBlockRequest = false;
|
||||||
@@ -407,7 +411,7 @@ export default {
|
|||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
generateGoogleMapJavascriptUrl: (language, callbackFnName) => {
|
generateGoogleMapJavascriptUrl: (language, callbackFnName) => {
|
||||||
let url = `${api.googleMapJavascriptUrl}?key=${settings.getGoogleMapAPIKey()}&libraries=core,marker&callback=${callbackFnName}`;
|
let url = `${api.googleMapJavascriptUrl}?key=${getGoogleMapAPIKey()}&libraries=core,marker&callback=${callbackFnName}`;
|
||||||
|
|
||||||
if (language) {
|
if (language) {
|
||||||
url = url + `&language=${language}`;
|
url = url + `&language=${language}`;
|
||||||
@@ -416,10 +420,10 @@ export default {
|
|||||||
return url;
|
return url;
|
||||||
},
|
},
|
||||||
generateBaiduMapJavascriptUrl: (callbackFnName) => {
|
generateBaiduMapJavascriptUrl: (callbackFnName) => {
|
||||||
return `${api.baiduMapJavascriptUrl}&ak=${settings.getBaiduMapAK()}&callback=${callbackFnName}`;
|
return `${api.baiduMapJavascriptUrl}&ak=${getBaiduMapAK()}&callback=${callbackFnName}`;
|
||||||
},
|
},
|
||||||
generateAmapJavascriptUrl: (callbackFnName) => {
|
generateAmapJavascriptUrl: (callbackFnName) => {
|
||||||
return `${api.amapJavascriptUrl}&key=${settings.getAmapApplicationKey()}&plugin=AMap.ToolBar&callback=${callbackFnName}`;
|
return `${api.amapJavascriptUrl}&key=${getAmapApplicationKey()}&plugin=AMap.ToolBar&callback=${callbackFnName}`;
|
||||||
},
|
},
|
||||||
generateAmapApiInternalProxyUrl: () => {
|
generateAmapApiInternalProxyUrl: () => {
|
||||||
return `${window.location.origin}${api.baseAmapApiProxyUrlPath}`;
|
return `${window.location.origin}${api.baseAmapApiProxyUrlPath}`;
|
||||||
|
|||||||
+153
-83
@@ -1,12 +1,7 @@
|
|||||||
import Cookies from 'js-cookie';
|
|
||||||
|
|
||||||
import currencyConstants from '@/consts/currency.js';
|
import currencyConstants from '@/consts/currency.js';
|
||||||
import statisticsConstants from '@/consts/statistics.js';
|
import statisticsConstants from '@/consts/statistics.js';
|
||||||
|
|
||||||
import { base64decode } from '@/lib/common.js';
|
|
||||||
|
|
||||||
const settingsLocalStorageKey = 'ebk_app_settings';
|
const settingsLocalStorageKey = 'ebk_app_settings';
|
||||||
const serverSettingsCookieKey = 'ebk_server_settings';
|
|
||||||
|
|
||||||
const defaultSettings = {
|
const defaultSettings = {
|
||||||
theme: 'auto',
|
theme: 'auto',
|
||||||
@@ -106,87 +101,162 @@ function setSubOption(key, subKey, value) {
|
|||||||
return setSettings(settings);
|
return setSettings(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getServerSetting(key) {
|
export function isEnableDebug() {
|
||||||
const settings = Cookies.get(serverSettingsCookieKey) || '';
|
return getOption('debug');
|
||||||
const settingsArr = settings.split('_');
|
|
||||||
|
|
||||||
for (let i = 0; i < settingsArr.length; i++) {
|
|
||||||
const pairs = settingsArr[i].split('.');
|
|
||||||
|
|
||||||
if (pairs[0] === key) {
|
|
||||||
return pairs[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getServerDecodedSetting(key) {
|
export function getTheme() {
|
||||||
const value = getServerSetting(key);
|
return getOption('theme');
|
||||||
|
|
||||||
if (!value) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return decodeURIComponent(base64decode(value));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearSettings() {
|
export function setTheme(value) {
|
||||||
|
return setOption('theme', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getFontSize() {
|
||||||
|
return getOption('fontSize');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setFontSize(value) {
|
||||||
|
return setOption('fontSize', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getTimeZone() {
|
||||||
|
return getOption('timeZone');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setTimeZone(value) {
|
||||||
|
return setOption('timeZone', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isEnableApplicationLock() {
|
||||||
|
return getOption('applicationLock');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setEnableApplicationLock(value) {
|
||||||
|
return setOption('applicationLock', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isEnableApplicationLockWebAuthn() {
|
||||||
|
return getOption('applicationLockWebAuthn');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setEnableApplicationLockWebAuthn(value) {
|
||||||
|
return setOption('applicationLockWebAuthn', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isAutoUpdateExchangeRatesData() {
|
||||||
|
return getOption('autoUpdateExchangeRatesData');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setAutoUpdateExchangeRatesData(value) {
|
||||||
|
setOption('autoUpdateExchangeRatesData', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isAutoGetCurrentGeoLocation() {
|
||||||
|
return getOption('autoGetCurrentGeoLocation');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setAutoGetCurrentGeoLocation(value) {
|
||||||
|
setOption('autoGetCurrentGeoLocation', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isEnableThousandsSeparator() {
|
||||||
|
return getOption('thousandsSeparator');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setEnableThousandsSeparator(value) {
|
||||||
|
setOption('thousandsSeparator', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCurrencyDisplayMode() {
|
||||||
|
return getOption('currencyDisplayMode');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setCurrencyDisplayMode(value) {
|
||||||
|
setOption('currencyDisplayMode', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isShowAmountInHomePage() {
|
||||||
|
return getOption('showAmountInHomePage');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setShowAmountInHomePage(value) {
|
||||||
|
setOption('showAmountInHomePage', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isShowTotalAmountInTransactionListPage() {
|
||||||
|
return getOption('showTotalAmountInTransactionListPage');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setShowTotalAmountInTransactionListPage(value) {
|
||||||
|
setOption('showTotalAmountInTransactionListPage', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isShowAccountBalance() {
|
||||||
|
return getOption('showAccountBalance');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setShowAccountBalance(value) {
|
||||||
|
setOption('showAccountBalance', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStatisticsDefaultChartType() {
|
||||||
|
return getSubOption('statistics', 'defaultChartType');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setStatisticsDefaultChartType(value) {
|
||||||
|
setSubOption('statistics', 'defaultChartType', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStatisticsDefaultChartDataType() {
|
||||||
|
return getSubOption('statistics', 'defaultChartDataType');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setStatisticsDefaultChartDataType(value) {
|
||||||
|
setSubOption('statistics', 'defaultChartDataType', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStatisticsDefaultDateRange() {
|
||||||
|
return getSubOption('statistics', 'defaultDataRangeType');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setStatisticsDefaultDateRange(value) {
|
||||||
|
setSubOption('statistics', 'defaultDataRangeType', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStatisticsDefaultAccountFilter() {
|
||||||
|
return getSubOption('statistics', 'defaultAccountFilter');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setStatisticsDefaultAccountFilter(value) {
|
||||||
|
setSubOption('statistics', 'defaultAccountFilter', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStatisticsDefaultTransactionCategoryFilter() {
|
||||||
|
return getSubOption('statistics', 'defaultTransactionCategoryFilter');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setStatisticsDefaultTransactionCategoryFilter(value) {
|
||||||
|
setSubOption('statistics', 'defaultTransactionCategoryFilter', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getStatisticsSortingType() {
|
||||||
|
return getSubOption('statistics', 'defaultSortingType');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setStatisticsSortingType(value) {
|
||||||
|
setSubOption('statistics', 'defaultSortingType', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isEnableAnimate() {
|
||||||
|
return getOption('animate');
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setEnableAnimate(value) {
|
||||||
|
return setOption('animate', value);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function clearSettings() {
|
||||||
localStorage.removeItem(settingsLocalStorageKey);
|
localStorage.removeItem(settingsLocalStorageKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
|
||||||
isProduction: () => process.env.NODE_ENV === 'production',
|
|
||||||
getTheme: () => getOption('theme'),
|
|
||||||
setTheme: value => setOption('theme', value),
|
|
||||||
getFontSize: () => getOption('fontSize'),
|
|
||||||
setFontSize: value => setOption('fontSize', value),
|
|
||||||
getTimezone: () => getOption('timeZone'),
|
|
||||||
setTimezone: value => setOption('timeZone', value),
|
|
||||||
isEnableDebug: () => getOption('debug'),
|
|
||||||
setEnableDebug: value => setOption('debug', value),
|
|
||||||
isEnableApplicationLock: () => getOption('applicationLock'),
|
|
||||||
setEnableApplicationLock: value => setOption('applicationLock', value),
|
|
||||||
isEnableApplicationLockWebAuthn: () => getOption('applicationLockWebAuthn'),
|
|
||||||
setEnableApplicationLockWebAuthn: value => setOption('applicationLockWebAuthn', value),
|
|
||||||
isAutoUpdateExchangeRatesData: () => getOption('autoUpdateExchangeRatesData'),
|
|
||||||
setAutoUpdateExchangeRatesData: value => setOption('autoUpdateExchangeRatesData', value),
|
|
||||||
isAutoGetCurrentGeoLocation: () => getOption('autoGetCurrentGeoLocation'),
|
|
||||||
setAutoGetCurrentGeoLocation: value => setOption('autoGetCurrentGeoLocation', value),
|
|
||||||
isEnableThousandsSeparator: () => getOption('thousandsSeparator'),
|
|
||||||
setEnableThousandsSeparator: value => setOption('thousandsSeparator', value),
|
|
||||||
getCurrencyDisplayMode: () => getOption('currencyDisplayMode'),
|
|
||||||
setCurrencyDisplayMode: value => setOption('currencyDisplayMode', value),
|
|
||||||
isShowAmountInHomePage: () => getOption('showAmountInHomePage'),
|
|
||||||
setShowAmountInHomePage: value => setOption('showAmountInHomePage', value),
|
|
||||||
isShowTotalAmountInTransactionListPage: () => getOption('showTotalAmountInTransactionListPage'),
|
|
||||||
setShowTotalAmountInTransactionListPage: value => setOption('showTotalAmountInTransactionListPage', value),
|
|
||||||
isShowAccountBalance: () => getOption('showAccountBalance'),
|
|
||||||
setShowAccountBalance: value => setOption('showAccountBalance', value),
|
|
||||||
getStatisticsDefaultChartType: () => getSubOption('statistics', 'defaultChartType'),
|
|
||||||
setStatisticsDefaultChartType: value => setSubOption('statistics', 'defaultChartType', value),
|
|
||||||
getStatisticsDefaultChartDataType: () => getSubOption('statistics', 'defaultChartDataType'),
|
|
||||||
setStatisticsDefaultChartDataType: value => setSubOption('statistics', 'defaultChartDataType', value),
|
|
||||||
getStatisticsDefaultDateRange: () => getSubOption('statistics', 'defaultDataRangeType'),
|
|
||||||
setStatisticsDefaultDateRange: value => setSubOption('statistics', 'defaultDataRangeType', value),
|
|
||||||
getStatisticsDefaultAccountFilter: () => getSubOption('statistics', 'defaultAccountFilter'),
|
|
||||||
setStatisticsDefaultAccountFilter: value => setSubOption('statistics', 'defaultAccountFilter', value),
|
|
||||||
getStatisticsDefaultTransactionCategoryFilter: () => getSubOption('statistics', 'defaultTransactionCategoryFilter'),
|
|
||||||
setStatisticsDefaultTransactionCategoryFilter: value => setSubOption('statistics', 'defaultTransactionCategoryFilter', value),
|
|
||||||
getStatisticsSortingType: () => getSubOption('statistics', 'defaultSortingType'),
|
|
||||||
setStatisticsSortingType: value => setSubOption('statistics', 'defaultSortingType', value),
|
|
||||||
isEnableAnimate: () => getOption('animate'),
|
|
||||||
setEnableAnimate: value => setOption('animate', value),
|
|
||||||
isUserRegistrationEnabled: () => getServerSetting('r') === '1',
|
|
||||||
isDataExportingEnabled: () => getServerSetting('e') === '1',
|
|
||||||
getMapProvider: () => getServerSetting('m'),
|
|
||||||
isMapDataFetchProxyEnabled: () => getServerSetting('mp') === '1',
|
|
||||||
getTomTomMapAPIKey: () => getServerDecodedSetting('tmak'),
|
|
||||||
getGoogleMapAPIKey: () => getServerDecodedSetting('gmak'),
|
|
||||||
getBaiduMapAK: () => getServerDecodedSetting('bmak'),
|
|
||||||
getAmapApplicationKey: () => getServerDecodedSetting('amak'),
|
|
||||||
getAmapSecurityVerificationMethod: () => getServerSetting('amsv'),
|
|
||||||
getAmapApiExternalProxyUrl: () => getServerDecodedSetting('amep'),
|
|
||||||
getAmapApplicationSecret: () => getServerDecodedSetting('amas'),
|
|
||||||
clearSettings: clearSettings
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { f7, f7ready } from 'framework7-vue';
|
import { f7, f7ready } from 'framework7-vue';
|
||||||
|
|
||||||
import fontConstants from '@/consts/font.js';
|
import fontConstants from '@/consts/font.js';
|
||||||
import settings from './settings.js';
|
import { isEnableAnimate } from './settings.js';
|
||||||
import { translateError } from './i18n.js';
|
import { translateError } from './i18n.js';
|
||||||
|
|
||||||
export function showAlert(message, confirmCallback, translateFn) {
|
export function showAlert(message, confirmCallback, translateFn) {
|
||||||
@@ -9,7 +9,7 @@ export function showAlert(message, confirmCallback, translateFn) {
|
|||||||
f7.dialog.create({
|
f7.dialog.create({
|
||||||
title: translateFn('global.app.title'),
|
title: translateFn('global.app.title'),
|
||||||
text: translateError(message, translateFn),
|
text: translateError(message, translateFn),
|
||||||
animate: settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: translateFn('OK'),
|
text: translateFn('OK'),
|
||||||
@@ -25,7 +25,7 @@ export function showConfirm(message, confirmCallback, cancelCallback, translateF
|
|||||||
f7.dialog.create({
|
f7.dialog.create({
|
||||||
title: translateFn('global.app.title'),
|
title: translateFn('global.app.title'),
|
||||||
text: translateFn(message),
|
text: translateFn(message),
|
||||||
animate: settings.isEnableAnimate(),
|
animate: isEnableAnimate(),
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
text: translateFn('Cancel'),
|
text: translateFn('Cancel'),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import CryptoJS from 'crypto-js';
|
import CryptoJS from 'crypto-js';
|
||||||
|
|
||||||
import settings from './settings.js';
|
|
||||||
import { isString, isObject } from './common.js';
|
import { isString, isObject } from './common.js';
|
||||||
|
import { isEnableApplicationLock } from './settings.js';
|
||||||
|
|
||||||
const appLockSecretBaseStringPrefix = 'EBK_LOCK_SECRET_';
|
const appLockSecretBaseStringPrefix = 'EBK_LOCK_SECRET_';
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ function getDecryptedToken(encryptedToken, appLockState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getToken() {
|
function getToken() {
|
||||||
if (settings.isEnableApplicationLock()) {
|
if (isEnableApplicationLock()) {
|
||||||
return sessionStorage.getItem(tokenSessionStorageKey);
|
return sessionStorage.getItem(tokenSessionStorageKey);
|
||||||
} else {
|
} else {
|
||||||
return localStorage.getItem(tokenLocalStorageKey);
|
return localStorage.getItem(tokenLocalStorageKey);
|
||||||
@@ -55,7 +55,7 @@ function isUserUnlocked() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings.isEnableApplicationLock()) {
|
if (!isEnableApplicationLock()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ function isCorrectPinCode(pinCode) {
|
|||||||
|
|
||||||
function updateToken(token) {
|
function updateToken(token) {
|
||||||
if (isString(token)) {
|
if (isString(token)) {
|
||||||
if (settings.isEnableApplicationLock()) {
|
if (isEnableApplicationLock()) {
|
||||||
sessionStorage.setItem(tokenSessionStorageKey, token);
|
sessionStorage.setItem(tokenSessionStorageKey, token);
|
||||||
|
|
||||||
const appLockState = getUserAppLockState();
|
const appLockState = getUserAppLockState();
|
||||||
|
|||||||
+16
-13
@@ -1,15 +1,18 @@
|
|||||||
export default {
|
export function isProduction() {
|
||||||
getVersion: () => {
|
return process.env.NODE_ENV === 'production';
|
||||||
let version = __EZBOOKKEEPING_VERSION__ || 'unknown'; // eslint-disable-line
|
}
|
||||||
let commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__; // eslint-disable-line
|
|
||||||
|
|
||||||
if (commitHash) {
|
export function getVersion() {
|
||||||
return `${version} (${commitHash.substring(0, Math.min(7, commitHash.length))})`
|
let version = __EZBOOKKEEPING_VERSION__ || 'unknown'; // eslint-disable-line
|
||||||
} else {
|
let commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__; // eslint-disable-line
|
||||||
return version;
|
|
||||||
}
|
if (commitHash) {
|
||||||
},
|
return `${version} (${commitHash.substring(0, Math.min(7, commitHash.length))})`
|
||||||
getBuildTime: () => {
|
} else {
|
||||||
return __EZBOOKKEEPING_BUILD_UNIX_TIME__; // eslint-disable-line
|
return version;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
export function getBuildTime() {
|
||||||
|
return __EZBOOKKEEPING_BUILD_UNIX_TIME__; // eslint-disable-line
|
||||||
|
}
|
||||||
|
|||||||
+3
-5
@@ -73,8 +73,7 @@ import 'line-awesome/dist/line-awesome/css/line-awesome.css';
|
|||||||
import VueDatePicker from '@vuepic/vue-datepicker';
|
import VueDatePicker from '@vuepic/vue-datepicker';
|
||||||
import '@vuepic/vue-datepicker/dist/main.css';
|
import '@vuepic/vue-datepicker/dist/main.css';
|
||||||
|
|
||||||
import version from '@/lib/version.js';
|
import { getVersion, getBuildTime } from '@/lib/version.js';
|
||||||
import settings from '@/lib/settings.js';
|
|
||||||
import userstate from '@/lib/userstate.js';
|
import userstate from '@/lib/userstate.js';
|
||||||
import {
|
import {
|
||||||
getI18nOptions,
|
getI18nOptions,
|
||||||
@@ -183,10 +182,9 @@ app.component('TransactionTagSelectionSheet', TransactionTagSelectionSheet);
|
|||||||
|
|
||||||
app.directive('TextareaAutoSize', TextareaAutoSize);
|
app.directive('TextareaAutoSize', TextareaAutoSize);
|
||||||
|
|
||||||
app.config.globalProperties.$version = version.getVersion();
|
app.config.globalProperties.$version = getVersion();
|
||||||
app.config.globalProperties.$buildTime = version.getBuildTime();
|
app.config.globalProperties.$buildTime = getBuildTime();
|
||||||
|
|
||||||
app.config.globalProperties.$settings = settings;
|
|
||||||
app.config.globalProperties.$locale = i18nFunctions(i18n.global);
|
app.config.globalProperties.$locale = i18nFunctions(i18n.global);
|
||||||
app.config.globalProperties.$tIf = (text, isTranslate) => translateIf(text, isTranslate, i18n.global.t);
|
app.config.globalProperties.$tIf = (text, isTranslate) => translateIf(text, isTranslate, i18n.global.t);
|
||||||
|
|
||||||
|
|||||||
+16
-10
@@ -1,5 +1,6 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
|
import { useSettingsStore } from './setting.js';
|
||||||
import { useUserStore } from './user.js';
|
import { useUserStore } from './user.js';
|
||||||
import { useAccountsStore } from './account.js';
|
import { useAccountsStore } from './account.js';
|
||||||
import { useTransactionCategoriesStore } from './transactionCategory.js';
|
import { useTransactionCategoriesStore } from './transactionCategory.js';
|
||||||
@@ -11,7 +12,6 @@ import { useExchangeRatesStore } from './exchangeRates.js';
|
|||||||
|
|
||||||
import userState from '@/lib/userstate.js';
|
import userState from '@/lib/userstate.js';
|
||||||
import services from '@/lib/services.js';
|
import services from '@/lib/services.js';
|
||||||
import settings from '@/lib/settings.js';
|
|
||||||
import logger from '@/lib/logger.js';
|
import logger from '@/lib/logger.js';
|
||||||
import { isObject, isString } from '@/lib/common.js';
|
import { isObject, isString } from '@/lib/common.js';
|
||||||
|
|
||||||
@@ -43,6 +43,8 @@ export const useRootStore = defineStore('root', {
|
|||||||
userStore.resetUserInfo();
|
userStore.resetUserInfo();
|
||||||
},
|
},
|
||||||
authorize({ loginName, password }) {
|
authorize({ loginName, password }) {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
services.authorize({
|
services.authorize({
|
||||||
loginName: loginName,
|
loginName: loginName,
|
||||||
@@ -60,13 +62,13 @@ export const useRootStore = defineStore('root', {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.isEnableApplicationLock() || userState.getUserAppLockState()) {
|
if (settingsStore.appSettings.applicationLock || userState.getUserAppLockState()) {
|
||||||
const appLockState = userState.getUserAppLockState();
|
const appLockState = userState.getUserAppLockState();
|
||||||
|
|
||||||
if (!appLockState || appLockState.username !== data.result.user.username) {
|
if (!appLockState || appLockState.username !== data.result.user.username) {
|
||||||
userState.clearTokenAndUserInfo(true);
|
userState.clearTokenAndUserInfo(true);
|
||||||
settings.setEnableApplicationLock(false);
|
settingsStore.setEnableApplicationLock(false);
|
||||||
settings.setEnableApplicationLockWebAuthn(false);
|
settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
userState.clearWebAuthnConfig();
|
userState.clearWebAuthnConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,6 +95,8 @@ export const useRootStore = defineStore('root', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
authorize2FA({ token, passcode, recoveryCode }) {
|
authorize2FA({ token, passcode, recoveryCode }) {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let promise = null;
|
let promise = null;
|
||||||
|
|
||||||
@@ -119,13 +123,13 @@ export const useRootStore = defineStore('root', {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.isEnableApplicationLock() || userState.getUserAppLockState()) {
|
if (settingsStore.appSettings.applicationLock || userState.getUserAppLockState()) {
|
||||||
const appLockState = userState.getUserAppLockState();
|
const appLockState = userState.getUserAppLockState();
|
||||||
|
|
||||||
if (!appLockState || appLockState.username !== data.result.user.username) {
|
if (!appLockState || appLockState.username !== data.result.user.username) {
|
||||||
userState.clearTokenAndUserInfo(true);
|
userState.clearTokenAndUserInfo(true);
|
||||||
settings.setEnableApplicationLock(false);
|
settingsStore.setEnableApplicationLock(false);
|
||||||
settings.setEnableApplicationLockWebAuthn(false);
|
settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
userState.clearWebAuthnConfig();
|
userState.clearWebAuthnConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,6 +156,8 @@ export const useRootStore = defineStore('root', {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
register({ user }) {
|
register({ user }) {
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
services.register({
|
services.register({
|
||||||
username: user.username,
|
username: user.username,
|
||||||
@@ -169,9 +175,9 @@ export const useRootStore = defineStore('root', {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settings.isEnableApplicationLock()) {
|
if (settingsStore.appSettings.applicationLock) {
|
||||||
settings.setEnableApplicationLock(false);
|
settingsStore.setEnableApplicationLock(false);
|
||||||
settings.setEnableApplicationLockWebAuthn(false);
|
settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
userState.clearWebAuthnConfig();
|
userState.clearWebAuthnConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+107
-9
@@ -2,27 +2,125 @@ import { defineStore } from 'pinia';
|
|||||||
|
|
||||||
import currencyConstants from '@/consts/currency.js';
|
import currencyConstants from '@/consts/currency.js';
|
||||||
import datetimeConstants from '@/consts/datetime.js';
|
import datetimeConstants from '@/consts/datetime.js';
|
||||||
|
import * as settings from '@/lib/settings.js';
|
||||||
|
|
||||||
export const useSettingsStore = defineStore('settings', {
|
export const useSettingsStore = defineStore('settings', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
defaultSetting: {
|
appSettings: {
|
||||||
language: '',
|
theme: settings.getTheme(),
|
||||||
|
fontSize: settings.getFontSize(),
|
||||||
|
timeZone: settings.getTimeZone(),
|
||||||
|
applicationLock: settings.isEnableApplicationLock(),
|
||||||
|
applicationLockWebAuthn: settings.isEnableApplicationLockWebAuthn(),
|
||||||
|
autoUpdateExchangeRatesData: settings.isAutoUpdateExchangeRatesData(),
|
||||||
|
autoGetCurrentGeoLocation: settings.isAutoGetCurrentGeoLocation(),
|
||||||
|
thousandsSeparator: settings.isEnableThousandsSeparator(),
|
||||||
|
currencyDisplayMode: settings.getCurrencyDisplayMode(),
|
||||||
|
showAmountInHomePage: settings.isShowAmountInHomePage(),
|
||||||
|
showTotalAmountInTransactionListPage: settings.isShowTotalAmountInTransactionListPage(),
|
||||||
|
showAccountBalance: settings.isShowAccountBalance(),
|
||||||
|
statistics: {
|
||||||
|
defaultChartType: settings.getStatisticsDefaultChartType(),
|
||||||
|
defaultChartDataType: settings.getStatisticsDefaultChartDataType(),
|
||||||
|
defaultDataRangeType: settings.getStatisticsDefaultDateRange(),
|
||||||
|
defaultAccountFilter: settings.getStatisticsDefaultAccountFilter(),
|
||||||
|
defaultTransactionCategoryFilter: settings.getStatisticsDefaultTransactionCategoryFilter(),
|
||||||
|
defaultSortingType: settings.getStatisticsSortingType()
|
||||||
|
},
|
||||||
|
animate: settings.isEnableAnimate()
|
||||||
|
},
|
||||||
|
localeDefaultSettings: {
|
||||||
currency: currencyConstants.defaultCurrency,
|
currency: currencyConstants.defaultCurrency,
|
||||||
firstDayOfWeek: datetimeConstants.defaultFirstDayOfWeek,
|
firstDayOfWeek: datetimeConstants.defaultFirstDayOfWeek
|
||||||
longDateFormat: 0,
|
|
||||||
shortDateFormat: 0,
|
|
||||||
longTimeFormat: 0,
|
|
||||||
shortTimeFormat: 0
|
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
|
setTheme(value) {
|
||||||
|
settings.setTheme(value);
|
||||||
|
this.appSettings.theme = value;
|
||||||
|
},
|
||||||
|
setFontSize(value) {
|
||||||
|
settings.setFontSize(value);
|
||||||
|
this.appSettings.fontSize = value;
|
||||||
|
},
|
||||||
|
setTimeZone(value) {
|
||||||
|
settings.setTimeZone(value);
|
||||||
|
this.appSettings.timeZone = value;
|
||||||
|
},
|
||||||
|
setEnableApplicationLock(value) {
|
||||||
|
settings.setEnableApplicationLock(value);
|
||||||
|
this.appSettings.applicationLock = value;
|
||||||
|
},
|
||||||
|
setEnableApplicationLockWebAuthn(value) {
|
||||||
|
settings.setEnableApplicationLockWebAuthn(value);
|
||||||
|
this.appSettings.applicationLockWebAuthn = value;
|
||||||
|
},
|
||||||
|
setAutoUpdateExchangeRatesData(value) {
|
||||||
|
settings.setAutoUpdateExchangeRatesData(value);
|
||||||
|
this.appSettings.autoUpdateExchangeRatesData = value;
|
||||||
|
},
|
||||||
|
setAutoGetCurrentGeoLocation(value) {
|
||||||
|
settings.setAutoGetCurrentGeoLocation(value);
|
||||||
|
this.appSettings.autoGetCurrentGeoLocation = value;
|
||||||
|
},
|
||||||
|
setEnableThousandsSeparator(value) {
|
||||||
|
settings.setEnableThousandsSeparator(value);
|
||||||
|
this.appSettings.thousandsSeparator = value;
|
||||||
|
},
|
||||||
|
setCurrencyDisplayMode(value) {
|
||||||
|
settings.setCurrencyDisplayMode(value);
|
||||||
|
this.appSettings.currencyDisplayMode = value;
|
||||||
|
},
|
||||||
|
setShowAmountInHomePage(value) {
|
||||||
|
settings.setShowAmountInHomePage(value);
|
||||||
|
this.appSettings.showAmountInHomePage = value;
|
||||||
|
},
|
||||||
|
setShowTotalAmountInTransactionListPage(value) {
|
||||||
|
settings.setShowTotalAmountInTransactionListPage(value);
|
||||||
|
this.appSettings.showTotalAmountInTransactionListPage = value;
|
||||||
|
},
|
||||||
|
setShowAccountBalance(value) {
|
||||||
|
settings.setShowAccountBalance(value);
|
||||||
|
this.appSettings.showAccountBalance = value;
|
||||||
|
},
|
||||||
|
setStatisticsDefaultChartType(value) {
|
||||||
|
settings.setStatisticsDefaultChartType(value);
|
||||||
|
this.appSettings.statistics.defaultChartType = value;
|
||||||
|
},
|
||||||
|
setStatisticsDefaultChartDataType(value) {
|
||||||
|
settings.setStatisticsDefaultChartDataType(value);
|
||||||
|
this.appSettings.statistics.defaultChartDataType = value;
|
||||||
|
},
|
||||||
|
setStatisticsDefaultDateRange(value) {
|
||||||
|
settings.setStatisticsDefaultDateRange(value);
|
||||||
|
this.appSettings.statistics.defaultDataRangeType = value;
|
||||||
|
},
|
||||||
|
setStatisticsDefaultAccountFilter(value) {
|
||||||
|
settings.setStatisticsDefaultAccountFilter(value);
|
||||||
|
this.appSettings.statistics.defaultAccountFilter = value;
|
||||||
|
},
|
||||||
|
setStatisticsDefaultTransactionCategoryFilter(value) {
|
||||||
|
settings.setStatisticsDefaultTransactionCategoryFilter(value);
|
||||||
|
this.appSettings.statistics.defaultTransactionCategoryFilter = value;
|
||||||
|
},
|
||||||
|
setStatisticsSortingType(value) {
|
||||||
|
settings.setStatisticsSortingType(value);
|
||||||
|
this.appSettings.statistics.defaultSortingType = value;
|
||||||
|
},
|
||||||
|
setEnableAnimate(value) {
|
||||||
|
settings.setEnableAnimate(value);
|
||||||
|
this.appSettings.animate = value;
|
||||||
|
},
|
||||||
|
clearAppSettings() {
|
||||||
|
settings.clearSettings();
|
||||||
|
},
|
||||||
updateLocalizedDefaultSettings(localeDefaultSettings) {
|
updateLocalizedDefaultSettings(localeDefaultSettings) {
|
||||||
if (!localeDefaultSettings) {
|
if (!localeDefaultSettings) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.defaultSetting.currency = localeDefaultSettings.defaultCurrency;
|
this.localeDefaultSettings.currency = localeDefaultSettings.defaultCurrency;
|
||||||
this.defaultSetting.firstDayOfWeek = localeDefaultSettings.defaultFirstDayOfWeek;
|
this.localeDefaultSettings.firstDayOfWeek = localeDefaultSettings.defaultFirstDayOfWeek;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
</v-btn>
|
</v-btn>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col cols="12" class="text-center text-base">
|
<v-col cols="12" class="text-center text-base" v-if="isUserRegistrationEnabled">
|
||||||
<span>{{ $t('Don\'t have an account?') }}</span>
|
<span>{{ $t('Don\'t have an account?') }}</span>
|
||||||
<router-link class="text-primary ms-2" to="/signup">
|
<router-link class="text-primary ms-2" to="/signup">
|
||||||
{{ $t('Create an account') }}
|
{{ $t('Create an account') }}
|
||||||
@@ -141,6 +141,8 @@ import { useRootStore } from '@/stores/index.js';
|
|||||||
import { useSettingsStore } from '@/stores/setting.js';
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||||
|
|
||||||
|
import { isUserRegistrationEnabled } from '@/lib/server_settings.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mdiEyeOutline,
|
mdiEyeOutline,
|
||||||
mdiEyeOffOutline,
|
mdiEyeOffOutline,
|
||||||
@@ -181,7 +183,7 @@ export default {
|
|||||||
return this.$locale.getAllLanguageInfos();
|
return this.$locale.getAllLanguageInfos();
|
||||||
},
|
},
|
||||||
isUserRegistrationEnabled() {
|
isUserRegistrationEnabled() {
|
||||||
return this.$settings.isUserRegistrationEnabled();
|
return isUserRegistrationEnabled();
|
||||||
},
|
},
|
||||||
inputIsEmpty() {
|
inputIsEmpty() {
|
||||||
return !this.username || !this.password;
|
return !this.username || !this.password;
|
||||||
@@ -255,8 +257,8 @@ export default {
|
|||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({silent: true, force: false});
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$router.replace('/');
|
this.$router.replace('/');
|
||||||
@@ -297,7 +299,7 @@ export default {
|
|||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -97,8 +97,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<v-spacer />
|
<v-spacer />
|
||||||
<v-btn color="primary" variant="text" class="me-2"
|
<v-btn color="primary" variant="text" class="me-2"
|
||||||
:icon="true" @click="(currentTheme === 'light' ? currentTheme = 'dark' : (currentTheme === 'dark' ? currentTheme = 'auto' : currentTheme = 'light'))">
|
:icon="true" @click="(theme === 'light' ? theme = 'dark' : (theme === 'dark' ? theme = 'auto' : theme = 'light'))">
|
||||||
<v-icon :icon="(currentTheme === 'light' ? icons.themeLight : (currentTheme === 'dark' ? icons.themeDark : icons.themeAuto))" size="24" />
|
<v-icon :icon="(theme === 'light' ? icons.themeLight : (theme === 'dark' ? icons.themeDark : icons.themeAuto))" size="24" />
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-avatar class="cursor-pointer" color="primary" variant="tonal">
|
<v-avatar class="cursor-pointer" color="primary" variant="tonal">
|
||||||
<v-icon :icon="icons.user"/>
|
<v-icon :icon="icons.user"/>
|
||||||
@@ -197,10 +197,7 @@ import {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
const self = this;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
theme: self.$settings.getTheme(),
|
|
||||||
logouting: false,
|
logouting: false,
|
||||||
isVerticalNavScrolled: false,
|
isVerticalNavScrolled: false,
|
||||||
showVerticalOverlayMenu: false,
|
showVerticalOverlayMenu: false,
|
||||||
@@ -236,14 +233,13 @@ export default {
|
|||||||
currentNickName() {
|
currentNickName() {
|
||||||
return this.userStore.currentUserNickname || this.$t('User');
|
return this.userStore.currentUserNickname || this.$t('User');
|
||||||
},
|
},
|
||||||
currentTheme: {
|
theme: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.theme;
|
return this.settingsStore.appSettings.theme;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
if (value !== this.$settings.getTheme()) {
|
if (value !== this.settingsStore.appSettings.theme) {
|
||||||
this.theme = value;
|
this.settingsStore.setTheme(value);
|
||||||
this.$settings.setTheme(value);
|
|
||||||
|
|
||||||
if (value === 'light' || value === 'dark') {
|
if (value === 'light' || value === 'dark') {
|
||||||
this.globalTheme.global.name.value = value;
|
this.globalTheme.global.name.value = value;
|
||||||
@@ -275,9 +271,9 @@ export default {
|
|||||||
self.logouting = false;
|
self.logouting = false;
|
||||||
self.showLoading = false;
|
self.showLoading = false;
|
||||||
|
|
||||||
self.$settings.clearSettings();
|
self.settingsStore.clearAppSettings();
|
||||||
|
|
||||||
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage);
|
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage, self.settingsStore.appSettings.timeZone);
|
||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
|
|
||||||
this.$router.replace('/login');
|
this.$router.replace('/login');
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</v-card>
|
</v-card>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col cols="12">
|
<v-col cols="12" v-if="isDataExportingEnabled">
|
||||||
<v-card :class="{ 'disabled': exportingData }" :title="$t('Export Data')">
|
<v-card :class="{ 'disabled': exportingData }" :title="$t('Export Data')">
|
||||||
<v-card-text>
|
<v-card-text>
|
||||||
<span class="text-subtitle-1">{{ $t('Export all data to csv file.') }} {{ $t('It may take a long time, please wait for a few minutes.') }}</span>
|
<span class="text-subtitle-1">{{ $t('Export all data to csv file.') }} {{ $t('It may take a long time, please wait for a few minutes.') }}</span>
|
||||||
@@ -153,6 +153,7 @@ import { useRootStore } from '@/stores/index.js';
|
|||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
|
|
||||||
import { appendThousandsSeparator } from '@/lib/common.js';
|
import { appendThousandsSeparator } from '@/lib/common.js';
|
||||||
|
import { isDataExportingEnabled } from '@/lib/server_settings.js';
|
||||||
import { startDownloadFile } from '@/lib/ui.js';
|
import { startDownloadFile } from '@/lib/ui.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -206,7 +207,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
isDataExportingEnabled() {
|
isDataExportingEnabled() {
|
||||||
return this.$settings.isDataExportingEnabled();
|
return isDataExportingEnabled();
|
||||||
},
|
},
|
||||||
exportFileName() {
|
exportFileName() {
|
||||||
const nickname = this.userStore.currentUserNickname;
|
const nickname = this.userStore.currentUserNickname;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
|
|
||||||
import logger from '@/lib/logger.js';
|
import logger from '@/lib/logger.js';
|
||||||
@@ -46,8 +47,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isSupportedWebAuthn: false,
|
isSupportedWebAuthn: false,
|
||||||
isEnableApplicationLock: this.$settings.isEnableApplicationLock(),
|
|
||||||
isEnableApplicationLockWebAuthn: this.$settings.isEnableApplicationLockWebAuthn(),
|
|
||||||
currentPinCodeForEnable: '',
|
currentPinCodeForEnable: '',
|
||||||
currentPinCodeForDisable: '',
|
currentPinCodeForDisable: '',
|
||||||
showInputPinCodeSheetForEnable: false,
|
showInputPinCodeSheetForEnable: false,
|
||||||
@@ -55,7 +54,23 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore)
|
...mapStores(useSettingsStore, useUserStore),
|
||||||
|
isEnableApplicationLock: {
|
||||||
|
get: function () {
|
||||||
|
return this.settingsStore.appSettings.applicationLock;
|
||||||
|
},
|
||||||
|
set: function (value) {
|
||||||
|
this.settingsStore.setEnableApplicationLock(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isEnableApplicationLockWebAuthn: {
|
||||||
|
get: function () {
|
||||||
|
return this.settingsStore.appSettings.applicationLockWebAuthn;
|
||||||
|
},
|
||||||
|
set: function (value) {
|
||||||
|
this.settingsStore.setEnableApplicationLockWebAuthn(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
isEnableApplicationLockWebAuthn: function (newValue) {
|
isEnableApplicationLockWebAuthn: function (newValue) {
|
||||||
@@ -71,7 +86,7 @@ export default {
|
|||||||
self.$hideLoading();
|
self.$hideLoading();
|
||||||
|
|
||||||
self.$user.saveWebAuthnConfig(id);
|
self.$user.saveWebAuthnConfig(id);
|
||||||
self.$settings.setEnableApplicationLockWebAuthn(true);
|
self.settingsStore.setEnableApplicationLockWebAuthn(true);
|
||||||
self.$toast('You have enabled WebAuthn successfully');
|
self.$toast('You have enabled WebAuthn successfully');
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
logger.error('failed to enable WebAuthn', error);
|
logger.error('failed to enable WebAuthn', error);
|
||||||
@@ -89,11 +104,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.isEnableApplicationLockWebAuthn = false;
|
self.isEnableApplicationLockWebAuthn = false;
|
||||||
self.$settings.setEnableApplicationLockWebAuthn(false);
|
self.settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
self.$user.clearWebAuthnConfig();
|
self.$user.clearWebAuthnConfig();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.$settings.setEnableApplicationLockWebAuthn(false);
|
self.settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
self.$user.clearWebAuthnConfig();
|
self.$user.clearWebAuthnConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,7 +121,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
enable(pinCode) {
|
enable(pinCode) {
|
||||||
if (this.$settings.isEnableApplicationLock()) {
|
if (this.settingsStore.appSettings.applicationLock) {
|
||||||
this.$alert('Application lock has been enabled');
|
this.$alert('Application lock has been enabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -129,17 +144,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$user.encryptToken(user.username, pinCode);
|
this.$user.encryptToken(user.username, pinCode);
|
||||||
this.$settings.setEnableApplicationLock(true);
|
this.settingsStore.setEnableApplicationLock(true);
|
||||||
this.isEnableApplicationLock = true;
|
|
||||||
|
|
||||||
this.$settings.setEnableApplicationLockWebAuthn(false);
|
this.settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
this.$user.clearWebAuthnConfig();
|
this.$user.clearWebAuthnConfig();
|
||||||
this.isEnableApplicationLockWebAuthn = false;
|
|
||||||
|
|
||||||
this.showInputPinCodeSheetForEnable = false;
|
this.showInputPinCodeSheetForEnable = false;
|
||||||
},
|
},
|
||||||
disable(pinCode) {
|
disable(pinCode) {
|
||||||
if (!this.$settings.isEnableApplicationLock()) {
|
if (!this.settingsStore.appSettings.applicationLock) {
|
||||||
this.$alert('Application lock is not enabled');
|
this.$alert('Application lock is not enabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -155,12 +168,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$user.decryptToken();
|
this.$user.decryptToken();
|
||||||
this.$settings.setEnableApplicationLock(false);
|
this.settingsStore.setEnableApplicationLock(false);
|
||||||
this.isEnableApplicationLock = false;
|
|
||||||
|
|
||||||
this.$settings.setEnableApplicationLockWebAuthn(false);
|
this.settingsStore.setEnableApplicationLockWebAuthn(false);
|
||||||
this.$user.clearWebAuthnConfig();
|
this.$user.clearWebAuthnConfig();
|
||||||
this.isEnableApplicationLockWebAuthn = false;
|
|
||||||
|
|
||||||
this.showInputPinCodeSheetForDisable = false;
|
this.showInputPinCodeSheetForDisable = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<p class="no-margin">
|
<p class="no-margin">
|
||||||
<span class="month-expense" v-if="loading">0.00 USD</span>
|
<span class="month-expense" v-if="loading">0.00 USD</span>
|
||||||
<span class="month-expense" v-else-if="!loading">{{ transactionOverview.thisMonth.expenseAmount }}</span>
|
<span class="month-expense" v-else-if="!loading">{{ transactionOverview.thisMonth.expenseAmount }}</span>
|
||||||
<f7-link class="margin-left-half" @click="toggleShowAmountInHomePage()">
|
<f7-link class="margin-left-half" @click="showAmountInHomePage = !showAmountInHomePage">
|
||||||
<f7-icon class="ebk-hide-icon" :f7="showAmountInHomePage ? 'eye_slash_fill' : 'eye_fill'"></f7-icon>
|
<f7-icon class="ebk-hide-icon" :f7="showAmountInHomePage ? 'eye_slash_fill' : 'eye_fill'"></f7-icon>
|
||||||
</f7-link>
|
</f7-link>
|
||||||
</p>
|
</p>
|
||||||
@@ -189,6 +189,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
import { useOverviewStore } from '@/stores/overview.js';
|
import { useOverviewStore } from '@/stores/overview.js';
|
||||||
|
|
||||||
@@ -212,14 +213,25 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
todayFirstUnixTime: getTodayFirstUnixTime(),
|
todayFirstUnixTime: getTodayFirstUnixTime(),
|
||||||
todayLastUnixTime: getTodayLastUnixTime(),
|
todayLastUnixTime: getTodayLastUnixTime()
|
||||||
showAmountInHomePage: self.$settings.isShowAmountInHomePage(),
|
|
||||||
isEnableThousandsSeparator: self.$settings.isEnableThousandsSeparator(),
|
|
||||||
currencyDisplayMode: self.$settings.getCurrencyDisplayMode()
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore, useOverviewStore),
|
...mapStores(useSettingsStore, useUserStore, useOverviewStore),
|
||||||
|
showAmountInHomePage: {
|
||||||
|
get: function() {
|
||||||
|
return this.settingsStore.appSettings.showAmountInHomePage;
|
||||||
|
},
|
||||||
|
set: function(value) {
|
||||||
|
this.settingsStore.setShowAmountInHomePage(value);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isEnableThousandsSeparator() {
|
||||||
|
return this.settingsStore.appSettings.thousandsSeparator;
|
||||||
|
},
|
||||||
|
currencyDisplayMode() {
|
||||||
|
return this.settingsStore.appSettings.currencyDisplayMode;
|
||||||
|
},
|
||||||
defaultCurrency() {
|
defaultCurrency() {
|
||||||
return this.userStore.currentUserDefaultCurrency;
|
return this.userStore.currentUserDefaultCurrency;
|
||||||
},
|
},
|
||||||
@@ -330,14 +342,6 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onPageAfterIn() {
|
onPageAfterIn() {
|
||||||
this.showAmountInHomePage = this.$settings.isShowAmountInHomePage();
|
|
||||||
|
|
||||||
if (this.isEnableThousandsSeparator !== this.$settings.isEnableThousandsSeparator() || this.currencyDisplayMode !== this.$settings.getCurrencyDisplayMode()) {
|
|
||||||
this.isEnableThousandsSeparator = this.$settings.isEnableThousandsSeparator();
|
|
||||||
this.currencyDisplayMode = this.$settings.getCurrencyDisplayMode();
|
|
||||||
this.$forceUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
let dateChanged = false;
|
let dateChanged = false;
|
||||||
|
|
||||||
if (this.todayFirstUnixTime !== getTodayFirstUnixTime()) {
|
if (this.todayFirstUnixTime !== getTodayFirstUnixTime()) {
|
||||||
@@ -377,10 +381,6 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
toggleShowAmountInHomePage() {
|
|
||||||
this.showAmountInHomePage = !this.showAmountInHomePage;
|
|
||||||
this.$settings.setShowAmountInHomePage(this.showAmountInHomePage);
|
|
||||||
},
|
|
||||||
getDisplayAmount(amount, incomplete) {
|
getDisplayAmount(amount, incomplete) {
|
||||||
if (!this.showAmountInHomePage) {
|
if (!this.showAmountInHomePage) {
|
||||||
return this.$locale.getDisplayCurrency('***', this.defaultCurrency);
|
return this.$locale.getDisplayCurrency('***', this.defaultCurrency);
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ import { useRootStore } from '@/stores/index.js';
|
|||||||
import { useSettingsStore } from '@/stores/setting.js';
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||||
|
|
||||||
|
import { isUserRegistrationEnabled } from '@/lib/server_settings.js';
|
||||||
import { isModalShowing } from '@/lib/ui.mobile.js';
|
import { isModalShowing } from '@/lib/ui.mobile.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -143,7 +144,7 @@ export default {
|
|||||||
return this.$locale.getAllLanguageInfos();
|
return this.$locale.getAllLanguageInfos();
|
||||||
},
|
},
|
||||||
isUserRegistrationEnabled() {
|
isUserRegistrationEnabled() {
|
||||||
return this.$settings.isUserRegistrationEnabled();
|
return isUserRegistrationEnabled();
|
||||||
},
|
},
|
||||||
inputIsEmpty() {
|
inputIsEmpty() {
|
||||||
return !this.username || !this.password;
|
return !this.username || !this.password;
|
||||||
@@ -214,7 +215,7 @@ export default {
|
|||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +268,7 @@ export default {
|
|||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,10 @@
|
|||||||
:key="currentLocale + '_timezone'"
|
:key="currentLocale + '_timezone'"
|
||||||
:title="$t('Timezone')"
|
:title="$t('Timezone')"
|
||||||
smart-select :smart-select-params="{ openIn: 'popup', popupPush: true, closeOnSelect: true, scrollToSelectedItem: true, searchbar: true, searchbarPlaceholder: $t('Timezone'), searchbarDisableText: $t('Cancel'), appendSearchbarNotFound: $t('No results'), popupCloseLinkText: $t('Done') }">
|
smart-select :smart-select-params="{ openIn: 'popup', popupPush: true, closeOnSelect: true, scrollToSelectedItem: true, searchbar: true, searchbarPlaceholder: $t('Timezone'), searchbarDisableText: $t('Cancel'), appendSearchbarNotFound: $t('No results'), popupCloseLinkText: $t('Done') }">
|
||||||
<select v-model="currentTimezone">
|
<select v-model="timeZone">
|
||||||
<option :value="timezone.name"
|
<option :value="tz.name"
|
||||||
:key="timezone.name"
|
:key="tz.name"
|
||||||
v-for="timezone in allTimezones">{{ `(UTC${timezone.utcOffset}) ${timezone.displayName}` }}</option>
|
v-for="tz in allTimezones">{{ `(UTC${tz.utcOffset}) ${tz.displayName}` }}</option>
|
||||||
</select>
|
</select>
|
||||||
</f7-list-item>
|
</f7-list-item>
|
||||||
|
|
||||||
@@ -114,8 +114,7 @@ export default {
|
|||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentLocale: this.$i18n.locale,
|
currentLocale: self.$i18n.locale,
|
||||||
isEnableApplicationLock: self.$settings.isEnableApplicationLock(),
|
|
||||||
logouting: false
|
logouting: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -127,98 +126,101 @@ export default {
|
|||||||
allTimezones() {
|
allTimezones() {
|
||||||
return this.$locale.getAllTimezones(true);
|
return this.$locale.getAllTimezones(true);
|
||||||
},
|
},
|
||||||
|
allCurrencyDisplayModes() {
|
||||||
|
return currencyConstants.allCurrencyDisplayModes;
|
||||||
|
},
|
||||||
|
currentNickName() {
|
||||||
|
return this.userStore.currentUserNickname || this.$t('User');
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.getTheme();
|
return this.settingsStore.appSettings.theme;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
if (value !== this.$settings.getTheme()) {
|
if (value !== this.settingsStore.appSettings.theme) {
|
||||||
this.$settings.setTheme(value);
|
this.settingsStore.setTheme(value);
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
currentTimezone: {
|
timeZone: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$locale.getTimezone();
|
return this.settingsStore.appSettings.timeZone;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$locale.setTimezone(value);
|
this.settingsStore.setTimeZone(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
currentNickName() {
|
|
||||||
return this.userStore.currentUserNickname || this.$t('User');
|
|
||||||
},
|
|
||||||
exchangeRatesLastUpdateDate() {
|
exchangeRatesLastUpdateDate() {
|
||||||
const exchangeRatesLastUpdateTime = this.exchangeRatesStore.exchangeRatesLastUpdateTime;
|
const exchangeRatesLastUpdateTime = this.exchangeRatesStore.exchangeRatesLastUpdateTime;
|
||||||
return exchangeRatesLastUpdateTime ? this.$locale.formatUnixTimeToLongDate(this.userStore, exchangeRatesLastUpdateTime) : '';
|
return exchangeRatesLastUpdateTime ? this.$locale.formatUnixTimeToLongDate(this.userStore, exchangeRatesLastUpdateTime) : '';
|
||||||
},
|
},
|
||||||
allCurrencyDisplayModes() {
|
|
||||||
return currencyConstants.allCurrencyDisplayModes;
|
|
||||||
},
|
|
||||||
isAutoUpdateExchangeRatesData: {
|
isAutoUpdateExchangeRatesData: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isAutoUpdateExchangeRatesData();
|
return this.settingsStore.appSettings.autoUpdateExchangeRatesData;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setAutoUpdateExchangeRatesData(value);
|
this.settingsStore.setAutoUpdateExchangeRatesData(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
isEnableApplicationLock() {
|
||||||
|
return this.settingsStore.appSettings.applicationLock;
|
||||||
|
},
|
||||||
isAutoGetCurrentGeoLocation: {
|
isAutoGetCurrentGeoLocation: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isAutoGetCurrentGeoLocation();
|
return this.settingsStore.appSettings.autoGetCurrentGeoLocation;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setAutoGetCurrentGeoLocation(value);
|
this.settingsStore.setAutoGetCurrentGeoLocation(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isEnableThousandsSeparator: {
|
isEnableThousandsSeparator: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isEnableThousandsSeparator();
|
return this.settingsStore.appSettings.thousandsSeparator;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setEnableThousandsSeparator(value);
|
this.settingsStore.setEnableThousandsSeparator(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
currencyDisplayMode: {
|
currencyDisplayMode: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.getCurrencyDisplayMode();
|
return this.settingsStore.appSettings.currencyDisplayMode;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setCurrencyDisplayMode(value);
|
this.settingsStore.setCurrencyDisplayMode(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showAmountInHomePage: {
|
showAmountInHomePage: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isShowAmountInHomePage();
|
return this.settingsStore.appSettings.showAmountInHomePage;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setShowAmountInHomePage(value);
|
this.settingsStore.setShowAmountInHomePage(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showAccountBalance: {
|
showAccountBalance: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isShowAccountBalance();
|
return this.settingsStore.appSettings.showAccountBalance;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setShowAccountBalance(value);
|
this.settingsStore.setShowAccountBalance(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showTotalAmountInTransactionListPage: {
|
showTotalAmountInTransactionListPage: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isShowTotalAmountInTransactionListPage();
|
return this.settingsStore.appSettings.showTotalAmountInTransactionListPage;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setShowTotalAmountInTransactionListPage(value);
|
this.settingsStore.setShowTotalAmountInTransactionListPage(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isEnableAnimate: {
|
isEnableAnimate: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.isEnableAnimate();
|
return this.settingsStore.appSettings.animate;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
if (value !== this.$settings.isEnableAnimate()) {
|
if (value !== this.settingsStore.appSettings.animate) {
|
||||||
this.$settings.setEnableAnimate(value);
|
this.settingsStore.setEnableAnimate(value);
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,7 +229,6 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
onPageAfterIn() {
|
onPageAfterIn() {
|
||||||
this.currentLocale = this.$i18n.locale;
|
this.currentLocale = this.$i18n.locale;
|
||||||
this.isEnableApplicationLock = this.$settings.isEnableApplicationLock();
|
|
||||||
},
|
},
|
||||||
logout() {
|
logout() {
|
||||||
const self = this;
|
const self = this;
|
||||||
@@ -241,9 +242,9 @@ export default {
|
|||||||
self.logouting = false;
|
self.logouting = false;
|
||||||
self.$hideLoading();
|
self.$hideLoading();
|
||||||
|
|
||||||
self.$settings.clearSettings();
|
self.settingsStore.clearAppSettings();
|
||||||
|
|
||||||
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage);
|
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage, self.settingsStore.appSettings.timeZone);
|
||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
|
|
||||||
router.navigate('/');
|
router.navigate('/');
|
||||||
|
|||||||
@@ -199,8 +199,8 @@ export default {
|
|||||||
email: '',
|
email: '',
|
||||||
nickname: '',
|
nickname: '',
|
||||||
language: self.$i18n.locale,
|
language: self.$i18n.locale,
|
||||||
defaultCurrency: settingsStore.defaultSetting.currency,
|
defaultCurrency: settingsStore.localeDefaultSettings.currency,
|
||||||
firstDayOfWeek: settingsStore.defaultSetting.firstDayOfWeek,
|
firstDayOfWeek: settingsStore.localeDefaultSettings.firstDayOfWeek,
|
||||||
},
|
},
|
||||||
submitting: false,
|
submitting: false,
|
||||||
presetCategories: {
|
presetCategories: {
|
||||||
@@ -230,8 +230,8 @@ export default {
|
|||||||
return this.$i18n.locale;
|
return this.$i18n.locale;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
const isCurrencyDefault = this.user.defaultCurrency === this.settingsStore.defaultSetting.currency;
|
const isCurrencyDefault = this.user.defaultCurrency === this.settingsStore.localeDefaultSettings.currency;
|
||||||
const isFirstWeekDayDefault = this.user.firstDayOfWeek === this.settingsStore.defaultSetting.firstDayOfWeek;
|
const isFirstWeekDayDefault = this.user.firstDayOfWeek === this.settingsStore.localeDefaultSettings.firstDayOfWeek;
|
||||||
|
|
||||||
this.user.language = value;
|
this.user.language = value;
|
||||||
|
|
||||||
@@ -239,11 +239,11 @@ export default {
|
|||||||
this.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
this.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
|
|
||||||
if (isCurrencyDefault) {
|
if (isCurrencyDefault) {
|
||||||
this.user.defaultCurrency = this.settingsStore.defaultSetting.currency;
|
this.user.defaultCurrency = this.settingsStore.localeDefaultSettings.currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFirstWeekDayDefault) {
|
if (isFirstWeekDayDefault) {
|
||||||
this.user.firstDayOfWeek = this.settingsStore.defaultSetting.firstDayOfWeek;
|
this.user.firstDayOfWeek = this.settingsStore.localeDefaultSettings.firstDayOfWeek;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -362,7 +362,7 @@ export default {
|
|||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default {
|
|||||||
return this.$locale.getAllLanguageInfos();
|
return this.$locale.getAllLanguageInfos();
|
||||||
},
|
},
|
||||||
isWebAuthnAvailable() {
|
isWebAuthnAvailable() {
|
||||||
return this.$settings.isEnableApplicationLockWebAuthn()
|
return this.settingsStore.appSettings.applicationLockWebAuthn
|
||||||
&& this.$user.getWebAuthnCredentialId()
|
&& this.$user.getWebAuthnCredentialId()
|
||||||
&& webauthn.isSupported();
|
&& webauthn.isSupported();
|
||||||
},
|
},
|
||||||
@@ -106,7 +106,7 @@ export default {
|
|||||||
const self = this;
|
const self = this;
|
||||||
const router = self.f7router;
|
const router = self.f7router;
|
||||||
|
|
||||||
if (!self.$settings.isEnableApplicationLockWebAuthn() || !self.$user.getWebAuthnCredentialId()) {
|
if (!self.settingsStore.appSettings.applicationLockWebAuthn || !self.$user.getWebAuthnCredentialId()) {
|
||||||
self.$toast('WebAuthn is not enabled');
|
self.$toast('WebAuthn is not enabled');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.$settings.isAutoUpdateExchangeRatesData()) {
|
if (self.settingsStore.appSettings.autoUpdateExchangeRatesData) {
|
||||||
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
self.exchangeRatesStore.getLatestExchangeRates({ silent: true, force: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,9 +196,9 @@ export default {
|
|||||||
|
|
||||||
self.$confirm('Are you sure you want to re-login?', () => {
|
self.$confirm('Are you sure you want to re-login?', () => {
|
||||||
self.rootStore.forceLogout();
|
self.rootStore.forceLogout();
|
||||||
self.$settings.clearSettings();
|
self.settingsStore.clearAppSettings();
|
||||||
|
|
||||||
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage);
|
const localeDefaultSettings = self.$locale.initLocale(self.userStore.currentUserLanguage, self.settingsStore.appSettings.timeZone);
|
||||||
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
self.settingsStore.updateLocalizedDefaultSettings(localeDefaultSettings);
|
||||||
|
|
||||||
router.navigate('/login', {
|
router.navigate('/login', {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<p class="no-margin">
|
<p class="no-margin">
|
||||||
<span class="net-assets" v-if="loading">0.00 USD</span>
|
<span class="net-assets" v-if="loading">0.00 USD</span>
|
||||||
<span class="net-assets" v-else-if="!loading">{{ netAssets }}</span>
|
<span class="net-assets" v-else-if="!loading">{{ netAssets }}</span>
|
||||||
<f7-link class="margin-left-half" @click="toggleShowAccountBalance()">
|
<f7-link class="margin-left-half" @click="showAccountBalance = !showAccountBalance">
|
||||||
<f7-icon class="ebk-hide-icon" :f7="showAccountBalance ? 'eye_slash_fill' : 'eye_fill'"></f7-icon>
|
<f7-icon class="ebk-hide-icon" :f7="showAccountBalance ? 'eye_slash_fill' : 'eye_fill'"></f7-icon>
|
||||||
</f7-link>
|
</f7-link>
|
||||||
</p>
|
</p>
|
||||||
@@ -166,6 +166,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
import { useAccountsStore } from '@/stores/account.js';
|
import { useAccountsStore } from '@/stores/account.js';
|
||||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||||
@@ -184,7 +185,6 @@ export default {
|
|||||||
showHidden: false,
|
showHidden: false,
|
||||||
sortable: false,
|
sortable: false,
|
||||||
accountToDelete: null,
|
accountToDelete: null,
|
||||||
showAccountBalance: this.$settings.isShowAccountBalance(),
|
|
||||||
showMoreActionSheet: false,
|
showMoreActionSheet: false,
|
||||||
showDeleteActionSheet: false,
|
showDeleteActionSheet: false,
|
||||||
displayOrderModified: false,
|
displayOrderModified: false,
|
||||||
@@ -192,7 +192,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore, useAccountsStore, useExchangeRatesStore),
|
...mapStores(useSettingsStore, useUserStore, useAccountsStore, useExchangeRatesStore),
|
||||||
defaultCurrency() {
|
defaultCurrency() {
|
||||||
return this.userStore.currentUserDefaultCurrency;
|
return this.userStore.currentUserDefaultCurrency;
|
||||||
},
|
},
|
||||||
@@ -232,6 +232,14 @@ export default {
|
|||||||
totalLiabilities() {
|
totalLiabilities() {
|
||||||
const totalLiabilities = this.accountsStore.getTotalLiabilities(this.showAccountBalance);
|
const totalLiabilities = this.accountsStore.getTotalLiabilities(this.showAccountBalance);
|
||||||
return this.$locale.getDisplayCurrency(totalLiabilities, this.defaultCurrency);
|
return this.$locale.getDisplayCurrency(totalLiabilities, this.defaultCurrency);
|
||||||
|
},
|
||||||
|
showAccountBalance: {
|
||||||
|
get: function () {
|
||||||
|
return this.settingsStore.appSettings.showAccountBalance;
|
||||||
|
},
|
||||||
|
set: function (value) {
|
||||||
|
this.settingsStore.setShowAccountBalance(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -295,10 +303,6 @@ export default {
|
|||||||
hasVisibleSubAccount(account) {
|
hasVisibleSubAccount(account) {
|
||||||
return this.accountsStore.hasVisibleSubAccount(this.showHidden, account);
|
return this.accountsStore.hasVisibleSubAccount(this.showHidden, account);
|
||||||
},
|
},
|
||||||
toggleShowAccountBalance() {
|
|
||||||
this.showAccountBalance = !this.showAccountBalance;
|
|
||||||
this.$settings.setShowAccountBalance(this.showAccountBalance);
|
|
||||||
},
|
|
||||||
accountBalance(account) {
|
accountBalance(account) {
|
||||||
const balance = this.accountsStore.getAccountBalance(this.showAccountBalance, account);
|
const balance = this.accountsStore.getAccountBalance(this.showAccountBalance, account);
|
||||||
return this.$locale.getDisplayCurrency(balance, account.currency);
|
return this.$locale.getDisplayCurrency(balance, account.currency);
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
|
|
||||||
import fontConstants from '@/consts/font.js';
|
import fontConstants from '@/consts/font.js';
|
||||||
@@ -117,15 +118,15 @@ export default {
|
|||||||
'f7router'
|
'f7router'
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
const self = this;
|
const settingsStore = useSettingsStore();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentTime: getCurrentUnixTime(),
|
currentTime: getCurrentUnixTime(),
|
||||||
fontSize: self.$settings.getFontSize()
|
fontSize: settingsStore.appSettings.fontSize
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore),
|
...mapStores(useSettingsStore, useUserStore),
|
||||||
minFontSizeType() {
|
minFontSizeType() {
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
@@ -152,8 +153,8 @@ export default {
|
|||||||
setFontSize() {
|
setFontSize() {
|
||||||
const router = this.f7router;
|
const router = this.f7router;
|
||||||
|
|
||||||
if (this.fontSize !== this.$settings.getFontSize()) {
|
if (this.fontSize !== this.settingsStore.appSettings.fontSize) {
|
||||||
this.$settings.setFontSize(this.fontSize);
|
this.settingsStore.setFontSize(this.fontSize);
|
||||||
setAppFontSize(this.fontSize);
|
setAppFontSize(this.fontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useAccountsStore } from '@/stores/account.js';
|
import { useAccountsStore } from '@/stores/account.js';
|
||||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||||
|
|
||||||
@@ -140,7 +141,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useAccountsStore, useStatisticsStore),
|
...mapStores(useSettingsStore, useAccountsStore, useStatisticsStore),
|
||||||
title() {
|
title() {
|
||||||
if (this.modifyDefault) {
|
if (this.modifyDefault) {
|
||||||
return 'Default Account Filter';
|
return 'Default Account Filter';
|
||||||
@@ -188,7 +189,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self.modifyDefault) {
|
if (self.modifyDefault) {
|
||||||
self.filterAccountIds = copyObjectTo(self.$settings.getStatisticsDefaultAccountFilter(), allAccountIds);
|
self.filterAccountIds = copyObjectTo(self.settingsStore.appSettings.statistics.defaultAccountFilter, allAccountIds);
|
||||||
} else {
|
} else {
|
||||||
self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds);
|
self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds);
|
||||||
}
|
}
|
||||||
@@ -222,7 +223,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self.modifyDefault) {
|
if (self.modifyDefault) {
|
||||||
self.$settings.setStatisticsDefaultAccountFilter(filteredAccountIds);
|
self.settingsStore.setStatisticsDefaultAccountFilter(filteredAccountIds);
|
||||||
} else {
|
} else {
|
||||||
self.statisticsStore.updateTransactionStatisticsFilter({
|
self.statisticsStore.updateTransactionStatisticsFilter({
|
||||||
filterAccountIds: filteredAccountIds
|
filterAccountIds: filteredAccountIds
|
||||||
|
|||||||
@@ -124,6 +124,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||||
|
|
||||||
@@ -149,7 +150,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useTransactionCategoriesStore, useStatisticsStore),
|
...mapStores(useSettingsStore, useTransactionCategoriesStore, useStatisticsStore),
|
||||||
|
|
||||||
title() {
|
title() {
|
||||||
if (this.modifyDefault) {
|
if (this.modifyDefault) {
|
||||||
@@ -221,7 +222,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self.modifyDefault) {
|
if (self.modifyDefault) {
|
||||||
self.filterCategoryIds = copyObjectTo(self.$settings.getStatisticsDefaultTransactionCategoryFilter(), allCategoryIds);
|
self.filterCategoryIds = copyObjectTo(self.settingsStore.appSettings.statistics.defaultTransactionCategoryFilter, allCategoryIds);
|
||||||
} else {
|
} else {
|
||||||
self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds);
|
self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds);
|
||||||
}
|
}
|
||||||
@@ -255,7 +256,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (self.modifyDefault) {
|
if (self.modifyDefault) {
|
||||||
self.$settings.setStatisticsDefaultTransactionCategoryFilter(filteredCategoryIds);
|
self.settingsStore.setStatisticsDefaultTransactionCategoryFilter(filteredCategoryIds);
|
||||||
} else {
|
} else {
|
||||||
self.statisticsStore.updateTransactionStatisticsFilter({
|
self.statisticsStore.updateTransactionStatisticsFilter({
|
||||||
filterCategoryIds: filteredCategoryIds
|
filterCategoryIds: filteredCategoryIds
|
||||||
|
|||||||
@@ -50,11 +50,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
|
|
||||||
import datetimeConstants from '@/consts/datetime.js';
|
import datetimeConstants from '@/consts/datetime.js';
|
||||||
import statisticsConstants from '@/consts/statistics.js';
|
import statisticsConstants from '@/consts/statistics.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
|
...mapStores(useSettingsStore),
|
||||||
allChartTypes() {
|
allChartTypes() {
|
||||||
return statisticsConstants.allChartTypes;
|
return statisticsConstants.allChartTypes;
|
||||||
},
|
},
|
||||||
@@ -83,34 +87,34 @@ export default {
|
|||||||
},
|
},
|
||||||
defaultChartType: {
|
defaultChartType: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.getStatisticsDefaultChartType();
|
return this.settingsStore.appSettings.statistics.defaultChartType;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setStatisticsDefaultChartType(value);
|
this.settingsStore.setStatisticsDefaultChartType(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultChartDataType: {
|
defaultChartDataType: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.getStatisticsDefaultChartDataType();
|
return this.settingsStore.appSettings.statistics.defaultChartDataType;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setStatisticsDefaultChartDataType(value);
|
this.settingsStore.setStatisticsDefaultChartDataType(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultDateRange: {
|
defaultDateRange: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.getStatisticsDefaultDateRange();
|
return this.settingsStore.appSettings.statistics.defaultDataRangeType;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setStatisticsDefaultDateRange(value);
|
this.settingsStore.setStatisticsDefaultDateRange(value);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
defaultSortingType: {
|
defaultSortingType: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this.$settings.getStatisticsSortingType();
|
return this.settingsStore.appSettings.statistics.defaultSortingType;
|
||||||
},
|
},
|
||||||
set: function (value) {
|
set: function (value) {
|
||||||
this.$settings.setStatisticsSortingType(value);
|
this.settingsStore.setStatisticsSortingType(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
import { useAccountsStore } from '@/stores/account.js';
|
import { useAccountsStore } from '@/stores/account.js';
|
||||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||||
@@ -273,12 +274,9 @@ export default {
|
|||||||
'f7router'
|
'f7router'
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
const self = this;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
loadingError: null,
|
loadingError: null,
|
||||||
showAccountBalance: self.$settings.isShowAccountBalance(),
|
|
||||||
showChartDataTypePopover: false,
|
showChartDataTypePopover: false,
|
||||||
showSortingTypePopover: false,
|
showSortingTypePopover: false,
|
||||||
showDatePopover: false,
|
showDatePopover: false,
|
||||||
@@ -287,7 +285,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore, useAccountsStore, useTransactionCategoriesStore, useStatisticsStore),
|
...mapStores(useSettingsStore, useUserStore, useAccountsStore, useTransactionCategoriesStore, useStatisticsStore),
|
||||||
defaultCurrency() {
|
defaultCurrency() {
|
||||||
return this.userStore.currentUserDefaultCurrency;
|
return this.userStore.currentUserDefaultCurrency;
|
||||||
},
|
},
|
||||||
@@ -323,6 +321,9 @@ export default {
|
|||||||
allDateRanges() {
|
allDateRanges() {
|
||||||
return datetimeConstants.allDateRanges;
|
return datetimeConstants.allDateRanges;
|
||||||
},
|
},
|
||||||
|
showAccountBalance() {
|
||||||
|
return this.settingsStore.appSettings.showAccountBalance;
|
||||||
|
},
|
||||||
totalAmountName() {
|
totalAmountName() {
|
||||||
if (this.query.chartDataType === this.allChartDataTypes.IncomeByAccount.type
|
if (this.query.chartDataType === this.allChartDataTypes.IncomeByAccount.type
|
||||||
|| this.query.chartDataType === this.allChartDataTypes.IncomeByPrimaryCategory.type
|
|| this.query.chartDataType === this.allChartDataTypes.IncomeByPrimaryCategory.type
|
||||||
@@ -431,25 +432,25 @@ export default {
|
|||||||
created() {
|
created() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
|
||||||
let defaultChartType = self.$settings.getStatisticsDefaultChartType();
|
let defaultChartType = self.settingsStore.appSettings.statistics.defaultChartType;
|
||||||
|
|
||||||
if (defaultChartType !== self.allChartTypes.Pie && defaultChartType !== self.allChartTypes.Bar) {
|
if (defaultChartType !== self.allChartTypes.Pie && defaultChartType !== self.allChartTypes.Bar) {
|
||||||
defaultChartType = statisticsConstants.defaultChartType;
|
defaultChartType = statisticsConstants.defaultChartType;
|
||||||
}
|
}
|
||||||
|
|
||||||
let defaultChartDataType = self.$settings.getStatisticsDefaultChartDataType();
|
let defaultChartDataType = self.settingsStore.appSettings.statistics.defaultChartDataType;
|
||||||
|
|
||||||
if (defaultChartDataType < self.allChartDataTypes.ExpenseByAccount.type || defaultChartDataType > self.allChartDataTypes.AccountTotalLiabilities.type) {
|
if (defaultChartDataType < self.allChartDataTypes.ExpenseByAccount.type || defaultChartDataType > self.allChartDataTypes.AccountTotalLiabilities.type) {
|
||||||
defaultChartDataType = statisticsConstants.defaultChartDataType;
|
defaultChartDataType = statisticsConstants.defaultChartDataType;
|
||||||
}
|
}
|
||||||
|
|
||||||
let defaultDateRange = self.$settings.getStatisticsDefaultDateRange();
|
let defaultDateRange = self.settingsStore.appSettings.statistics.defaultDataRangeType;
|
||||||
|
|
||||||
if (defaultDateRange < self.allDateRanges.All.type || defaultDateRange >= self.allDateRanges.Custom.type) {
|
if (defaultDateRange < self.allDateRanges.All.type || defaultDateRange >= self.allDateRanges.Custom.type) {
|
||||||
defaultDateRange = statisticsConstants.defaultDataRangeType;
|
defaultDateRange = statisticsConstants.defaultDataRangeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
let defaultSortType = self.$settings.getStatisticsSortingType();
|
let defaultSortType = self.settingsStore.appSettings.statistics.defaultSortingType;
|
||||||
|
|
||||||
if (defaultSortType < self.allSortingTypes.Amount.type || defaultSortType > self.allSortingTypes.Name.type) {
|
if (defaultSortType < self.allSortingTypes.Amount.type || defaultSortType > self.allSortingTypes.Name.type) {
|
||||||
defaultSortType = statisticsConstants.defaultSortingType;
|
defaultSortType = statisticsConstants.defaultSortingType;
|
||||||
@@ -463,8 +464,8 @@ export default {
|
|||||||
endTime: dateRange ? dateRange.maxTime : undefined,
|
endTime: dateRange ? dateRange.maxTime : undefined,
|
||||||
chartType: defaultChartType,
|
chartType: defaultChartType,
|
||||||
chartDataType: defaultChartDataType,
|
chartDataType: defaultChartDataType,
|
||||||
filterAccountIds: self.$settings.getStatisticsDefaultAccountFilter() || {},
|
filterAccountIds: self.settingsStore.appSettings.statistics.defaultAccountFilter || {},
|
||||||
filterCategoryIds: self.$settings.getStatisticsDefaultTransactionCategoryFilter() || {},
|
filterCategoryIds: self.settingsStore.appSettings.statistics.defaultTransactionCategoryFilter || {},
|
||||||
sortingType: defaultSortType,
|
sortingType: defaultSortType,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -303,7 +303,7 @@
|
|||||||
<f7-actions-button v-if="mode !== 'view'" @click="updateGeoLocation(true)">{{ $t('Update Geographic Location') }}</f7-actions-button>
|
<f7-actions-button v-if="mode !== 'view'" @click="updateGeoLocation(true)">{{ $t('Update Geographic Location') }}</f7-actions-button>
|
||||||
<f7-actions-button v-if="mode !== 'view'" @click="clearGeoLocation">{{ $t('Clear Geographic Location') }}</f7-actions-button>
|
<f7-actions-button v-if="mode !== 'view'" @click="clearGeoLocation">{{ $t('Clear Geographic Location') }}</f7-actions-button>
|
||||||
</f7-actions-group>
|
</f7-actions-group>
|
||||||
<f7-actions-group v-if="$settings.getMapProvider()">
|
<f7-actions-group v-if="mapProvider">
|
||||||
<f7-actions-button :class="{ 'disabled': !transaction.geoLocation }" @click="showGeoLocationMapSheet = true">{{ $t('Show on the map') }}</f7-actions-button>
|
<f7-actions-button :class="{ 'disabled': !transaction.geoLocation }" @click="showGeoLocationMapSheet = true">{{ $t('Show on the map') }}</f7-actions-button>
|
||||||
</f7-actions-group>
|
</f7-actions-group>
|
||||||
<f7-actions-group>
|
<f7-actions-group>
|
||||||
@@ -331,6 +331,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
import { useAccountsStore } from '@/stores/account.js';
|
import { useAccountsStore } from '@/stores/account.js';
|
||||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||||
@@ -367,6 +368,7 @@ import {
|
|||||||
getTransactionPrimaryCategoryName,
|
getTransactionPrimaryCategoryName,
|
||||||
getTransactionSecondaryCategoryName
|
getTransactionSecondaryCategoryName
|
||||||
} from '@/lib/category.js';
|
} from '@/lib/category.js';
|
||||||
|
import { getMapProvider } from '@/lib/server_settings.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
@@ -375,9 +377,10 @@ export default {
|
|||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
const self = this;
|
const self = this;
|
||||||
|
const settingsStore = useSettingsStore();
|
||||||
const query = self.f7route.query;
|
const query = self.f7route.query;
|
||||||
const now = getCurrentUnixTime();
|
const now = getCurrentUnixTime();
|
||||||
const currentTimezone = self.$locale.getTimezone();
|
const currentTimezone = settingsStore.appSettings.timeZone;
|
||||||
|
|
||||||
let defaultType = transactionConstants.allTransactionTypes.Expense;
|
let defaultType = transactionConstants.allTransactionTypes.Expense;
|
||||||
|
|
||||||
@@ -412,7 +415,6 @@ export default {
|
|||||||
geoLocationStatus: null,
|
geoLocationStatus: null,
|
||||||
submitting: false,
|
submitting: false,
|
||||||
isSupportGeoLocation: !!navigator.geolocation,
|
isSupportGeoLocation: !!navigator.geolocation,
|
||||||
showAccountBalance: self.$settings.isShowAccountBalance(),
|
|
||||||
showGeoLocationActionSheet: false,
|
showGeoLocationActionSheet: false,
|
||||||
showMoreActionSheet: false,
|
showMoreActionSheet: false,
|
||||||
showSourceAmountSheet: false,
|
showSourceAmountSheet: false,
|
||||||
@@ -426,7 +428,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore, useAccountsStore, useTransactionCategoriesStore, useTransactionTagsStore, useTransactionsStore, useExchangeRatesStore),
|
...mapStores(useSettingsStore, useUserStore, useAccountsStore, useTransactionCategoriesStore, useTransactionTagsStore, useTransactionsStore, useExchangeRatesStore),
|
||||||
title() {
|
title() {
|
||||||
if (this.mode === 'add') {
|
if (this.mode === 'add') {
|
||||||
return 'Add Transaction';
|
return 'Add Transaction';
|
||||||
@@ -672,6 +674,12 @@ export default {
|
|||||||
allowedMaxAmount() {
|
allowedMaxAmount() {
|
||||||
return transactionConstants.maxAmount;
|
return transactionConstants.maxAmount;
|
||||||
},
|
},
|
||||||
|
showAccountBalance() {
|
||||||
|
return this.settingsStore.appSettings.showAccountBalance;
|
||||||
|
},
|
||||||
|
mapProvider() {
|
||||||
|
return getMapProvider();
|
||||||
|
},
|
||||||
inputIsEmpty() {
|
inputIsEmpty() {
|
||||||
return !!this.inputEmptyProblemMessage;
|
return !!this.inputEmptyProblemMessage;
|
||||||
},
|
},
|
||||||
@@ -898,7 +906,7 @@ export default {
|
|||||||
onPageAfterIn() {
|
onPageAfterIn() {
|
||||||
this.$routeBackOnError(this.f7router, 'loadingError');
|
this.$routeBackOnError(this.f7router, 'loadingError');
|
||||||
|
|
||||||
if (this.$settings.isAutoGetCurrentGeoLocation() && this.mode === 'add'
|
if (this.settingsStore.appSettings.autoGetCurrentGeoLocation && this.mode === 'add'
|
||||||
&& !this.geoLocationStatus && !this.transaction.geoLocation) {
|
&& !this.geoLocationStatus && !this.transaction.geoLocation) {
|
||||||
this.updateGeoLocation(false);
|
this.updateGeoLocation(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -413,6 +413,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapStores } from 'pinia';
|
import { mapStores } from 'pinia';
|
||||||
|
import { useSettingsStore } from '@/stores/setting.js';
|
||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
import { useAccountsStore } from '@/stores/account.js';
|
import { useAccountsStore } from '@/stores/account.js';
|
||||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||||
@@ -441,14 +442,11 @@ export default {
|
|||||||
'f7router'
|
'f7router'
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
const self = this;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
loadingError: null,
|
loadingError: null,
|
||||||
loadingMore: false,
|
loadingMore: false,
|
||||||
transactionToDelete: null,
|
transactionToDelete: null,
|
||||||
showTotalAmountInTransactionListPage: self.$settings.isShowTotalAmountInTransactionListPage(),
|
|
||||||
showDatePopover: false,
|
showDatePopover: false,
|
||||||
showTypePopover: false,
|
showTypePopover: false,
|
||||||
showCategoryPopover: false,
|
showCategoryPopover: false,
|
||||||
@@ -458,7 +456,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useUserStore, useAccountsStore, useTransactionCategoriesStore, useTransactionsStore),
|
...mapStores(useSettingsStore, useUserStore, useAccountsStore, useTransactionCategoriesStore, useTransactionsStore),
|
||||||
defaultCurrency() {
|
defaultCurrency() {
|
||||||
if (this.query.accountId && this.query.accountId !== '0') {
|
if (this.query.accountId && this.query.accountId !== '0') {
|
||||||
const account = this.allAccounts[this.query.accountId];
|
const account = this.allAccounts[this.query.accountId];
|
||||||
@@ -551,6 +549,9 @@ export default {
|
|||||||
},
|
},
|
||||||
allDateRanges() {
|
allDateRanges() {
|
||||||
return datetimeConstants.allDateRanges;
|
return datetimeConstants.allDateRanges;
|
||||||
|
},
|
||||||
|
showTotalAmountInTransactionListPage() {
|
||||||
|
return this.settingsStore.appSettings.showTotalAmountInTransactionListPage;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import { useRootStore } from '@/stores/index.js';
|
|||||||
import { useUserStore } from '@/stores/user.js';
|
import { useUserStore } from '@/stores/user.js';
|
||||||
|
|
||||||
import { appendThousandsSeparator } from '@/lib/common.js';
|
import { appendThousandsSeparator } from '@/lib/common.js';
|
||||||
|
import { isDataExportingEnabled } from '@/lib/server_settings.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: [
|
props: [
|
||||||
@@ -96,7 +97,7 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
isDataExportingEnabled() {
|
isDataExportingEnabled() {
|
||||||
return this.$settings.isDataExportingEnabled();
|
return isDataExportingEnabled();
|
||||||
},
|
},
|
||||||
exportFileName() {
|
exportFileName() {
|
||||||
const nickname = this.userStore.currentUserNickname;
|
const nickname = this.userStore.currentUserNickname;
|
||||||
|
|||||||
Reference in New Issue
Block a user