modify the name of debit card to checking account, add savings account and certificate of deposit
This commit is contained in:
+2
-2
@@ -154,7 +154,7 @@ func (a *AccountsApi) AccountCreateHandler(c *core.WebContext) (any, *errs.Error
|
||||
return nil, errs.ErrClientTimezoneOffsetInvalid
|
||||
}
|
||||
|
||||
if accountCreateReq.Category < models.ACCOUNT_CATEGORY_CASH || accountCreateReq.Category > models.ACCOUNT_CATEGORY_INVESTMENT {
|
||||
if accountCreateReq.Category < models.ACCOUNT_CATEGORY_CASH || accountCreateReq.Category > models.ACCOUNT_CATEGORY_CERTIFICATE_OF_DEPOSIT {
|
||||
log.Warnf(c, "[accounts.AccountCreateHandler] account category invalid, category is %d", accountCreateReq.Category)
|
||||
return nil, errs.ErrAccountCategoryInvalid
|
||||
}
|
||||
@@ -288,7 +288,7 @@ func (a *AccountsApi) AccountModifyHandler(c *core.WebContext) (any, *errs.Error
|
||||
return nil, errs.NewIncompleteOrIncorrectSubmissionError(err)
|
||||
}
|
||||
|
||||
if accountModifyReq.Category < models.ACCOUNT_CATEGORY_CASH || accountModifyReq.Category > models.ACCOUNT_CATEGORY_INVESTMENT {
|
||||
if accountModifyReq.Category < models.ACCOUNT_CATEGORY_CASH || accountModifyReq.Category > models.ACCOUNT_CATEGORY_CERTIFICATE_OF_DEPOSIT {
|
||||
log.Warnf(c, "[accounts.AccountModifyHandler] account category invalid, category is %d", accountModifyReq.Category)
|
||||
return nil, errs.ErrAccountCategoryInvalid
|
||||
}
|
||||
|
||||
+27
-21
@@ -8,33 +8,39 @@ type AccountCategory byte
|
||||
|
||||
// Account categories
|
||||
const (
|
||||
ACCOUNT_CATEGORY_CASH AccountCategory = 1
|
||||
ACCOUNT_CATEGORY_DEBIT_CARD AccountCategory = 2
|
||||
ACCOUNT_CATEGORY_CREDIT_CARD AccountCategory = 3
|
||||
ACCOUNT_CATEGORY_VIRTUAL AccountCategory = 4
|
||||
ACCOUNT_CATEGORY_DEBT AccountCategory = 5
|
||||
ACCOUNT_CATEGORY_RECEIVABLES AccountCategory = 6
|
||||
ACCOUNT_CATEGORY_INVESTMENT AccountCategory = 7
|
||||
ACCOUNT_CATEGORY_CASH AccountCategory = 1
|
||||
ACCOUNT_CATEGORY_CHECKING_ACCOUNT AccountCategory = 2
|
||||
ACCOUNT_CATEGORY_CREDIT_CARD AccountCategory = 3
|
||||
ACCOUNT_CATEGORY_VIRTUAL AccountCategory = 4
|
||||
ACCOUNT_CATEGORY_DEBT AccountCategory = 5
|
||||
ACCOUNT_CATEGORY_RECEIVABLES AccountCategory = 6
|
||||
ACCOUNT_CATEGORY_INVESTMENT AccountCategory = 7
|
||||
ACCOUNT_CATEGORY_SAVINGS_ACCOUNT AccountCategory = 8
|
||||
ACCOUNT_CATEGORY_CERTIFICATE_OF_DEPOSIT AccountCategory = 9
|
||||
)
|
||||
|
||||
var assetAccountCategory = map[AccountCategory]bool{
|
||||
ACCOUNT_CATEGORY_CASH: true,
|
||||
ACCOUNT_CATEGORY_DEBIT_CARD: true,
|
||||
ACCOUNT_CATEGORY_CREDIT_CARD: false,
|
||||
ACCOUNT_CATEGORY_VIRTUAL: true,
|
||||
ACCOUNT_CATEGORY_DEBT: false,
|
||||
ACCOUNT_CATEGORY_RECEIVABLES: true,
|
||||
ACCOUNT_CATEGORY_INVESTMENT: true,
|
||||
ACCOUNT_CATEGORY_CASH: true,
|
||||
ACCOUNT_CATEGORY_CHECKING_ACCOUNT: true,
|
||||
ACCOUNT_CATEGORY_CREDIT_CARD: false,
|
||||
ACCOUNT_CATEGORY_VIRTUAL: true,
|
||||
ACCOUNT_CATEGORY_DEBT: false,
|
||||
ACCOUNT_CATEGORY_RECEIVABLES: true,
|
||||
ACCOUNT_CATEGORY_INVESTMENT: true,
|
||||
ACCOUNT_CATEGORY_SAVINGS_ACCOUNT: true,
|
||||
ACCOUNT_CATEGORY_CERTIFICATE_OF_DEPOSIT: true,
|
||||
}
|
||||
|
||||
var liabilityAccountCategory = map[AccountCategory]bool{
|
||||
ACCOUNT_CATEGORY_CASH: false,
|
||||
ACCOUNT_CATEGORY_DEBIT_CARD: false,
|
||||
ACCOUNT_CATEGORY_CREDIT_CARD: true,
|
||||
ACCOUNT_CATEGORY_VIRTUAL: false,
|
||||
ACCOUNT_CATEGORY_DEBT: true,
|
||||
ACCOUNT_CATEGORY_RECEIVABLES: false,
|
||||
ACCOUNT_CATEGORY_INVESTMENT: false,
|
||||
ACCOUNT_CATEGORY_CASH: false,
|
||||
ACCOUNT_CATEGORY_CHECKING_ACCOUNT: false,
|
||||
ACCOUNT_CATEGORY_CREDIT_CARD: true,
|
||||
ACCOUNT_CATEGORY_VIRTUAL: false,
|
||||
ACCOUNT_CATEGORY_DEBT: true,
|
||||
ACCOUNT_CATEGORY_RECEIVABLES: false,
|
||||
ACCOUNT_CATEGORY_INVESTMENT: false,
|
||||
ACCOUNT_CATEGORY_SAVINGS_ACCOUNT: false,
|
||||
ACCOUNT_CATEGORY_CERTIFICATE_OF_DEPOSIT: false,
|
||||
}
|
||||
|
||||
// AccountType represents account type
|
||||
|
||||
@@ -11,7 +11,7 @@ func TestAccountInfoResponseSliceLess(t *testing.T) {
|
||||
var accountRespSlice AccountInfoResponseSlice
|
||||
accountRespSlice = append(accountRespSlice, &AccountInfoResponse{
|
||||
Id: 1,
|
||||
Category: ACCOUNT_CATEGORY_DEBIT_CARD,
|
||||
Category: ACCOUNT_CATEGORY_CHECKING_ACCOUNT,
|
||||
DisplayOrder: int32(1),
|
||||
})
|
||||
accountRespSlice = append(accountRespSlice, &AccountInfoResponse{
|
||||
|
||||
+11
-1
@@ -6,7 +6,12 @@ const allAccountCategories = [
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'Debit Card',
|
||||
name: 'Checking Account',
|
||||
defaultAccountIconId: '100'
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
name: 'Savings Account',
|
||||
defaultAccountIconId: '100'
|
||||
},
|
||||
{
|
||||
@@ -29,6 +34,11 @@ const allAccountCategories = [
|
||||
name: 'Receivables',
|
||||
defaultAccountIconId: '700'
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: 'Certificate of Deposit',
|
||||
defaultAccountIconId: '110'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
name: 'Investment Account',
|
||||
|
||||
+22
-4
@@ -100,7 +100,7 @@ export function getSubAccountCurrencies(account, showHidden, subAccountId) {
|
||||
return subAccountCurrencies;
|
||||
}
|
||||
|
||||
export function getCategorizedAccounts(allAccounts) {
|
||||
export function getCategorizedAccountsMap(allAccounts) {
|
||||
const ret = {};
|
||||
|
||||
for (let i = 0; i < allAccounts.length; i++) {
|
||||
@@ -128,8 +128,26 @@ export function getCategorizedAccounts(allAccounts) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function getCategorizedAccounts(allAccounts) {
|
||||
const ret = [];
|
||||
const categorizedAccounts = getCategorizedAccountsMap(allAccounts);
|
||||
|
||||
for (let i = 0; i < accountConstants.allCategories.length; i++) {
|
||||
const category = accountConstants.allCategories[i];
|
||||
|
||||
if (!categorizedAccounts[category.id]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const accountCategory = categorizedAccounts[category.id];
|
||||
ret.push(accountCategory);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function getCategorizedAccountsWithVisibleCount(categorizedAccounts) {
|
||||
const ret = {};
|
||||
const ret = [];
|
||||
|
||||
for (let i = 0; i < accountConstants.allCategories.length; i++) {
|
||||
const accountCategory = accountConstants.allCategories[i];
|
||||
@@ -181,7 +199,7 @@ export function getCategorizedAccountsWithVisibleCount(categorizedAccounts) {
|
||||
}
|
||||
|
||||
if (allAccounts.length > 0) {
|
||||
ret[accountCategory.id] = {
|
||||
ret.push({
|
||||
category: accountCategory.id,
|
||||
name: accountCategory.name,
|
||||
icon: accountCategory.defaultAccountIconId,
|
||||
@@ -191,7 +209,7 @@ export function getCategorizedAccountsWithVisibleCount(categorizedAccounts) {
|
||||
allSubAccounts: allSubAccounts,
|
||||
allVisibleSubAccountCounts: allVisibleSubAccountCounts,
|
||||
allFirstVisibleSubAccountIndexes: allFirstVisibleSubAccountIndexes
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-6
@@ -55,7 +55,7 @@ import {
|
||||
} from './currency.js';
|
||||
|
||||
import {
|
||||
getCategorizedAccounts,
|
||||
getCategorizedAccountsMap,
|
||||
getAllFilteredAccountsBalance
|
||||
} from './account.js';
|
||||
|
||||
@@ -1280,14 +1280,17 @@ function getEnableDisableOptions(translateFn) {
|
||||
}
|
||||
|
||||
function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts, showAccountBalance, defaultCurrency, userStore, settingsStore, exchangeRatesStore, translateFn) {
|
||||
const categorizedAccounts = copyObjectTo(getCategorizedAccounts(allVisibleAccounts), {});
|
||||
const ret = [];
|
||||
const categorizedAccounts = copyObjectTo(getCategorizedAccountsMap(allVisibleAccounts), {});
|
||||
|
||||
for (let category in categorizedAccounts) {
|
||||
if (!Object.prototype.hasOwnProperty.call(categorizedAccounts, category)) {
|
||||
for (let i = 0; i < accountConstants.allCategories.length; i++) {
|
||||
const category = accountConstants.allCategories[i];
|
||||
|
||||
if (!categorizedAccounts[category.id]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const accountCategory = categorizedAccounts[category];
|
||||
const accountCategory = categorizedAccounts[category.id];
|
||||
|
||||
if (accountCategory.accounts) {
|
||||
for (let i = 0; i < accountCategory.accounts.length; i++) {
|
||||
@@ -1339,9 +1342,11 @@ function getCategorizedAccountsWithDisplayBalance(allVisibleAccounts, showAccoun
|
||||
} else {
|
||||
accountCategory.displayBalance = '***';
|
||||
}
|
||||
|
||||
ret.push(accountCategory);
|
||||
}
|
||||
|
||||
return categorizedAccounts;
|
||||
return ret;
|
||||
}
|
||||
|
||||
function joinMultiText(textArray, translateFn) {
|
||||
|
||||
+3
-1
@@ -1395,12 +1395,14 @@
|
||||
"Income": "Income",
|
||||
"Transfer": "Transfer",
|
||||
"Cash": "Cash",
|
||||
"Debit Card": "Debit Card",
|
||||
"Checking Account": "Checking Account",
|
||||
"Credit Card": "Credit Card",
|
||||
"Virtual Account": "Virtual Account",
|
||||
"Debt Account": "Debt Account",
|
||||
"Receivables": "Receivables",
|
||||
"Investment Account": "Investment Account",
|
||||
"Savings Account": "Savings Account",
|
||||
"Certificate of Deposit": "Certificate of Deposit",
|
||||
"Balance": "Balance",
|
||||
"Unable to retrieve account list": "Unable to retrieve account list",
|
||||
"Account list is up to date": "Account list is up to date",
|
||||
|
||||
@@ -1395,12 +1395,14 @@
|
||||
"Income": "收入",
|
||||
"Transfer": "转账",
|
||||
"Cash": "现金",
|
||||
"Debit Card": "借记卡",
|
||||
"Checking Account": "借记账户",
|
||||
"Credit Card": "信用卡",
|
||||
"Virtual Account": "虚拟账户",
|
||||
"Debt Account": "负债账户",
|
||||
"Receivables": "应收款项",
|
||||
"Investment Account": "投资账户",
|
||||
"Savings Account": "储蓄账户",
|
||||
"Certificate of Deposit": "定期存款",
|
||||
"Balance": "余额",
|
||||
"Unable to retrieve account list": "无法获取账户列表",
|
||||
"Account list is up to date": "账户列表已是最新",
|
||||
|
||||
@@ -10,7 +10,7 @@ import colorConstants from '@/consts/color.js';
|
||||
import services from '@/lib/services.js';
|
||||
import logger from '@/lib/logger.js';
|
||||
import { isNumber, isEquals } from '@/lib/common.js';
|
||||
import { getCategorizedAccounts, getAllFilteredAccountsBalance } from '@/lib/account.js';
|
||||
import { getCategorizedAccountsMap, getAllFilteredAccountsBalance } from '@/lib/account.js';
|
||||
|
||||
function loadAccountList(state, accounts) {
|
||||
state.allAccounts = accounts;
|
||||
@@ -28,7 +28,7 @@ function loadAccountList(state, accounts) {
|
||||
}
|
||||
}
|
||||
|
||||
state.allCategorizedAccounts = getCategorizedAccounts(accounts);
|
||||
state.allCategorizedAccounts = getCategorizedAccountsMap(accounts);
|
||||
}
|
||||
|
||||
function addAccountToAccountList(state, account) {
|
||||
@@ -56,7 +56,7 @@ function addAccountToAccountList(state, account) {
|
||||
const accountList = state.allCategorizedAccounts[account.category].accounts;
|
||||
accountList.push(account);
|
||||
} else {
|
||||
state.allCategorizedAccounts = getCategorizedAccounts(state.allAccounts);
|
||||
state.allCategorizedAccounts = getCategorizedAccountsMap(state.allAccounts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<v-main>
|
||||
<v-window class="d-flex flex-grow-1 disable-tab-transition w-100-window-container" v-model="activeTab">
|
||||
<v-window-item value="accountPage">
|
||||
<v-card variant="flat" min-height="680">
|
||||
<v-card variant="flat" min-height="780">
|
||||
<template #title>
|
||||
<div class="title-and-toolbar d-flex align-center">
|
||||
<v-btn class="mr-3 d-md-none" density="compact" color="default" variant="plain"
|
||||
|
||||
Reference in New Issue
Block a user