modify balance modification transaction

This commit is contained in:
MaysWind
2025-08-10 17:00:08 +08:00
parent 55bf8b9e30
commit f3d240442b
6 changed files with 25 additions and 7 deletions
+7 -1
View File
@@ -246,9 +246,15 @@ export class Transaction implements TransactionInfoResponse {
}
public toModifyRequest(actualTime?: number): TransactionModifyRequest {
let categoryId = this.getCategoryId();
if (this.type === TransactionType.ModifyBalance) {
categoryId = '0';
}
return {
id: this.id,
categoryId: this.getCategoryId(),
categoryId: categoryId,
time: actualTime ? actualTime : this.time,
utcOffset: this.utcOffset,
sourceAccountId: this.sourceAccountId,
+5 -1
View File
@@ -1050,7 +1050,11 @@ export const useTransactionsStore = defineStore('transactions', () => {
if (transaction.type !== TransactionType.Expense &&
transaction.type !== TransactionType.Income &&
transaction.type !== TransactionType.Transfer) {
transaction.type !== TransactionType.Transfer &&
transaction.type !== TransactionType.ModifyBalance) {
reject({ message: 'An error occurred' });
return;
} else if (!isEdit && transaction.type === TransactionType.ModifyBalance) {
reject({ message: 'An error occurred' });
return;
}
@@ -480,7 +480,7 @@
</v-btn>
</v-btn-group>
<v-btn color="warning" variant="tonal" :disabled="loading || submitting"
v-if="mode === TransactionEditPageMode.View && originalTransactionEditable && transaction.type !== TransactionType.ModifyBalance"
v-if="mode === TransactionEditPageMode.View && originalTransactionEditable"
@click="edit">{{ tt('Edit') }}</v-btn>
<v-btn color="error" variant="tonal" :disabled="loading || submitting"
v-if="mode === TransactionEditPageMode.View && originalTransactionEditable" @click="remove">
+1 -1
View File
@@ -299,7 +299,7 @@
@click="duplicate(transaction)"></f7-swipeout-button>
<f7-swipeout-button color="orange" close
:text="tt('Edit')"
v-if="transaction.editable && transaction.type !== TransactionType.ModifyBalance"
v-if="transaction.editable"
@click="edit(transaction)"></f7-swipeout-button>
<f7-swipeout-button color="red" class="padding-left padding-right"
v-if="transaction.editable"