clear all transactions of specified account (#228)

This commit is contained in:
MaysWind
2025-09-22 00:26:59 +08:00
parent cbe784172e
commit 245fdd78e4
25 changed files with 397 additions and 5 deletions
+1
View File
@@ -325,6 +325,7 @@ func startWebServer(c *core.CliContext) error {
apiV1Route.GET("/data/statistics.json", bindApi(api.DataManagements.DataStatisticsHandler))
apiV1Route.POST("/data/clear/all.json", bindApi(api.DataManagements.ClearAllDataHandler))
apiV1Route.POST("/data/clear/transactions.json", bindApi(api.DataManagements.ClearAllTransactionsHandler))
apiV1Route.POST("/data/clear/transactions/by_account.json", bindApi(api.DataManagements.ClearAllTransactionsByAccountHandler))
if config.EnableDataExport {
apiV1Route.GET("/data/export.csv", bindCsv(api.DataManagements.ExportDataToEzbookkeepingCSVHandler))
+56
View File
@@ -15,6 +15,7 @@ import (
"github.com/mayswind/ezbookkeeping/pkg/utils"
)
const pageCountForClearTransactions = 1000
const pageCountForDataExport = 1000
// DataManagementsApi represents data management api
@@ -232,6 +233,61 @@ func (a *DataManagementsApi) ClearAllTransactionsHandler(c *core.WebContext) (an
return true, nil
}
// ClearAllTransactionsByAccountHandler deletes all transactions of specified account
func (a *DataManagementsApi) ClearAllTransactionsByAccountHandler(c *core.WebContext) (any, *errs.Error) {
var clearDataReq models.ClearAccountTransactionsRequest
err := c.ShouldBindJSON(&clearDataReq)
if err != nil {
log.Warnf(c, "[data_managements.ClearAllTransactionsByAccountHandler] parse request failed, because %s", err.Error())
return nil, errs.NewIncompleteOrIncorrectSubmissionError(err)
}
uid := c.GetCurrentUid()
user, err := a.users.GetUserById(c, uid)
if err != nil {
if !errs.IsCustomError(err) {
log.Warnf(c, "[data_managements.ClearAllTransactionsByAccountHandler] failed to get user for user \"uid:%d\", because %s", uid, err.Error())
}
return nil, errs.ErrUserNotFound
}
if !a.users.IsPasswordEqualsUserPassword(clearDataReq.Password, user) {
return nil, errs.ErrUserPasswordWrong
}
if user.FeatureRestriction.Contains(core.USER_FEATURE_RESTRICTION_TYPE_CLEAR_ALL_DATA) {
return nil, errs.ErrNotPermittedToPerformThisAction
}
account, err := a.accounts.GetAccountByAccountId(c, uid, clearDataReq.AccountId)
if err != nil {
log.Errorf(c, "[data_managements.ClearAllTransactionsByAccountHandler] failed to get account \"id:%d\" for user \"uid:%d\", because %s", uid, clearDataReq.AccountId, err.Error())
return nil, errs.Or(err, errs.ErrOperationFailed)
}
if account.Hidden {
return nil, errs.ErrCannotDeleteTransactionInHiddenAccount
}
if account.Type == models.ACCOUNT_TYPE_MULTI_SUB_ACCOUNTS {
return nil, errs.ErrCannotDeleteTransactionInParentAccount
}
err = a.transactions.DeleteAllTransactionsOfAccount(c, uid, account.AccountId, pageCountForClearTransactions)
if err != nil {
log.Errorf(c, "[data_managements.ClearAllTransactionsByAccountHandler] failed to delete all transactions in account \"id:%d\", because %s", account.AccountId, err.Error())
return nil, errs.Or(err, errs.ErrOperationFailed)
}
log.Infof(c, "[data_managements.ClearAllTransactionsByAccountHandler] user \"uid:%d\" has cleared all transactions in account \"id:%d\"", uid, account.AccountId)
return true, nil
}
func (a *DataManagementsApi) getExportedFileContent(c *core.WebContext, fileType string) ([]byte, string, *errs.Error) {
if !a.CurrentConfig().EnableDataExport {
return nil, "", errs.ErrDataExportNotAllowed
+6
View File
@@ -5,6 +5,12 @@ type ClearDataRequest struct {
Password string `json:"password" binding:"omitempty,min=6,max=128"`
}
// ClearAccountTransactionsRequest represents all parameters of clear transaction data of a specific account request
type ClearAccountTransactionsRequest struct {
AccountId int64 `json:"accountId,string" binding:"required,min=1"`
Password string `json:"password" binding:"omitempty,min=6,max=128"`
}
// DataStatisticsResponse represents a view-object of user data statistic
type DataStatisticsResponse struct {
TotalAccountCount int64 `json:"totalAccountCount,string"`
+37
View File
@@ -1381,6 +1381,43 @@ func (s *TransactionService) DeleteAllTransactions(c core.Context, uid int64, de
})
}
// DeleteAllTransactionsOfAccount deletes all existed transactions of specific account from database
func (s *TransactionService) DeleteAllTransactionsOfAccount(c core.Context, uid int64, accountId int64, pageCount int32) error {
if uid <= 0 {
return errs.ErrUserIdInvalid
}
if accountId <= 0 {
return errs.ErrAccountIdInvalid
}
transactions, err := s.GetAllSpecifiedTransactions(c, uid, 0, 0, 0, nil, []int64{accountId}, nil, false, models.TRANSACTION_TAG_FILTER_HAS_ANY, "", "", pageCount, true)
if err != nil {
return err
}
if len(transactions) < 1 {
return nil
}
for i := 0; i < len(transactions); i++ {
transaction := transactions[i]
if transaction.Type == models.TRANSACTION_DB_TYPE_TRANSFER_IN {
err = s.DeleteTransaction(c, uid, transaction.RelatedId)
} else {
err = s.DeleteTransaction(c, uid, transaction.TransactionId)
}
if err != nil {
return err
}
}
return nil
}
// GetRelatedTransferTransaction returns the related transaction for transfer transaction
func (s *TransactionService) GetRelatedTransferTransaction(originalTransaction *models.Transaction) *models.Transaction {
var relatedType models.TransactionDbType
+1 -1
View File
@@ -26,7 +26,7 @@
<f7-button large fill
:class="{ 'disabled': !currentPassword || confirmDisabled }"
:color="color || 'primary'"
:text="tt('Continue')"
:text="tt('Confirm')"
@click="confirm">
</f7-button>
<div class="margin-top text-align-center">
+1
View File
@@ -7,6 +7,7 @@ export const DEFAULT_API_TIMEOUT: number = 10000; // 10s
export const DEFAULT_UPLOAD_API_TIMEOUT: number = 30000; // 30s
export const DEFAULT_EXPORT_API_TIMEOUT: number = 180000; // 180s
export const DEFAULT_IMPORT_API_TIMEOUT: number = 1800000; // 1800s
export const DEFAULT_CLEAR_ALL_TRANSACTIONS_API_TIMEOUT: number = 1800000; // 1800s
export const DEFAULT_LLM_API_TIMEOUT: number = 600000; // 600s
export const GOOGLE_MAP_JAVASCRIPT_URL: string = 'https://maps.googleapis.com/maps/api/js';
+13 -2
View File
@@ -21,6 +21,7 @@ import {
DEFAULT_UPLOAD_API_TIMEOUT,
DEFAULT_EXPORT_API_TIMEOUT,
DEFAULT_IMPORT_API_TIMEOUT,
DEFAULT_CLEAR_ALL_TRANSACTIONS_API_TIMEOUT,
DEFAULT_LLM_API_TIMEOUT,
GOOGLE_MAP_JAVASCRIPT_URL,
BAIDU_MAP_JAVASCRIPT_URL,
@@ -42,6 +43,7 @@ import type {
import type {
ExportTransactionDataRequest,
ClearDataRequest,
ClearAccountTransactionsRequest,
DataStatisticsResponse
} from '@/models/data_management.ts';
import type {
@@ -383,10 +385,19 @@ export default {
}
},
clearAllData: (req: ClearDataRequest): ApiResponsePromise<boolean> => {
return axios.post<ApiResponse<boolean>>('v1/data/clear/all.json', req);
return axios.post<ApiResponse<boolean>>('v1/data/clear/all.json', req, {
timeout: DEFAULT_CLEAR_ALL_TRANSACTIONS_API_TIMEOUT
} as ApiRequestConfig);
},
clearAllTransactions: (req: ClearDataRequest): ApiResponsePromise<boolean> => {
return axios.post<ApiResponse<boolean>>('v1/data/clear/transactions.json', req);
return axios.post<ApiResponse<boolean>>('v1/data/clear/transactions.json', req, {
timeout: DEFAULT_CLEAR_ALL_TRANSACTIONS_API_TIMEOUT
} as ApiRequestConfig);
},
clearAllTransactionsOfAccount: (req: ClearAccountTransactionsRequest): ApiResponsePromise<boolean> => {
return axios.post<ApiResponse<boolean>>('v1/data/clear/transactions/by_account.json', req, {
timeout: DEFAULT_CLEAR_ALL_TRANSACTIONS_API_TIMEOUT
} as ApiRequestConfig);
},
getAllAccounts: ({ visibleOnly }: { visibleOnly: boolean }): ApiResponsePromise<AccountInfoResponse[]> => {
return axios.get<ApiResponse<AccountInfoResponse[]>>('v1/accounts/list.json?visible_only=' + visibleOnly);
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Sind Sie sicher, dass Sie {count} Transaktionen importieren möchten?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "Sie haben {count} Transaktionen erfolgreich importiert.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Ein Aktivierungslink wurde an Ihre E-Mail-Adresse gesendet: {email}. Wenn Sie die E-Mail nicht erhalten haben, geben Sie bitte das Passwort erneut ein und klicken Sie auf die Schaltfläche unten, um die Bestätigungs-E-Mail erneut zu senden.",
"resendValidationEmailTip": "Wenn Sie die E-Mail nicht erhalten haben, geben Sie bitte das Passwort erneut ein und klicken Sie auf die Schaltfläche unten, um die Bestätigungs-E-Mail an: {email} erneut zu senden."
}
@@ -1409,6 +1410,7 @@
"Continue": "Weiter",
"Previous": "Zurück",
"Next": "Weiter",
"Confirm": "Confirm",
"Status": "Status",
"Enable": "Aktivieren",
"Enabled": "Aktiviert",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Diese Aktion kann NICHT rückgängig gemacht werden. Dies wird Ihre Konten, Kategorien, Tags und Transaktionsdaten löschen. Bitte geben Sie Ihr aktuelles Passwort ein, um zu bestätigen.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Alle Benutzerdaten wurden gelöscht",
"Unable to clear user data": "Benutzerdaten können nicht gelöscht werden",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Are you sure you want to import {count} transactions?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "You have imported {count} transactions successfully.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Account activation link has been sent to your email address: {email}, If you don't receive the mail, please fill password again and click the button below to resend the validation mail.",
"resendValidationEmailTip": "If you don't receive the mail, please fill password again and click the button below to resend the validation mail to: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Continue",
"Previous": "Previous",
"Next": "Next",
"Confirm": "Confirm",
"Status": "Status",
"Enable": "Enable",
"Enabled": "Enabled",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "All user data has been cleared",
"Unable to clear user data": "Unable to clear user data",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "¿Está seguro de que desea importar {count} transacciones?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "Ha importado {count} transacciones correctamente.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "El enlace de activación de la cuenta se envió a su dirección de correo electrónico: {email}. Si no recibe el correo, ingrese la contraseña nuevamente y haga clic en el botón a continuación para reenviar el correo de validación.",
"resendValidationEmailTip": "Si no recibe el correo, complete nuevamente la contraseña y haga clic en el botón a continuación para reenviar el correo de validación a: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Continuar",
"Previous": "Anterior",
"Next": "Siguiente",
"Confirm": "Confirm",
"Status": "Estado",
"Enable": "Activar",
"Enabled": "Activado",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "NO PUEDE deshacer esta acción. Esto borrará sus cuentas, categorías, etiquetas y datos de transacciones. Por favor ingrese su contraseña actual para confirmar.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Todos los datos del usuario han sido borrados.",
"Unable to clear user data": "No se pueden borrar los datos del usuario",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Êtes-vous sûr de vouloir importer {count} transactions ?",
"importingTransactions": "Importation ({process}%)",
"importTransactionResult": "Vous avez importé {count} transactions avec succès.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Le lien d'activation du compte a été envoyé à votre adresse e-mail : {email}, Si vous ne recevez pas le mail, veuillez remplir à nouveau le mot de passe et cliquer sur le bouton ci-dessous pour renvoyer l'e-mail de validation.",
"resendValidationEmailTip": "Si vous ne recevez pas le mail, veuillez remplir à nouveau le mot de passe et cliquer sur le bouton ci-dessous pour renvoyer l'e-mail de validation à : {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Continuer",
"Previous": "Précédent",
"Next": "Suivant",
"Confirm": "Confirm",
"Status": "État",
"Enable": "Activer",
"Enabled": "Activé",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "Vous NE POUVEZ PAS annuler cette action. Ceci effacera vos données de transactions. Veuillez entrer votre mot de passe actuel pour confirmer.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Vous NE POUVEZ PAS annuler cette action. Ceci effacera vos comptes, catégories, étiquettes et données de transactions. Veuillez entrer votre mot de passe actuel pour confirmer.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Vous NE POUVEZ PAS annuler cette action. \"Effacer toutes les transactions\" effacera toutes vos données de transactions, et \"Effacer toutes les données\" effacera vos comptes, catégories, étiquettes et données de transactions. Veuillez entrer votre mot de passe actuel pour confirmer.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "Toutes les transactions ont été effacées",
"All user data has been cleared": "Toutes les données utilisateur ont été effacées",
"Unable to clear user data": "Impossible d'effacer les données utilisateur",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Sei sicuro di voler importare {count} transazioni?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "Hai importato {count} transazioni.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Abbiamo inviato un link per l'attivazione del tuo account all'indirizzo {email}. Se non hai ricevuto la mail, inserisci nuovamente la password e premi il bottone per ritentare l'invio.",
"resendValidationEmailTip": "Se non hai ricevuto la mail, inserisci nuovamente la password e premi il bottone per ritentare l'invio all'indirizzo: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Continua",
"Previous": "Precedente",
"Next": "Successivo",
"Confirm": "Confirm",
"Status": "Stato",
"Enable": "Abilita",
"Enabled": "Abilitato",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "NON PUOI annullare questa azione. Questo cancellerà i tuoi account, categorie, tag e dati delle transazioni. Inserisci la tua password attuale per confermare.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Tutti i dati utente sono stati cancellati",
"Unable to clear user data": "Impossibile cancellare i dati utente",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "本当に{count}件の取引をインポートしますか?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "{count}件の取引を正常にインポートしました。",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "アカウントの有効化リンクがメールアドレスに送信されました:{email}、メールが届かない場合はパスワードをもう一度入力して下のボタンをクリックして認証メールを再送信してください。",
"resendValidationEmailTip": "メールが届かない場合は、パスワードをもう一度入力の上、以下のボタンをクリックして検証メールを再送信してください: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "続ける",
"Previous": "前",
"Next": "次",
"Confirm": "Confirm",
"Status": "ステータス",
"Enable": "有効",
"Enabled": "有効になっています",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "このアクションを元に戻すことはできません。これにより、口座、カテゴリ、タグ、および取引データがクリアされます。確認のため現在のパスワードを入力してください。",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "ユーザーデータがすべてクリアされました",
"Unable to clear user data": "ユーザーデータをクリアできません",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Weet je zeker dat je {count} transacties wilt importeren?",
"importingTransactions": "Bezig met importeren ({process}%)",
"importTransactionResult": "Je hebt {count} transacties succesvol geïmporteerd.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Een activatielink is verzonden naar je e-mailadres: {email}. Als je de e-mail niet ontvangt, vul dan je wachtwoord opnieuw in en klik op de knop hieronder om de validatiemail opnieuw te verzenden.",
"resendValidationEmailTip": "Als je de e-mail niet ontvangt, vul dan je wachtwoord opnieuw in en klik op de knop hieronder om de validatiemail opnieuw te verzenden naar: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Doorgaan",
"Previous": "Vorige",
"Next": "Volgende",
"Confirm": "Confirm",
"Status": "Status",
"Enable": "Inschakelen",
"Enabled": "Ingeschakeld",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Dit kan NIET ongedaan worden gemaakt. Je rekeningen, categorieën, tags en transacties worden gewist. Voer je huidige wachtwoord in ter bevestiging.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Alle gebruikersgegevens zijn gewist",
"Unable to clear user data": "Kan gebruikersgegevens niet wissen",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Tem certeza de que deseja importar {count} transações?",
"importingTransactions": "Importando ({process}%)",
"importTransactionResult": "Você importou {count} transações com sucesso.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "O link de ativação da conta foi enviado para seu endereço de e-mail: {email}. Se você não receber o e-mail, por favor preencha a senha novamente e clique no botão abaixo para reenviar o e-mail de validação.",
"resendValidationEmailTip": "Se você não receber o e-mail, por favor preencha a senha novamente e clique no botão abaixo para reenviar o e-mail de validação para: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Continuar",
"Previous": "Anterior",
"Next": "Próximo",
"Confirm": "Confirm",
"Status": "Status",
"Enable": "Habilitar",
"Enabled": "Habilitado",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Você NÃO PODE desfazer esta ação. Isto apagará seus dados de contas, categorias, tags e transações. Por favor, insira sua senha atual para confirmar.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Todos os dados de usuário foram apagados",
"Unable to clear user data": "Não foi possível limpar os dados de usuário",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Вы уверены, что хотите импортировать {count} транзакций?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "Вы успешно импортировали {count} транзакций.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Ссылка для активации учетной записи была отправлена на ваш электронный адрес: {email}. Если вы не получили письмо, заполните пароль снова и нажмите кнопку ниже, чтобы отправить письмо повторно.",
"resendValidationEmailTip": "Если вы не получили письмо, заполните пароль снова и нажмите кнопку ниже, чтобы отправить письмо повторно на: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Продолжить",
"Previous": "Предыдущий",
"Next": "Следующий",
"Confirm": "Confirm",
"Status": "Статус",
"Enable": "Включить",
"Enabled": "Включено",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Вы НЕ сможете отменить это действие. Это очистит данные ваших счетов, категорий, тегов и транзакций. Пожалуйста, введите текущий пароль для подтверждения.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Все данные пользователя были очищены",
"Unable to clear user data": "Не удалось очистить данные пользователя",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Ви впевнені, що хочете імпортувати {count} транзакцій?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "Ви успішно імпортували {count} транзакцій.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Посилання для активації облікового запису було надіслано на вашу електронну адресу: {email}. Якщо ви не отримали лист, введіть пароль ще раз і натисніть кнопку нижче, щоб надіслати лист повторно.",
"resendValidationEmailTip": "Якщо ви не отримали лист, введіть пароль ще раз і натисніть кнопку нижче, щоб надіслати лист повторно на адресу: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Продовжити",
"Previous": "Назад",
"Next": "Далі",
"Confirm": "Confirm",
"Status": "Статус",
"Enable": "Увімкнути",
"Enabled": "Увімкнено",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Цю дію не можна скасувати. Будуть видалені рахунки, категорії, теги та транзакції. Введіть поточний пароль для підтвердження.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Усі дані користувача очищено",
"Unable to clear user data": "Не вдалося очистити дані",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "Bạn có chắc chắn muốn nhập {count} giao dịch không?",
"importingTransactions": "Importing ({process}%)",
"importTransactionResult": "Bạn đã nhập thành công {count} giao dịch.",
"clearTransactionsInAccountTip": "You CANNOT undo this action. This will clear your transactions data in {account}. Please enter your current password to confirm.",
"accountActivationAndResendValidationEmailTip": "Liên kết kích hoạt tài khoản đã được gửi tới email của bạn: {email}. Nếu bạn không nhận được email, vui lòng nhập lại mật khẩu và nhấp nút bên dưới để gửi lại email xác nhận.",
"resendValidationEmailTip": "Nếu bạn không nhận được email, vui lòng nhập lại mật khẩu và nhấp nút bên dưới để gửi lại email xác nhận tới: {email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "Tiếp tục",
"Previous": "Trước",
"Next": "Tiếp theo",
"Confirm": "Confirm",
"Status": "Trạng thái",
"Enable": "Bật",
"Enabled": "Đã bật",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "Bạn KHÔNG THỂ hoàn tác hành động này. Thao tác này sẽ xóa dữ liệu tài khoản, danh mục, thẻ và giao dịch của bạn. Vui lòng nhập mật khẩu hiện tại của bạn để xác nhận.",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.",
"All transactions in this account has been cleared": "All transactions in this account has been cleared",
"All transactions has been cleared": "All transactions has been cleared",
"All user data has been cleared": "Tất cả dữ liệu người dùng đã bị xóa",
"Unable to clear user data": "Không thể xóa dữ liệu người dùng",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "您确定要导入 {count} 个交易?",
"importingTransactions": "正在导入 ({process}%)",
"importTransactionResult": "您已经成功导入 {count} 个交易。",
"clearTransactionsInAccountTip": "您不能撤销该操作。该操作将会清除您在 {account} 账户中的交易数据。请输入您当前的密码以确认。",
"accountActivationAndResendValidationEmailTip": "账号激活链接已经发送到您的邮箱地址:{email},如果您没有收到邮件,请再次输入密码并点击下方的按钮重新发送验证邮件。",
"resendValidationEmailTip": "如果您没有收到邮件,请再次输入密码并点击下方的按钮重新发送验证邮件到:{email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "继续",
"Previous": "上一步",
"Next": "下一步",
"Confirm": "确认",
"Status": "状态",
"Enable": "启用",
"Enabled": "启用",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "您不能撤销该操作。该操作将会清除您的交易数据。请输入您当前的密码以确认。",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "您不能撤销该操作。该操作将会清除您的账户、分类、标签以及交易数据。请输入您当前的密码以确认。",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "您不能撤销该操作。\"清除所有交易\" 将会清除您的所有交易数据,以及 \"清除所有数据\" 将会清除您的账户、分类、标签以及交易数据。请输入您当前的密码以确认。",
"All transactions in this account has been cleared": "该账户中的所有交易已经清空",
"All transactions has been cleared": "所有交易已经清空",
"All user data has been cleared": "用户所有数据已经清空",
"Unable to clear user data": "无法清除用户数据",
+3
View File
@@ -124,6 +124,7 @@
"confirmImportTransactions": "您確定要匯入 {count} 個交易?",
"importingTransactions": "正在匯入 ({process}%)",
"importTransactionResult": "您已經成功匯入 {count} 個交易。",
"clearTransactionsInAccountTip": "您不能還原此操作。此操作將會清除您在 {account} 帳戶中的交易資料。請輸入您目前的密碼以確認。",
"accountActivationAndResendValidationEmailTip": "帳號啟用連結已經傳送到您的信箱地址:{email},如果您沒有收到郵件,請再次輸入密碼並點擊下方的按鈕重新發送驗證郵件。",
"resendValidationEmailTip": "如果您沒有收到郵件,請再次輸入密碼並點擊下方的按鈕重新發送驗證郵件到:{email}"
}
@@ -1409,6 +1410,7 @@
"Continue": "繼續",
"Previous": "上一步",
"Next": "下一步",
"Confirm": "確認",
"Status": "狀態",
"Enable": "啟用",
"Enabled": "啟用",
@@ -2098,6 +2100,7 @@
"You CANNOT undo this action. This will clear your transactions data. Please enter your current password to confirm.": "您不能還原此操作。此操作將會清除您的交易資料。請輸入您目前的密碼以確認。",
"You CANNOT undo this action. This will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "您不能還原此操作。此操作將會清除您的帳戶、分類、標籤以及交易資料。請輸入您目前的密碼以確認。",
"You CANNOT undo this action. \"Clear All Transactions\" will clear all your transactions data, and \"Clear All Data\" will clear your accounts, categories, tags and transactions data. Please enter your current password to confirm.": "您不能還原此操作。\"清除所有交易\" 將會清除您的所有交易資料,以及 \"清除所有資料\" 將會清除您的帳戶、分類、標籤以及交易資料。請輸入您目前的密碼以確認。",
"All transactions in this account has been cleared": "此帳戶中的所有交易已經清空",
"All transactions has been cleared": "所有交易已經清空",
"All user data has been cleared": "使用者所有資料已經清空",
"Unable to clear user data": "無法清除使用者資料",
+5
View File
@@ -14,6 +14,11 @@ export interface ClearDataRequest {
readonly password: string;
}
export interface ClearAccountTransactionsRequest {
readonly accountId: string;
readonly password: string;
}
export interface DataStatisticsResponse {
readonly totalAccountCount: string;
readonly totalTransactionCategoryCount: string;
+43 -2
View File
@@ -457,6 +457,46 @@ export const useRootStore = defineStore('root', () => {
});
}
function clearAllUserTransactionsOfAccount({ accountId, password }: { accountId: string, password: string }): Promise<boolean> {
return new Promise((resolve, reject) => {
services.clearAllTransactionsOfAccount({
accountId: accountId,
password: password
}).then(response => {
const data = response.data;
if (!data || !data.success || !data.result) {
reject({ message: 'Unable to clear user data' });
return;
}
if (!accountsStore.accountListStateInvalid) {
accountsStore.updateAccountListInvalidState(true);
}
if (!overviewStore.transactionOverviewStateInvalid) {
overviewStore.updateTransactionOverviewInvalidState(true);
}
if (!statisticsStore.transactionStatisticsStateInvalid) {
statisticsStore.updateTransactionStatisticsInvalidState(true);
}
resolve(data.result);
}).catch(error => {
logger.error('failed to clear user data', error);
if (error && error.processed) {
reject(error);
} else if (error.response && error.response.data && error.response.data.errorMessage) {
reject({ error: error.response.data });
} else {
reject({ message: 'Unable to clear user data' });
}
});
});
}
function clearAllUserTransactions({ password }: { password: string }): Promise<boolean> {
return new Promise((resolve, reject) => {
services.clearAllTransactions({
@@ -560,7 +600,8 @@ export const useRootStore = defineStore('root', () => {
resetPassword,
updateUserProfile,
resendVerifyEmailByLoginedUser,
clearAllUserData,
clearAllUserTransactions
clearAllUserTransactionsOfAccount,
clearAllUserTransactions,
clearAllUserData
};
});
+22
View File
@@ -248,6 +248,13 @@
@click="edit(element)">
{{ tt('Edit') }}
</v-btn>
<v-btn class="px-2 ms-1" density="comfortable" color="default" variant="text"
:class="{ 'd-none': loading, 'hover-display': !loading }"
:disabled="loading" :prepend-icon="mdiEraser"
v-if="element.type === AccountType.SingleAccount.type || element.getSubAccount(activeSubAccount[element.id])"
@click="clearAllTransactions(element)">
{{ tt('Clear All Transactions') }}
</v-btn>
<v-btn class="px-2 ms-1" density="comfortable" color="default" variant="text"
:class="{ 'd-none': loading, 'hover-display': !loading }"
:disabled="loading" :prepend-icon="mdiDeleteOutline"
@@ -282,6 +289,7 @@
<edit-dialog ref="editDialog" />
<reconciliation-statement-dialog ref="reconciliationStatementDialog"
@error="onShowDateRangeError" />
<clear-all-transactions-dialog ref="clearAllTransactionsDialog" />
<date-range-selection-dialog :title="tt('Custom Date Range')"
v-model:show="showCustomDateRangeDialog"
@@ -297,6 +305,7 @@ import ConfirmDialog from '@/components/desktop/ConfirmDialog.vue';
import SnackBar from '@/components/desktop/SnackBar.vue';
import EditDialog from './list/dialogs/EditDialog.vue';
import ReconciliationStatementDialog from './list/dialogs/ReconciliationStatementDialog.vue';
import ClearAllTransactionsDialog from '@/views/desktop/accounts/list/dialogs/ClearAllTransactionsDialog.vue';
import AccountFilterSettingsCard from '@/views/desktop/common/cards/AccountFilterSettingsCard.vue';
import { ref, computed, useTemplateRef, watch } from 'vue';
@@ -322,6 +331,7 @@ import {
mdiSquareRounded,
mdiMenu,
mdiPencilOutline,
mdiEraser,
mdiDeleteOutline,
mdiListBoxOutline,
mdiInvoiceListOutline,
@@ -333,6 +343,7 @@ type ConfirmDialogType = InstanceType<typeof ConfirmDialog>;
type SnackBarType = InstanceType<typeof SnackBar>;
type EditDialogType = InstanceType<typeof EditDialog>;
type ReconciliationStatementDialogType = InstanceType<typeof ReconciliationStatementDialog>;
type ClearAllTransactionsDialogType = InstanceType<typeof ClearAllTransactionsDialog>;
const display = useDisplay();
@@ -361,6 +372,7 @@ const confirmDialog = useTemplateRef<ConfirmDialogType>('confirmDialog');
const snackbar = useTemplateRef<SnackBarType>('snackbar');
const editDialog = useTemplateRef<EditDialogType>('editDialog');
const reconciliationStatementDialog = useTemplateRef<ReconciliationStatementDialogType>('reconciliationStatementDialog');
const clearAllTransactionsDialog = useTemplateRef<ClearAllTransactionsDialogType>('clearAllTransactionsDialog');
const activeAccountCategoryType = ref<number>(AccountCategory.Default.type);
const activeTab = ref<string>('accountPage');
@@ -513,6 +525,16 @@ function showReconciliationStatementCustomDateRangeDialog(account: Account, date
});
}
function clearAllTransactions(account: Account): void {
clearAllTransactionsDialog.value?.open(account).then(() => {
snackbar.value?.showMessage('All transactions in this account has been cleared');
if (accountsStore.accountListStateInvalid && !loading.value) {
reload(false);
}
});
}
function hide(account: Account, targetAccount: Account, hidden: boolean): void {
loading.value = true;
@@ -0,0 +1,111 @@
<template>
<v-dialog width="640" :persistent="true" v-model="showState">
<v-card class="pa-2 pa-sm-4 pa-md-4">
<template #title>
<div class="d-flex align-center justify-center">
<h4 class="text-h4 text-error text-wrap">{{ tt('Are you sure you want to clear all transactions?') }}</h4>
</div>
</template>
<v-card-text class="pb-2 text-error">{{ tt('format.misc.clearTransactionsInAccountTip', { account: currentAccount?.name }) }}</v-card-text>
<v-card-text class="mb-md-4 w-100 d-flex justify-center">
<div class="w-100">
<v-text-field
autocomplete="current-password"
type="password"
variant="underlined"
color="error"
:disabled="clearingData"
:placeholder="tt('Current Password')"
v-model="currentPassword"
/>
</div>
</v-card-text>
<v-card-text class="overflow-y-visible">
<div class="w-100 d-flex justify-center gap-4">
<v-btn color="error" :disabled="!currentPassword || clearingData" @click="confirm">
{{ tt('Confirm') }}
<v-progress-circular indeterminate size="22" class="ms-2" v-if="clearingData"></v-progress-circular>
</v-btn>
<v-btn color="secondary" variant="tonal" :disabled="clearingData" @click="cancel">
{{ tt('Cancel') }}
</v-btn>
</div>
</v-card-text>
</v-card>
</v-dialog>
<snack-bar ref="snackbar" />
</template>
<script setup lang="ts">
import SnackBar from '@/components/desktop/SnackBar.vue';
import { ref, useTemplateRef } from 'vue';
import { useI18n } from '@/locales/helpers.ts';
import { useRootStore } from '@/stores/index.ts';
import { Account } from '@/models/account.ts';
type SnackBarType = InstanceType<typeof SnackBar>;
const { tt } = useI18n();
const rootStore = useRootStore();
let resolveFunc: (() => void) | null = null;
let rejectFunc: ((reason?: unknown) => void) | null = null;
const snackbar = useTemplateRef<SnackBarType>('snackbar');
const showState = ref<boolean>(false);
const clearingData = ref<boolean>(false);
const currentPassword = ref<string>('');
const currentAccount = ref<Account | undefined>(undefined);
function open(account: Account): Promise<void> {
showState.value = true;
clearingData.value = false;
currentPassword.value = '';
currentAccount.value = account;
return new Promise((resolve, reject) => {
resolveFunc = resolve;
rejectFunc = reject;
});
}
function confirm(): void {
if (!currentAccount.value || !currentPassword.value) {
return;
}
clearingData.value = true;
rootStore.clearAllUserTransactionsOfAccount({
accountId: currentAccount.value.id,
password: currentPassword.value
}).then(() => {
clearingData.value = false;
resolveFunc?.();
showState.value = false;
}).catch(error => {
clearingData.value = false;
if (!error.processed) {
snackbar.value?.showError(error);
}
});
}
function cancel(): void {
rejectFunc?.();
showState.value = false;
}
defineExpose({
open
});
</script>
+62
View File
@@ -162,12 +162,16 @@
<f7-actions-group v-if="accountForMoreActionSheet && accountForMoreActionSheet.type === AccountType.SingleAccount.type">
<f7-actions-button @click="showReconciliationStatement(accountForMoreActionSheet)">{{ tt('Reconciliation Statement') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group v-if="accountForMoreActionSheet && accountForMoreActionSheet.type === AccountType.SingleAccount.type">
<f7-actions-button color="red" @click="showPasswordSheetForClearAllTransaction(accountForMoreActionSheet)">{{ tt('Clear All Transactions') }}</f7-actions-button>
</f7-actions-group>
<template v-if="accountForMoreActionSheet && accountForMoreActionSheet.type === AccountType.MultiSubAccounts.type">
<f7-actions-group :key="subAccount.id"
v-for="subAccount in accountForMoreActionSheet.subAccounts"
v-show="showHidden || !subAccount.hidden">
<f7-actions-label>{{ subAccount.name }}</f7-actions-label>
<f7-actions-button @click="showReconciliationStatement(subAccount)">{{ tt('Reconciliation Statement') }}</f7-actions-button>
<f7-actions-button color="red" @click="showPasswordSheetForClearAllTransaction(subAccount)">{{ tt('Clear All Transactions') }}</f7-actions-button>
</f7-actions-group>
</template>
<f7-actions-group>
@@ -198,6 +202,16 @@
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
</f7-actions-group>
</f7-actions>
<password-input-sheet :title="tt('Are you sure you want to clear all transactions?')"
:hint="tt('format.misc.clearTransactionsInAccountTip', { account: accountToClearTransactions?.name ?? 'undefined' })"
:confirm-disabled="clearingData"
:cancel-disabled="clearingData"
color="red"
v-model:show="showInputPasswordSheetForClearAllTransactions"
v-model="currentPasswordForClearData"
@password:confirm="clearAllTransactions">
</password-input-sheet>
</f7-page>
</template>
@@ -209,6 +223,7 @@ import { useI18n } from '@/locales/helpers.ts';
import { useI18nUIComponents, showLoading, hideLoading } from '@/lib/ui/mobile.ts';
import { useAccountListPageBaseBase } from '@/views/base/accounts/AccountListPageBase.ts';
import { useRootStore } from '@/stores/index.ts';
import { useAccountsStore } from '@/stores/account.ts';
import { TextDirection } from '@/core/text.ts';
@@ -238,15 +253,20 @@ const {
accountBalance
} = useAccountListPageBaseBase();
const rootStore = useRootStore();
const accountsStore = useAccountsStore();
const loadingError = ref<unknown | null>(null);
const sortable = ref<boolean>(false);
const accountForMoreActionSheet = ref<Account | null>(null);
const accountToDelete = ref<Account | null>(null);
const accountToClearTransactions = ref<Account | null>(null);
const currentPasswordForClearData = ref<string>('');
const clearingData = ref<boolean>(false);
const showAccountMoreActionSheet = ref<boolean>(false);
const showMoreActionSheet = ref<boolean>(false);
const showDeleteActionSheet = ref<boolean>(false);
const showInputPasswordSheetForClearAllTransactions = ref<boolean>(false);
const displayOrderSaving = ref<boolean>(false);
const textDirection = computed<TextDirection>(() => getCurrentLanguageTextDirection());
@@ -343,6 +363,48 @@ function showReconciliationStatement(account: Account | null): void {
accountForMoreActionSheet.value = null;
}
function showPasswordSheetForClearAllTransaction(account: Account | null): void {
if (!account) {
showAlert('An error occurred');
return;
}
accountToClearTransactions.value = account;
currentPasswordForClearData.value = '';
showInputPasswordSheetForClearAllTransactions.value = true;
showAccountMoreActionSheet.value = false;
accountForMoreActionSheet.value = null;
}
function clearAllTransactions(password: string): void {
if (!accountToClearTransactions.value) {
showAlert('An error occurred');
return;
}
clearingData.value = true;
showLoading(() => clearingData.value);
rootStore.clearAllUserTransactionsOfAccount({
accountId: accountToClearTransactions.value.id,
password: password
}).then(() => {
clearingData.value = false;
currentPasswordForClearData.value = '';
hideLoading();
showInputPasswordSheetForClearAllTransactions.value = false;
showToast('All transactions in this account has been cleared');
}).catch(error => {
clearingData.value = false;
hideLoading();
if (!error.processed) {
showToast(error.message || error);
}
});
}
function hide(account: Account, hidden: boolean): void {
showLoading();