mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 08:14:25 +08:00
support changing numeral system
This commit is contained in:
@@ -14,7 +14,7 @@ import type {
|
||||
import { getExchangedAmountByRate } from '@/lib/numeral.ts';
|
||||
|
||||
export function useExchangeRatesPageBase() {
|
||||
const { getAllDisplayExchangeRates, formatUnixTimeToLongDate, parseAmount } = useI18n();
|
||||
const { getAllDisplayExchangeRates, formatUnixTimeToLongDate, parseAmountFromWesternArabicNumerals } = useI18n();
|
||||
|
||||
const userStore = useUserStore();
|
||||
const exchangeRatesStore = useExchangeRatesStore();
|
||||
@@ -49,7 +49,7 @@ export function useExchangeRatesPageBase() {
|
||||
|
||||
function setAsBaseline(currency: string, amount: string): void {
|
||||
baseCurrency.value = currency;
|
||||
baseAmount.value = parseAmount(amount);
|
||||
baseAmount.value = parseAmountFromWesternArabicNumerals(amount);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -7,6 +7,9 @@ import { useUserStore } from '@/stores/user.ts';
|
||||
import { useAccountsStore } from '@/stores/account.ts';
|
||||
import { useOverviewStore } from '@/stores/overview.ts';
|
||||
|
||||
import type { HiddenAmount, NumberWithSuffix } from '@/core/numeral.ts';
|
||||
import { DISPLAY_HIDDEN_AMOUNT, INCOMPLETE_AMOUNT_SUFFIX } from '@/consts/numeral.ts';
|
||||
|
||||
import { Account } from '@/models/account.ts';
|
||||
import type {
|
||||
TransactionOverviewResponse,
|
||||
@@ -20,7 +23,7 @@ export function useHomePageBase() {
|
||||
formatUnixTimeToLongYear,
|
||||
formatUnixTimeToLongMonth,
|
||||
formatUnixTimeToLongMonthDay,
|
||||
formatAmountWithCurrency
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
@@ -37,18 +40,18 @@ export function useHomePageBase() {
|
||||
const allAccounts = computed<Account[]>(() => accountsStore.allAccounts);
|
||||
|
||||
const netAssets = computed<string>(() => {
|
||||
const netAssets = accountsStore.getNetAssets(showAmountInHomePage.value);
|
||||
return formatAmountWithCurrency(netAssets, defaultCurrency.value);
|
||||
const netAssets: number | HiddenAmount | NumberWithSuffix = accountsStore.getNetAssets(showAmountInHomePage.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(netAssets, defaultCurrency.value);
|
||||
});
|
||||
|
||||
const totalAssets = computed<string>(() => {
|
||||
const totalAssets = accountsStore.getTotalAssets(showAmountInHomePage.value);
|
||||
return formatAmountWithCurrency(totalAssets, defaultCurrency.value);
|
||||
const totalAssets: number | HiddenAmount | NumberWithSuffix = accountsStore.getTotalAssets(showAmountInHomePage.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(totalAssets, defaultCurrency.value);
|
||||
});
|
||||
|
||||
const totalLiabilities = computed<string>(() => {
|
||||
const totalLiabilities = accountsStore.getTotalLiabilities(showAmountInHomePage.value);
|
||||
return formatAmountWithCurrency(totalLiabilities, defaultCurrency.value);
|
||||
const totalLiabilities: number | HiddenAmount | NumberWithSuffix = accountsStore.getTotalLiabilities(showAmountInHomePage.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(totalLiabilities, defaultCurrency.value);
|
||||
});
|
||||
|
||||
const displayDateRange = computed<TransactionOverviewDisplayTime>(() => {
|
||||
@@ -75,10 +78,10 @@ export function useHomePageBase() {
|
||||
|
||||
function getDisplayAmount(amount: number, incomplete: boolean): string {
|
||||
if (!showAmountInHomePage.value) {
|
||||
return formatAmountWithCurrency('***', defaultCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(DISPLAY_HIDDEN_AMOUNT, defaultCurrency.value);
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(amount, defaultCurrency.value) + (incomplete ? '+' : '');
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(amount, defaultCurrency.value) + (incomplete ? INCOMPLETE_AMOUNT_SUFFIX : '');
|
||||
}
|
||||
|
||||
function getDisplayIncomeAmount(category: TransactionOverviewResponseItem): string {
|
||||
|
||||
@@ -6,14 +6,15 @@ import { useSettingsStore } from '@/stores/setting.ts';
|
||||
import { useUserStore } from '@/stores/user.ts';
|
||||
import { useAccountsStore } from '@/stores/account.ts';
|
||||
|
||||
import type { HiddenAmount, NumberWithSuffix } from '@/core/numeral.ts';
|
||||
import type { WeekDayValue } from '@/core/datetime.ts';
|
||||
import { type AccountCategory, AccountType } from '@/core/account.ts';
|
||||
import type { Account, CategorizedAccount } from '@/models/account.ts';
|
||||
|
||||
import { isObject, isString } from '@/lib/common.ts';
|
||||
import { isObject, isNumber, isString } from '@/lib/common.ts';
|
||||
|
||||
export function useAccountListPageBaseBase() {
|
||||
const { formatAmountWithCurrency } = useI18n();
|
||||
const { formatAmountToLocalizedNumeralsWithCurrency } = useI18n();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
const userStore = useUserStore();
|
||||
@@ -37,18 +38,18 @@ export function useAccountListPageBaseBase() {
|
||||
const allAccountCount = computed<number>(() => accountsStore.allAvailableAccountsCount);
|
||||
|
||||
const netAssets = computed<string>(() => {
|
||||
const netAssets = accountsStore.getNetAssets(showAccountBalance.value);
|
||||
return formatAmountWithCurrency(netAssets, defaultCurrency.value);
|
||||
const netAssets: number | HiddenAmount | NumberWithSuffix = accountsStore.getNetAssets(showAccountBalance.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(netAssets, defaultCurrency.value);
|
||||
});
|
||||
|
||||
const totalAssets = computed<string>(() => {
|
||||
const totalAssets = accountsStore.getTotalAssets(showAccountBalance.value);
|
||||
return formatAmountWithCurrency(totalAssets, defaultCurrency.value);
|
||||
const totalAssets: number | HiddenAmount | NumberWithSuffix = accountsStore.getTotalAssets(showAccountBalance.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(totalAssets, defaultCurrency.value);
|
||||
});
|
||||
|
||||
const totalLiabilities = computed<string>(() => {
|
||||
const totalLiabilities = accountsStore.getTotalLiabilities(showAccountBalance.value);
|
||||
return formatAmountWithCurrency(totalLiabilities, defaultCurrency.value);
|
||||
const totalLiabilities: number | HiddenAmount | NumberWithSuffix = accountsStore.getTotalLiabilities(showAccountBalance.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(totalLiabilities, defaultCurrency.value);
|
||||
});
|
||||
|
||||
function accountCategoryTotalBalance(accountCategory?: AccountCategory): string {
|
||||
@@ -56,19 +57,19 @@ export function useAccountListPageBaseBase() {
|
||||
return '';
|
||||
}
|
||||
|
||||
const totalBalance = accountsStore.getAccountCategoryTotalBalance(showAccountBalance.value, accountCategory);
|
||||
return formatAmountWithCurrency(totalBalance, defaultCurrency.value);
|
||||
const totalBalance: number | HiddenAmount | NumberWithSuffix = accountsStore.getAccountCategoryTotalBalance(showAccountBalance.value, accountCategory);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(totalBalance, defaultCurrency.value);
|
||||
}
|
||||
|
||||
function accountBalance(account: Account, currentSubAccountId?: string): string | null {
|
||||
if (account.type === AccountType.SingleAccount.type) {
|
||||
const balance = accountsStore.getAccountBalance(showAccountBalance.value, account);
|
||||
const balance: number| HiddenAmount | null = accountsStore.getAccountBalance(showAccountBalance.value, account);
|
||||
|
||||
if (!isString(balance)) {
|
||||
if (!isNumber(balance) && !isString(balance)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(balance, account.currency);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(balance, account.currency);
|
||||
} else if (account.type === AccountType.MultiSubAccounts.type) {
|
||||
const balanceResult = accountsStore.getAccountSubAccountBalance(showAccountBalance.value, showHidden.value, account, currentSubAccountId);
|
||||
|
||||
@@ -76,7 +77,7 @@ export function useAccountListPageBaseBase() {
|
||||
return '';
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(balanceResult.balance, balanceResult.currency);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(balanceResult.balance, balanceResult.currency);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@ import type {
|
||||
TransactionReconciliationStatementResponseItem
|
||||
} from '@/models/transaction.ts';
|
||||
|
||||
import {
|
||||
replaceAll,
|
||||
removeAll
|
||||
} from '@/lib/common.ts';
|
||||
import { replaceAll } from '@/lib/common.ts';
|
||||
|
||||
import {
|
||||
getUtcOffsetByUtcOffsetMinutes,
|
||||
@@ -36,12 +33,11 @@ export function useReconciliationStatementPageBase() {
|
||||
tt,
|
||||
getAllAccountBalanceTrendChartTypes,
|
||||
getAllStatisticsDateAggregationTypesWithShortName,
|
||||
getCurrentDigitGroupingSymbol,
|
||||
formatUnixTimeToLongDateTime,
|
||||
formatUnixTimeToLongDate,
|
||||
formatUnixTimeToShortTime,
|
||||
formatAmount,
|
||||
formatAmountWithCurrency
|
||||
formatAmountToWesternArabicNumeralsWithoutDigitGrouping,
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
@@ -90,30 +86,30 @@ export function useReconciliationStatementPageBase() {
|
||||
});
|
||||
|
||||
const displayTotalInflows = computed<string>(() => {
|
||||
return formatAmountWithCurrency(reconciliationStatements.value?.totalInflows ?? 0, currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(reconciliationStatements.value?.totalInflows ?? 0, currentAccountCurrency.value);
|
||||
});
|
||||
|
||||
const displayTotalOutflows = computed<string>(() => {
|
||||
return formatAmountWithCurrency(reconciliationStatements.value?.totalOutflows ?? 0, currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(reconciliationStatements.value?.totalOutflows ?? 0, currentAccountCurrency.value);
|
||||
});
|
||||
|
||||
const displayTotalBalance = computed<string>(() => {
|
||||
return formatAmountWithCurrency((reconciliationStatements?.value?.totalInflows ?? 0) - (reconciliationStatements.value?.totalOutflows ?? 0), currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency((reconciliationStatements?.value?.totalInflows ?? 0) - (reconciliationStatements.value?.totalOutflows ?? 0), currentAccountCurrency.value);
|
||||
});
|
||||
|
||||
const displayOpeningBalance = computed<string>(() => {
|
||||
if (isCurrentLiabilityAccount.value) {
|
||||
return formatAmountWithCurrency(-(reconciliationStatements?.value?.openingBalance ?? 0), currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(-(reconciliationStatements?.value?.openingBalance ?? 0), currentAccountCurrency.value);
|
||||
} else {
|
||||
return formatAmountWithCurrency(reconciliationStatements?.value?.openingBalance ?? 0, currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(reconciliationStatements?.value?.openingBalance ?? 0, currentAccountCurrency.value);
|
||||
}
|
||||
});
|
||||
|
||||
const displayClosingBalance = computed<string>(() => {
|
||||
if (isCurrentLiabilityAccount.value) {
|
||||
return formatAmountWithCurrency(-(reconciliationStatements?.value?.closingBalance ?? 0), currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(-(reconciliationStatements?.value?.closingBalance ?? 0), currentAccountCurrency.value);
|
||||
} else {
|
||||
return formatAmountWithCurrency(reconciliationStatements?.value?.closingBalance ?? 0, currentAccountCurrency.value);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(reconciliationStatements?.value?.closingBalance ?? 0, currentAccountCurrency.value);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -159,7 +155,7 @@ export function useReconciliationStatementPageBase() {
|
||||
currency = allAccountsMap.value[transaction.sourceAccountId].currency;
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(transaction.sourceAmount, currency);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(transaction.sourceAmount, currency);
|
||||
}
|
||||
|
||||
function getDisplayDestinationAmount(transaction: TransactionReconciliationStatementResponseItem): string {
|
||||
@@ -169,7 +165,7 @@ export function useReconciliationStatementPageBase() {
|
||||
currency = allAccountsMap.value[transaction.destinationAccountId].currency;
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(transaction.destinationAmount, currency);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(transaction.destinationAmount, currency);
|
||||
}
|
||||
|
||||
function getDisplayAccountBalance(transaction: TransactionReconciliationStatementResponseItem): string {
|
||||
@@ -187,9 +183,9 @@ export function useReconciliationStatementPageBase() {
|
||||
}
|
||||
|
||||
if (isLiabilityAccount) {
|
||||
return formatAmountWithCurrency(-transaction.accountClosingBalance, currency);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(-transaction.accountClosingBalance, currency);
|
||||
} else {
|
||||
return formatAmountWithCurrency(transaction.accountClosingBalance, currency);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(transaction.accountClosingBalance, currency);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +196,6 @@ export function useReconciliationStatementPageBase() {
|
||||
separator = '\t';
|
||||
}
|
||||
|
||||
const digitGroupingSymbol = getCurrentDigitGroupingSymbol();
|
||||
const accountBalanceName = isCurrentLiabilityAccount.value ? 'Account Outstanding Balance' : 'Account Balance';
|
||||
|
||||
const header = [
|
||||
@@ -218,13 +213,13 @@ export function useReconciliationStatementPageBase() {
|
||||
const transactionTime = getUnixTime(parseDateFromUnixTime(transaction.time, transaction.utcOffset, currentTimezoneOffsetMinutes.value));
|
||||
const type = getDisplayTransactionType(transaction);
|
||||
let categoryName = allCategoriesMap.value[transaction.categoryId]?.name || '';
|
||||
let displayAmount = removeAll(formatAmount(transaction.sourceAmount), digitGroupingSymbol);
|
||||
let displayAmount = formatAmountToWesternArabicNumeralsWithoutDigitGrouping(transaction.sourceAmount);
|
||||
let displayAccountName = allAccountsMap.value[transaction.sourceAccountId]?.name || '';
|
||||
|
||||
if (transaction.type === TransactionType.ModifyBalance) {
|
||||
categoryName = tt('Modify Balance');
|
||||
} else if (transaction.type === TransactionType.Transfer && transaction.destinationAccountId === accountId.value) {
|
||||
displayAmount = removeAll(formatAmount(transaction.destinationAmount), digitGroupingSymbol);
|
||||
displayAmount = formatAmountToWesternArabicNumeralsWithoutDigitGrouping(transaction.destinationAmount);
|
||||
}
|
||||
|
||||
if (transaction.type === TransactionType.Transfer && allAccountsMap.value[transaction.destinationAccountId]) {
|
||||
@@ -234,9 +229,9 @@ export function useReconciliationStatementPageBase() {
|
||||
let displayAccountBalance = '';
|
||||
|
||||
if (isCurrentLiabilityAccount.value) {
|
||||
displayAccountBalance = removeAll(formatAmount(-transaction.accountClosingBalance), digitGroupingSymbol);
|
||||
displayAccountBalance = formatAmountToWesternArabicNumeralsWithoutDigitGrouping(-transaction.accountClosingBalance);
|
||||
} else {
|
||||
displayAccountBalance = removeAll(formatAmount(transaction.accountClosingBalance), digitGroupingSymbol);
|
||||
displayAccountBalance = formatAmountToWesternArabicNumeralsWithoutDigitGrouping(transaction.accountClosingBalance);
|
||||
}
|
||||
|
||||
let description = transaction.comment || '';
|
||||
|
||||
@@ -9,6 +9,7 @@ import { type TransactionStatisticsFilter, useStatisticsStore } from '@/stores/s
|
||||
import type { TypeAndDisplayName } from '@/core/base.ts';
|
||||
import { type LocalizedDateRange, type WeekDayValue, DateRangeScene, DateRange } from '@/core/datetime.ts';
|
||||
import { StatisticsAnalysisType, ChartDataType, ChartSortingType, ChartDateAggregationType } from '@/core/statistics.ts';
|
||||
import { DISPLAY_HIDDEN_AMOUNT } from '@/consts/numeral.ts';
|
||||
import type { TransactionCategoricalAnalysisData, TransactionTrendsAnalysisData } from '@/models/transaction.ts';
|
||||
|
||||
import { limitText, findNameByType, findDisplayNameByType } from '@/lib/common.ts';
|
||||
@@ -23,7 +24,7 @@ export function useStatisticsTransactionPageBase() {
|
||||
formatUnixTimeToLongDateTime,
|
||||
formatUnixTimeToLongYearMonth,
|
||||
formatDateRange,
|
||||
formatAmountWithCurrency
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
@@ -200,13 +201,13 @@ export function useStatisticsTransactionPageBase() {
|
||||
const trendsAnalysisData = computed<TransactionTrendsAnalysisData | null>(() => statisticsStore.trendsAnalysisData);
|
||||
|
||||
function getDisplayAmount(amount: number, currency: string, textLimit?: number): string {
|
||||
const finalAmount = formatAmountWithCurrency(amount, currency);
|
||||
const finalAmount = formatAmountToLocalizedNumeralsWithCurrency(amount, currency);
|
||||
|
||||
if (!showAccountBalance.value
|
||||
&& (query.value.chartDataType === ChartDataType.AccountTotalAssets.type
|
||||
|| query.value.chartDataType === ChartDataType.AccountTotalLiabilities.type)
|
||||
) {
|
||||
return '***';
|
||||
return DISPLAY_HIDDEN_AMOUNT;
|
||||
}
|
||||
|
||||
if (textLimit) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
|
||||
import { useTransactionsStore } from '@/stores/transaction.ts';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.ts';
|
||||
|
||||
import { DISPLAY_HIDDEN_AMOUNT } from '@/consts/numeral.ts';
|
||||
import type { WeekDayValue } from '@/core/datetime.ts';
|
||||
import type { LocalizedTimezoneInfo } from '@/core/timezone.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
@@ -59,7 +60,7 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
||||
tt,
|
||||
getAllTimezones,
|
||||
getTimezoneDifferenceDisplayText,
|
||||
formatAmountWithCurrency,
|
||||
formatAmountToLocalizedNumeralsWithCurrency,
|
||||
getAdaptiveAmountRate,
|
||||
getCategorizedAccountsWithDisplayBalance
|
||||
} = useI18n();
|
||||
@@ -360,12 +361,12 @@ export function useTransactionEditPageBase(type: TransactionEditPageType, initMo
|
||||
}
|
||||
}
|
||||
|
||||
function getDisplayAmount(amount: number | string, hideAmount: boolean, currencyCode: string): string {
|
||||
function getDisplayAmount(amount: number, hideAmount: boolean, currencyCode: string): string {
|
||||
if (hideAmount) {
|
||||
return formatAmountWithCurrency('***', currencyCode);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(DISPLAY_HIDDEN_AMOUNT, currencyCode);
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(amount, currencyCode);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(amount, currencyCode);
|
||||
}
|
||||
|
||||
function getTransactionPictureUrl(pictureInfo?: TransactionPictureInfoBasicResponse | null): string | undefined {
|
||||
|
||||
@@ -13,6 +13,7 @@ import type { TypeAndName } from '@/core/base.ts';
|
||||
import { type LocalizedDateRange, type WeekDayValue, DateRange, DateRangeScene } from '@/core/datetime.ts';
|
||||
import { AccountType } from '@/core/account.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import { DISPLAY_HIDDEN_AMOUNT, INCOMPLETE_AMOUNT_SUFFIX } from '@/consts/numeral.ts';
|
||||
|
||||
import type { Account } from '@/models/account.ts';
|
||||
import type { TransactionCategory } from '@/models/transaction_category.ts';
|
||||
@@ -84,7 +85,7 @@ export function useTransactionListPageBase() {
|
||||
formatUnixTimeToLongYearMonth,
|
||||
formatUnixTimeToShortTime,
|
||||
formatDateRange,
|
||||
formatAmountWithCurrency
|
||||
formatAmountToLocalizedNumeralsWithCurrency
|
||||
} = useI18n();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
@@ -231,7 +232,7 @@ export function useTransactionListPageBase() {
|
||||
const displayAmount: string[] = [];
|
||||
|
||||
for (let i = 1; i < amountFilterItems.length; i++) {
|
||||
displayAmount.push(formatAmountWithCurrency(amountFilterItems[i], false));
|
||||
displayAmount.push(formatAmountToLocalizedNumeralsWithCurrency(parseInt(amountFilterItems[i]), false));
|
||||
}
|
||||
|
||||
return displayAmount.join(' ~ ');
|
||||
@@ -279,10 +280,10 @@ export function useTransactionListPageBase() {
|
||||
|
||||
function formatAmount(amount: number, hideAmount: boolean, currencyCode: string): string {
|
||||
if (hideAmount) {
|
||||
return formatAmountWithCurrency('***', currencyCode);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(DISPLAY_HIDDEN_AMOUNT, currencyCode);
|
||||
}
|
||||
|
||||
return formatAmountWithCurrency(amount, currencyCode);
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(amount, currencyCode);
|
||||
}
|
||||
|
||||
function getDisplayTime(transaction: Transaction): string {
|
||||
@@ -337,8 +338,8 @@ export function useTransactionListPageBase() {
|
||||
}
|
||||
|
||||
function getDisplayMonthTotalAmount(amount: number, currency: string | false, symbol: string, incomplete: boolean): string {
|
||||
const displayAmount = formatAmountWithCurrency(amount, currency);
|
||||
return symbol + displayAmount + (incomplete ? '+' : '');
|
||||
const displayAmount = formatAmountToLocalizedNumeralsWithCurrency(amount, currency);
|
||||
return symbol + displayAmount + (incomplete ? INCOMPLETE_AMOUNT_SUFFIX : '');
|
||||
}
|
||||
|
||||
function getTransactionTypeName(type: number | null, defaultName: string): string {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { useUserStore } from '@/stores/user.ts';
|
||||
import type { DataStatisticsResponse, DisplayDataStatistics } from '@/models/data_management.ts';
|
||||
|
||||
export function useDataManagementPageBase() {
|
||||
const { tt, appendDigitGroupingSymbol } = useI18n();
|
||||
const { tt, formatNumberToLocalizedNumerals } = useI18n();
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
@@ -19,13 +19,13 @@ export function useDataManagementPageBase() {
|
||||
}
|
||||
|
||||
return {
|
||||
totalTransactionCount: appendDigitGroupingSymbol(dataStatistics.value.totalTransactionCount),
|
||||
totalAccountCount: appendDigitGroupingSymbol(dataStatistics.value.totalAccountCount),
|
||||
totalTransactionCategoryCount: appendDigitGroupingSymbol(dataStatistics.value.totalTransactionCategoryCount),
|
||||
totalTransactionTagCount: appendDigitGroupingSymbol(dataStatistics.value.totalTransactionTagCount),
|
||||
totalTransactionPictureCount: appendDigitGroupingSymbol(dataStatistics.value.totalTransactionPictureCount),
|
||||
totalTransactionTemplateCount: appendDigitGroupingSymbol(dataStatistics.value.totalTransactionTemplateCount),
|
||||
totalScheduledTransactionCount: appendDigitGroupingSymbol(dataStatistics.value.totalScheduledTransactionCount)
|
||||
totalTransactionCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionCount)),
|
||||
totalAccountCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalAccountCount)),
|
||||
totalTransactionCategoryCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionCategoryCount)),
|
||||
totalTransactionTagCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionTagCount)),
|
||||
totalTransactionPictureCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionPictureCount)),
|
||||
totalTransactionTemplateCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalTransactionTemplateCount)),
|
||||
totalScheduledTransactionCount: formatNumberToLocalizedNumerals(parseInt(dataStatistics.value.totalScheduledTransactionCount))
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { useOverviewStore } from '@/stores/overview.ts';
|
||||
|
||||
import type { TypeAndDisplayName } from '@/core/base.ts';
|
||||
import { WeekDay } from '@/core/datetime.ts';
|
||||
import { type LocalizedDigitGroupingType, DigitGroupingSymbol } from '@/core/numeral.ts';
|
||||
import { type LocalizedDigitGroupingType, NumeralSystem, DecimalSeparator, DigitGroupingSymbol } from '@/core/numeral.ts';
|
||||
|
||||
import { type UserBasicInfo, User } from '@/models/user.ts';
|
||||
import { type CategorizedAccount, Account} from '@/models/account.ts';
|
||||
@@ -27,10 +27,11 @@ export function useUserProfilePageBase() {
|
||||
getAllLongTimeFormats,
|
||||
getAllShortTimeFormats,
|
||||
getAllFiscalYearFormats,
|
||||
getAllCurrencyDisplayTypes,
|
||||
getAllNumeralSystemTypes,
|
||||
getAllDecimalSeparators,
|
||||
getAllDigitGroupingSymbols,
|
||||
getAllDigitGroupingTypes,
|
||||
getAllCurrencyDisplayTypes,
|
||||
getAllCoordinateDisplayTypes,
|
||||
getAllExpenseAmountColors,
|
||||
getAllIncomeAmountColors,
|
||||
@@ -62,10 +63,11 @@ export function useUserProfilePageBase() {
|
||||
const allLongTimeFormats = computed<TypeAndDisplayName[]>(() => getAllLongTimeFormats());
|
||||
const allShortTimeFormats = computed<TypeAndDisplayName[]>(() => getAllShortTimeFormats());
|
||||
const allFiscalYearFormats = computed<TypeAndDisplayName[]>(() => getAllFiscalYearFormats());
|
||||
const allCurrencyDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCurrencyDisplayTypes(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DecimalSeparator.valueOf(newProfile.value.decimalSeparator)?.symbol || DecimalSeparator.Default.symbol));
|
||||
const allNumeralSystemTypes = computed<TypeAndDisplayName[]>(() => getAllNumeralSystemTypes());
|
||||
const allDecimalSeparators = computed<TypeAndDisplayName[]>(() => getAllDecimalSeparators());
|
||||
const allDigitGroupingSymbols = computed<TypeAndDisplayName[]>(() => getAllDigitGroupingSymbols());
|
||||
const allDigitGroupingTypes = computed<LocalizedDigitGroupingType[]>(() => getAllDigitGroupingTypes(DigitGroupingSymbol.valueOf(newProfile.value.digitGroupingSymbol)?.symbol || DigitGroupingSymbol.Default.symbol));
|
||||
const allCurrencyDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCurrencyDisplayTypes());
|
||||
const allDigitGroupingTypes = computed<LocalizedDigitGroupingType[]>(() => getAllDigitGroupingTypes(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DigitGroupingSymbol.valueOf(newProfile.value.digitGroupingSymbol)?.symbol || DigitGroupingSymbol.Default.symbol));
|
||||
const allCoordinateDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCoordinateDisplayTypes());
|
||||
const allExpenseAmountColorTypes = computed<TypeAndDisplayName[]>(() => getAllExpenseAmountColors());
|
||||
const allIncomeAmountColorTypes = computed<TypeAndDisplayName[]>(() => getAllIncomeAmountColors());
|
||||
@@ -108,10 +110,11 @@ export function useUserProfilePageBase() {
|
||||
newProfile.value.longTimeFormat === oldProfile.value.longTimeFormat &&
|
||||
newProfile.value.shortTimeFormat === oldProfile.value.shortTimeFormat &&
|
||||
newProfile.value.fiscalYearFormat === oldProfile.value.fiscalYearFormat &&
|
||||
newProfile.value.currencyDisplayType === oldProfile.value.currencyDisplayType &&
|
||||
newProfile.value.numeralSystem === oldProfile.value.numeralSystem &&
|
||||
newProfile.value.decimalSeparator === oldProfile.value.decimalSeparator &&
|
||||
newProfile.value.digitGroupingSymbol === oldProfile.value.digitGroupingSymbol &&
|
||||
newProfile.value.digitGrouping === oldProfile.value.digitGrouping &&
|
||||
newProfile.value.currencyDisplayType === oldProfile.value.currencyDisplayType &&
|
||||
newProfile.value.coordinateDisplayType === oldProfile.value.coordinateDisplayType &&
|
||||
newProfile.value.expenseAmountColor === oldProfile.value.expenseAmountColor &&
|
||||
newProfile.value.incomeAmountColor === oldProfile.value.incomeAmountColor) {
|
||||
@@ -199,10 +202,11 @@ export function useUserProfilePageBase() {
|
||||
allLongTimeFormats,
|
||||
allShortTimeFormats,
|
||||
allFiscalYearFormats,
|
||||
allCurrencyDisplayTypes,
|
||||
allNumeralSystemTypes,
|
||||
allDecimalSeparators,
|
||||
allDigitGroupingSymbols,
|
||||
allDigitGroupingTypes,
|
||||
allCurrencyDisplayTypes,
|
||||
allCoordinateDisplayTypes,
|
||||
allExpenseAmountColorTypes,
|
||||
allIncomeAmountColorTypes,
|
||||
|
||||
Reference in New Issue
Block a user