Made clear massages for errors in recipient registration

This commit is contained in:
Arseni
2025-12-16 18:42:57 +03:00
parent 67b52af150
commit 5218632c00
3 changed files with 29 additions and 6 deletions

View File

@@ -425,9 +425,13 @@
"addRecipient": "Add Recipient", "addRecipient": "Add Recipient",
"editRecipient": "Edit Recipient", "editRecipient": "Edit Recipient",
"saveRecipient": "Save Recipient", "saveRecipient": "Save Recipient",
"choosePaymentMethod": "Payment Methods (choose at least 1)", "choosePaymentMethod": "Payment Methods (choose at least 1)",
"recipientFormRule": "Recipient must have at least one payment method", "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", "allStatus": "All",
"readyStatus": "Ready", "readyStatus": "Ready",
@@ -443,6 +447,10 @@
"@errorSaveRecipient": { "@errorSaveRecipient": {
"description": "Error message displayed when saving a recipient fails" "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": "Recipient deleted successfully",
"@recipientDeletedSuccessfully": { "@recipientDeletedSuccessfully": {
"description": "Success message displayed when a recipient is deleted" "description": "Success message displayed when a recipient is deleted"

View File

@@ -425,9 +425,13 @@
"addRecipient": "Добавить получателя", "addRecipient": "Добавить получателя",
"editRecipient": "Редактировать получателя", "editRecipient": "Редактировать получателя",
"saveRecipient": "Сохранить получателя", "saveRecipient": "Сохранить получателя",
"choosePaymentMethod": "Способы оплаты (выберите хотя бы 1)", "choosePaymentMethod": "Способы оплаты (выберите хотя бы 1)",
"recipientFormRule": "Получатель должен иметь хотя бы один способ оплаты", "recipientFormRule": "Получатель должен иметь хотя бы один способ оплаты",
"recipientFormValidationError": "Заполните обязательные поля, чтобы сохранить получателя",
"@recipientFormValidationError": {
"description": "Сообщение об ошибке, если обязательные поля формы получателя не заполнены"
},
"allStatus": "Все", "allStatus": "Все",
"readyStatus": "Готов", "readyStatus": "Готов",
@@ -443,6 +447,10 @@
"@errorSaveRecipient": { "@errorSaveRecipient": {
"description": "Сообщение об ошибке при неудачном сохранении получателя" "description": "Сообщение об ошибке при неудачном сохранении получателя"
}, },
"recipientSavedSuccessfully": "Получатель успешно сохранен",
"@recipientSavedSuccessfully": {
"description": "Сообщение об успешном сохранении получателя"
},
"recipientDeletedSuccessfully": "Получатель успешно удален", "recipientDeletedSuccessfully": "Получатель успешно удален",
"@recipientDeletedSuccessfully": { "@recipientDeletedSuccessfully": {
"description": "Сообщение об успешном удалении получателя" "description": "Сообщение об успешном удалении получателя"

View File

@@ -101,8 +101,15 @@ class _AdressBookRecipientFormState extends State<AdressBookRecipientForm> {
//TODO: Change when registration is ready //TODO: Change when registration is ready
Future<void> _save() async { Future<void> _save() async {
if (!_formKey.currentState!.validate() || _methods.isEmpty) { final l10n = AppLocalizations.of(context)!;
notifyUser(context, AppLocalizations.of(context)!.errorSaveRecipient);
if (!_formKey.currentState!.validate()) {
notifyUser(context, l10n.recipientFormValidationError);
return;
}
if (_methods.isEmpty) {
notifyUser(context, l10n.recipientFormRule);
return; return;
} }
@@ -114,8 +121,8 @@ class _AdressBookRecipientFormState extends State<AdressBookRecipientForm> {
final recipient = await executeActionWithNotification( final recipient = await executeActionWithNotification(
context: context, context: context,
action: _doSave, action: _doSave,
errorMessage: AppLocalizations.of(context)!.errorSaveRecipient, errorMessage: l10n.errorSaveRecipient,
successMessage: AppLocalizations.of(context)!.recipientFormRule, successMessage: l10n.recipientSavedSuccessfully,
); );