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",
"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"

View File

@@ -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": "Сообщение об успешном удалении получателя"

View File

@@ -101,8 +101,15 @@ class _AdressBookRecipientFormState extends State<AdressBookRecipientForm> {
//TODO: Change when registration is ready
Future<void> _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<AdressBookRecipientForm> {
final recipient = await executeActionWithNotification(
context: context,
action: _doSave,
errorMessage: AppLocalizations.of(context)!.errorSaveRecipient,
successMessage: AppLocalizations.of(context)!.recipientFormRule,
errorMessage: l10n.errorSaveRecipient,
successMessage: l10n.recipientSavedSuccessfully,
);