From 86cab7988c6cfba4586d80f55ef036edb1f69db2 Mon Sep 17 00:00:00 2001 From: elforjani13 <39470382+elforjani13@users.noreply.github.com> Date: Thu, 24 Mar 2022 15:03:25 +0200 Subject: [PATCH] feat: handle item error. --- src/containers/Items/utils.js | 8 ++++++++ src/lang/ar/index.json | 6 ++---- src/lang/en/index.json | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/containers/Items/utils.js b/src/containers/Items/utils.js index 406746786..8031e56ea 100644 --- a/src/containers/Items/utils.js +++ b/src/containers/Items/utils.js @@ -104,6 +104,14 @@ export const handleDeleteErrors = (errors) => { intent: Intent.DANGER, }); } + if ( + errors.find((error) => error.type === 'ITEM_HAS_ASSOCIATED_TRANSACTIONS') + ) { + AppToaster.show({ + message: intl.get('item.error.you_could_not_delete_item_has_associated'), + intent: Intent.DANGER, + }); + } }; /** diff --git a/src/lang/ar/index.json b/src/lang/ar/index.json index 3accd9b2f..880af1586 100644 --- a/src/lang/ar/index.json +++ b/src/lang/ar/index.json @@ -1795,13 +1795,10 @@ "profit_loss_sheet.percentage_of_row": "% التغير الأفقي", "profit_loss_sheet.percentage_of_expense": "% التغير في المصاريف", "profit_loss_sheet.percentage_of_income": "% التغير الإيرادات", - "report.balance_sheet_comparison.title": "مقارنة الميزانية العمومية", "report.balance_sheet_comparison.desc": "يعرض أصول الشركة والتزاماتها وحقوق المساهمين في نقطة زمنية محددة مقارنة بالسنة الماضية.", - "report.profit_loss_sheet_comparison.title": "مقارنة قائمة الدخل", "report.profit_loss_sheet_comparison.desc": "يعرض الإيرادات والتكاليف والمصاريف المتكبدة في نقطة محددة ومقارنة بالعام السابق.", - "warehouse_locations.label": "المخازن", "warehouse_locations.column.warehouse_name": "اسم المخزن", "warehouse_locations.column.quantity": "الكمية", @@ -2007,5 +2004,6 @@ "receipt.branch_button.label": "الفرع: {label}", "receipt.warehouse_button.label": "المخزن: {label}", "warehouse_transfer.empty_status.title": "", - "warehouse_transfer.empty_status.description": "" + "warehouse_transfer.empty_status.description": "", + "item.error.you_could_not_delete_item_has_associated": "لا يمكنك حذف العنصر لديه معاملات مرتبطة به " } \ No newline at end of file diff --git a/src/lang/en/index.json b/src/lang/en/index.json index 41d4ebc9e..fd2ad8d65 100644 --- a/src/lang/en/index.json +++ b/src/lang/en/index.json @@ -1440,6 +1440,7 @@ "AP_aging_summary.filter_options.label": "Filter vendors", "item.error.type_cannot_change_with_item_has_transactions": "Cannot change item type to inventory with item has associated transactions.", "item.error.cannot_change_inventory_account": "Cannot change item inventory account while the item has transactions.", + "item.error.you_could_not_delete_item_has_associated":"You could not delete item that has associated transactions", "customer.link.customer_details": "Customer details ({amount})", "bad_debt.dialog.written_off_amount": "Written-off amount", "bad_debt.dialog.bad_debt": "Bad debt",