mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
improve ui
This commit is contained in:
@@ -778,6 +778,60 @@ function categroyTypeToTransactionType(categoryType) {
|
||||
}
|
||||
}
|
||||
|
||||
function allVisibleTransactionCategories(allTransactionCategories) {
|
||||
const ret = {};
|
||||
|
||||
for (let key in transactionConstants.allTransactionTypes) {
|
||||
if (!Object.prototype.hasOwnProperty.call(transactionConstants.allTransactionTypes, key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const transactionType = transactionConstants.allTransactionTypes[key];
|
||||
|
||||
if (!allTransactionCategories[transactionType]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const allCategories = allTransactionCategories[transactionType];
|
||||
const visibleCategories = [];
|
||||
const allVisibleSubCategories = {};
|
||||
|
||||
for (let j = 0; j < allCategories.length; j++) {
|
||||
const category = allCategories[j];
|
||||
|
||||
if (category.hidden) {
|
||||
continue;
|
||||
}
|
||||
|
||||
visibleCategories.push(category);
|
||||
|
||||
if (category.subCategories) {
|
||||
const visibleSubCategories = [];
|
||||
|
||||
for (let k = 0; k < category.subCategories.length; k++) {
|
||||
const subCategory = category.subCategories[k];
|
||||
|
||||
if (!subCategory.hidden) {
|
||||
visibleSubCategories.push(subCategory);
|
||||
}
|
||||
}
|
||||
|
||||
if (visibleSubCategories.length > 0) {
|
||||
allVisibleSubCategories[category.id] = visibleSubCategories;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret[transactionType.toString()] = {
|
||||
type: transactionType.toString(),
|
||||
visibleCategories: visibleCategories,
|
||||
visibleSubCategories: allVisibleSubCategories
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getCategoryInfo(categoryId) {
|
||||
for (let i = 0; i < accountConstants.allCategories.length; i++) {
|
||||
if (accountConstants.allCategories[i].id === categoryId) {
|
||||
@@ -816,6 +870,60 @@ function getCategorizedAccounts(allAccounts) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getVisibleCategorizedAccounts(categorizedAccounts) {
|
||||
const ret = {};
|
||||
|
||||
for (let i = 0; i < accountConstants.allCategories.length; i++) {
|
||||
const accountCategory = accountConstants.allCategories[i];
|
||||
|
||||
if (!categorizedAccounts[accountCategory.id] || !categorizedAccounts[accountCategory.id].accounts) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const allAccounts = categorizedAccounts[accountCategory.id].accounts;
|
||||
const visibleAccounts = [];
|
||||
const allVisibleSubAccounts = {};
|
||||
|
||||
for (let j = 0; j < allAccounts.length; j++) {
|
||||
const account = allAccounts[j];
|
||||
|
||||
if (account.hidden) {
|
||||
continue;
|
||||
}
|
||||
|
||||
visibleAccounts.push(account);
|
||||
|
||||
if (account.type === accountConstants.allAccountTypes.MultiSubAccounts && account.subAccounts) {
|
||||
const visibleSubAccounts = [];
|
||||
|
||||
for (let k = 0; k < account.subAccounts.length; k++) {
|
||||
const subAccount = account.subAccounts[k];
|
||||
|
||||
if (!subAccount.hidden) {
|
||||
visibleSubAccounts.push(subAccount);
|
||||
}
|
||||
}
|
||||
|
||||
if (visibleSubAccounts.length > 0) {
|
||||
allVisibleSubAccounts[account.id] = visibleSubAccounts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (visibleAccounts.length > 0) {
|
||||
ret[accountCategory.id] = {
|
||||
category: accountCategory.id,
|
||||
name: accountCategory.name,
|
||||
icon: accountCategory.defaultAccountIconId,
|
||||
visibleAccounts: visibleAccounts,
|
||||
visibleSubAccounts: allVisibleSubAccounts
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getAllFilteredAccountsBalance(categorizedAccounts, accountFilter) {
|
||||
const allAccountCategories = accountConstants.allCategories;
|
||||
const ret = [];
|
||||
@@ -961,8 +1069,10 @@ export default {
|
||||
parseDeviceInfo,
|
||||
transactionTypeToCategroyType,
|
||||
categroyTypeToTransactionType,
|
||||
allVisibleTransactionCategories,
|
||||
getCategoryInfo,
|
||||
getCategorizedAccounts,
|
||||
getVisibleCategorizedAccounts,
|
||||
getAllFilteredAccountsBalance,
|
||||
makeButtonCopyToClipboard,
|
||||
changeClipboardObjectText,
|
||||
|
||||
Reference in New Issue
Block a user