total amount on the account list page supports excluding specified accounts (#161)

This commit is contained in:
MaysWind
2025-06-29 22:27:34 +08:00
parent 90e862fbb1
commit 801c0f8572
25 changed files with 305 additions and 24 deletions
+2
View File
@@ -27,6 +27,8 @@ var ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES = map[string]UserApplicationClo
"autoSaveTransactionDraft": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING,
"autoGetCurrentGeoLocation": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
"alwaysShowTransactionPicturesInMobileTransactionEditPage": USER_APPLICATION_CLOUD_SETTING_TYPE_BOOLEAN,
// Account List Page
"totalAmountExcludeAccountIds": USER_APPLICATION_CLOUD_SETTING_TYPE_STRING_BOOLEAN_MAP,
// Exchange Rates Data Page
"currencySortByInExchangeRatesPage": USER_APPLICATION_CLOUD_SETTING_TYPE_NUMBER,
// Statistics Settings
+6
View File
@@ -45,6 +45,8 @@ export interface ApplicationSettings extends BaseApplicationSetting {
autoSaveTransactionDraft: string;
autoGetCurrentGeoLocation: boolean;
alwaysShowTransactionPicturesInMobileTransactionEditPage: boolean;
// Account List Page
totalAmountExcludeAccountIds: Record<string, boolean>;
// Exchange Rates Data Page
currencySortByInExchangeRatesPage: number;
// Statistics Settings
@@ -101,6 +103,8 @@ export const ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES: Record<string, UserAp
'autoSaveTransactionDraft': UserApplicationCloudSettingType.String,
'autoGetCurrentGeoLocation': UserApplicationCloudSettingType.Boolean,
'alwaysShowTransactionPicturesInMobileTransactionEditPage': UserApplicationCloudSettingType.Boolean,
// Account List Page
'totalAmountExcludeAccountIds': UserApplicationCloudSettingType.StringBooleanMap,
// Exchange Rates Data Page
'currencySortByInExchangeRatesPage': UserApplicationCloudSettingType.Number,
// Statistics Settings
@@ -141,6 +145,8 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = {
autoSaveTransactionDraft: 'disabled',
autoGetCurrentGeoLocation: false,
alwaysShowTransactionPicturesInMobileTransactionEditPage: false,
// Account List Page
totalAmountExcludeAccountIds: {},
// Exchange Rates Data Page
currencySortByInExchangeRatesPage: CurrencySortingType.Default.type,
// Statistics Settings
+15 -3
View File
@@ -265,7 +265,7 @@ export function selectAccountOrSubAccounts(filterAccountIds: Record<string, bool
}
}
export function selectAll(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>): void {
export function selectAll(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>, skipHiddenAccount: boolean): void {
for (const accountId in filterAccountIds) {
if (!Object.prototype.hasOwnProperty.call(filterAccountIds, accountId)) {
continue;
@@ -273,13 +273,17 @@ export function selectAll(filterAccountIds: Record<string, boolean>, allAccounts
const account = allAccountsMap[accountId];
if (skipHiddenAccount && account && account.hidden) {
continue;
}
if (account && account.type === AccountType.SingleAccount.type) {
filterAccountIds[account.id] = false;
}
}
}
export function selectNone(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>): void {
export function selectNone(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>, skipHiddenAccount: boolean): void {
for (const accountId in filterAccountIds) {
if (!Object.prototype.hasOwnProperty.call(filterAccountIds, accountId)) {
continue;
@@ -287,13 +291,17 @@ export function selectNone(filterAccountIds: Record<string, boolean>, allAccount
const account = allAccountsMap[accountId];
if (skipHiddenAccount && account && account.hidden) {
continue;
}
if (account && account.type === AccountType.SingleAccount.type) {
filterAccountIds[account.id] = true;
}
}
}
export function selectInvert(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>): void {
export function selectInvert(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>, skipHiddenAccount: boolean): void {
for (const accountId in filterAccountIds) {
if (!Object.prototype.hasOwnProperty.call(filterAccountIds, accountId)) {
continue;
@@ -301,6 +309,10 @@ export function selectInvert(filterAccountIds: Record<string, boolean>, allAccou
const account = allAccountsMap[accountId];
if (skipHiddenAccount && account && account.hidden) {
continue;
}
if (account && account.type === AccountType.SingleAccount.type) {
filterAccountIds[account.id] = !filterAccountIds[account.id];
}
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Alle Typen",
"More": "Mehr",
"All": "Alle",
"Partial": "Partial",
"Today": "Heute",
"Yesterday": "Gestern",
"Recent 7 days": "Letzte 7 Tage",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Konto kann nicht gespeichert werden",
"Show Hidden Accounts": "Versteckte Konten anzeigen",
"Hide Hidden Accounts": "Versteckte Konten ausblenden",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Konto kann nicht abgerufen werden",
"Unable to hide this account": "Dieses Konto kann nicht ausgeblendet werden",
"Unable to unhide this account": "Dieses Konto kann nicht eingeblendet werden",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Bestätigung jedes mal anzeigen",
"Automatically Add Geolocation": "Geolocation automatisch hinzufügen",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Wechselkursdatenseite",
"Exchange Rate": "Wechselkurs",
"Enable Animation": "Animation aktivieren",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "All Types",
"More": "More",
"All": "All",
"Partial": "Partial",
"Today": "Today",
"Yesterday": "Yesterday",
"Recent 7 days": "Recent 7 days",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Unable to save account",
"Show Hidden Accounts": "Show Hidden Accounts",
"Hide Hidden Accounts": "Hide Hidden Accounts",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Unable to retrieve account",
"Unable to hide this account": "Unable to hide this account",
"Unable to unhide this account": "Unable to unhide this account",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Show Confirmation Every Time",
"Automatically Add Geolocation": "Automatically Add Geolocation",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Exchange Rates Data Page",
"Exchange Rate": "Exchange Rate",
"Enable Animation": "Enable Animation",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Todos los tipos",
"More": "Más",
"All": "Todo",
"Partial": "Partial",
"Today": "Hoy",
"Yesterday": "Ayer",
"Recent 7 days": "Últimos 7 días",
@@ -1610,6 +1611,7 @@
"Unable to save account": "No se puede guardar la cuenta",
"Show Hidden Accounts": "Mostrar cuentas ocultas",
"Hide Hidden Accounts": "Ocultar cuentas ocultas",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "No se puede recuperar la cuenta",
"Unable to hide this account": "No se puede ocultar esta cuenta",
"Unable to unhide this account": "No se puede mostrar esta cuenta",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Mostrar confirmación cada vez",
"Automatically Add Geolocation": "Agregar geolocalización automáticamente",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Página de datos de tipos de cambio",
"Exchange Rate": "Tipo de cambio",
"Enable Animation": "Habilitar animación",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Tutti i tipi",
"More": "Altro",
"All": "Tutti",
"Partial": "Partial",
"Today": "Oggi",
"Yesterday": "Ieri",
"Recent 7 days": "Ultimi 7 giorni",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Impossibile salvare l'account",
"Show Hidden Accounts": "Mostra account nascosti",
"Hide Hidden Accounts": "Nascondi account nascosti",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Impossibile recuperare l'account",
"Unable to hide this account": "Impossibile nascondere questo account",
"Unable to unhide this account": "Impossibile mostrare questo account",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Mostra conferma ogni volta",
"Automatically Add Geolocation": "Aggiungi automaticamente geolocalizzazione",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Pagina dati tassi di cambio",
"Exchange Rate": "Tasso di cambio",
"Enable Animation": "Abilita animazione",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "全種類",
"More": "さらに",
"All": "すべて",
"Partial": "Partial",
"Today": "今日",
"Yesterday": "昨日",
"Recent 7 days": "直近7日間",
@@ -1610,6 +1611,7 @@
"Unable to save account": "口座を保存できません",
"Show Hidden Accounts": "非表示口座を表示します",
"Hide Hidden Accounts": "非表示口座を隠します",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "口座を取得できません",
"Unable to hide this account": "この口座は非表示にできません",
"Unable to unhide this account": "この口座は非表示を解除できません",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "確認を毎回表示",
"Automatically Add Geolocation": "座標を自動的に追加",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "為替レートデータページ",
"Exchange Rate": "為替レート",
"Enable Animation": "アニメーションの有効",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Todos os Tipos",
"More": "Mais",
"All": "Todos",
"Partial": "Partial",
"Today": "Hoje",
"Yesterday": "Ontem",
"Recent 7 days": "Últimos 7 dias",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Não foi possível salvar conta",
"Show Hidden Accounts": "Mostrar Contas Ocultas",
"Hide Hidden Accounts": "Ocultar Contas Ocultas",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Não foi possível recuperar conta",
"Unable to hide this account": "Não foi possível ocultar esta conta",
"Unable to unhide this account": "Não foi possível desocultar esta conta",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Mostrar Confirmação Toda Vez",
"Automatically Add Geolocation": "Adicionar Geolocalização Automaticamente",
"Always Show Transaction Pictures": "Sempre Mostrar Imagens de Transações",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Página de Dados de Taxas de Câmbio",
"Exchange Rate": "Taxa de Câmbio",
"Enable Animation": "Habilitar Animação",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Все типы",
"More": "Еще",
"All": "Все",
"Partial": "Partial",
"Today": "Сегодня",
"Yesterday": "Вчера",
"Recent 7 days": "Последние 7 дней",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Не удалось сохранить счет",
"Show Hidden Accounts": "Показать скрытые счета",
"Hide Hidden Accounts": "Скрыть скрытые счета",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Не удалось получить счет",
"Unable to hide this account": "Не удалось скрыть этот счет",
"Unable to unhide this account": "Не удалось отобразить этот счет",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Показывать подтверждение каждый раз",
"Automatically Add Geolocation": "Автоматически добавлять геолокацию",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Страница данных о курсах валют",
"Exchange Rate": "Курс обмена",
"Enable Animation": "Включить анимацию",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Усі типи",
"More": "Більше",
"All": "Усе",
"Partial": "Partial",
"Today": "Сьогодні",
"Yesterday": "Вчора",
"Recent 7 days": "Останні 7 днів",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Не вдалося зберегти рахунок",
"Show Hidden Accounts": "Показати приховані рахунки",
"Hide Hidden Accounts": "Приховати приховані рахунки",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Не вдалося отримати рахунок",
"Unable to hide this account": "Не вдалося приховати цей рахунок",
"Unable to unhide this account": "Не вдалося відобразити цей рахунок",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Показувати підтвердження щоразу",
"Automatically Add Geolocation": "Автоматично додавати геолокацію",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Сторінка курсів валют",
"Exchange Rate": "Курс обміну",
"Enable Animation": "Увімкнути анімацію",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "Tất cả các loại",
"More": "Thêm",
"All": "Tất cả",
"Partial": "Partial",
"Today": "Hôm nay",
"Yesterday": "Hôm qua",
"Recent 7 days": "7 ngày gần đây",
@@ -1610,6 +1611,7 @@
"Unable to save account": "Không thể lưu tài khoản",
"Show Hidden Accounts": "Hiển thị tài khoản ẩn",
"Hide Hidden Accounts": "Ẩn tài khoản ẩn",
"Set Accounts Included in Total": "Set Accounts Included in Total",
"Unable to retrieve account": "Không thể lấy tài khoản",
"Unable to hide this account": "Không thể ẩn tài khoản này",
"Unable to unhide this account": "Không thể hiển thị tài khoản này",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "Hiển thị xác nhận mỗi lần",
"Automatically Add Geolocation": "Tự động thêm vị trí địa lý",
"Always Show Transaction Pictures": "Always Show Transaction Pictures",
"Account List Page": "Account List Page",
"Accounts Included in Total": "Accounts Included in Total",
"Exchange Rates Data Page": "Trang dữ liệu tỷ giá hối đoái",
"Exchange Rate": "Tỷ giá hối đoái",
"Enable Animation": "Bật hoạt ảnh",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "全部类型",
"More": "更多",
"All": "全部",
"Partial": "部分",
"Today": "今天",
"Yesterday": "昨天",
"Recent 7 days": "最近7天",
@@ -1610,6 +1611,7 @@
"Unable to save account": "无法保存账户",
"Show Hidden Accounts": "显示隐藏的账户",
"Hide Hidden Accounts": "不显示隐藏的账户",
"Set Accounts Included in Total": "设置计入总金额的账户",
"Unable to retrieve account": "无法获取账户",
"Unable to hide this account": "无法隐藏账户",
"Unable to unhide this account": "无法取消隐藏账户",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "每次提示确认",
"Automatically Add Geolocation": "自动添加地理位置",
"Always Show Transaction Pictures": "总是显示交易图片",
"Account List Page": "账户列表页面",
"Accounts Included in Total": "计入总金额的账户",
"Exchange Rates Data Page": "汇率数据页面",
"Exchange Rate": "汇率",
"Enable Animation": "启用动画",
+4
View File
@@ -1372,6 +1372,7 @@
"All Types": "全部類型",
"More": "更多",
"All": "全部",
"Partial": "部分",
"Today": "今天",
"Yesterday": "昨天",
"Recent 7 days": "最近7天",
@@ -1610,6 +1611,7 @@
"Unable to save account": "無法儲存帳戶",
"Show Hidden Accounts": "顯示隱藏的帳戶",
"Hide Hidden Accounts": "不顯示隱藏的帳戶",
"Set Accounts Included in Total": "設定計入總金額的帳戶",
"Unable to retrieve account": "無法取得帳戶",
"Unable to hide this account": "無法隱藏帳戶",
"Unable to unhide this account": "無法取消隱藏帳戶",
@@ -1886,6 +1888,8 @@
"Show Confirmation Every Time": "每次提示確認",
"Automatically Add Geolocation": "自動新增地理位置",
"Always Show Transaction Pictures": "總是顯示交易圖片",
"Account List Page": "帳戶清單頁面",
"Accounts Included in Total": "計入總金額的帳戶",
"Exchange Rates Data Page": "匯率資料頁面",
"Exchange Rate": "匯率",
"Enable Animation": "啟用動畫",
+11 -3
View File
@@ -1,6 +1,7 @@
import { ref, computed } from 'vue';
import { defineStore } from 'pinia';
import { useSettingsStore } from './setting.ts';
import { useUserStore } from './user.ts';
import { useExchangeRatesStore } from './exchangeRates.ts';
@@ -21,6 +22,7 @@ import services from '@/lib/services.ts';
import logger from '@/lib/logger.ts';
export const useAccountsStore = defineStore('accounts', () => {
const settingsStore = useSettingsStore();
const userStore = useUserStore();
const exchangeRatesStore = useExchangeRatesStore();
@@ -484,7 +486,9 @@ export const useAccountsStore = defineStore('accounts', () => {
return '***';
}
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, () => true);
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
!settingsStore.appSettings.totalAmountExcludeAccountIds[account.id]
);
let netAssets = 0;
let hasUnCalculatedAmount = false;
@@ -515,7 +519,9 @@ export const useAccountsStore = defineStore('accounts', () => {
return '***';
}
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account => account.isAsset || false);
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
!settingsStore.appSettings.totalAmountExcludeAccountIds[account.id] && (account.isAsset || false)
);
let totalAssets = 0;
let hasUnCalculatedAmount = false;
@@ -546,7 +552,9 @@ export const useAccountsStore = defineStore('accounts', () => {
return '***';
}
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account => account.isLiability || false);
const accountsBalance = getAllFilteredAccountsBalance(allCategorizedAccountsMap.value, account =>
!settingsStore.appSettings.totalAmountExcludeAccountIds[account.id] && (account.isLiability || false)
);
let totalLiabilities = 0;
let hasUnCalculatedAmount = false;
+9
View File
@@ -220,6 +220,13 @@ export const useSettingsStore = defineStore('settings', () => {
updateUserApplicationCloudSettingValue('alwaysShowTransactionPicturesInMobileTransactionEditPage', value);
}
// Account List Page
function setTotalAmountExcludeAccountIds(value: Record<string, boolean>): void {
updateApplicationSettingsValue('totalAmountExcludeAccountIds', value);
appSettings.value.totalAmountExcludeAccountIds = value;
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
}
// Exchange Rates Data Page
function setCurrencySortByInExchangeRatesPage(value: number): void {
updateApplicationSettingsValue('currencySortByInExchangeRatesPage', value);
@@ -429,6 +436,8 @@ export const useSettingsStore = defineStore('settings', () => {
setAutoSaveTransactionDraft,
setAutoGetCurrentGeoLocation,
setAlwaysShowTransactionPicturesInMobileTransactionEditPage,
// -- Account List Page
setTotalAmountExcludeAccountIds,
// -- Exchange Rates Data Page
setCurrencySortByInExchangeRatesPage,
// -- Statistics Settings
@@ -39,6 +39,10 @@ export function useAccountFilterSettingPageBase(type?: string) {
}
});
const allowHiddenAccount = computed<boolean>(() => {
return type === 'statisticsDefault' || type === 'statisticsCurrent' || type === 'transactionListCurrent';
});
const allCategorizedAccounts = computed<AccountCategoriesWithVisibleCount[]>(() => getCategorizedAccountsWithVisibleCount(accountsStore.allCategorizedAccountsMap));
const hasAnyAvailableAccount = computed<boolean>(() => accountsStore.allAvailableAccountsCount > 0);
@@ -64,6 +68,10 @@ export function useAccountFilterSettingPageBase(type?: string) {
const account = accountsStore.allAccountsMap[accountId];
if (!allowHiddenAccount.value && account.hidden) {
continue;
}
if (type === 'transactionListCurrent' && transactionsStore.allFilterAccountIdsCount > 0) {
allAccountIds[account.id] = true;
} else {
@@ -91,6 +99,9 @@ export function useAccountFilterSettingPageBase(type?: string) {
}
filterAccountIds.value = allAccountIds;
return true;
} else if (type === 'accountListTotalAmount') {
filterAccountIds.value = Object.assign(allAccountIds, settingsStore.appSettings.totalAmountExcludeAccountIds);
return true;
} else {
return false;
}
@@ -109,6 +120,10 @@ export function useAccountFilterSettingPageBase(type?: string) {
const account = accountsStore.allAccountsMap[accountId];
if (!allowHiddenAccount.value && account.hidden) {
continue;
}
if (!isAccountOrSubAccountsAllChecked(account, filterAccountIds.value)) {
filteredAccountIds[accountId] = true;
isAllSelected = false;
@@ -135,6 +150,8 @@ export function useAccountFilterSettingPageBase(type?: string) {
if (changed) {
transactionsStore.updateTransactionListInvalidState(true);
}
} else if (type === 'accountListTotalAmount') {
settingsStore.setTotalAmountExcludeAccountIds(filteredAccountIds);
}
return changed;
@@ -148,6 +165,7 @@ export function useAccountFilterSettingPageBase(type?: string) {
// computed states
title,
applyText,
allowHiddenAccount,
allCategorizedAccounts,
hasAnyAvailableAccount,
hasAnyVisibleAccount,
@@ -47,6 +47,12 @@ export const ALL_APPLICATION_CLOUD_SETTINGS: CategorizedApplicationCloudSettingI
{ settingKey: 'alwaysShowTransactionPicturesInMobileTransactionEditPage', settingName: 'Always Show Transaction Pictures', mobile: true, desktop: false }
]
},
{
categoryName: 'Account List Page',
items: [
{ settingKey: 'totalAmountExcludeAccountIds', settingName: 'Accounts Included in Total', mobile: true, desktop: true },
]
},
{
categoryName: 'Exchange Rates Data Page',
items: [
+53 -2
View File
@@ -1,8 +1,9 @@
import { computed } from 'vue';
import { ref, computed } from 'vue';
import { useI18n } from '@/locales/helpers.ts';
import { useSettingsStore } from '@/stores/setting.ts';
import { useAccountsStore } from '@/stores/account.ts';
import { useTransactionsStore } from '@/stores/transaction.ts';
import { useOverviewStore } from '@/stores/overview.ts';
import { useStatisticsStore } from '@/stores/statistics.ts';
@@ -14,10 +15,13 @@ export function useAppSettingPageBase() {
const { tt, getAllTimezones, getAllTimezoneTypesUsedForStatistics, getAllCurrencySortingTypes, setTimeZone } = useI18n();
const settingsStore = useSettingsStore();
const accountsStore = useAccountsStore();
const transactionsStore = useTransactionsStore();
const overviewStore = useOverviewStore();
const statisticsStore = useStatisticsStore();
const loadingAccounts = ref<boolean>(false);
const allThemes = computed<NameValue[]>(() => {
return [
{ name: tt('System Default'), value: 'auto' },
@@ -38,6 +42,8 @@ export function useAppSettingPageBase() {
];
});
const hasAnyVisibleAccount = computed<boolean>(() => accountsStore.allVisibleAccountsCount > 0);
const timeZone = computed<string>({
get: () => settingsStore.appSettings.timeZone,
set: (value) => {
@@ -108,7 +114,50 @@ export function useAppSettingPageBase() {
set: (value: number) => settingsStore.setCurrencySortByInExchangeRatesPage(value)
});
const accountsIncludedInTotalDisplayContent = computed<string>(() => {
if (loadingAccounts.value || !accountsStore.allVisiblePlainAccounts || !accountsStore.allVisiblePlainAccounts.length) {
return '';
}
const excludeAccountIds = settingsStore.appSettings.totalAmountExcludeAccountIds;
let hasExcludeAccount = false;
for (const accountId in excludeAccountIds) {
if (!Object.prototype.hasOwnProperty.call(excludeAccountIds, accountId)) {
continue;
}
if (excludeAccountIds[accountId]) {
hasExcludeAccount = true;
break;
}
}
if (!hasExcludeAccount) {
return tt('All');
}
let allVisibleAccountExcluded = true;
for (let i = 0; i < accountsStore.allVisiblePlainAccounts.length; i++) {
const account = accountsStore.allVisiblePlainAccounts[i];
if (!excludeAccountIds[account.id]) {
allVisibleAccountExcluded = false;
break;
}
}
if (allVisibleAccountExcluded) {
return tt('None');
}
return tt('Partial');
});
return {
// states
loadingAccounts,
// computed states
allThemes,
allTimezones,
@@ -116,6 +165,7 @@ export function useAppSettingPageBase() {
allCurrencySortingTypes,
allAutoSaveTransactionDraftTypes,
timeZone,
hasAnyVisibleAccount,
isAutoUpdateExchangeRatesData,
showAccountBalance,
showAmountInHomePage,
@@ -125,6 +175,7 @@ export function useAppSettingPageBase() {
showTagInTransactionListPage,
autoSaveTransactionDraft,
isAutoGetCurrentGeoLocation,
currencySortByInExchangeRatesPage
currencySortByInExchangeRatesPage,
accountsIncludedInTotalDisplayContent
};
}
+13
View File
@@ -80,6 +80,10 @@
<v-list-item :prepend-icon="mdiEyeOffOutline"
:title="tt('Hide Hidden Accounts')"
v-if="showHidden" @click="showHidden = false"></v-list-item>
<v-divider class="my-2" v-if="hasAnyVisibleAccount"/>
<v-list-item :prepend-icon="mdiCalculatorVariantOutline"
:title="tt('Set Accounts Included in Total')"
v-if="hasAnyVisibleAccount" @click="showAccountsIncludedInTotalDialog = true"></v-list-item>
</v-list>
</v-menu>
</v-btn>
@@ -248,6 +252,11 @@
</v-col>
</v-row>
<v-dialog width="800" v-model="showAccountsIncludedInTotalDialog">
<account-filter-settings-card type="accountListTotalAmount" :dialog-mode="true"
@settings:change="showAccountsIncludedInTotalDialog = false" />
</v-dialog>
<edit-dialog ref="editDialog" />
<confirm-dialog ref="confirmDialog"/>
@@ -258,6 +267,7 @@
import ConfirmDialog from '@/components/desktop/ConfirmDialog.vue';
import SnackBar from '@/components/desktop/SnackBar.vue';
import EditDialog from './list/dialogs/EditDialog.vue';
import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue';
import { ref, computed, useTemplateRef, watch } from 'vue';
import { useDisplay } from 'vuetify';
@@ -273,6 +283,7 @@ import type { Account } from '@/models/account.ts';
import {
mdiEyeOutline,
mdiEyeOffOutline,
mdiCalculatorVariantOutline,
mdiRefresh,
mdiSquareRounded,
mdiMenu,
@@ -317,7 +328,9 @@ const activeTab = ref<string>('accountPage');
const activeSubAccount = ref<Record<string, string>>({});
const alwaysShowNav = ref<boolean>(display.mdAndUp.value);
const showNav = ref<boolean>(display.mdAndUp.value);
const showAccountsIncludedInTotalDialog = ref<boolean>(false);
const hasAnyVisibleAccount = computed<boolean>(() => accountsStore.allVisibleAccountsCount > 0);
const activeAccountCategory = computed<AccountCategory | undefined>(() => AccountCategory.valueOf(activeAccountCategoryType.value));
const activeAccountCategoryTotalBalance = computed<string>(() => accountCategoryTotalBalance(activeAccountCategory.value));
@@ -192,6 +192,32 @@
</v-card>
</v-col>
<v-col cols="12">
<v-card :title="tt('Account List Page')">
<v-form>
<v-card-text>
<v-row>
<v-col cols="12" md="6">
<v-text-field
class="always-cursor-pointer"
item-title="displayName"
item-value="type"
persistent-placeholder
:loading="loadingAccounts"
:readonly="true"
:disabled="!hasAnyVisibleAccount"
:label="tt('Accounts Included in Total')"
:placeholder="tt('Accounts Included in Total')"
:model-value="accountsIncludedInTotalDisplayContent"
@click="showAccountsIncludedInTotalDialog = true"
/>
</v-col>
</v-row>
</v-card-text>
</v-form>
</v-card>
</v-col>
<v-col cols="12">
<v-card :title="tt('Exchange Rates Data Page')">
<v-form>
@@ -214,30 +240,45 @@
</v-card>
</v-col>
</v-row>
<v-dialog width="800" v-model="showAccountsIncludedInTotalDialog">
<account-filter-settings-card type="accountListTotalAmount" :dialog-mode="true"
@settings:change="showAccountsIncludedInTotalDialog = false" />
</v-dialog>
<snack-bar ref="snackbar" />
</template>
<script setup lang="ts">
import { computed } from 'vue';
import SnackBar from '@/components/desktop/SnackBar.vue';
import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue';
import { ref, computed, useTemplateRef } from 'vue';
import { useTheme } from 'vuetify';
import { useI18n } from '@/locales/helpers.ts';
import { useAppSettingPageBase } from '@/views/base/settings/AppSettingsPageBase.ts';
import { useSettingsStore } from '@/stores/setting.ts';
import { useAccountsStore } from '@/stores/account.ts';
import type { LocalizedSwitchOption } from '@/core/base.ts';
import { ThemeType } from '@/core/theme.ts';
import { getSystemTheme } from '@/lib/ui/common.ts';
type SnackBarType = InstanceType<typeof SnackBar>;
const theme = useTheme();
const { tt, getAllEnableDisableOptions } = useI18n();
const {
loadingAccounts,
allThemes,
allTimezones,
allTimezoneTypesUsedForStatistics,
allCurrencySortingTypes,
allAutoSaveTransactionDraftTypes,
hasAnyVisibleAccount,
timeZone,
isAutoUpdateExchangeRatesData,
showAccountBalance,
@@ -248,10 +289,16 @@ const {
showTagInTransactionListPage,
autoSaveTransactionDraft,
isAutoGetCurrentGeoLocation,
currencySortByInExchangeRatesPage
currencySortByInExchangeRatesPage,
accountsIncludedInTotalDisplayContent
} = useAppSettingPageBase();
const settingsStore = useSettingsStore();
const accountsStore = useAccountsStore();
const snackbar = useTemplateRef<SnackBarType>('snackbar');
const showAccountsIncludedInTotalDialog = ref<boolean>(false);
const enableDisableOptions = computed<LocalizedSwitchOption[]>(() => getAllEnableDisableOptions());
@@ -274,4 +321,22 @@ const showAddTransactionButtonInDesktopNavbar = computed<boolean>({
get: () => settingsStore.appSettings.showAddTransactionButtonInDesktopNavbar,
set: (value) => settingsStore.setShowAddTransactionButtonInDesktopNavbar(value)
});
function init(): void {
loadingAccounts.value = true;
accountsStore.loadAllAccounts({
force: false
}).then(() => {
loadingAccounts.value = false;
}).catch(error => {
loadingAccounts.value = false;
if (!error.processed) {
snackbar.value?.showError(error);
}
});
}
init();
</script>
@@ -22,13 +22,13 @@
:title="tt('Invert Selection')"
:disabled="!hasAnyVisibleAccount"
@click="selectInvertAccounts"></v-list-item>
<v-divider class="my-2"/>
<v-divider class="my-2" v-if="allowHiddenAccount"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Accounts')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
v-if="allowHiddenAccount && !showHidden" @click="showHidden = true"></v-list-item>
<v-list-item :prepend-icon="mdiEyeOffOutline"
:title="tt('Hide Hidden Accounts')"
v-if="showHidden" @click="showHidden = false"></v-list-item>
v-if="allowHiddenAccount && showHidden" @click="showHidden = false"></v-list-item>
</v-list>
</v-menu>
</v-btn>
@@ -53,13 +53,13 @@
:title="tt('Invert Selection')"
:disabled="!hasAnyVisibleAccount"
@click="selectInvertAccounts"></v-list-item>
<v-divider class="my-2"/>
<v-divider class="my-2" v-if="allowHiddenAccount"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Accounts')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
v-if="allowHiddenAccount && !showHidden" @click="showHidden = true"></v-list-item>
<v-list-item :prepend-icon="mdiEyeOffOutline"
:title="tt('Hide Hidden Accounts')"
v-if="showHidden" @click="showHidden = false"></v-list-item>
v-if="allowHiddenAccount && showHidden" @click="showHidden = false"></v-list-item>
</v-list>
</v-menu>
</v-btn>
@@ -196,6 +196,7 @@ const {
filterAccountIds,
title,
applyText,
allowHiddenAccount,
allCategorizedAccounts,
hasAnyAvailableAccount,
hasAnyVisibleAccount,
@@ -245,7 +246,7 @@ function updateAccountSelected(account: Account, value: boolean | null): void {
}
function selectAllAccounts(): void {
selectAll(filterAccountIds.value, accountsStore.allAccountsMap);
selectAll(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
if (props.autoSave) {
save();
@@ -253,7 +254,7 @@ function selectAllAccounts(): void {
}
function selectNoneAccounts(): void {
selectNone(filterAccountIds.value, accountsStore.allAccountsMap);
selectNone(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
if (props.autoSave) {
save();
@@ -261,7 +262,7 @@ function selectNoneAccounts(): void {
}
function selectInvertAccounts(): void {
selectInvert(filterAccountIds.value, accountsStore.allAccountsMap);
selectInvert(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
if (props.autoSave) {
save();
+8
View File
@@ -159,6 +159,9 @@
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Accounts') }}</f7-actions-button>
<f7-actions-button v-if="showHidden" @click="showHidden = false">{{ tt('Hide Hidden Accounts') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group v-if="hasAnyVisibleAccount">
<f7-actions-button @click="setAccountsIncludedInTotal()">{{ tt('Set Accounts Included in Total') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
</f7-actions-group>
@@ -223,6 +226,7 @@ const displayOrderSaving = ref<boolean>(false);
const firstShowingIds = computed<AccountShowingIds>(() => accountsStore.getFirstShowingIds(showHidden.value));
const lastShowingIds = computed<AccountShowingIds>(() => accountsStore.getLastShowingIds(showHidden.value));
const hasAnyVisibleAccount = computed<boolean>(() => accountsStore.allVisibleAccountsCount > 0);
const noAvailableAccount = computed<boolean>(() => {
if (showHidden.value) {
return accountsStore.allAvailableAccountsCount < 1;
@@ -383,6 +387,10 @@ function saveSortResult(): void {
});
}
function setAccountsIncludedInTotal(): void {
props.f7router.navigate('/settings/filter/account?type=accountListTotalAmount');
}
function onSort(event: { el: { id: string }; from: number; to: number }): void {
if (!event || !event.el || !event.el.id) {
showToast('Unable to move account');
@@ -120,7 +120,7 @@
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleAccount }" @click="selectNoneAccounts">{{ tt('Select None') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleAccount }" @click="selectInvertAccounts">{{ tt('Invert Selection') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-group v-if="allowHiddenAccount">
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Accounts') }}</f7-actions-button>
<f7-actions-button v-if="showHidden" @click="showHidden = false">{{ tt('Hide Hidden Accounts') }}</f7-actions-button>
</f7-actions-group>
@@ -171,6 +171,7 @@ const {
filterAccountIds,
title,
applyText,
allowHiddenAccount,
allCategorizedAccounts,
hasAnyAvailableAccount,
hasAnyVisibleAccount,
@@ -245,15 +246,15 @@ function updateAccountSelected(e: Event): void {
}
function selectAllAccounts(): void {
selectAll(filterAccountIds.value, accountsStore.allAccountsMap);
selectAll(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
}
function selectNoneAccounts(): void {
selectNone(filterAccountIds.value, accountsStore.allAccountsMap);
selectNone(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
}
function selectInvertAccounts(): void {
selectInvert(filterAccountIds.value, accountsStore.allAccountsMap);
selectInvert(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
}
function save(): void {
+38 -1
View File
@@ -73,6 +73,18 @@
</f7-list-item>
</f7-list>
<f7-block-title>{{ tt('Account List Page') }}</f7-block-title>
<f7-list strong inset dividers>
<f7-list-item :disabled="!hasAnyVisibleAccount"
:title="tt('Accounts Included in Total')"
link="/settings/filter/account?type=accountListTotalAmount">
<template #after>
<f7-preloader v-if="loadingAccounts" />
<span v-else-if="!loadingAccounts">{{ accountsIncludedInTotalDisplayContent }}</span>
</template>
</f7-list-item>
</f7-list>
<f7-block-title>{{ tt('Exchange Rates Data Page') }}</f7-block-title>
<f7-list strong inset dividers>
<f7-list-item
@@ -101,14 +113,19 @@
import { ref, computed } from 'vue';
import { useI18n } from '@/locales/helpers.ts';
import { useI18nUIComponents } from '@/lib/ui/mobile.ts';
import { useAppSettingPageBase } from '@/views/base/settings/AppSettingsPageBase.ts';
import { useSettingsStore } from '@/stores/setting.ts';
import { useAccountsStore } from '@/stores/account.ts';
import { findNameByValue, findDisplayNameByType } from '@/lib/common.ts';
const { tt } = useI18n();
const { showToast } = useI18nUIComponents();
const {
loadingAccounts,
hasAnyVisibleAccount,
allTimezoneTypesUsedForStatistics,
allCurrencySortingTypes,
allAutoSaveTransactionDraftTypes,
@@ -118,10 +135,12 @@ const {
showTagInTransactionListPage,
autoSaveTransactionDraft,
isAutoGetCurrentGeoLocation,
currencySortByInExchangeRatesPage
currencySortByInExchangeRatesPage,
accountsIncludedInTotalDisplayContent
} = useAppSettingPageBase();
const settingsStore = useSettingsStore();
const accountsStore = useAccountsStore();
const showTimezoneUsedForStatisticsInHomePagePopup = ref<boolean>(false);
const showAutoSaveTransactionDraftPopup = ref<boolean>(false);
@@ -131,4 +150,22 @@ const alwaysShowTransactionPicturesInMobileTransactionEditPage = computed<boolea
get: () => settingsStore.appSettings.alwaysShowTransactionPicturesInMobileTransactionEditPage,
set: (value) => settingsStore.setAlwaysShowTransactionPicturesInMobileTransactionEditPage(value)
});
function init(): void {
loadingAccounts.value = true;
accountsStore.loadAllAccounts({
force: false
}).then(() => {
loadingAccounts.value = false;
}).catch(error => {
loadingAccounts.value = false;
if (!error.processed) {
showToast(error.message || error);
}
});
}
init();
</script>