From 5218632c00791b3c7c9eb2c21b0f1ba8f9d75648 Mon Sep 17 00:00:00 2001 From: Arseni Date: Tue, 16 Dec 2025 18:42:57 +0300 Subject: [PATCH] Made clear massages for errors in recipient registration --- frontend/pweb/lib/l10n/en.arb | 10 +++++++++- frontend/pweb/lib/l10n/ru.arb | 10 +++++++++- .../pweb/lib/pages/address_book/form/page.dart | 15 +++++++++++---- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/frontend/pweb/lib/l10n/en.arb b/frontend/pweb/lib/l10n/en.arb index 22fd2f5..515aaa5 100644 --- a/frontend/pweb/lib/l10n/en.arb +++ b/frontend/pweb/lib/l10n/en.arb @@ -425,9 +425,13 @@ "addRecipient": "Add Recipient", "editRecipient": "Edit Recipient", "saveRecipient": "Save Recipient", - + "choosePaymentMethod": "Payment Methods (choose at least 1)", "recipientFormRule": "Recipient must have at least one payment method", + "recipientFormValidationError": "Fill in the required fields to save the recipient", + "@recipientFormValidationError": { + "description": "Error message shown when recipient form fields are invalid or missing" + }, "allStatus": "All", "readyStatus": "Ready", @@ -443,6 +447,10 @@ "@errorSaveRecipient": { "description": "Error message displayed when saving a recipient fails" }, + "recipientSavedSuccessfully": "Recipient saved successfully", + "@recipientSavedSuccessfully": { + "description": "Success message displayed when a recipient is saved" + }, "recipientDeletedSuccessfully": "Recipient deleted successfully", "@recipientDeletedSuccessfully": { "description": "Success message displayed when a recipient is deleted" diff --git a/frontend/pweb/lib/l10n/ru.arb b/frontend/pweb/lib/l10n/ru.arb index e47f9dc..6eb4a16 100644 --- a/frontend/pweb/lib/l10n/ru.arb +++ b/frontend/pweb/lib/l10n/ru.arb @@ -425,9 +425,13 @@ "addRecipient": "Добавить получателя", "editRecipient": "Редактировать получателя", "saveRecipient": "Сохранить получателя", - + "choosePaymentMethod": "Способы оплаты (выберите хотя бы 1)", "recipientFormRule": "Получатель должен иметь хотя бы один способ оплаты", + "recipientFormValidationError": "Заполните обязательные поля, чтобы сохранить получателя", + "@recipientFormValidationError": { + "description": "Сообщение об ошибке, если обязательные поля формы получателя не заполнены" + }, "allStatus": "Все", "readyStatus": "Готов", @@ -443,6 +447,10 @@ "@errorSaveRecipient": { "description": "Сообщение об ошибке при неудачном сохранении получателя" }, + "recipientSavedSuccessfully": "Получатель успешно сохранен", + "@recipientSavedSuccessfully": { + "description": "Сообщение об успешном сохранении получателя" + }, "recipientDeletedSuccessfully": "Получатель успешно удален", "@recipientDeletedSuccessfully": { "description": "Сообщение об успешном удалении получателя" diff --git a/frontend/pweb/lib/pages/address_book/form/page.dart b/frontend/pweb/lib/pages/address_book/form/page.dart index 0404025..74db1a9 100644 --- a/frontend/pweb/lib/pages/address_book/form/page.dart +++ b/frontend/pweb/lib/pages/address_book/form/page.dart @@ -101,8 +101,15 @@ class _AdressBookRecipientFormState extends State { //TODO: Change when registration is ready Future _save() async { - if (!_formKey.currentState!.validate() || _methods.isEmpty) { - notifyUser(context, AppLocalizations.of(context)!.errorSaveRecipient); + final l10n = AppLocalizations.of(context)!; + + if (!_formKey.currentState!.validate()) { + notifyUser(context, l10n.recipientFormValidationError); + return; + } + + if (_methods.isEmpty) { + notifyUser(context, l10n.recipientFormRule); return; } @@ -114,8 +121,8 @@ class _AdressBookRecipientFormState extends State { final recipient = await executeActionWithNotification( context: context, action: _doSave, - errorMessage: AppLocalizations.of(context)!.errorSaveRecipient, - successMessage: AppLocalizations.of(context)!.recipientFormRule, + errorMessage: l10n.errorSaveRecipient, + successMessage: l10n.recipientSavedSuccessfully, );