This commit is contained in:
a.bouhuolia
2021-03-20 18:59:56 +02:00
3 changed files with 35 additions and 1 deletions

View File

@@ -37,4 +37,17 @@ export const handleDeleteErrors = (errors) => {
intent: Intent.DANGER,
});
}
if (
errors.find(
(error) => error.type === 'TYPE_CANNOT_CHANGE_WITH_ITEM_HAS_TRANSACTIONS',
)
) {
AppToaster.show({
message: formatMessage({
id:
'cannot_change_item_type_to_inventory_with_item_has_associated_transactions',
}),
intent: Intent.DANGER,
});
}
};

View File

@@ -1,4 +1,7 @@
import moment from 'moment';
import { formatMessage } from 'services/intl';
import { Intent } from '@blueprintjs/core';
import { AppToaster } from 'components';
import { transformToForm, repeatValue } from 'utils';
export const MIN_LINES_NUMBER = 4;
@@ -36,4 +39,18 @@ export const transformToEditForm = (bill) => {
),
],
};
}
};
// handle delete errors.
export const handleDeleteErrors = (errors) => {
if (
errors.find((error) => error.type === 'BILL_HAS_ASSOCIATED_PAYMENT_ENTRIES')
) {
AppToaster.show({
message: formatMessage({
id: 'cannot_delete_bill_that_has_payment_transactions',
}),
intent: Intent.DANGER,
});
}
};