feat(branches & warehouses): handle errors.

This commit is contained in:
elforjani13
2022-03-13 15:20:00 +02:00
parent 0bbd31dcce
commit bd3059ecd8
4 changed files with 19 additions and 3 deletions

View File

@@ -12,4 +12,10 @@ export const handleDeleteErrors = (errors) => {
intent: Intent.DANGER,
});
}
if (errors.some((e) => e.type === 'BRANCH_HAS_ASSOCIATED_TRANSACTIONS')) {
AppToaster.show({
message: intl.get('branche.error.branch_has_associated_transactions'),
intent: Intent.DANGER,
});
}
};

View File

@@ -14,4 +14,12 @@ export const handleDeleteErrors = (errors) => {
intent: Intent.DANGER,
});
}
if (errors.some((e) => e.type === 'WAREHOUSE_HAS_ASSOCIATED_TRANSACTIONS')) {
AppToaster.show({
message: intl.get(
'warehouse.error.warehouse_has_associated_transactions',
),
intent: Intent.DANGER,
});
}
};

View File

@@ -19,7 +19,7 @@ import ReceiptItemsEntriesEditor from './ReceiptItemsEntriesEditor';
import ReceiptFormFloatingActions from './ReceiptFormFloatingActions';
import ReceiptFormFooter from './ReceiptFormFooter';
import ReceiptFormDialogs from './ReceiptFormDialogs';
import ReceiptFormTopBar from './ReceiptFormTopBar';
import ReceiptFormTopBar from './ReceiptFormTopbar';
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
import withSettings from 'containers/Settings/withSettings';

View File

@@ -1898,6 +1898,8 @@
"vendor_opening_balance.label.opening_balance_at": "Opening balance at",
"customer.label.opening_branch": "Opening Balance Branch",
"vendor.label.opening_branch": "Opening Balance Branch",
"warehouse.error.warehouse_code_not_unique":"Warehouse code not unique",
"branche.error.warehouse_code_not_unique":"Branch code not unique"
"warehouse.error.warehouse_code_not_unique": "Warehouse code not unique",
"warehouse.error.warehouse_has_associated_transactions": "You could not delete the warehouse that has associated transactions.",
"branche.error.warehouse_code_not_unique": "Branch code not unique",
"branche.error.branch_has_associated_transactions": "You could not delete the branch that has associated transactions."
}