mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 00:12:11 +08:00
migrate to typescript
This commit is contained in:
@@ -124,9 +124,9 @@ import { mapStores } from 'pinia';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import { getMapProvider } from '@/lib/server_settings.js';
|
||||
import { getMapProvider } from '@/lib/server_settings.ts';
|
||||
import { getMapWebsite } from '@/lib/map/index.js';
|
||||
import licenses from '@/lib/licenses.js';
|
||||
import { getLicense, getThirdPartyLicenses } from '@/lib/licenses.ts';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
@@ -152,10 +152,10 @@ export default {
|
||||
return getMapWebsite();
|
||||
},
|
||||
licenseLines() {
|
||||
return licenses.getLicense().replaceAll(/\r/g, '').split('\n');
|
||||
return getLicense().replaceAll(/\r/g, '').split('\n');
|
||||
},
|
||||
thirdPartyLicenses() {
|
||||
return licenses.getThirdPartyLicenses();
|
||||
return getThirdPartyLicenses();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,8 @@ import { mapStores } from 'pinia';
|
||||
import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
|
||||
import {
|
||||
mdiChevronLeft,
|
||||
@@ -131,7 +132,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
@@ -140,7 +141,7 @@ export default {
|
||||
return this.$locale.getAllLanguageInfoArray(false);
|
||||
},
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
currentLanguageName() {
|
||||
return this.$locale.getCurrentLanguageDisplayName();
|
||||
|
||||
@@ -197,6 +197,7 @@ import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useOverviewStore } from '@/stores/overview.js';
|
||||
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import {
|
||||
formatUnixTime,
|
||||
getUnixTimeBeforeUnixTime,
|
||||
@@ -245,7 +246,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useSettingsStore, useUserStore, useAccountsStore, useOverviewStore),
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
showAmountInHomePage: {
|
||||
get: function() {
|
||||
|
||||
@@ -175,15 +175,16 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import apiConstants from '@/consts/api.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import {
|
||||
isUserRegistrationEnabled,
|
||||
isUserForgetPasswordEnabled,
|
||||
isUserVerifyEmailEnabled,
|
||||
getLoginPageTips
|
||||
} from '@/lib/server_settings.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
} from '@/lib/server_settings.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
import {
|
||||
mdiOnepassword,
|
||||
@@ -212,7 +213,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore, useExchangeRatesStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
@@ -240,7 +241,7 @@ export default {
|
||||
}
|
||||
},
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
currentLanguageName() {
|
||||
return this.$locale.getCurrentLanguageDisplayName();
|
||||
@@ -320,7 +321,7 @@ export default {
|
||||
}).catch(error => {
|
||||
self.logining = false;
|
||||
|
||||
if (self.isUserVerifyEmailEnabled && error.error && error.error.errorCode === apiConstants.userEmailNotVerifiedErrorCode && error.error.context && error.error.context.email) {
|
||||
if (self.isUserVerifyEmailEnabled && error.error && error.error.errorCode === KnownErrorCode.UserEmailNotVerified && error.error.context && error.error.context.email) {
|
||||
self.$router.push(`/verify_email?email=${encodeURIComponent(error.error.context.email)}&emailSent=${error.error.context.hasValidEmailVerifyToken || false}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,9 +201,10 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { isUserScheduledTransactionEnabled } from '@/lib/server_settings.js';
|
||||
import { getSystemTheme, setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import { isUserScheduledTransactionEnabled } from '@/lib/server_settings.ts';
|
||||
import { getSystemTheme, setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
import {
|
||||
mdiMenu,
|
||||
@@ -263,7 +264,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore, useUserStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
mdAndDown() {
|
||||
return this.display.mdAndDown.value;
|
||||
@@ -286,7 +287,7 @@ export default {
|
||||
if (value !== this.settingsStore.appSettings.theme) {
|
||||
this.settingsStore.setTheme(value);
|
||||
|
||||
if (value === 'light' || value === 'dark') {
|
||||
if (value === ThemeType.Light || value === ThemeType.Dark) {
|
||||
this.globalTheme.global.name.value = value;
|
||||
} else {
|
||||
this.globalTheme.global.name.value = getSystemTheme();
|
||||
|
||||
@@ -137,7 +137,8 @@ import { mapStores } from 'pinia';
|
||||
import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
|
||||
import {
|
||||
mdiChevronLeft
|
||||
@@ -177,7 +178,7 @@ export default {
|
||||
}
|
||||
},
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
@@ -186,7 +187,7 @@ export default {
|
||||
return this.$locale.getAllLanguageInfoArray(false);
|
||||
},
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
currentLanguageName() {
|
||||
return this.$locale.getCurrentLanguageDisplayName();
|
||||
|
||||
@@ -244,10 +244,11 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { categorizedArrayToPlainArray } from '@/lib/common.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import { categorizedArrayToPlainArray } from '@/lib/common.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
import {
|
||||
mdiArrowLeft,
|
||||
@@ -277,7 +278,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore, useTransactionCategoriesStore, useExchangeRatesStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
allLanguages() {
|
||||
return this.$locale.getAllLanguageInfoArray(false);
|
||||
@@ -314,7 +315,7 @@ export default {
|
||||
}
|
||||
},
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
currentLanguageName() {
|
||||
const languageInfo = this.$locale.getLanguageInfo(this.currentLocale);
|
||||
@@ -495,11 +496,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
|
||||
@@ -117,10 +117,11 @@ import { useTokensStore } from '@/stores/token.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import webauthn from '@/lib/webauthn.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -132,7 +133,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore, useUserStore, useTokensStore, useTransactionsStore, useExchangeRatesStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
@@ -146,7 +147,7 @@ export default {
|
||||
&& webauthn.isSupported();
|
||||
},
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
currentLanguageName() {
|
||||
return this.$locale.getCurrentLanguageDisplayName();
|
||||
|
||||
@@ -116,8 +116,9 @@ import { mapStores } from 'pinia';
|
||||
import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.ts';
|
||||
|
||||
import {
|
||||
mdiChevronLeft
|
||||
@@ -144,7 +145,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
@@ -153,7 +154,7 @@ export default {
|
||||
return this.$locale.getAllLanguageInfoArray(false);
|
||||
},
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
currentLanguageName() {
|
||||
return this.$locale.getCurrentLanguageDisplayName();
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
</div>
|
||||
<v-divider />
|
||||
<v-tabs show-arrows class="account-category-tabs my-4" direction="vertical"
|
||||
:disabled="loading" v-model="activeAccountCategoryId">
|
||||
<v-tab class="tab-text-truncate" :key="accountCategory.id" :value="accountCategory.id"
|
||||
:disabled="loading" v-model="activeAccountCategoryType">
|
||||
<v-tab class="tab-text-truncate" :key="accountCategory.type" :value="accountCategory.type"
|
||||
v-for="accountCategory in allAccountCategories">
|
||||
<ItemIcon icon-type="account" :icon-id="accountCategory.defaultAccountIconId" />
|
||||
<div class="d-flex flex-column text-truncate ml-2">
|
||||
@@ -146,8 +146,8 @@
|
||||
handle=".drag-handle"
|
||||
ghost-class="dragging-item"
|
||||
:disabled="activeAccountCategoryVisibleAccountCount <= 1"
|
||||
:list="allCategorizedAccountsMap[activeAccountCategory.id].accounts"
|
||||
v-if="allCategorizedAccountsMap[activeAccountCategory.id] && allCategorizedAccountsMap[activeAccountCategory.id].accounts && allCategorizedAccountsMap[activeAccountCategory.id].accounts.length"
|
||||
:list="allCategorizedAccountsMap[activeAccountCategory.type].accounts"
|
||||
v-if="allCategorizedAccountsMap[activeAccountCategory.type] && allCategorizedAccountsMap[activeAccountCategory.type].accounts && allCategorizedAccountsMap[activeAccountCategory.type].accounts.length"
|
||||
@change="onMove"
|
||||
>
|
||||
<template #item="{ element }">
|
||||
@@ -169,7 +169,7 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="mt-4" v-if="element.type === allAccountTypes.MultiSubAccounts">
|
||||
<div class="mt-4" v-if="element.type === allAccountTypes.MultiSubAccounts.type">
|
||||
<v-btn-toggle
|
||||
class="account-subaccounts"
|
||||
variant="outlined"
|
||||
@@ -265,10 +265,9 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import { isObject } from '@/lib/common.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { isObject } from '@/lib/common.ts';
|
||||
import {
|
||||
getAccountCategoryInfo,
|
||||
getSubAccountCurrencies,
|
||||
getAccountOrSubAccountId,
|
||||
getAccountOrSubAccountComment
|
||||
@@ -295,7 +294,7 @@ export default {
|
||||
const { mdAndUp } = useDisplay();
|
||||
|
||||
return {
|
||||
activeAccountCategoryId: accountConstants.allCategories[0].id,
|
||||
activeAccountCategoryType: AccountCategory.Default.type,
|
||||
activeTab: 'accountPage',
|
||||
activeSubAccount: {},
|
||||
loading: true,
|
||||
@@ -325,10 +324,10 @@ export default {
|
||||
return this.userStore.currentUserDefaultCurrency;
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allAccountCategories() {
|
||||
return accountConstants.allCategories;
|
||||
return AccountCategory.values();
|
||||
},
|
||||
allAccounts() {
|
||||
return this.accountsStore.allAccounts;
|
||||
@@ -352,17 +351,17 @@ export default {
|
||||
return this.getDisplayCurrency(totalLiabilities, this.defaultCurrency);
|
||||
},
|
||||
activeAccountCategory() {
|
||||
return getAccountCategoryInfo(this.activeAccountCategoryId);
|
||||
return AccountCategory.valueOf(this.activeAccountCategoryType);
|
||||
},
|
||||
activeAccountCategoryTotalBalance() {
|
||||
return this.accountCategoryTotalBalance(this.activeAccountCategory);
|
||||
},
|
||||
activeAccountCategoryVisibleAccountCount() {
|
||||
if (!this.allCategorizedAccountsMap[this.activeAccountCategory.id] || !this.allCategorizedAccountsMap[this.activeAccountCategory.id].accounts) {
|
||||
if (!this.allCategorizedAccountsMap[this.activeAccountCategory.type] || !this.allCategorizedAccountsMap[this.activeAccountCategory.type].accounts) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const accounts = this.allCategorizedAccountsMap[this.activeAccountCategory.id].accounts;
|
||||
const accounts = this.allCategorizedAccountsMap[this.activeAccountCategory.type].accounts;
|
||||
|
||||
if (this.showHidden) {
|
||||
return accounts.length;
|
||||
@@ -422,7 +421,7 @@ export default {
|
||||
for (let i = 0; i < self.allAccounts.length; i++) {
|
||||
const account = self.allAccounts[i];
|
||||
|
||||
if (account.type === self.allAccountTypes.MultiSubAccounts && !self.activeSubAccount[account.id]) {
|
||||
if (account.type === self.allAccountTypes.MultiSubAccounts.type && !self.activeSubAccount[account.id]) {
|
||||
self.activeSubAccount[account.id] = '';
|
||||
}
|
||||
}
|
||||
@@ -459,9 +458,9 @@ export default {
|
||||
accountCurrency(account) {
|
||||
const self = this;
|
||||
|
||||
if (account.type === self.allAccountTypes.SingleAccount) {
|
||||
if (account.type === self.allAccountTypes.SingleAccount.type) {
|
||||
return self.$locale.getCurrencyName(account.currency);
|
||||
} else if (account.type === self.allAccountTypes.MultiSubAccounts) {
|
||||
} else if (account.type === self.allAccountTypes.MultiSubAccounts.type) {
|
||||
const subAccountCurrencies = getSubAccountCurrencies(account, self.showHidden, self.activeSubAccount[account.id])
|
||||
.map(currencyCode => self.$locale.getCurrencyName(currencyCode));
|
||||
return self.$locale.joinMultiText(subAccountCurrencies);
|
||||
@@ -470,10 +469,10 @@ export default {
|
||||
}
|
||||
},
|
||||
accountBalance(account) {
|
||||
if (account.type === this.allAccountTypes.SingleAccount) {
|
||||
if (account.type === this.allAccountTypes.SingleAccount.type) {
|
||||
const balance = this.accountsStore.getAccountBalance(this.showAccountBalance, account);
|
||||
return this.getDisplayCurrency(balance, account.currency);
|
||||
} else if (account.type === this.allAccountTypes.MultiSubAccounts) {
|
||||
} else if (account.type === this.allAccountTypes.MultiSubAccounts.type) {
|
||||
const balanceResult = this.accountsStore.getAccountSubAccountBalance(this.showAccountBalance, this.showHidden, account, this.activeSubAccount[account.id]);
|
||||
|
||||
if (!isObject(balanceResult)) {
|
||||
@@ -538,7 +537,7 @@ export default {
|
||||
const self = this;
|
||||
|
||||
self.$refs.editDialog.open({
|
||||
category: self.activeAccountCategoryId
|
||||
category: self.activeAccountCategoryType
|
||||
}).then(result => {
|
||||
if (result && result.message) {
|
||||
self.$refs.snackbar.showMessage(result.message);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<v-dialog :width="account.type === allAccountTypes.MultiSubAccounts ? 1000 : 800" :persistent="!!persistent" v-model="showState">
|
||||
<v-dialog :width="account.type === allAccountTypes.MultiSubAccounts.type ? 1000 : 800" :persistent="!!persistent" v-model="showState">
|
||||
<v-card class="pa-2 pa-sm-4 pa-md-8">
|
||||
<template #title>
|
||||
<div class="d-flex align-center justify-center">
|
||||
@@ -8,7 +8,7 @@
|
||||
<v-progress-circular indeterminate size="22" class="ml-2" v-if="loading"></v-progress-circular>
|
||||
</div>
|
||||
<v-btn density="comfortable" color="default" variant="text" class="ml-2" :icon="true"
|
||||
:disabled="loading || submitting || !!editAccountId || account.type !== allAccountTypes.MultiSubAccounts">
|
||||
:disabled="loading || submitting || !!editAccountId || account.type !== allAccountTypes.MultiSubAccounts.type">
|
||||
<v-icon :icon="icons.more" />
|
||||
<v-menu activator="parent">
|
||||
<v-list>
|
||||
@@ -21,12 +21,12 @@
|
||||
</div>
|
||||
</template>
|
||||
<v-card-text class="d-flex flex-column flex-md-row mt-md-4 pt-0">
|
||||
<div class="mb-4" v-if="account.type === allAccountTypes.MultiSubAccounts">
|
||||
<div class="mb-4" v-if="account.type === allAccountTypes.MultiSubAccounts.type">
|
||||
<v-tabs direction="vertical" :disabled="loading || submitting" v-model="currentAccountIndex">
|
||||
<v-tab :value="-1">
|
||||
<span>{{ $t('Main Account') }}</span>
|
||||
</v-tab>
|
||||
<template v-if="account.type === allAccountTypes.MultiSubAccounts">
|
||||
<template v-if="account.type === allAccountTypes.MultiSubAccounts.type">
|
||||
<v-tab :key="idx" :value="idx" v-for="(subAccount, idx) in subAccounts">
|
||||
<span>{{ $t('Sub Account') + ' #' + (idx + 1) }}</span>
|
||||
<v-btn class="ml-2" color="error" size="24" variant="text"
|
||||
@@ -38,15 +38,15 @@
|
||||
</div>
|
||||
|
||||
<v-window class="d-flex flex-grow-1 disable-tab-transition w-100-window-container"
|
||||
:class="{ 'ml-md-5': account.type === allAccountTypes.MultiSubAccounts }"
|
||||
:class="{ 'ml-md-5': account.type === allAccountTypes.MultiSubAccounts.type }"
|
||||
v-model="activeTab">
|
||||
<v-window-item value="account">
|
||||
<v-form class="mt-2">
|
||||
<v-row>
|
||||
<v-col cols="12" md="12" v-if="account.type === allAccountTypes.SingleAccount || currentAccountIndex < 0">
|
||||
<v-col cols="12" md="12" v-if="account.type === allAccountTypes.SingleAccount.type || currentAccountIndex < 0">
|
||||
<v-select
|
||||
item-title="displayName"
|
||||
item-value="id"
|
||||
item-value="type"
|
||||
persistent-placeholder
|
||||
:disabled="loading || submitting"
|
||||
:label="$t('Account Category')"
|
||||
@@ -71,10 +71,10 @@
|
||||
</template>
|
||||
</v-select>
|
||||
</v-col>
|
||||
<v-col cols="12" md="12" v-if="account.type === allAccountTypes.SingleAccount || currentAccountIndex < 0">
|
||||
<v-col cols="12" md="12" v-if="account.type === allAccountTypes.SingleAccount.type || currentAccountIndex < 0">
|
||||
<v-select
|
||||
item-title="displayName"
|
||||
item-value="id"
|
||||
item-value="type"
|
||||
persistent-placeholder
|
||||
:disabled="loading || submitting || !!editAccountId"
|
||||
:label="$t('Account Type')"
|
||||
@@ -108,7 +108,7 @@
|
||||
:disabled="loading || submitting"
|
||||
v-model="selectedAccount.color" />
|
||||
</v-col>
|
||||
<v-col cols="12" :md="currentAccountIndex < 0 && isAccountSupportCreditCardStatementDate() ? 6 : 12" v-if="account.type === allAccountTypes.SingleAccount || currentAccountIndex >= 0">
|
||||
<v-col cols="12" :md="currentAccountIndex < 0 && isAccountSupportCreditCardStatementDate() ? 6 : 12" v-if="account.type === allAccountTypes.SingleAccount.type || currentAccountIndex >= 0">
|
||||
<v-autocomplete
|
||||
item-title="displayName"
|
||||
item-value="currencyCode"
|
||||
@@ -126,7 +126,7 @@
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-col>
|
||||
<v-col cols="12" :md="account.type === allAccountTypes.SingleAccount || currentAccountIndex >= 0 ? 6 : 12" v-if="currentAccountIndex < 0 && isAccountSupportCreditCardStatementDate()">
|
||||
<v-col cols="12" :md="account.type === allAccountTypes.SingleAccount.type || currentAccountIndex >= 0 ? 6 : 12" v-if="currentAccountIndex < 0 && isAccountSupportCreditCardStatementDate()">
|
||||
<v-autocomplete
|
||||
item-title="displayName"
|
||||
item-value="day"
|
||||
@@ -141,7 +141,7 @@
|
||||
></v-autocomplete>
|
||||
</v-col>
|
||||
<v-col cols="12" :md="!editAccountId && selectedAccount.balance ? 6 : 12"
|
||||
v-if="account.type === allAccountTypes.SingleAccount || currentAccountIndex >= 0">
|
||||
v-if="account.type === allAccountTypes.SingleAccount.type || currentAccountIndex >= 0">
|
||||
<amount-input :disabled="loading || submitting || !!editAccountId"
|
||||
:persistent-placeholder="true"
|
||||
:currency="selectedAccount.currency"
|
||||
@@ -151,7 +151,7 @@
|
||||
v-model="selectedAccount.balance"/>
|
||||
</v-col>
|
||||
<v-col cols="12" md="6" v-show="selectedAccount.balance"
|
||||
v-if="!editAccountId && (account.type === allAccountTypes.SingleAccount || currentAccountIndex >= 0)">
|
||||
v-if="!editAccountId && (account.type === allAccountTypes.SingleAccount.type || currentAccountIndex >= 0)">
|
||||
<date-time-select
|
||||
:disabled="loading || submitting"
|
||||
:label="$t('Balance Time')"
|
||||
@@ -200,11 +200,11 @@ import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useAccountsStore } from '@/stores/account.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import { isNumber } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { ALL_ACCOUNT_ICONS } from '@/consts/icon.ts';
|
||||
import { ALL_ACCOUNT_COLORS } from '@/consts/color.ts';
|
||||
import { isNumber } from '@/lib/common.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
setAccountModelByAnotherAccount,
|
||||
setAccountSuitableIcon
|
||||
@@ -264,7 +264,7 @@ export default {
|
||||
}
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allAccountCategories() {
|
||||
return this.$locale.getAllAccountCategories();
|
||||
@@ -273,10 +273,10 @@ export default {
|
||||
return this.$locale.getAllAccountTypes();
|
||||
},
|
||||
allAccountIcons() {
|
||||
return iconConstants.allAccountIcons;
|
||||
return ALL_ACCOUNT_ICONS;
|
||||
},
|
||||
allAccountColors() {
|
||||
return colorConstants.allAccountColors;
|
||||
return ALL_ACCOUNT_COLORS;
|
||||
},
|
||||
allCurrencies() {
|
||||
return this.$locale.getAllCurrencies();
|
||||
@@ -366,7 +366,7 @@ export default {
|
||||
});
|
||||
},
|
||||
addSubAccount() {
|
||||
if (this.account.type !== this.allAccountTypes.MultiSubAccounts) {
|
||||
if (this.account.type !== this.allAccountTypes.MultiSubAccounts.type) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ export default {
|
||||
|
||||
let problemMessage = self.getInputEmptyProblemMessage(self.account, false);
|
||||
|
||||
if (!problemMessage && self.account.type === self.allAccountTypes.MultiSubAccounts) {
|
||||
if (!problemMessage && self.account.type === self.allAccountTypes.MultiSubAccounts.type) {
|
||||
for (let i = 0; i < self.subAccounts.length; i++) {
|
||||
problemMessage = self.getInputEmptyProblemMessage(self.subAccounts[i], true);
|
||||
|
||||
@@ -447,7 +447,7 @@ export default {
|
||||
this.showState = false;
|
||||
},
|
||||
isAccountSupportCreditCardStatementDate() {
|
||||
return this.account && this.account.category === accountConstants.creditCardCategoryType;
|
||||
return this.account && this.account.category === AccountCategory.CreditCard.type;
|
||||
},
|
||||
chooseSuitableIcon(oldCategory, newCategory) {
|
||||
setAccountSuitableIcon(this.account, oldCategory, newCategory);
|
||||
@@ -459,7 +459,7 @@ export default {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.account.type === this.allAccountTypes.MultiSubAccounts) {
|
||||
if (this.account.type === this.allAccountTypes.MultiSubAccounts.type) {
|
||||
for (let i = 0; i < this.subAccounts.length; i++) {
|
||||
const isSubAccountEmpty = !!this.getInputEmptyProblemMessage(this.subAccounts[i], true);
|
||||
|
||||
@@ -478,7 +478,7 @@ export default {
|
||||
return 'Account type cannot be blank';
|
||||
} else if (!account.name) {
|
||||
return 'Account name cannot be blank';
|
||||
} else if (account.type === this.allAccountTypes.SingleAccount && !account.currency) {
|
||||
} else if (account.type === this.allAccountTypes.SingleAccount.type && !account.currency) {
|
||||
return 'Account currency cannot be blank';
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -214,7 +214,8 @@ import { useOverviewStore } from '@/stores/overview.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import { getSystemTheme } from '@/lib/ui.js';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import { getSystemTheme } from '@/lib/ui/common.ts';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
@@ -239,7 +240,7 @@ export default {
|
||||
if (value !== this.settingsStore.appSettings.theme) {
|
||||
this.settingsStore.setTheme(value);
|
||||
|
||||
if (value === 'light' || value === 'dark') {
|
||||
if (value === ThemeType.Light || value === ThemeType.Dark) {
|
||||
this.globalTheme.global.name.value = value;
|
||||
} else {
|
||||
this.globalTheme.global.name.value = getSystemTheme();
|
||||
|
||||
@@ -200,12 +200,12 @@ import { useDisplay } from 'vuetify';
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import {
|
||||
isNoAvailableCategory,
|
||||
getAvailableCategoryCount
|
||||
} from '@/lib/category.js';
|
||||
import { getNavSideBarOuterHeight } from '@/lib/ui.desktop.js';
|
||||
import { getNavSideBarOuterHeight } from '@/lib/ui/desktop.js';
|
||||
|
||||
import {
|
||||
mdiRefresh,
|
||||
@@ -227,7 +227,7 @@ export default {
|
||||
const { mdAndUp } = useDisplay();
|
||||
|
||||
return {
|
||||
activeCategoryType: categoryConstants.allCategoryTypes.Expense,
|
||||
activeCategoryType: CategoryType.Expense,
|
||||
activeTab: 'categoryPage',
|
||||
primaryCategoryId: '0',
|
||||
loading: true,
|
||||
@@ -255,7 +255,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useTransactionCategoriesStore),
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
return CategoryType;
|
||||
},
|
||||
primaryCategories() {
|
||||
if (!this.transactionCategoriesStore.allTransactionCategories || !this.transactionCategoriesStore.allTransactionCategories[this.activeCategoryType]) {
|
||||
@@ -501,7 +501,7 @@ export default {
|
||||
|
||||
self.$nextTick(() => {
|
||||
if (self.$refs.navbar && self.$refs.navbar.$el && self.$refs.navbar.$el.nextElementSibling) {
|
||||
let navbarHeight = getNavSideBarOuterHeight(self.$refs.navbar.$el.nextElementSibling);
|
||||
const navbarHeight = getNavSideBarOuterHeight(self.$refs.navbar.$el.nextElementSibling);
|
||||
self.cardMinHeight = Math.max(navbarHeight, 680);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -97,10 +97,10 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { ALL_CATEGORY_ICONS } from '@/consts/icon.ts';
|
||||
import { ALL_CATEGORY_COLORS } from '@/consts/color.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
setCategoryModelByAnotherCategory,
|
||||
allVisiblePrimaryTransactionCategoriesByType
|
||||
@@ -153,10 +153,10 @@ export default {
|
||||
}
|
||||
},
|
||||
allCategoryIcons() {
|
||||
return iconConstants.allCategoryIcons;
|
||||
return ALL_CATEGORY_ICONS;
|
||||
},
|
||||
allCategoryColors() {
|
||||
return colorConstants.allCategoryColors;
|
||||
return ALL_CATEGORY_COLORS;
|
||||
},
|
||||
inputIsEmpty() {
|
||||
return !!this.inputEmptyProblemMessage;
|
||||
@@ -205,9 +205,9 @@ export default {
|
||||
|
||||
const categoryType = parseInt(options.type);
|
||||
|
||||
if (categoryType !== categoryConstants.allCategoryTypes.Income &&
|
||||
categoryType !== categoryConstants.allCategoryTypes.Expense &&
|
||||
categoryType !== categoryConstants.allCategoryTypes.Transfer) {
|
||||
if (categoryType !== CategoryType.Income &&
|
||||
categoryType !== CategoryType.Expense &&
|
||||
categoryType !== CategoryType.Transfer) {
|
||||
self.loading = false;
|
||||
self.showState = false;
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { categorizedArrayToPlainArray } from '@/lib/common.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { categorizedArrayToPlainArray } from '@/lib/common.ts';
|
||||
|
||||
import {
|
||||
mdiDotsVertical
|
||||
@@ -152,11 +152,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
|
||||
@@ -105,10 +105,10 @@
|
||||
</template>
|
||||
</v-list-item>
|
||||
|
||||
<v-divider v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])"/>
|
||||
<v-divider v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])"/>
|
||||
|
||||
<v-list rounded density="comfortable" class="pa-0 ml-4"
|
||||
v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
|
||||
v-if="(showHidden || !account.hidden) && account.type === allAccountTypes.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
|
||||
<template :key="subAccount.id"
|
||||
v-for="(subAccount, subIdx) in accountCategory.allSubAccounts[account.id]">
|
||||
<v-divider v-if="showHidden ? subIdx > 0 : (!subAccount.hidden ? subIdx > accountCategory.allFirstVisibleSubAccountIndexes[account.id] : false)"/>
|
||||
@@ -152,8 +152,8 @@ import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import { copyObjectTo } from '@/lib/common.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { copyObjectTo } from '@/lib/common.ts';
|
||||
import {
|
||||
getCategorizedAccountsWithVisibleCount,
|
||||
selectAccountOrSubAccounts,
|
||||
@@ -185,7 +185,7 @@ export default {
|
||||
data: function () {
|
||||
return {
|
||||
loading: true,
|
||||
expandAccountCategories: accountConstants.allCategories.map(category => category.id),
|
||||
expandAccountCategories: AccountCategory.values().map(category => category.type),
|
||||
filterAccountIds: {},
|
||||
showHidden: false,
|
||||
icons: {
|
||||
@@ -215,7 +215,7 @@ export default {
|
||||
}
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccountsMap);
|
||||
@@ -241,7 +241,7 @@ export default {
|
||||
|
||||
const allAccountIds = {};
|
||||
|
||||
for (let accountId in self.accountsStore.allAccountsMap) {
|
||||
for (const accountId in self.accountsStore.allAccountsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.accountsStore.allAccountsMap, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -260,7 +260,7 @@ export default {
|
||||
} else if (self.type === 'statisticsCurrent') {
|
||||
self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds);
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let accountId in self.transactionsStore.allFilterAccountIds) {
|
||||
for (const accountId in self.transactionsStore.allFilterAccountIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterAccountIds, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -292,7 +292,7 @@ export default {
|
||||
let finalAccountIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let accountId in self.filterAccountIds) {
|
||||
for (const accountId in self.filterAccountIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterAccountIds, accountId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -149,8 +149,8 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.ts';
|
||||
import {
|
||||
allTransactionCategoriesWithVisibleCount,
|
||||
hasAnyAvailableCategory,
|
||||
@@ -187,9 +187,9 @@ export default {
|
||||
return {
|
||||
loading: true,
|
||||
expandCategoryTypes: [
|
||||
categoryConstants.allCategoryTypes.Income.toString(),
|
||||
categoryConstants.allCategoryTypes.Expense.toString(),
|
||||
categoryConstants.allCategoryTypes.Transfer.toString()
|
||||
CategoryType.Income.toString(),
|
||||
CategoryType.Expense.toString(),
|
||||
CategoryType.Transfer.toString()
|
||||
],
|
||||
filterCategoryIds: {},
|
||||
showHidden: false,
|
||||
@@ -245,7 +245,7 @@ export default {
|
||||
|
||||
const allCategoryIds = {};
|
||||
|
||||
for (let categoryId in self.transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
for (const categoryId in self.transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionCategoriesStore.allTransactionCategoriesMap, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ export default {
|
||||
} else if (self.type === 'statisticsCurrent') {
|
||||
self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds);
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let categoryId in self.transactionsStore.allFilterCategoryIds) {
|
||||
for (const categoryId in self.transactionsStore.allFilterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ export default {
|
||||
let finalCategoryIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let categoryId in self.filterCategoryIds) {
|
||||
for (const categoryId in self.filterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -388,11 +388,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
|
||||
@@ -136,13 +136,13 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { TransactionTagFilterType } from '@/core/transaction.ts';
|
||||
|
||||
import {
|
||||
selectAll,
|
||||
selectNone,
|
||||
selectInvert
|
||||
} from '@/lib/common.js';
|
||||
} from '@/lib/common.ts';
|
||||
|
||||
import {
|
||||
mdiSelectAll,
|
||||
@@ -169,7 +169,7 @@ export default {
|
||||
loading: true,
|
||||
expandTagCategories: [ 'default' ],
|
||||
filterTagIds: {},
|
||||
tagFilterType: transactionConstants.defaultTransactionTagFilterType.type,
|
||||
tagFilterType: TransactionTagFilterType.Default.type,
|
||||
showHidden: false,
|
||||
icons: {
|
||||
selectAll: mdiSelectAll,
|
||||
@@ -218,7 +218,7 @@ export default {
|
||||
|
||||
const allTransactionTagIds = {};
|
||||
|
||||
for (let transactionTagId in self.transactionTagsStore.allTransactionTagsMap) {
|
||||
for (const transactionTagId in self.transactionTagsStore.allTransactionTagsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionTagsStore.allTransactionTagsMap, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -228,7 +228,7 @@ export default {
|
||||
}
|
||||
|
||||
if (self.type === 'statisticsCurrent') {
|
||||
let transactionTagIds = self.statisticsStore.transactionStatisticsFilter.tagIds ? self.statisticsStore.transactionStatisticsFilter.tagIds.split(',') : [];
|
||||
const transactionTagIds = self.statisticsStore.transactionStatisticsFilter.tagIds ? self.statisticsStore.transactionStatisticsFilter.tagIds.split(',') : [];
|
||||
|
||||
for (let i = 0; i < transactionTagIds.length; i++) {
|
||||
const transactionTagId = transactionTagIds[i];
|
||||
@@ -241,7 +241,7 @@ export default {
|
||||
self.filterTagIds = allTransactionTagIds;
|
||||
self.tagFilterType = self.statisticsStore.transactionStatisticsFilter.tagFilterType;
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let transactionTagId in self.transactionsStore.allFilterTagIds) {
|
||||
for (const transactionTagId in self.transactionsStore.allFilterTagIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterTagIds, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ export default {
|
||||
let finalTagIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let transactionTagId in self.filterTagIds) {
|
||||
for (const transactionTagId in self.filterTagIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterTagIds, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import {
|
||||
parseDateFromUnixTime,
|
||||
getMonthName
|
||||
} from '@/lib/datetime.js';
|
||||
import { getExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { getExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -109,7 +109,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
let amountGap = maxAmount - minAmount;
|
||||
const amountGap = maxAmount - minAmount;
|
||||
|
||||
return {
|
||||
tooltip: {
|
||||
@@ -274,12 +274,12 @@ export default {
|
||||
|
||||
if (clickData && e.seriesId === 'seriesIncome') {
|
||||
this.$emit('click', {
|
||||
transactionType: transactionConstants.allTransactionTypes.Income,
|
||||
transactionType: TransactionType.Income,
|
||||
monthStartTime: clickData.monthStartTime
|
||||
});
|
||||
} else if (clickData && e.seriesId === 'seriesExpense') {
|
||||
this.$emit('click', {
|
||||
transactionType: transactionConstants.allTransactionTypes.Expense,
|
||||
transactionType: TransactionType.Expense,
|
||||
monthStartTime: clickData.monthStartTime
|
||||
});
|
||||
}
|
||||
|
||||
@@ -325,12 +325,13 @@ import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import {
|
||||
isDefined,
|
||||
limitText,
|
||||
getNameByKeyValue,
|
||||
arrayItemToObjectField
|
||||
} from '@/lib/common.js'
|
||||
} from '@/lib/common.ts'
|
||||
import { formatPercent } from '@/lib/numeral.js';
|
||||
import {
|
||||
getYearAndMonthFromUnixTime,
|
||||
@@ -414,7 +415,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useSettingsStore, useUserStore, useAccountsStore, useTransactionCategoriesStore, useStatisticsStore),
|
||||
isDarkMode() {
|
||||
return this.globalTheme.global.name.value === 'dark';
|
||||
return this.globalTheme.global.name.value === ThemeType.Dark;
|
||||
},
|
||||
defaultCurrency() {
|
||||
return this.userStore.currentUserDefaultCurrency;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<v-card>
|
||||
<template #title>
|
||||
<div class="title-and-toolbar d-flex align-center">
|
||||
<span>{{ templateType === allTemplateTypes.Schedule ? $t('Scheduled Transactions') : $t('Transaction Templates') }}</span>
|
||||
<span>{{ templateType === allTemplateTypes.Schedule.type ? $t('Scheduled Transactions') : $t('Transaction Templates') }}</span>
|
||||
<v-btn class="ml-3" color="default" variant="outlined"
|
||||
:disabled="loading || updating" @click="add">{{ $t('Add') }}</v-btn>
|
||||
<v-btn class="ml-3" color="primary" variant="tonal"
|
||||
@@ -60,8 +60,8 @@
|
||||
|
||||
<tbody v-if="!loading && noAvailableTemplate">
|
||||
<tr>
|
||||
<td v-if="templateType === allTemplateTypes.Normal">{{ $t('No available template. Once you add templates, you can quickly add a new transaction using the dropdown menu of the Add button on the transaction list page') }}</td>
|
||||
<td v-else-if="templateType === allTemplateTypes.Schedule">{{ $t('No available scheduled transactions') }}</td>
|
||||
<td v-if="templateType === allTemplateTypes.Normal.type">{{ $t('No available template. Once you add templates, you can quickly add a new transaction using the dropdown menu of the Add button on the transaction list page') }}</td>
|
||||
<td v-else-if="templateType === allTemplateTypes.Schedule.type">{{ $t('No available scheduled transactions') }}</td>
|
||||
<td v-else>{{ $t('No available template') }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -81,9 +81,9 @@
|
||||
<v-badge class="right-bottom-icon" color="secondary"
|
||||
location="bottom right" offset-x="8" :icon="icons.hide"
|
||||
v-if="element.hidden">
|
||||
<v-icon size="20" start :icon="templateType === allTemplateTypes.Schedule ? icons.clock : icons.text"/>
|
||||
<v-icon size="20" start :icon="templateType === allTemplateTypes.Schedule.type ? icons.clock : icons.text"/>
|
||||
</v-badge>
|
||||
<v-icon size="20" start :icon="templateType === allTemplateTypes.Schedule ? icons.clock : icons.text" v-else-if="!element.hidden"/>
|
||||
<v-icon size="20" start :icon="templateType === allTemplateTypes.Schedule.type ? icons.clock : icons.text" v-else-if="!element.hidden"/>
|
||||
<span class="transaction-template-name">{{ element.name }}</span>
|
||||
</div>
|
||||
|
||||
@@ -151,7 +151,7 @@ import EditDialog from '@/views/desktop/transactions/list/dialogs/EditDialog.vue
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import { TemplateType } from '@/core/template.ts';
|
||||
import {
|
||||
isNoAvailableTemplate,
|
||||
getAvailableTemplateCount
|
||||
@@ -181,7 +181,7 @@ export default {
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
templateType: templateConstants.allTemplateTypes.Normal,
|
||||
templateType: TemplateType.Normal.type,
|
||||
loading: true,
|
||||
updating: false,
|
||||
templateHiding: {},
|
||||
@@ -216,7 +216,7 @@ export default {
|
||||
return getAvailableTemplateCount(this.templates, this.showHidden);
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
return TemplateType.all();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -413,12 +413,12 @@
|
||||
|
||||
<v-divider v-if="query.tagIds && query.tagIds !== 'none'" />
|
||||
|
||||
<template :key="filterType.type"
|
||||
v-for="filterType in allTransactionTagFilterTypes"
|
||||
v-if="query.tagIds && query.tagIds !== 'none'">
|
||||
<template v-if="query.tagIds && query.tagIds !== 'none'">
|
||||
<v-list-item class="text-sm" density="compact"
|
||||
:key="filterType.type"
|
||||
:value="filterType.type"
|
||||
:append-icon="(query.tagFilterType === filterType.type ? icons.check : null)">
|
||||
:append-icon="(query.tagFilterType === filterType.type ? icons.check : null)"
|
||||
v-for="filterType in allTransactionTagFilterTypes">
|
||||
<v-list-item-title class="cursor-pointer"
|
||||
@click="changeTagFilterType(filterType.type)">
|
||||
<div class="d-flex align-center">
|
||||
@@ -595,12 +595,12 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
|
||||
import { AccountType } from '@/core/account.ts';
|
||||
import { TransactionType, TransactionTagFilterType } from '@/core/transaction.ts';
|
||||
import { TemplateType } from '@/core/template.ts';
|
||||
import numeralConstants from '@/consts/numeral.js';
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import { isString, isNumber, getNameByKeyValue } from '@/lib/common.js';
|
||||
import { isString, isNumber, getNameByKeyValue } from '@/lib/common.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import {
|
||||
getCurrentUnixTime,
|
||||
@@ -629,8 +629,8 @@ import {
|
||||
} from '@/lib/category.js';
|
||||
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
||||
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
|
||||
import { isDataImportingEnabled } from '@/lib/server_settings.js';
|
||||
import { scrollToSelectedItem } from '@/lib/ui.desktop.js';
|
||||
import { isDataImportingEnabled } from '@/lib/server_settings.ts';
|
||||
import { scrollToSelectedItem } from '@/lib/ui/desktop.js';
|
||||
|
||||
import {
|
||||
mdiMagnify,
|
||||
@@ -729,7 +729,7 @@ export default {
|
||||
if (this.query.accountIds && this.queryAllFilterAccountIdsCount === 1) {
|
||||
const account = this.allAccounts[this.query.accountIds];
|
||||
|
||||
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
|
||||
if (account && account.type === AccountType.MultiSubAccounts.type) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -980,16 +980,16 @@ export default {
|
||||
return numeralConstants.allAmountFilterTypeArray;
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return transactionConstants.allTransactionTypes;
|
||||
return TransactionType;
|
||||
},
|
||||
allTransactionTagFilterTypes() {
|
||||
const allTagFilterTypes = this.$locale.getAllTransactionTagFilterTypes();
|
||||
const allTagFilterTypesWithIcon = [];
|
||||
const tagFilterIconMap = {
|
||||
[transactionConstants.allTransactionTagFilterTypes.HasAny.type]: this.icons.withAnyTags,
|
||||
[transactionConstants.allTransactionTagFilterTypes.HasAll.type]: this.icons.withAllTags,
|
||||
[transactionConstants.allTransactionTagFilterTypes.NotHasAny.type]: this.icons.withoutAnyTags,
|
||||
[transactionConstants.allTransactionTagFilterTypes.NotHasAll.type]: this.icons.withoutAllTags
|
||||
[TransactionTagFilterType.HasAny.type]: this.icons.withAnyTags,
|
||||
[TransactionTagFilterType.HasAll.type]: this.icons.withAllTags,
|
||||
[TransactionTagFilterType.NotHasAny.type]: this.icons.withoutAnyTags,
|
||||
[TransactionTagFilterType.NotHasAll.type]: this.icons.withoutAllTags
|
||||
};
|
||||
|
||||
for (let i = 0; i < allTagFilterTypes.length; i++) {
|
||||
@@ -1055,7 +1055,7 @@ export default {
|
||||
},
|
||||
allTransactionTemplates() {
|
||||
const allVisibleTemplates = this.transactionTemplatesStore.allVisibleTemplates;
|
||||
return allVisibleTemplates[templateConstants.allTemplateTypes.Normal] || [];
|
||||
return allVisibleTemplates[TemplateType.Normal.type] || [];
|
||||
},
|
||||
recentMonthDateRanges() {
|
||||
return this.$locale.getAllRecentMonthDateRanges(this.userStore, true, true);
|
||||
@@ -1147,7 +1147,7 @@ export default {
|
||||
this.reload(false);
|
||||
|
||||
this.transactionTemplatesStore.loadAllTemplates({
|
||||
templateType: templateConstants.allTemplateTypes.Normal,
|
||||
templateType: TemplateType.Normal.type,
|
||||
force: false
|
||||
});
|
||||
},
|
||||
@@ -1312,7 +1312,7 @@ export default {
|
||||
if (type && this.query.categoryIds) {
|
||||
newCategoryFilter = '';
|
||||
|
||||
for (let categoryId in this.queryAllFilterCategoryIds) {
|
||||
for (const categoryId in this.queryAllFilterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.queryAllFilterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -179,10 +179,10 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import {
|
||||
getNameByKeyValue
|
||||
} from '@/lib/common.js';
|
||||
} from '@/lib/common.ts';
|
||||
import {
|
||||
getTransactionPrimaryCategoryName,
|
||||
getTransactionSecondaryCategoryName,
|
||||
@@ -219,7 +219,7 @@ export default {
|
||||
return this.userStore.currentUserDefaultCurrency;
|
||||
},
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
return CategoryType;
|
||||
},
|
||||
allAccounts() {
|
||||
return this.accountsStore.allPlainAccounts;
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
v-model="transaction.time"
|
||||
@error="showDateTimeError" />
|
||||
</v-col>
|
||||
<v-col cols="12" md="6" v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule">
|
||||
<v-col cols="12" md="6" v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule.type">
|
||||
<schedule-frequency-select
|
||||
:readonly="mode === 'view'"
|
||||
:disabled="loading || submitting"
|
||||
@@ -208,7 +208,7 @@
|
||||
v-model:type="transaction.scheduledFrequencyType"
|
||||
v-model="transaction.scheduledFrequency" />
|
||||
</v-col>
|
||||
<v-col cols="12" md="6" v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule)">
|
||||
<v-col cols="12" md="6" v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule.type)">
|
||||
<v-autocomplete
|
||||
class="transaction-edit-timezone"
|
||||
item-title="displayNameWithUtcOffset"
|
||||
@@ -400,22 +400,23 @@ import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import fileConstants from '@/consts/file.js';
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import apiConstants from '@/consts/api.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { TransactionType, TransactionEditScopeType } from '@/core/transaction.ts';
|
||||
import { TemplateType, ScheduledTemplateFrequencyType } from '@/core/template.ts';
|
||||
import { TRANSACTION_MAX_PICTURE_COUNT } from '@/consts/transaction.ts';
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import { SUPPORTED_IMAGE_EXTENSIONS } from '@/consts/file.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import {
|
||||
isArray,
|
||||
getNameByKeyValue
|
||||
} from '@/lib/common.js';
|
||||
} from '@/lib/common.ts';
|
||||
import {
|
||||
getUtcOffsetByUtcOffsetMinutes,
|
||||
getTimezoneOffsetMinutes,
|
||||
getCurrentUnixTime
|
||||
} from '@/lib/datetime.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
getTransactionPrimaryCategoryName,
|
||||
getTransactionSecondaryCategoryName,
|
||||
@@ -425,7 +426,7 @@ import { setTransactionModelByTransaction } from '@/lib/transaction.js';
|
||||
import {
|
||||
isTransactionPicturesEnabled,
|
||||
getMapProvider
|
||||
} from '@/lib/server_settings.js';
|
||||
} from '@/lib/server_settings.ts';
|
||||
|
||||
import {
|
||||
mdiDotsVertical,
|
||||
@@ -496,13 +497,13 @@ export default {
|
||||
} else {
|
||||
return 'Transaction Detail';
|
||||
}
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Normal) {
|
||||
} else if (this.type === 'template' && this.transaction.templateType === TemplateType.Normal.type) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Transaction Template';
|
||||
} else if (this.mode === 'edit') {
|
||||
return 'Edit Transaction Template';
|
||||
}
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
} else if (this.type === 'template' && this.transaction.templateType === TemplateType.Schedule.type) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Scheduled Transaction';
|
||||
} else if (this.mode === 'edit') {
|
||||
@@ -571,13 +572,13 @@ export default {
|
||||
return this.userStore.currentUserDefaultAccountId;
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return transactionConstants.allTransactionTypes;
|
||||
return TransactionType;
|
||||
},
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
return CategoryType;
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
return TemplateType.all();
|
||||
},
|
||||
allTimezones() {
|
||||
return this.$locale.getAllTimezones(true);
|
||||
@@ -607,7 +608,7 @@ export default {
|
||||
return this.transactionTagsStore.allTransactionTagsMap;
|
||||
},
|
||||
supportedImageExtensions() {
|
||||
return fileConstants.supportedImageExtensions;
|
||||
return SUPPORTED_IMAGE_EXTENSIONS;
|
||||
},
|
||||
hasAvailableExpenseCategories() {
|
||||
if (!this.allCategories || !this.allCategories[this.allCategoryTypes.Expense] || !this.allCategories[this.allCategoryTypes.Expense].length) {
|
||||
@@ -702,7 +703,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !isArray(this.transaction.pictures) || this.transaction.pictures.length < transactionConstants.maxPictureCount;
|
||||
return !isArray(this.transaction.pictures) || this.transaction.pictures.length < TRANSACTION_MAX_PICTURE_COUNT;
|
||||
},
|
||||
mapProvider() {
|
||||
return getMapProvider();
|
||||
@@ -839,8 +840,8 @@ export default {
|
||||
self.transaction.templateType = options.templateType;
|
||||
}
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = templateConstants.allTemplateScheduledFrequencyTypes.Disabled.type;
|
||||
if (self.transaction.templateType === TemplateType.Schedule.type) {
|
||||
self.transaction.scheduledFrequencyType = ScheduledTemplateFrequencyType.Disabled.type;
|
||||
self.transaction.scheduledFrequency = '';
|
||||
}
|
||||
|
||||
@@ -850,7 +851,7 @@ export default {
|
||||
self.transaction.templateType = options.currentTemplate.templateType;
|
||||
self.transaction.name = options.currentTemplate.name;
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
if (self.transaction.templateType === TemplateType.Schedule.type) {
|
||||
self.transaction.scheduledFrequencyType = options.currentTemplate.scheduledFrequencyType;
|
||||
self.transaction.scheduledFrequency = options.currentTemplate.scheduledFrequency;
|
||||
self.transaction.utcOffset = options.currentTemplate.utcOffset;
|
||||
@@ -903,7 +904,7 @@ export default {
|
||||
self.transaction.templateType = template.templateType;
|
||||
self.transaction.name = template.name;
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
if (self.transaction.templateType === TemplateType.Schedule.type) {
|
||||
self.transaction.scheduledFrequencyType = template.scheduledFrequencyType;
|
||||
self.transaction.scheduledFrequency = template.scheduledFrequency;
|
||||
self.transaction.utcOffset = template.utcOffset;
|
||||
@@ -974,12 +975,12 @@ export default {
|
||||
}).catch(error => {
|
||||
self.submitting = false;
|
||||
|
||||
if (error.error && (error.error.errorCode === apiConstants.transactionCannotCreateInThisTimeErrorCode || error.error.errorCode === apiConstants.transactionCannotModifyInThisTimeErrorCode)) {
|
||||
if (error.error && (error.error.errorCode === KnownErrorCode.TransactionCannotCreateInThisTime || error.error.errorCode === KnownErrorCode.TransactionCannotModifyInThisTime)) {
|
||||
self.$refs.confirmDialog.open('You have set this time range to prevent editing transactions. Would you like to change the editable transaction range to All?').then(() => {
|
||||
self.submitting = true;
|
||||
|
||||
self.userStore.updateUserTransactionEditScope({
|
||||
transactionEditScope: transactionConstants.allTransactionEditScopeTypes.All.type
|
||||
transactionEditScope: TransactionEditScopeType.All.type
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
|
||||
@@ -1272,7 +1273,7 @@ export default {
|
||||
self.removingPictureId = '';
|
||||
self.submitting = false;
|
||||
}).catch(error => {
|
||||
if (error.error && error.error.errorCode === apiConstants.transactionPictureNotFoundErrorCode) {
|
||||
if (error.error && error.error.errorCode === KnownErrorCode.TransactionPictureNotFound) {
|
||||
for (let i = 0; i < self.transaction.pictures.length; i++) {
|
||||
if (self.transaction.pictures[i].pictureId === pictureInfo.pictureId) {
|
||||
self.transaction.pictures.splice(i, 1);
|
||||
|
||||
@@ -606,16 +606,16 @@ import { useOverviewStore } from '@/stores/overview.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import {
|
||||
isString,
|
||||
isNumber,
|
||||
getNameByKeyValue,
|
||||
objectFieldToArrayItem
|
||||
} from '@/lib/common.js';
|
||||
import { isFileExtensionSupported } from '@/lib/file.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
} from '@/lib/common.ts';
|
||||
import { isFileExtensionSupported } from '@/lib/file.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import {
|
||||
parseDateFromUnixTime,
|
||||
@@ -736,10 +736,10 @@ export default {
|
||||
return getNameByKeyValue(this.allSupportedImportFileTypes, this.fileType, 'type', 'subTypes');
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return transactionConstants.allTransactionTypes;
|
||||
return TransactionType;
|
||||
},
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
return CategoryType;
|
||||
},
|
||||
allAccounts() {
|
||||
return this.accountsStore.allPlainAccounts;
|
||||
@@ -1635,7 +1635,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
for (let name in invalidCategoryNames) {
|
||||
for (const name in invalidCategoryNames) {
|
||||
if (!Object.prototype.hasOwnProperty.call(invalidCategoryNames, name)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1666,7 +1666,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
for (let name in invalidAccountNames) {
|
||||
for (const name in invalidAccountNames) {
|
||||
if (!Object.prototype.hasOwnProperty.call(invalidAccountNames, name)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1700,7 +1700,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
for (let name in invalidTagNames) {
|
||||
for (const name in invalidTagNames) {
|
||||
if (!Object.prototype.hasOwnProperty.call(invalidTagNames, name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -338,12 +338,12 @@ import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useOverviewStore } from '@/stores/overview.js';
|
||||
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import fileConstants from '@/consts/file.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { SUPPORTED_IMAGE_EXTENSIONS } from '@/consts/file.ts';
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import { getCategorizedAccounts } from '@/lib/account.js';
|
||||
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
import {
|
||||
mdiAccount,
|
||||
@@ -460,7 +460,7 @@ export default {
|
||||
return this.$locale.getAllTransactionEditScopeTypes();
|
||||
},
|
||||
supportedImageExtensions() {
|
||||
return fileConstants.supportedImageExtensions;
|
||||
return SUPPORTED_IMAGE_EXTENSIONS;
|
||||
},
|
||||
currentUserAvatar() {
|
||||
return this.userStore.getUserAvatarUrl(this.oldProfile, this.avatarNoCacheId);
|
||||
|
||||
@@ -162,9 +162,9 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import { isEquals } from '@/lib/common.js';
|
||||
import { isDataExportingEnabled } from '@/lib/server_settings.js';
|
||||
import { startDownloadFile } from '@/lib/ui.js';
|
||||
import { isEquals } from '@/lib/common.ts';
|
||||
import { isDataExportingEnabled } from '@/lib/server_settings.ts';
|
||||
import { startDownloadFile } from '@/lib/ui/common.ts';
|
||||
|
||||
import {
|
||||
mdiRefresh,
|
||||
|
||||
@@ -135,8 +135,8 @@ import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useTokensStore } from '@/stores/token.js';
|
||||
|
||||
import { isEquals } from '@/lib/common.js';
|
||||
import { parseSessionInfo } from '@/lib/misc.js';
|
||||
import { isEquals } from '@/lib/common.ts';
|
||||
import { parseSessionInfo } from '@/lib/session.ts';
|
||||
|
||||
import {
|
||||
mdiRefresh,
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTwoFactorAuthStore } from '@/stores/twoFactorAuth.js';
|
||||
|
||||
import { makeButtonCopyToClipboard, changeClipboardObjectText } from '@/lib/misc.js';
|
||||
import { ClipboardHolder } from '@/lib/clipboard.ts';
|
||||
|
||||
import {
|
||||
mdiContentCopy
|
||||
@@ -157,7 +157,7 @@ export default {
|
||||
watch: {
|
||||
'currentBackupCode': function (newValue) {
|
||||
if (this.clipboardHolder) {
|
||||
changeClipboardObjectText(this.clipboardHolder, newValue);
|
||||
this.clipboardHolder.setClipboardText(newValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -319,7 +319,7 @@ export default {
|
||||
}
|
||||
|
||||
if (self.$refs.copyToClipboardIcon) {
|
||||
self.clipboardHolder = makeButtonCopyToClipboard({
|
||||
self.clipboardHolder = ClipboardHolder.create({
|
||||
el: '#copy-to-clipboard-icon',
|
||||
text: self.currentBackupCode,
|
||||
successCallback: function () {
|
||||
|
||||
@@ -62,9 +62,9 @@ import { mapStores } from 'pinia';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import { getMapProvider } from '@/lib/server_settings.js';
|
||||
import { getMapProvider } from '@/lib/server_settings.ts';
|
||||
import { getMapWebsite } from '@/lib/map/index.js';
|
||||
import licenses from '@/lib/licenses.js';
|
||||
import { getLicense, getThirdPartyLicenses } from '@/lib/licenses.ts';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
@@ -90,10 +90,10 @@ export default {
|
||||
return getMapWebsite();
|
||||
},
|
||||
licenseLines() {
|
||||
return licenses.getLicense().replaceAll(/\r/g, '').split('\n');
|
||||
return getLicense().replaceAll(/\r/g, '').split('\n');
|
||||
},
|
||||
thirdPartyLicenses() {
|
||||
return licenses.getThirdPartyLicenses();
|
||||
return getThirdPartyLicenses();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { TRANSACTION_MIN_AMOUNT, TRANSACTION_MAX_AMOUNT } from '@/consts/transaction.ts';
|
||||
import { getConvertedAmount } from '@/lib/numeral.js';
|
||||
|
||||
export default {
|
||||
@@ -136,10 +136,10 @@ export default {
|
||||
}
|
||||
},
|
||||
allowedMinAmount() {
|
||||
return transactionConstants.minAmountNumber;
|
||||
return TRANSACTION_MIN_AMOUNT;
|
||||
},
|
||||
allowedMaxAmount() {
|
||||
return transactionConstants.maxAmountNumber;
|
||||
return TRANSACTION_MAX_AMOUNT;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -208,7 +208,7 @@ import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
import { useOverviewStore } from '@/stores/overview.js';
|
||||
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import { TemplateType } from '@/core/template.ts';
|
||||
import { formatUnixTime } from '@/lib/datetime.js';
|
||||
|
||||
export default {
|
||||
@@ -236,7 +236,7 @@ export default {
|
||||
},
|
||||
allTransactionTemplates() {
|
||||
const allTemplates = this.transactionTemplatesStore.allVisibleTemplates;
|
||||
return allTemplates[templateConstants.allTemplateTypes.Normal] || [];
|
||||
return allTemplates[TemplateType.Normal.type] || [];
|
||||
},
|
||||
allDateRanges() {
|
||||
return datetimeConstants.allDateRanges;
|
||||
@@ -285,7 +285,7 @@ export default {
|
||||
});
|
||||
|
||||
self.transactionTemplatesStore.loadAllTemplates({
|
||||
templateType: templateConstants.allTemplateTypes.Normal,
|
||||
templateType: TemplateType.Normal.type,
|
||||
force: false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -187,17 +187,17 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import apiConstants from '@/consts/api.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import {
|
||||
isUserRegistrationEnabled,
|
||||
isUserForgetPasswordEnabled,
|
||||
isUserVerifyEmailEnabled,
|
||||
getLoginPageTips
|
||||
} from '@/lib/server_settings.js';
|
||||
import { getDesktopVersionPath } from '@/lib/version.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { isModalShowing } from '@/lib/ui.mobile.js';
|
||||
} from '@/lib/server_settings.ts';
|
||||
import { getDesktopVersionPath } from '@/lib/version.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
import { isModalShowing } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -227,7 +227,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore, useExchangeRatesStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
@@ -333,7 +333,7 @@ export default {
|
||||
self.logining = false;
|
||||
self.$hideLoading();
|
||||
|
||||
if (self.isUserVerifyEmailEnabled && error.error && error.error.errorCode === apiConstants.userEmailNotVerifiedErrorCode && error.error.context && error.error.context.email) {
|
||||
if (self.isUserVerifyEmailEnabled && error.error && error.error.errorCode === KnownErrorCode.UserEmailNotVerified && error.error.context && error.error.context.email) {
|
||||
self.resendVerifyEmail = error.error.context.email;
|
||||
self.hasValidEmailVerifyToken = error.error.context.hasValidEmailVerifyToken || false;
|
||||
self.currentPasswordForResendVerifyEmail = '';
|
||||
|
||||
@@ -80,9 +80,9 @@ import { useOverviewStore } from '@/stores/overview.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import { getDesktopVersionPath } from '@/lib/version.js';
|
||||
import { isUserScheduledTransactionEnabled } from '@/lib/server_settings.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { getDesktopVersionPath } from '@/lib/version.ts';
|
||||
import { isUserScheduledTransactionEnabled } from '@/lib/server_settings.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
|
||||
@@ -182,9 +182,9 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { getNameByKeyValue, categorizedArrayToPlainArray } from '@/lib/common.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { getNameByKeyValue, categorizedArrayToPlainArray } from '@/lib/common.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -287,7 +287,7 @@ export default {
|
||||
const self = this;
|
||||
const router = self.f7router;
|
||||
|
||||
let problemMessage = self.inputEmptyProblemMessage || self.inputInvalidProblemMessage;
|
||||
const problemMessage = self.inputEmptyProblemMessage || self.inputInvalidProblemMessage;
|
||||
|
||||
if (problemMessage) {
|
||||
self.$alert(problemMessage);
|
||||
@@ -362,11 +362,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
|
||||
@@ -73,11 +73,11 @@ import { useTokensStore } from '@/stores/token.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import assetConstants from '@/consts/asset.js';
|
||||
import { APPLICATION_LOGO_PATH } from '@/consts/asset.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import webauthn from '@/lib/webauthn.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { isModalShowing } from '@/lib/ui.mobile.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
import { isModalShowing } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useRootStore, useSettingsStore, useUserStore, useTokensStore, useTransactionsStore, useExchangeRatesStore),
|
||||
ezBookkeepingLogoPath() {
|
||||
return assetConstants.ezBookkeepingLogoPath;
|
||||
return APPLICATION_LOGO_PATH;
|
||||
},
|
||||
version() {
|
||||
return 'v' + this.$version;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
|
||||
<f7-nav-title :title="$t(title)"></f7-nav-title>
|
||||
<f7-nav-right>
|
||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': editAccountId || account.type !== allAccountTypes.MultiSubAccounts }" @click="showMoreActionSheet = true"></f7-link>
|
||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': editAccountId || account.type !== allAccountTypes.MultiSubAccounts.type }" @click="showMoreActionSheet = true"></f7-link>
|
||||
<f7-link :class="{ 'disabled': isInputEmpty() || submitting }" :text="$t(saveButtonTitle)" @click="save"></f7-link>
|
||||
</f7-nav-right>
|
||||
</f7-navbar>
|
||||
@@ -23,7 +23,7 @@
|
||||
@click="showAccountCategorySheet = true"
|
||||
>
|
||||
<list-item-selection-sheet value-type="item"
|
||||
key-field="id" value-field="id" title-field="displayName"
|
||||
key-field="type" value-field="type" title-field="displayName"
|
||||
icon-field="defaultAccountIconId" icon-type="account"
|
||||
:items="allAccountCategories"
|
||||
v-model:show="showAccountCategorySheet"
|
||||
@@ -40,7 +40,7 @@
|
||||
@click="showAccountTypeSheet = true"
|
||||
>
|
||||
<list-item-selection-sheet value-type="item"
|
||||
key-field="id" value-field="id" title-field="displayName"
|
||||
key-field="type" value-field="type" title-field="displayName"
|
||||
:items="allAccountTypesArray"
|
||||
v-model:show="showAccountTypeSheet"
|
||||
v-model="account.type">
|
||||
@@ -94,7 +94,7 @@
|
||||
<f7-list-input label="Description" type="textarea" placeholder="Your account description (optional)"></f7-list-input>
|
||||
</f7-list>
|
||||
|
||||
<f7-list form strong inset dividers class="margin-vertical" v-else-if="!loading && account.type === allAccountTypes.SingleAccount">
|
||||
<f7-list form strong inset dividers class="margin-vertical" v-else-if="!loading && account.type === allAccountTypes.SingleAccount.type">
|
||||
<f7-list-input
|
||||
type="text"
|
||||
clear-button
|
||||
@@ -237,7 +237,7 @@
|
||||
></f7-list-input>
|
||||
</f7-list>
|
||||
|
||||
<f7-list form strong inset dividers class="margin-vertical" v-else-if="!loading && account.type === allAccountTypes.MultiSubAccounts">
|
||||
<f7-list form strong inset dividers class="margin-vertical" v-else-if="!loading && account.type === allAccountTypes.MultiSubAccounts.type">
|
||||
<f7-list-input
|
||||
type="text"
|
||||
clear-button
|
||||
@@ -324,7 +324,7 @@
|
||||
></f7-list-input>
|
||||
</f7-list>
|
||||
|
||||
<f7-block class="no-padding no-margin" v-if="!loading && account.type === allAccountTypes.MultiSubAccounts">
|
||||
<f7-block class="no-padding no-margin" v-if="!loading && account.type === allAccountTypes.MultiSubAccounts.type">
|
||||
<f7-list strong inset dividers class="subaccount-edit-list margin-vertical"
|
||||
:key="idx"
|
||||
v-for="(subAccount, idx) in subAccounts">
|
||||
@@ -493,12 +493,12 @@ import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useAccountsStore } from '@/stores/account.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { ALL_ACCOUNT_ICONS } from '@/consts/icon.ts';
|
||||
import { ALL_ACCOUNT_COLORS } from '@/consts/color.ts';
|
||||
import { TRANSACTION_MIN_AMOUNT, TRANSACTION_MAX_AMOUNT } from '@/consts/transaction.ts';
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
setAccountModelByAnotherAccount,
|
||||
setAccountSuitableIcon
|
||||
@@ -555,7 +555,7 @@ export default {
|
||||
}
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allAccountCategories() {
|
||||
return this.$locale.getAllAccountCategories();
|
||||
@@ -564,10 +564,10 @@ export default {
|
||||
return this.$locale.getAllAccountTypes();
|
||||
},
|
||||
allAccountIcons() {
|
||||
return iconConstants.allAccountIcons;
|
||||
return ALL_ACCOUNT_ICONS;
|
||||
},
|
||||
allAccountColors() {
|
||||
return colorConstants.allAccountColors;
|
||||
return ALL_ACCOUNT_COLORS;
|
||||
},
|
||||
allCurrencies() {
|
||||
return this.$locale.getAllCurrencies();
|
||||
@@ -590,10 +590,10 @@ export default {
|
||||
return allAvailableDays;
|
||||
},
|
||||
allowedMinAmount() {
|
||||
return transactionConstants.minAmountNumber;
|
||||
return TRANSACTION_MIN_AMOUNT;
|
||||
},
|
||||
allowedMaxAmount() {
|
||||
return transactionConstants.maxAmountNumber;
|
||||
return TRANSACTION_MAX_AMOUNT;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -654,7 +654,7 @@ export default {
|
||||
this.$routeBackOnError(this.f7router, 'loadingError');
|
||||
},
|
||||
addSubAccount() {
|
||||
if (this.account.type !== this.allAccountTypes.MultiSubAccounts) {
|
||||
if (this.account.type !== this.allAccountTypes.MultiSubAccounts.type) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ export default {
|
||||
|
||||
let problemMessage = self.getInputEmptyProblemMessage(self.account, false);
|
||||
|
||||
if (!problemMessage && self.account.type === self.allAccountTypes.MultiSubAccounts) {
|
||||
if (!problemMessage && self.account.type === self.allAccountTypes.MultiSubAccounts.type) {
|
||||
for (let i = 0; i < self.subAccounts.length; i++) {
|
||||
problemMessage = self.getInputEmptyProblemMessage(self.subAccounts[i], true);
|
||||
|
||||
@@ -745,10 +745,10 @@ export default {
|
||||
return this.$locale.getCurrencyName(currencyCode);
|
||||
},
|
||||
getAccountTypeName(accountType) {
|
||||
return getNameByKeyValue(this.allAccountTypesArray, accountType, 'id', 'displayName');
|
||||
return getNameByKeyValue(this.allAccountTypesArray, accountType, 'type', 'displayName');
|
||||
},
|
||||
getAccountCategoryName(accountCategory) {
|
||||
return getNameByKeyValue(this.allAccountCategories, accountCategory, 'id', 'displayName');
|
||||
return getNameByKeyValue(this.allAccountCategories, accountCategory, 'type', 'displayName');
|
||||
},
|
||||
getAccountCreditCardStatementDate(statementDate) {
|
||||
return getNameByKeyValue(this.allAvailableMonthDays, statementDate, 'day', 'displayName');
|
||||
@@ -766,7 +766,7 @@ export default {
|
||||
return this.$locale.formatAmountWithCurrency(this.settingsStore, this.userStore, value, currencyCode);
|
||||
},
|
||||
isAccountSupportCreditCardStatementDate() {
|
||||
return this.account && this.account.category === accountConstants.creditCardCategoryType;
|
||||
return this.account && this.account.category === AccountCategory.CreditCard.type;
|
||||
},
|
||||
chooseSuitableIcon(oldCategory, newCategory) {
|
||||
setAccountSuitableIcon(this.account, oldCategory, newCategory);
|
||||
@@ -778,7 +778,7 @@ export default {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.account.type === this.allAccountTypes.MultiSubAccounts) {
|
||||
if (this.account.type === this.allAccountTypes.MultiSubAccounts.type) {
|
||||
for (let i = 0; i < this.subAccounts.length; i++) {
|
||||
const isSubAccountEmpty = !!this.getInputEmptyProblemMessage(this.subAccounts[i], true);
|
||||
|
||||
@@ -797,7 +797,7 @@ export default {
|
||||
return 'Account type cannot be blank';
|
||||
} else if (!account.name) {
|
||||
return 'Account name cannot be blank';
|
||||
} else if (account.type === this.allAccountTypes.SingleAccount && !account.currency) {
|
||||
} else if (account.type === this.allAccountTypes.SingleAccount.type && !account.currency) {
|
||||
return 'Account currency cannot be blank';
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -38,8 +38,9 @@
|
||||
</f7-card-header>
|
||||
</f7-card>
|
||||
|
||||
<div class="skeleton-text" :key="listIdx" v-for="listIdx in [ 1, 2, 3 ]" v-if="loading">
|
||||
<f7-list strong inset dividers sortable class="list-has-group-title account-list margin-vertical">
|
||||
<div class="skeleton-text" v-if="loading">
|
||||
<f7-list strong inset dividers sortable class="list-has-group-title account-list margin-vertical"
|
||||
:key="listIdx" v-for="listIdx in [ 1, 2, 3 ]">
|
||||
<f7-list-item group-title :sortable="false">
|
||||
<small>
|
||||
<span>Account Category</span>
|
||||
@@ -66,12 +67,12 @@
|
||||
<f7-list-item :title="$t('No available account')"></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
<div :key="accountCategory.id"
|
||||
<div :key="accountCategory.type"
|
||||
v-for="accountCategory in allAccountCategories"
|
||||
v-show="(showHidden && hasAccount(accountCategory, false)) || hasAccount(accountCategory, true)">
|
||||
<f7-list strong inset dividers sortable class="list-has-group-title account-list margin-vertical"
|
||||
:sortable-enabled="sortable"
|
||||
v-if="allCategorizedAccountsMap[accountCategory.id]"
|
||||
v-if="allCategorizedAccountsMap[accountCategory.type]"
|
||||
@sortable:sort="onSort">
|
||||
<f7-list-item group-title :sortable="false">
|
||||
<small>
|
||||
@@ -82,15 +83,15 @@
|
||||
<f7-list-item swipeout
|
||||
class="nested-list-item"
|
||||
:id="getAccountDomId(account)"
|
||||
:class="{ 'has-child-list-item': account.type === allAccountTypes.MultiSubAccounts && hasVisibleSubAccount(account), 'actual-first-child': account.id === firstShowingIds.accounts[accountCategory.id], 'actual-last-child': account.id === lastShowingIds.accounts[accountCategory.id] }"
|
||||
:class="{ 'has-child-list-item': account.type === allAccountTypes.MultiSubAccounts.type && hasVisibleSubAccount(account), 'actual-first-child': account.id === firstShowingIds.accounts[accountCategory.type], 'actual-last-child': account.id === lastShowingIds.accounts[accountCategory.type] }"
|
||||
:after="accountBalance(account)"
|
||||
:link="!sortable ? '/transaction/list?accountIds=' + account.id : null"
|
||||
:key="account.id"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.id].accounts"
|
||||
v-for="account in allCategorizedAccountsMap[accountCategory.type].accounts"
|
||||
v-show="showHidden || !account.hidden"
|
||||
@taphold="setSortable()"
|
||||
>
|
||||
<template #media v-if="account.type !== allAccountTypes.MultiSubAccounts || !hasVisibleSubAccount(account)">
|
||||
<template #media v-if="account.type !== allAccountTypes.MultiSubAccounts.type || !hasVisibleSubAccount(account)">
|
||||
<ItemIcon icon-type="account" :icon-id="account.icon" :color="account.color">
|
||||
<f7-badge color="gray" class="right-bottom-icon" v-if="account.hidden">
|
||||
<f7-icon f7="eye_slash_fill"></f7-icon>
|
||||
@@ -101,7 +102,7 @@
|
||||
<template #title>
|
||||
<div class="display-flex padding-top-half padding-bottom-half">
|
||||
<ItemIcon icon-type="account" :icon-id="account.icon" :color="account.color"
|
||||
v-if="account.type === allAccountTypes.MultiSubAccounts && hasVisibleSubAccount(account)">
|
||||
v-if="account.type === allAccountTypes.MultiSubAccounts.type && hasVisibleSubAccount(account)">
|
||||
<f7-badge color="gray" class="right-bottom-icon" v-if="account.hidden">
|
||||
<f7-icon f7="eye_slash_fill"></f7-icon>
|
||||
</f7-badge>
|
||||
@@ -111,7 +112,7 @@
|
||||
<div class="item-footer" v-if="account.comment">{{ account.comment }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<li v-if="account.type === allAccountTypes.MultiSubAccounts">
|
||||
<li v-if="account.type === allAccountTypes.MultiSubAccounts.type">
|
||||
<ul class="no-padding">
|
||||
<f7-list-item class="no-sortable nested-list-item-child"
|
||||
:class="{ 'actual-first-child': subAccount.id === firstShowingIds.subAccounts[account.id], 'actual-last-child': subAccount.id === lastShowingIds.subAccounts[account.id] }"
|
||||
@@ -179,8 +180,8 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -205,10 +206,10 @@ export default {
|
||||
return this.userStore.currentUserDefaultCurrency;
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allAccountCategories() {
|
||||
return accountConstants.allCategories;
|
||||
return AccountCategory.values();
|
||||
},
|
||||
allCategorizedAccountsMap() {
|
||||
return this.accountsStore.allCategorizedAccountsMap;
|
||||
|
||||
@@ -149,11 +149,11 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import iconConstants from '@/consts/icon.js';
|
||||
import colorConstants from '@/consts/color.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { ALL_CATEGORY_ICONS } from '@/consts/icon.ts';
|
||||
import { ALL_CATEGORY_COLORS } from '@/consts/color.ts';
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
setCategoryModelByAnotherCategory,
|
||||
allVisiblePrimaryTransactionCategoriesByType
|
||||
@@ -205,10 +205,10 @@ export default {
|
||||
}
|
||||
},
|
||||
allCategoryIcons() {
|
||||
return iconConstants.allCategoryIcons;
|
||||
return ALL_CATEGORY_ICONS;
|
||||
},
|
||||
allCategoryColors() {
|
||||
return colorConstants.allCategoryColors;
|
||||
return ALL_CATEGORY_COLORS;
|
||||
},
|
||||
inputIsEmpty() {
|
||||
return !!this.inputEmptyProblemMessage;
|
||||
@@ -251,9 +251,9 @@ export default {
|
||||
} else if (query.parentId) {
|
||||
const categoryType = parseInt(query.type);
|
||||
|
||||
if (categoryType !== categoryConstants.allCategoryTypes.Income &&
|
||||
categoryType !== categoryConstants.allCategoryTypes.Expense &&
|
||||
categoryType !== categoryConstants.allCategoryTypes.Transfer) {
|
||||
if (categoryType !== CategoryType.Income &&
|
||||
categoryType !== CategoryType.Expense &&
|
||||
categoryType !== CategoryType.Transfer) {
|
||||
self.$toast('Parameter Invalid');
|
||||
self.loadingError = 'Parameter Invalid';
|
||||
return;
|
||||
|
||||
@@ -90,13 +90,13 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import {
|
||||
isNoAvailableCategory,
|
||||
getFirstShowingId,
|
||||
getLastShowingId
|
||||
} from '@/lib/category.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -142,13 +142,13 @@ export default {
|
||||
let title = '';
|
||||
|
||||
switch (this.categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income:
|
||||
case CategoryType.Income:
|
||||
title = 'Income';
|
||||
break;
|
||||
case categoryConstants.allCategoryTypes.Expense:
|
||||
case CategoryType.Expense:
|
||||
title = 'Expense';
|
||||
break;
|
||||
case categoryConstants.allCategoryTypes.Transfer:
|
||||
case CategoryType.Transfer:
|
||||
title = 'Transfer';
|
||||
break;
|
||||
default:
|
||||
@@ -186,9 +186,9 @@ export default {
|
||||
|
||||
self.categoryType = parseInt(query.type);
|
||||
|
||||
if (self.categoryType !== categoryConstants.allCategoryTypes.Income &&
|
||||
self.categoryType !== categoryConstants.allCategoryTypes.Expense &&
|
||||
self.categoryType !== categoryConstants.allCategoryTypes.Transfer) {
|
||||
if (self.categoryType !== CategoryType.Income &&
|
||||
self.categoryType !== CategoryType.Expense &&
|
||||
self.categoryType !== CategoryType.Transfer) {
|
||||
self.$toast('Parameter Invalid');
|
||||
self.loadingError = 'Parameter Invalid';
|
||||
return;
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { getObjectOwnFieldCount, categorizedArrayToPlainArray } from '@/lib/common.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { getObjectOwnFieldCount, categorizedArrayToPlainArray } from '@/lib/common.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -98,9 +98,9 @@ export default {
|
||||
self.categoryType = parseInt(query.type);
|
||||
|
||||
if (self.categoryType !== 0 &&
|
||||
self.categoryType !== categoryConstants.allCategoryTypes.Income &&
|
||||
self.categoryType !== categoryConstants.allCategoryTypes.Expense &&
|
||||
self.categoryType !== categoryConstants.allCategoryTypes.Transfer) {
|
||||
self.categoryType !== CategoryType.Income &&
|
||||
self.categoryType !== CategoryType.Expense &&
|
||||
self.categoryType !== CategoryType.Transfer) {
|
||||
self.$toast('Parameter Invalid');
|
||||
self.loadingError = 'Parameter Invalid';
|
||||
}
|
||||
@@ -137,11 +137,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
|
||||
@@ -9,34 +9,36 @@
|
||||
</f7-nav-right>
|
||||
</f7-navbar>
|
||||
|
||||
<f7-block class="combination-list-wrapper margin-vertical skeleton-text"
|
||||
:key="blockIdx" v-for="blockIdx in [ 1, 2, 3 ]" v-if="loading">
|
||||
<f7-accordion-item>
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers media-list
|
||||
class="combination-list-header combination-list-opened">
|
||||
<f7-list-item>
|
||||
<template #title>
|
||||
<span>Account Category</span>
|
||||
<f7-icon class="combination-list-chevron-icon" f7="chevron_up"></f7-icon>
|
||||
<div class="skeleton-text" v-if="loading">
|
||||
<f7-block class="combination-list-wrapper margin-vertical"
|
||||
:key="blockIdx" v-for="blockIdx in [ 1, 2, 3 ]">
|
||||
<f7-accordion-item>
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers media-list
|
||||
class="combination-list-header combination-list-opened">
|
||||
<f7-list-item>
|
||||
<template #title>
|
||||
<span>Account Category</span>
|
||||
<f7-icon class="combination-list-chevron-icon" f7="chevron_up"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content style="height: auto">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox class="disabled" title="Account Name"
|
||||
:key="itemIdx" v-for="itemIdx in (blockIdx === 1 ? [ 1 ] : [ 1, 2 ])">
|
||||
<template #media>
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content style="height: auto">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox class="disabled" title="Account Name"
|
||||
:key="itemIdx" v-for="itemIdx in (blockIdx === 1 ? [ 1 ] : [ 1, 2 ])">
|
||||
<template #media>
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-content>
|
||||
</f7-accordion-item>
|
||||
</f7-block>
|
||||
</f7-accordion-content>
|
||||
</f7-accordion-item>
|
||||
</f7-block>
|
||||
</div>
|
||||
|
||||
<f7-list strong inset dividers accordion-list class="margin-top" v-if="!loading && !hasAnyVisibleAccount">
|
||||
<f7-list-item :title="$t('No available account')"></f7-list-item>
|
||||
@@ -67,7 +69,7 @@
|
||||
<f7-accordion-content :style="{ height: collapseStates[accountCategory.category].opened ? 'auto' : '' }">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox
|
||||
:class="{ 'has-child-list-item': account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id]) }"
|
||||
:class="{ 'has-child-list-item': account.type === allAccountTypes.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id]) }"
|
||||
:title="account.name"
|
||||
:value="account.id"
|
||||
:checked="isAccountOrSubAccountsAllChecked(account, filterAccountIds)"
|
||||
@@ -86,7 +88,7 @@
|
||||
|
||||
<template #root>
|
||||
<ul class="padding-left"
|
||||
v-if="account.type === allAccountTypes.MultiSubAccounts && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
|
||||
v-if="account.type === allAccountTypes.MultiSubAccounts.type && ((showHidden && accountCategory.allSubAccounts[account.id]) || accountCategory.allVisibleSubAccountCounts[account.id])">
|
||||
<f7-list-item checkbox
|
||||
:title="subAccount.name"
|
||||
:value="subAccount.id"
|
||||
@@ -136,8 +138,8 @@ import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import { copyObjectTo } from '@/lib/common.js';
|
||||
import { AccountType, AccountCategory } from '@/core/account.ts';
|
||||
import { copyObjectTo } from '@/lib/common.ts';
|
||||
import {
|
||||
getCategorizedAccountsWithVisibleCount,
|
||||
selectAccountOrSubAccounts,
|
||||
@@ -183,7 +185,7 @@ export default {
|
||||
}
|
||||
},
|
||||
allAccountTypes() {
|
||||
return accountConstants.allAccountTypes;
|
||||
return AccountType.all();
|
||||
},
|
||||
allCategorizedAccounts() {
|
||||
return getCategorizedAccountsWithVisibleCount(this.accountsStore.allCategorizedAccountsMap);
|
||||
@@ -212,7 +214,7 @@ export default {
|
||||
|
||||
const allAccountIds = {};
|
||||
|
||||
for (let accountId in self.accountsStore.allAccountsMap) {
|
||||
for (const accountId in self.accountsStore.allAccountsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.accountsStore.allAccountsMap, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -231,7 +233,7 @@ export default {
|
||||
} else if (self.type === 'statisticsCurrent') {
|
||||
self.filterAccountIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterAccountIds, allAccountIds);
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let accountId in self.transactionsStore.allFilterAccountIds) {
|
||||
for (const accountId in self.transactionsStore.allFilterAccountIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterAccountIds, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -268,7 +270,7 @@ export default {
|
||||
let isAllSelected = true;
|
||||
let finalAccountIds = '';
|
||||
|
||||
for (let accountId in self.filterAccountIds) {
|
||||
for (const accountId in self.filterAccountIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterAccountIds, accountId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -345,15 +347,12 @@ export default {
|
||||
},
|
||||
getCollapseStates() {
|
||||
const collapseStates = {};
|
||||
const allCategories = AccountCategory.values();
|
||||
|
||||
for (let categoryType in accountConstants.allCategories) {
|
||||
if (!Object.prototype.hasOwnProperty.call(accountConstants.allCategories, categoryType)) {
|
||||
continue;
|
||||
}
|
||||
for (let i = 0; i < allCategories.length; i++) {
|
||||
const accountCategory = allCategories[i];
|
||||
|
||||
const accountCategory = accountConstants.allCategories[categoryType];
|
||||
|
||||
collapseStates[accountCategory.id] = {
|
||||
collapseStates[accountCategory.type] = {
|
||||
opened: true
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,44 +9,46 @@
|
||||
</f7-nav-right>
|
||||
</f7-navbar>
|
||||
|
||||
<f7-block class="combination-list-wrapper margin-vertical skeleton-text"
|
||||
:key="blockIdx" v-for="blockIdx in [ 1, 2 ]" v-if="loading">
|
||||
<f7-accordion-item>
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers media-list
|
||||
class="combination-list-header combination-list-opened">
|
||||
<f7-list-item>
|
||||
<template #title>
|
||||
<span>Transaction Category</span>
|
||||
<f7-icon class="combination-list-chevron-icon" f7="chevron_up"></f7-icon>
|
||||
<div class="skeleton-text" v-if="loading">
|
||||
<f7-block class="combination-list-wrapper margin-vertical"
|
||||
:key="blockIdx" v-for="blockIdx in [ 1, 2 ]">
|
||||
<f7-accordion-item>
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers media-list
|
||||
class="combination-list-header combination-list-opened">
|
||||
<f7-list-item>
|
||||
<template #title>
|
||||
<span>Transaction Category</span>
|
||||
<f7-icon class="combination-list-chevron-icon" f7="chevron_up"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content style="height: auto">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox class="disabled" title="Category Name"
|
||||
:key="itemIdx" v-for="itemIdx in [ 1, 2 ]">
|
||||
<template #media>
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</template>
|
||||
<template #root>
|
||||
<ul class="padding-left">
|
||||
<f7-list-item checkbox class="disabled" title="Sub Category Name"
|
||||
:key="subItemIdx" v-for="subItemIdx in [ 1, 2, 3 ]">
|
||||
<template #media>
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</ul>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content style="height: auto">
|
||||
<f7-list strong inset dividers accordion-list class="combination-list-content">
|
||||
<f7-list-item checkbox class="disabled" title="Category Name"
|
||||
:key="itemIdx" v-for="itemIdx in [ 1, 2 ]">
|
||||
<template #media>
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</template>
|
||||
<template #root>
|
||||
<ul class="padding-left">
|
||||
<f7-list-item checkbox class="disabled" title="Sub Category Name"
|
||||
:key="subItemIdx" v-for="subItemIdx in [ 1, 2, 3 ]">
|
||||
<template #media>
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</ul>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-content>
|
||||
</f7-accordion-item>
|
||||
</f7-block>
|
||||
</f7-accordion-content>
|
||||
</f7-accordion-item>
|
||||
</f7-block>
|
||||
</div>
|
||||
|
||||
<f7-block class="combination-list-wrapper margin-vertical"
|
||||
:key="transactionType.type"
|
||||
@@ -143,8 +145,8 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { copyObjectTo, arrayItemToObjectField } from '@/lib/common.ts';
|
||||
import {
|
||||
allTransactionCategoriesWithVisibleCount,
|
||||
hasAnyAvailableCategory,
|
||||
@@ -220,7 +222,7 @@ export default {
|
||||
|
||||
const allCategoryIds = {};
|
||||
|
||||
for (let categoryId in self.transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
for (const categoryId in self.transactionCategoriesStore.allTransactionCategoriesMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionCategoriesStore.allTransactionCategoriesMap, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -243,7 +245,7 @@ export default {
|
||||
} else if (self.type === 'statisticsCurrent') {
|
||||
self.filterCategoryIds = copyObjectTo(self.statisticsStore.transactionStatisticsFilter.filterCategoryIds, allCategoryIds);
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let categoryId in self.transactionsStore.allFilterCategoryIds) {
|
||||
for (const categoryId in self.transactionsStore.allFilterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -283,7 +285,7 @@ export default {
|
||||
let isAllSelected = true;
|
||||
let finalCategoryIds = '';
|
||||
|
||||
for (let categoryId in self.filterCategoryIds) {
|
||||
for (const categoryId in self.filterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -347,11 +349,11 @@ export default {
|
||||
},
|
||||
getCategoryTypeName(categoryType) {
|
||||
switch (categoryType) {
|
||||
case categoryConstants.allCategoryTypes.Income.toString():
|
||||
case CategoryType.Income.toString():
|
||||
return this.$t('Income Categories');
|
||||
case categoryConstants.allCategoryTypes.Expense.toString():
|
||||
case CategoryType.Expense.toString():
|
||||
return this.$t('Expense Categories');
|
||||
case categoryConstants.allCategoryTypes.Transfer.toString():
|
||||
case CategoryType.Transfer.toString():
|
||||
return this.$t('Transfer Categories');
|
||||
default:
|
||||
return this.$t('Transaction Categories');
|
||||
@@ -369,12 +371,12 @@ export default {
|
||||
getCollapseStates() {
|
||||
const collapseStates = {};
|
||||
|
||||
for (let categoryTypeField in categoryConstants.allCategoryTypes) {
|
||||
if (!Object.prototype.hasOwnProperty.call(categoryConstants.allCategoryTypes, categoryTypeField)) {
|
||||
for (const categoryTypeField in CategoryType) {
|
||||
if (!Object.prototype.hasOwnProperty.call(CategoryType, categoryTypeField)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const categoryType = categoryConstants.allCategoryTypes[categoryTypeField];
|
||||
const categoryType = CategoryType[categoryTypeField];
|
||||
|
||||
collapseStates[categoryType] = {
|
||||
opened: true
|
||||
|
||||
@@ -116,9 +116,9 @@ import { mapStores } from 'pinia';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import fontConstants from '@/consts/font.js';
|
||||
import { FontSize } from '@/core/font.ts';
|
||||
import { getCurrentUnixTime, getDay, getDayOfWeekName } from '@/lib/datetime.js';
|
||||
import { setAppFontSize, getFontSizePreviewClassName } from '@/lib/ui.mobile.js';
|
||||
import { setAppFontSize, getFontSizePreviewClassName } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -135,10 +135,10 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useSettingsStore, useUserStore),
|
||||
minFontSizeType() {
|
||||
return 0;
|
||||
return FontSize.MinimumFontSize.type;
|
||||
},
|
||||
maxFontSizeType() {
|
||||
return fontConstants.allFontSizeArray.length - 1;
|
||||
return FontSize.MaximumFontSize.type;
|
||||
},
|
||||
fontSizePreviewClassName() {
|
||||
return getFontSizePreviewClassName(this.fontSize);
|
||||
|
||||
@@ -116,13 +116,13 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { TransactionTagFilterType } from '@/core/transaction.ts';
|
||||
|
||||
import {
|
||||
selectAll,
|
||||
selectNone,
|
||||
selectInvert
|
||||
} from '@/lib/common.js';
|
||||
} from '@/lib/common.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -135,7 +135,7 @@ export default {
|
||||
loadingError: null,
|
||||
type: null,
|
||||
filterTagIds: {},
|
||||
tagFilterType: transactionConstants.defaultTransactionTagFilterType.type,
|
||||
tagFilterType: TransactionTagFilterType.Default.type,
|
||||
showHidden: false,
|
||||
collapseStates: {
|
||||
'default': {
|
||||
@@ -183,7 +183,7 @@ export default {
|
||||
|
||||
const allTransactionTagIds = {};
|
||||
|
||||
for (let transactionTagId in self.transactionTagsStore.allTransactionTagsMap) {
|
||||
for (const transactionTagId in self.transactionTagsStore.allTransactionTagsMap) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionTagsStore.allTransactionTagsMap, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export default {
|
||||
}
|
||||
|
||||
if (self.type === 'statisticsCurrent') {
|
||||
let transactionTagIds = self.statisticsStore.transactionStatisticsFilter.tagIds ? self.statisticsStore.transactionStatisticsFilter.tagIds.split(',') : [];
|
||||
const transactionTagIds = self.statisticsStore.transactionStatisticsFilter.tagIds ? self.statisticsStore.transactionStatisticsFilter.tagIds.split(',') : [];
|
||||
|
||||
for (let i = 0; i < transactionTagIds.length; i++) {
|
||||
const transactionTagId = transactionTagIds[i];
|
||||
@@ -206,7 +206,7 @@ export default {
|
||||
self.filterTagIds = allTransactionTagIds;
|
||||
self.tagFilterType = self.statisticsStore.transactionStatisticsFilter.tagFilterType;
|
||||
} else if (self.type === 'transactionListCurrent') {
|
||||
for (let transactionTagId in self.transactionsStore.allFilterTagIds) {
|
||||
for (const transactionTagId in self.transactionsStore.allFilterTagIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.transactionsStore.allFilterTagIds, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ export default {
|
||||
let finalTagIds = '';
|
||||
let changed = true;
|
||||
|
||||
for (let transactionTagId in self.filterTagIds) {
|
||||
for (const transactionTagId in self.filterTagIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(self.filterTagIds, transactionTagId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
import { getNameByKeyValue, limitText } from '@/lib/common.js';
|
||||
import { getNameByKeyValue, limitText } from '@/lib/common.ts';
|
||||
import { formatPercent } from '@/lib/numeral.js';
|
||||
import {
|
||||
getYearAndMonthFromUnixTime,
|
||||
@@ -344,7 +344,7 @@ import {
|
||||
getDateRangeByDateType
|
||||
} from '@/lib/datetime.js';
|
||||
import { isChartDataTypeAvailableForAnalysisType } from '@/lib/statistics.js';
|
||||
import { scrollToSelectedItem } from '@/lib/ui.mobile.js';
|
||||
import { scrollToSelectedItem } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
|
||||
@@ -152,7 +152,7 @@ import {
|
||||
getFirstShowingId,
|
||||
getLastShowingId
|
||||
} from '@/lib/tag.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<f7-page :ptr="!sortable" @ptr:refresh="reload" @page:afterin="onPageAfterIn">
|
||||
<f7-navbar>
|
||||
<f7-nav-left :back-link="$t('Back')"></f7-nav-left>
|
||||
<f7-nav-title :title="templateType === allTemplateTypes.Schedule ? $t('Scheduled Transactions') : $t('Transaction Templates')"></f7-nav-title>
|
||||
<f7-nav-title :title="templateType === allTemplateTypes.Schedule.type ? $t('Scheduled Transactions') : $t('Transaction Templates')"></f7-nav-title>
|
||||
<f7-nav-right class="navbar-compact-icons">
|
||||
<f7-link icon-f7="ellipsis" :class="{ 'disabled': !templates.length }" v-if="!sortable" @click="showMoreActionSheet = true"></f7-link>
|
||||
<f7-link :href="'/template/add?templateType=' + templateType" icon-f7="plus" v-if="!sortable"></f7-link>
|
||||
@@ -22,8 +22,8 @@
|
||||
<f7-list strong inset dividers class="margin-top" v-if="!loading && noAvailableTemplate">
|
||||
<f7-list-item :title="$t('No available template')"
|
||||
:footer="$t('Once you add templates, you can long press the Add button on the home page to quickly add a new transaction')"
|
||||
v-if="templateType === allTemplateTypes.Normal"></f7-list-item>
|
||||
<f7-list-item :title="$t('No available scheduled transactions')" v-else-if="templateType === allTemplateTypes.Schedule"></f7-list-item>
|
||||
v-if="templateType === allTemplateTypes.Normal.type"></f7-list-item>
|
||||
<f7-list-item :title="$t('No available scheduled transactions')" v-else-if="templateType === allTemplateTypes.Schedule.type"></f7-list-item>
|
||||
<f7-list-item :title="$t('No available template')" v-else></f7-list-item>
|
||||
</f7-list>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
v-show="showHidden || !template.hidden"
|
||||
@taphold="setSortable()">
|
||||
<template #media>
|
||||
<f7-icon :f7="templateType === allTemplateTypes.Schedule ? 'clock' : 'doc_plaintext'">
|
||||
<f7-icon :f7="templateType === allTemplateTypes.Schedule.type ? 'clock' : 'doc_plaintext'">
|
||||
<f7-badge color="gray" class="right-bottom-icon" v-if="template.hidden">
|
||||
<f7-icon f7="eye_slash_fill"></f7-icon>
|
||||
</f7-badge>
|
||||
@@ -88,14 +88,14 @@
|
||||
import { mapStores } from 'pinia';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import { isDefined } from '@/lib/common.js';
|
||||
import { TemplateType } from '@/core/template.ts';
|
||||
import { isDefined } from '@/lib/common.ts';
|
||||
import {
|
||||
isNoAvailableTemplate,
|
||||
getFirstShowingId,
|
||||
getLastShowingId
|
||||
} from '@/lib/template.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -104,7 +104,7 @@ export default {
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
templateType: templateConstants.allTemplateTypes.Normal,
|
||||
templateType: TemplateType.Normal.type,
|
||||
loading: true,
|
||||
loadingError: null,
|
||||
showHidden: false,
|
||||
@@ -131,16 +131,16 @@ export default {
|
||||
return isNoAvailableTemplate(this.templates, this.showHidden);
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
return TemplateType.all();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const self = this;
|
||||
|
||||
if (self.f7route.path === '/template/list') {
|
||||
self.templateType = templateConstants.allTemplateTypes.Normal;
|
||||
self.templateType = TemplateType.Normal.type;
|
||||
} else if (self.f7route.path === '/schedule/list') {
|
||||
self.templateType = templateConstants.allTemplateTypes.Schedule;
|
||||
self.templateType = TemplateType.Schedule.type;
|
||||
}
|
||||
|
||||
self.loading = true;
|
||||
|
||||
@@ -58,8 +58,8 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
|
||||
import numeralConstants from '@/consts/numeral.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { isString } from '@/lib/common.js';
|
||||
import { TRANSACTION_MIN_AMOUNT, TRANSACTION_MAX_AMOUNT } from '@/consts/transaction.ts';
|
||||
import { isString } from '@/lib/common.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
|
||||
export default {
|
||||
@@ -82,10 +82,10 @@ export default {
|
||||
return numeralConstants.allAmountFilterTypeArray;
|
||||
},
|
||||
allowedMinAmount() {
|
||||
return transactionConstants.minAmountNumber;
|
||||
return TRANSACTION_MIN_AMOUNT;
|
||||
},
|
||||
allowedMaxAmount() {
|
||||
return transactionConstants.maxAmountNumber;
|
||||
return TRANSACTION_MAX_AMOUNT;
|
||||
},
|
||||
amountCount() {
|
||||
return this.getAmountFilterParameterCount(this.type);
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow" header="Category" title="Category Names"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Account" title="Account Name"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Transaction Time" title="YYYY/MM/DD HH:mm:ss" v-if="type === 'transaction'"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Scheduled Transaction Frequency" title="Every XXXXX" v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow list-item-no-item-after" header="Transaction Timezone" title="(UTC XX:XX) System Default" link="#" :no-chevron="mode === 'view'" v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule)"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title" header="Scheduled Transaction Frequency" title="Every XXXXX" v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule.type"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow list-item-no-item-after" header="Transaction Timezone" title="(UTC XX:XX) System Default" link="#" :no-chevron="mode === 'view'" v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule.type)"></f7-list-item>
|
||||
<f7-list-item class="list-item-with-header-and-title list-item-title-hide-overflow" header="Geographic Location" title="No Location" v-if="type === 'transaction'"></f7-list-item>
|
||||
<f7-list-item header="Tags">
|
||||
<template #footer>
|
||||
@@ -258,7 +258,7 @@
|
||||
:header="$t('Scheduled Transaction Frequency')"
|
||||
:title="transactionDisplayScheduledFrequency"
|
||||
@click="showTransactionScheduledFrequencySheet = true"
|
||||
v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule"
|
||||
v-if="type === 'template' && transaction.templateType === allTemplateTypes.Schedule.type"
|
||||
>
|
||||
<schedule-frequency-sheet v-model:show="showTransactionScheduledFrequencySheet"
|
||||
v-model:type="transaction.scheduledFrequencyType"
|
||||
@@ -272,7 +272,7 @@
|
||||
:class="{ 'readonly': mode === 'view' }"
|
||||
:header="$t('Transaction 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'), pageTitle: $t('Transaction Timezone'), popupCloseLinkText: $t('Done') }"
|
||||
v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule)"
|
||||
v-if="type === 'transaction' || (type === 'template' && transaction.templateType === allTemplateTypes.Schedule.type)"
|
||||
>
|
||||
<select v-model="transaction.timeZone">
|
||||
<option :value="timezone.name" :key="timezone.name"
|
||||
@@ -439,16 +439,17 @@ import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import fileConstants from '@/consts/file.js';
|
||||
import categoryConstants from '@/consts/category.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import templateConstants from '@/consts/template.js';
|
||||
import apiConstants from '@/consts/api.js';
|
||||
import { CategoryType } from '@/core/category.ts';
|
||||
import { TransactionType, TransactionEditScopeType } from '@/core/transaction.ts';
|
||||
import { TemplateType, ScheduledTemplateFrequencyType } from '@/core/template.ts';
|
||||
import { TRANSACTION_MIN_AMOUNT, TRANSACTION_MAX_AMOUNT, TRANSACTION_MAX_PICTURE_COUNT } from '@/consts/transaction.ts';
|
||||
import { KnownErrorCode } from '@/consts/api.ts';
|
||||
import { SUPPORTED_IMAGE_EXTENSIONS } from '@/consts/file.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import {
|
||||
isArray,
|
||||
getNameByKeyValue
|
||||
} from '@/lib/common.js';
|
||||
} from '@/lib/common.ts';
|
||||
import {
|
||||
getTimezoneOffset,
|
||||
getTimezoneOffsetMinutes,
|
||||
@@ -456,7 +457,7 @@ import {
|
||||
getUtcOffsetByUtcOffsetMinutes,
|
||||
getActualUnixTimeForStore
|
||||
} from '@/lib/datetime.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.js';
|
||||
import { generateRandomUUID } from '@/lib/misc.ts';
|
||||
import {
|
||||
getTransactionPrimaryCategoryName,
|
||||
getTransactionSecondaryCategoryName,
|
||||
@@ -466,7 +467,7 @@ import { setTransactionModelByTransaction } from '@/lib/transaction.js';
|
||||
import {
|
||||
isTransactionPicturesEnabled,
|
||||
getMapProvider
|
||||
} from '@/lib/server_settings.js';
|
||||
} from '@/lib/server_settings.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -524,13 +525,13 @@ export default {
|
||||
} else {
|
||||
return 'Transaction Detail';
|
||||
}
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Normal) {
|
||||
} else if (this.type === 'template' && this.transaction.templateType === TemplateType.Normal.type) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Transaction Template';
|
||||
} else if (this.mode === 'edit') {
|
||||
return 'Edit Transaction Template';
|
||||
}
|
||||
} else if (this.type === 'template' && this.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
} else if (this.type === 'template' && this.transaction.templateType === TemplateType.Schedule.type) {
|
||||
if (this.mode === 'add') {
|
||||
return 'Add Scheduled Transaction';
|
||||
} else if (this.mode === 'edit') {
|
||||
@@ -598,13 +599,13 @@ export default {
|
||||
return this.userStore.currentUserFirstDayOfWeek;
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return transactionConstants.allTransactionTypes;
|
||||
return TransactionType;
|
||||
},
|
||||
allCategoryTypes() {
|
||||
return categoryConstants.allCategoryTypes;
|
||||
return CategoryType;
|
||||
},
|
||||
allTemplateTypes() {
|
||||
return templateConstants.allTemplateTypes;
|
||||
return TemplateType.all();
|
||||
},
|
||||
allTimezones() {
|
||||
return this.$locale.getAllTimezones(true);
|
||||
@@ -634,7 +635,7 @@ export default {
|
||||
return this.transactionTagsStore.allTransactionTagsMap;
|
||||
},
|
||||
supportedImageExtensions() {
|
||||
return fileConstants.supportedImageExtensions;
|
||||
return SUPPORTED_IMAGE_EXTENSIONS;
|
||||
},
|
||||
hasAvailableExpenseCategories() {
|
||||
if (!this.allCategories || !this.allCategories[this.allCategoryTypes.Expense] || !this.allCategories[this.allCategoryTypes.Expense].length) {
|
||||
@@ -711,7 +712,7 @@ export default {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (this.transaction.scheduledFrequencyType === templateConstants.allTemplateScheduledFrequencyTypes.Disabled.type) {
|
||||
if (this.transaction.scheduledFrequencyType === ScheduledTemplateFrequencyType.Disabled.type) {
|
||||
return this.$t('Disabled');
|
||||
}
|
||||
|
||||
@@ -724,7 +725,7 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.transaction.scheduledFrequencyType === templateConstants.allTemplateScheduledFrequencyTypes.Weekly.type) {
|
||||
if (this.transaction.scheduledFrequencyType === ScheduledTemplateFrequencyType.Weekly.type) {
|
||||
if (scheduledFrequencyValues.length) {
|
||||
return this.$t('format.misc.everyMultiDaysOfWeek', {
|
||||
days: this.$locale.getMultiWeekdayLongNames(scheduledFrequencyValues, this.firstDayOfWeek)
|
||||
@@ -732,7 +733,7 @@ export default {
|
||||
} else {
|
||||
return this.$t('Weekly');
|
||||
}
|
||||
} else if (this.transaction.scheduledFrequencyType === templateConstants.allTemplateScheduledFrequencyTypes.Monthly.type) {
|
||||
} else if (this.transaction.scheduledFrequencyType === ScheduledTemplateFrequencyType.Monthly.type) {
|
||||
if (scheduledFrequencyValues.length) {
|
||||
return this.$t('format.misc.everyMultiDaysOfMonth', {
|
||||
days: this.$locale.getMultiMonthdayShortNames(scheduledFrequencyValues)
|
||||
@@ -812,10 +813,10 @@ export default {
|
||||
return thumbs;
|
||||
},
|
||||
allowedMinAmount() {
|
||||
return transactionConstants.minAmountNumber;
|
||||
return TRANSACTION_MIN_AMOUNT;
|
||||
},
|
||||
allowedMaxAmount() {
|
||||
return transactionConstants.maxAmountNumber;
|
||||
return TRANSACTION_MAX_AMOUNT;
|
||||
},
|
||||
showAccountBalance() {
|
||||
return this.settingsStore.appSettings.showAccountBalance;
|
||||
@@ -828,7 +829,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !isArray(this.transaction.pictures) || this.transaction.pictures.length < transactionConstants.maxPictureCount;
|
||||
return !isArray(this.transaction.pictures) || this.transaction.pictures.length < TRANSACTION_MAX_PICTURE_COUNT;
|
||||
},
|
||||
mapProvider() {
|
||||
return getMapProvider();
|
||||
@@ -933,7 +934,7 @@ export default {
|
||||
self.accountsStore.loadAllAccounts({ force: false }),
|
||||
self.transactionCategoriesStore.loadAllCategories({ force: false }),
|
||||
self.transactionTagsStore.loadAllTags({ force: false }),
|
||||
self.transactionTemplatesStore.loadAllTemplates({ force: false, templateType: templateConstants.allTemplateTypes.Normal })
|
||||
self.transactionTemplatesStore.loadAllTemplates({ force: false, templateType: TemplateType.Normal.type })
|
||||
];
|
||||
|
||||
if (self.type === 'transaction') {
|
||||
@@ -953,8 +954,8 @@ export default {
|
||||
self.transaction.templateType = parseInt(query.templateType);
|
||||
}
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
self.transaction.scheduledFrequencyType = templateConstants.allTemplateScheduledFrequencyTypes.Disabled.type;
|
||||
if (self.transaction.templateType === TemplateType.Schedule.type) {
|
||||
self.transaction.scheduledFrequencyType = ScheduledTemplateFrequencyType.Disabled.type;
|
||||
self.transaction.scheduledFrequency = '';
|
||||
}
|
||||
|
||||
@@ -995,8 +996,8 @@ export default {
|
||||
if (self.type === 'transaction') {
|
||||
if (query.id) {
|
||||
fromTransaction = responses[4];
|
||||
} else if (query.templateId && self.transactionTemplatesStore.allTransactionTemplatesMap && self.transactionTemplatesStore.allTransactionTemplatesMap[templateConstants.allTemplateTypes.Normal]) {
|
||||
fromTransaction = self.transactionTemplatesStore.allTransactionTemplatesMap[templateConstants.allTemplateTypes.Normal][query.templateId];
|
||||
} else if (query.templateId && self.transactionTemplatesStore.allTransactionTemplatesMap && self.transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type]) {
|
||||
fromTransaction = self.transactionTemplatesStore.allTransactionTemplatesMap[TemplateType.Normal.type][query.templateId];
|
||||
|
||||
if (fromTransaction) {
|
||||
self.addByTemplateId = fromTransaction.id;
|
||||
@@ -1039,7 +1040,7 @@ export default {
|
||||
self.transaction.templateType = template.templateType;
|
||||
self.transaction.name = template.name;
|
||||
|
||||
if (self.transaction.templateType === templateConstants.allTemplateTypes.Schedule) {
|
||||
if (self.transaction.templateType === TemplateType.Schedule.type) {
|
||||
self.transaction.scheduledFrequencyType = template.scheduledFrequencyType;
|
||||
self.transaction.scheduledFrequency = template.scheduledFrequency;
|
||||
self.transaction.utcOffset = template.utcOffset;
|
||||
@@ -1134,13 +1135,13 @@ export default {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
|
||||
if (error.error && (error.error.errorCode === apiConstants.transactionCannotCreateInThisTimeErrorCode || error.error.errorCode === apiConstants.transactionCannotModifyInThisTimeErrorCode)) {
|
||||
if (error.error && (error.error.errorCode === KnownErrorCode.TransactionCannotCreateInThisTime || error.error.errorCode === KnownErrorCode.TransactionCannotModifyInThisTime)) {
|
||||
self.$confirm('You have set this time range to prevent editing transactions. Would you like to change the editable transaction range to All?', () => {
|
||||
self.submitting = true;
|
||||
self.$showLoading(() => self.submitting);
|
||||
|
||||
self.userStore.updateUserTransactionEditScope({
|
||||
transactionEditScope: transactionConstants.allTransactionEditScopeTypes.All.type
|
||||
transactionEditScope: TransactionEditScopeType.All.type
|
||||
}).then(() => {
|
||||
self.submitting = false;
|
||||
self.$hideLoading();
|
||||
@@ -1326,7 +1327,7 @@ export default {
|
||||
self.removingPictureId = '';
|
||||
self.submitting = false;
|
||||
}).catch(error => {
|
||||
if (error.error && error.error.errorCode === apiConstants.transactionPictureNotFoundErrorCode) {
|
||||
if (error.error && error.error.errorCode === KnownErrorCode.TransactionPictureNotFound) {
|
||||
for (let i = 0; i < self.transaction.pictures.length; i++) {
|
||||
if (self.transaction.pictures[i].pictureId === pictureInfo.pictureId) {
|
||||
self.transaction.pictures.splice(i, 1);
|
||||
|
||||
@@ -46,76 +46,77 @@
|
||||
</f7-link>
|
||||
</f7-toolbar>
|
||||
|
||||
<f7-block class="combination-list-wrapper margin-vertical skeleton-text"
|
||||
:key="blockIdx" v-for="blockIdx in [ 1, 2 ]" v-if="loading">
|
||||
<f7-accordion-item>
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers media-list
|
||||
class="transaction-amount-list combination-list-header combination-list-opened">
|
||||
<f7-list-item>
|
||||
<template #title>
|
||||
<small>YYYY-MM</small>
|
||||
<small class="transaction-amount-statistics" v-if="showTotalAmountInTransactionListPage">
|
||||
<span>0.00 USD</span>
|
||||
<span>0.00 USD</span>
|
||||
</small>
|
||||
<f7-icon class="combination-list-chevron-icon" f7="chevron_up"></f7-icon>
|
||||
<div class="skeleton-text" v-if="loading">
|
||||
<f7-block class="combination-list-wrapper margin-vertical" :key="blockIdx" v-for="blockIdx in [ 1, 2 ]">
|
||||
<f7-accordion-item>
|
||||
<f7-block-title>
|
||||
<f7-accordion-toggle>
|
||||
<f7-list strong inset dividers media-list
|
||||
class="transaction-amount-list combination-list-header combination-list-opened">
|
||||
<f7-list-item>
|
||||
<template #title>
|
||||
<small>YYYY-MM</small>
|
||||
<small class="transaction-amount-statistics" v-if="showTotalAmountInTransactionListPage">
|
||||
<span>0.00 USD</span>
|
||||
<span>0.00 USD</span>
|
||||
</small>
|
||||
<f7-icon class="combination-list-chevron-icon" f7="chevron_up"></f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content style="height: auto">
|
||||
<f7-list strong inset dividers media-list accordion-list class="transaction-info-list combination-list-content">
|
||||
<f7-list-item link="#" chevron-center class="transaction-info"
|
||||
:key="itemIdx" v-for="itemIdx in (blockIdx === 1 ? [ 1, 2, 3, 4, 5, 6, 7 ] : [ 1, 2, 3 ])">
|
||||
<template #media>
|
||||
<div class="display-flex flex-direction-column transaction-date">
|
||||
<span class="transaction-day full-line flex-direction-column">DD</span>
|
||||
<span class="transaction-day-of-week full-line flex-direction-column">Sun</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #inner>
|
||||
<div class="display-flex no-padding-horizontal">
|
||||
<div class="item-media">
|
||||
<div class="transaction-icon display-flex align-items-center">
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actual-item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<div class="transaction-category-name no-padding">
|
||||
<span>Category</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-after">
|
||||
<div class="transaction-amount">
|
||||
<span>0.00 USD</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-text">
|
||||
<div class="transaction-description">
|
||||
<span>Transaction Description</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-footer">
|
||||
<div class="transaction-footer">
|
||||
<span>HH:mm</span>
|
||||
<span>·</span>
|
||||
<span>Source Account</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-toggle>
|
||||
</f7-block-title>
|
||||
<f7-accordion-content style="height: auto">
|
||||
<f7-list strong inset dividers media-list accordion-list class="transaction-info-list combination-list-content">
|
||||
<f7-list-item link="#" chevron-center class="transaction-info"
|
||||
:key="itemIdx" v-for="itemIdx in (blockIdx === 1 ? [ 1, 2, 3, 4, 5, 6, 7 ] : [ 1, 2, 3 ])">
|
||||
<template #media>
|
||||
<div class="display-flex flex-direction-column transaction-date">
|
||||
<span class="transaction-day full-line flex-direction-column">DD</span>
|
||||
<span class="transaction-day-of-week full-line flex-direction-column">Sun</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #inner>
|
||||
<div class="display-flex no-padding-horizontal">
|
||||
<div class="item-media">
|
||||
<div class="transaction-icon display-flex align-items-center">
|
||||
<f7-icon f7="app_fill"></f7-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actual-item-inner">
|
||||
<div class="item-title-row">
|
||||
<div class="item-title">
|
||||
<div class="transaction-category-name no-padding">
|
||||
<span>Category</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-after">
|
||||
<div class="transaction-amount">
|
||||
<span>0.00 USD</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-text">
|
||||
<div class="transaction-description">
|
||||
<span>Transaction Description</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item-footer">
|
||||
<div class="transaction-footer">
|
||||
<span>HH:mm</span>
|
||||
<span>·</span>
|
||||
<span>Source Account</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</f7-list>
|
||||
</f7-accordion-content>
|
||||
</f7-accordion-item>
|
||||
</f7-block>
|
||||
</f7-accordion-content>
|
||||
</f7-accordion-item>
|
||||
</f7-block>
|
||||
</div>
|
||||
|
||||
<f7-list strong inset dividers class="margin-vertical" v-if="!loading && noTransaction">
|
||||
<f7-list-item :title="$t('No transaction data')"></f7-list-item>
|
||||
@@ -471,19 +472,20 @@
|
||||
</template>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item :title="filterType.displayName"
|
||||
:key="filterType.type"
|
||||
v-for="filterType in allTransactionTagFilterTypes"
|
||||
v-if="query.tagIds && query.tagIds !== 'none'"
|
||||
@click="changeTagFilterType(filterType.type)"
|
||||
>
|
||||
<template #after>
|
||||
<f7-icon class="list-item-checked-icon"
|
||||
f7="checkmark_alt"
|
||||
v-if="query.tagFilterType === filterType.type">
|
||||
</f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
<template v-if="query.tagIds && query.tagIds !== 'none'">
|
||||
<f7-list-item :title="filterType.displayName"
|
||||
:key="filterType.type"
|
||||
v-for="filterType in allTransactionTagFilterTypes"
|
||||
@click="changeTagFilterType(filterType.type)"
|
||||
>
|
||||
<template #after>
|
||||
<f7-icon class="list-item-checked-icon"
|
||||
f7="checkmark_alt"
|
||||
v-if="query.tagFilterType === filterType.type">
|
||||
</f7-icon>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
</template>
|
||||
|
||||
<f7-list-item :title="transactionTag.name"
|
||||
:class="{ 'list-item-selected': query.tagIds === transactionTag.id, 'item-in-multiple-selection': queryAllFilterTagIdsCount > 1 && queryAllFilterTagIds[transactionTag.id] }"
|
||||
@@ -526,11 +528,11 @@ import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
|
||||
import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
|
||||
import { AccountType } from '@/core/account.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import numeralConstants from '@/consts/numeral.js';
|
||||
import datetimeConstants from '@/consts/datetime.js';
|
||||
import accountConstants from '@/consts/account.js';
|
||||
import transactionConstants from '@/consts/transaction.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import {
|
||||
getCurrentUnixTime,
|
||||
getSpecifiedDayFirstUnixTime,
|
||||
@@ -549,7 +551,7 @@ import {
|
||||
import { categoryTypeToTransactionType, transactionTypeToCategoryType } from '@/lib/category.js';
|
||||
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
|
||||
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
|
||||
import { onSwipeoutDeleted, scrollToSelectedItem } from '@/lib/ui.mobile.js';
|
||||
import { onSwipeoutDeleted, scrollToSelectedItem } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -581,7 +583,7 @@ export default {
|
||||
if (this.query.accountIds && this.queryAllFilterAccountIdsCount === 1) {
|
||||
const account = this.allAccounts[this.query.accountIds];
|
||||
|
||||
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
|
||||
if (account && account.type === AccountType.MultiSubAccounts.type) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -678,7 +680,7 @@ export default {
|
||||
return numeralConstants.allAmountFilterTypeArray;
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return transactionConstants.allTransactionTypes;
|
||||
return TransactionType;
|
||||
},
|
||||
allTransactionTagFilterTypes() {
|
||||
return this.$locale.getAllTransactionTagFilterTypes();
|
||||
@@ -938,7 +940,7 @@ export default {
|
||||
if (type && this.query.categoryIds) {
|
||||
newCategoryFilter = '';
|
||||
|
||||
for (let categoryId in this.queryAllFilterCategoryIds) {
|
||||
for (const categoryId in this.queryAllFilterCategoryIds) {
|
||||
if (!Object.prototype.hasOwnProperty.call(this.queryAllFilterCategoryIds, categoryId)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ import { useRootStore } from '@/stores/index.js';
|
||||
import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
|
||||
import { isDataExportingEnabled } from '@/lib/server_settings.js';
|
||||
import { isDataExportingEnabled } from '@/lib/server_settings.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
|
||||
@@ -47,10 +47,10 @@ import { mapStores } from 'pinia';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useTokensStore } from '@/stores/token.js';
|
||||
|
||||
import { isEquals } from '@/lib/common.js';
|
||||
import { parseSessionInfo } from '@/lib/misc.js';
|
||||
import { isEquals } from '@/lib/common.ts';
|
||||
import { parseSessionInfo } from '@/lib/session.ts';
|
||||
|
||||
import { onSwipeoutDeleted } from '@/lib/ui.mobile.js';
|
||||
import { onSwipeoutDeleted } from '@/lib/ui/mobile.js';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
|
||||
@@ -339,10 +339,10 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useAccountsStore } from '@/stores/account.js';
|
||||
import { useOverviewStore } from '@/stores/overview.js';
|
||||
|
||||
import { getNameByKeyValue } from '@/lib/common.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import { getCategorizedAccounts } from '@/lib/account.js';
|
||||
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.js';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui.js';
|
||||
import { isUserVerifyEmailEnabled } from '@/lib/server_settings.ts';
|
||||
import { setExpenseAndIncomeAmountColor } from '@/lib/ui/common.ts';
|
||||
|
||||
export default {
|
||||
props: [
|
||||
@@ -568,7 +568,7 @@ export default {
|
||||
|
||||
self.showInputPasswordSheet = false;
|
||||
|
||||
let problemMessage = self.inputIsNotChangedProblemMessage || self.inputInvalidProblemMessage || self.extendInputInvalidProblemMessage || self.langAndRegionInputInvalidProblemMessage;
|
||||
const problemMessage = self.inputIsNotChangedProblemMessage || self.inputInvalidProblemMessage || self.extendInputInvalidProblemMessage || self.langAndRegionInputInvalidProblemMessage;
|
||||
|
||||
if (problemMessage) {
|
||||
self.$alert(problemMessage);
|
||||
|
||||
Reference in New Issue
Block a user