更新个人需求清单,新增信用额度和可用额度的标注;在账户列表和交易列表中显示可用额度;修改记账页面的时间选择为默认日期选择器;优化账户余额显示逻辑
This commit is contained in:
@@ -1889,6 +1889,8 @@
|
||||
"Are you sure you want to move all transactions?": "您確定要移動所有交易?",
|
||||
"Unable to move transactions": "無法移動交易",
|
||||
"All transactions in this account have been moved.": "此帳戶中的所有交易已被移動。",
|
||||
"Credit Limit": "信用額度",
|
||||
"Available": "可用額度",
|
||||
"Reconciliation Statement": "對帳單",
|
||||
"Account Balance Trends": "帳戶餘額趨勢",
|
||||
"Update Closing Balance": "更新期末餘額",
|
||||
|
||||
@@ -276,6 +276,10 @@
|
||||
</v-btn>
|
||||
<v-spacer/>
|
||||
<span class="account-balance ms-2">{{ accountBalance(element, activeSubAccount[element.id]) }}</span>
|
||||
<small class="text-medium-emphasis ms-2"
|
||||
v-if="!activeSubAccount[element.id] && element.creditLimit">
|
||||
{{ tt('Available') }}: {{ getRemainingCredit(element) }}
|
||||
</small>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -365,7 +369,7 @@ type ClearAllTransactionsDialogType = InstanceType<typeof ClearAllTransactionsDi
|
||||
|
||||
const display = useDisplay();
|
||||
|
||||
const { tt, getAllDateRanges, getCurrencyName, joinMultiText } = useI18n();
|
||||
const { tt, getAllDateRanges, getCurrencyName, joinMultiText, formatAmountToLocalizedNumeralsWithCurrency } = useI18n();
|
||||
|
||||
const {
|
||||
loading,
|
||||
@@ -473,6 +477,11 @@ function hasAccount(accountCategory: AccountCategory): boolean {
|
||||
return accountsStore.hasAccount(accountCategory, !showHidden.value);
|
||||
}
|
||||
|
||||
function getRemainingCredit(account: Account): string {
|
||||
const available = (account.creditLimit ?? 0) + account.balance;
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(available, account.currency);
|
||||
}
|
||||
|
||||
function accountCurrency(account: Account): string | null {
|
||||
if (account.type === AccountType.SingleAccount.type) {
|
||||
return getCurrencyName(account.currency);
|
||||
|
||||
@@ -698,6 +698,7 @@ import { type NumeralSystem, AmountFilterType } from '@/core/numeral.ts';
|
||||
import { ThemeType } from '@/core/theme.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import { TemplateType } from '@/core/template.ts';
|
||||
import { AccountType } from '@/core/account.ts';
|
||||
import type { TransactionCategory } from '@/models/transaction_category.ts';
|
||||
import { type Transaction, TransactionTagFilter } from '@/models/transaction.ts';
|
||||
import type { TransactionTemplate } from '@/models/transaction_template.ts';
|
||||
@@ -894,6 +895,11 @@ const filteredSingleAccount = computed(() => {
|
||||
const filteredAccountBalanceText = computed<string>(() => {
|
||||
const account = filteredSingleAccount.value;
|
||||
if (!account) return '';
|
||||
if (account.type === AccountType.MultiSubAccounts.type) {
|
||||
const result = accountsStore.getAccountSubAccountBalance(true, true, account);
|
||||
if (!result) return '';
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(result.balance, result.currency);
|
||||
}
|
||||
if (account.creditLimit) {
|
||||
const outstanding = -account.balance;
|
||||
const available = account.creditLimit + account.balance;
|
||||
|
||||
@@ -245,7 +245,7 @@
|
||||
v-if="pageTypeAndMode?.type === TransactionEditPageType.Transaction"
|
||||
>
|
||||
<template #header>
|
||||
<div class="transaction-edit-datetime-header" @click="showDateTimeDialog('time')">{{ tt('Transaction Time') }}</div>
|
||||
<div class="transaction-edit-datetime-header" @click="showDateTimeDialog('date')">{{ tt('Transaction Time') }}</div>
|
||||
</template>
|
||||
<template #title>
|
||||
<div class="transaction-edit-datetime-title">
|
||||
|
||||
@@ -643,6 +643,7 @@ import {
|
||||
} from '@/core/datetime.ts';
|
||||
import { type NumeralSystem, AmountFilterType } from '@/core/numeral.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import { AccountType } from '@/core/account.ts';
|
||||
import type { TransactionCategory } from '@/models/transaction_category.ts';
|
||||
import { type Transaction, TransactionTagFilter } from '@/models/transaction.ts';
|
||||
|
||||
@@ -767,6 +768,11 @@ const filteredSingleAccount = computed(() => {
|
||||
const filteredAccountBalanceText = computed<string>(() => {
|
||||
const account = filteredSingleAccount.value;
|
||||
if (!account) return '';
|
||||
if (account.type === AccountType.MultiSubAccounts.type) {
|
||||
const result = accountsStore.getAccountSubAccountBalance(true, true, account);
|
||||
if (!result) return '';
|
||||
return formatAmountToLocalizedNumeralsWithCurrency(result.balance, result.currency);
|
||||
}
|
||||
if (account.creditLimit) {
|
||||
const outstanding = -account.balance;
|
||||
const available = account.creditLimit + account.balance;
|
||||
|
||||
Reference in New Issue
Block a user