From e38b96c5280807242b7362c705d04bafc16c49c5 Mon Sep 17 00:00:00 2001 From: elforjani13 <39470382+elforjani13@users.noreply.github.com> Date: Mon, 7 Mar 2022 22:12:34 +0200 Subject: [PATCH] feat(account): handle error. --- .../Dialogs/AccountDialog/AccountDialogFormContent.js | 1 + src/containers/Dialogs/AccountDialog/utils.js | 7 +++++++ src/lang/ar/index.json | 4 +++- src/lang/en/index.json | 5 +++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js b/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js index ed249e561..2350b0f4e 100644 --- a/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js +++ b/src/containers/Dialogs/AccountDialog/AccountDialogFormContent.js @@ -146,6 +146,7 @@ function AccountFormDialogFields({ )} inline={true} intent={inputIntent({ error, touched })} + helperText={} > { if (errors.find((e) => e.type === 'ACCOUNT.NAME.NOT.UNIQUE')) { fields.name = intl.get('account_name_is_already_used'); } + if ( + errors.find((e) => e.type === 'ACCOUNT_CURRENCY_NOT_SAME_PARENT_ACCOUNT') + ) { + fields.parent_account_id = intl.get( + 'accounts.error.account_currency_not_same_parent_account', + ); + } return fields; }; diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json index fd0a4a941..36cab0141 100644 --- a/src/lang/ar/index.json +++ b/src/lang/ar/index.json @@ -1787,5 +1787,7 @@ "warehouse_locations.column.warehouse_name": "Warehouse name", "warehouse_locations.column.quantity": "Quantity", "warehouse_locations.column.available_for_sale": "Available for sale", - "warehouse_locations.column.warehouse_code": "Warehouse code" + "warehouse_locations.column.warehouse_code": "Warehouse code", + "accounts.error.account_currency_not_same_parent_account": "لا يمكنك إنشاء حساب بعملة مختلفة عن عملة الحساب الأصلي." + } \ No newline at end of file diff --git a/src/lang/en/index.json b/src/lang/en/index.json index e3d517d4b..2a568d6ea 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1800,7 +1800,7 @@ "warehouses.action.make_as_parimary": "Mark as Primary", "warehouse.alert.delete_message": "The warehouse has been deleted successfully", "warehouse.once_delete_this_warehouse": "Once you delete this warehouse, you won't be able to restore it later. Are you sure you want to delete this warehouse?", - "warehouse.error.could_not_delete_only_waerhouse":"You could not delete the only warehouse.", + "warehouse.error.could_not_delete_only_waerhouse": "You could not delete the only warehouse.", "sidebar_warehouse_transfer": "Warehouse Transfers", "warehouse_transfer.label.transfer_no": "Transfer No", "warehouse_transfer.label.form_warehouse": "Form Warehouse", @@ -1883,5 +1883,6 @@ "warehouse_transfer.alert.initiate_warehouse": "The given warehouse transfer has been initialized.", "warehouse_transfer.alert.are_you_sure_you_want_to_initate": "Are you sure you want to initiate this warehouse transfer?", "warehouse_transfer.alert.transferred_warehouse": "The given warehouse transfer has been delivered", - "warehouse_transfer.alert.are_you_sure_you_want_to_deliver": "Are you sure you want to deliver this warehouse transfer?" + "warehouse_transfer.alert.are_you_sure_you_want_to_deliver": "Are you sure you want to deliver this warehouse transfer?", + "accounts.error.account_currency_not_same_parent_account": "You could not create an account in a currency different from the parent account currency." } \ No newline at end of file