mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 06:40:31 +00:00
fix: Invalid bill payment amount on editing bill payment
This commit is contained in:
@@ -67,6 +67,7 @@ export const ERRORS = {
|
||||
BILL_NUMBER_EXISTS: 'BILL.NUMBER.EXISTS',
|
||||
ENTRIES_ALLOCATED_COST_COULD_NOT_DELETED:
|
||||
'ENTRIES_ALLOCATED_COST_COULD_NOT_DELETED',
|
||||
BILL_AMOUNT_SMALLER_THAN_PAID_AMOUNT: 'BILL_AMOUNT_SMALLER_THAN_PAID_AMOUNT',
|
||||
};
|
||||
/**
|
||||
* Transformes the bill to initial values of edit form.
|
||||
@@ -200,6 +201,14 @@ export const handleErrors = (errors, { setErrors }) => {
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (
|
||||
errors.some((e) => e.type === ERRORS.BILL_AMOUNT_SMALLER_THAN_PAID_AMOUNT)
|
||||
) {
|
||||
AppToaster.show({
|
||||
intent: Intent.DANGER,
|
||||
message: intl.get('bill.total_smaller_than_paid_amount'),
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export const useSetPrimaryBranchToForm = () => {
|
||||
|
||||
@@ -30,6 +30,7 @@ export default function PaymentMadeEntriesTable({
|
||||
// Formik context.
|
||||
const {
|
||||
values: { vendor_id },
|
||||
errors,
|
||||
} = useFormikContext();
|
||||
|
||||
// Handle update data.
|
||||
@@ -63,7 +64,7 @@ export default function PaymentMadeEntriesTable({
|
||||
data={entries}
|
||||
spinnerProps={false}
|
||||
payload={{
|
||||
errors: [],
|
||||
errors: errors?.entries || [],
|
||||
updateData: handleUpdateData,
|
||||
currencyCode,
|
||||
}}
|
||||
|
||||
@@ -112,6 +112,16 @@ export const transformErrors = (errors, { setErrors }) => {
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (
|
||||
errors.some(
|
||||
({ type }) => type === ERROR.INVOICE_AMOUNT_SMALLER_THAN_PAYMENT_AMOUNT,
|
||||
)
|
||||
) {
|
||||
AppToaster.show({
|
||||
message: intl.get('sale_invoice.total_smaller_than_paid_amount'),
|
||||
intent: Intent.DANGER,
|
||||
});
|
||||
}
|
||||
if (
|
||||
errors.some((error) => error.type === ERROR.SALE_INVOICE_NO_IS_REQUIRED)
|
||||
) {
|
||||
|
||||
@@ -28,6 +28,7 @@ export default function PaymentReceiveItemsTable({
|
||||
// Formik context.
|
||||
const {
|
||||
values: { customer_id },
|
||||
errors,
|
||||
} = useFormikContext();
|
||||
|
||||
// No results message.
|
||||
@@ -58,7 +59,7 @@ export default function PaymentReceiveItemsTable({
|
||||
data={entries}
|
||||
spinnerProps={false}
|
||||
payload={{
|
||||
errors: [],
|
||||
errors: errors?.entries || [],
|
||||
updateData: handleUpdateData,
|
||||
currencyCode,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user