mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
migrate to typescript
This commit is contained in:
@@ -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