mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
27 lines
723 B
JavaScript
27 lines
723 B
JavaScript
import React from 'react';
|
|
import { useFormikContext } from 'formik';
|
|
import ClearingAllLinesAlert from 'containers/Alerts/PaymentReceives/ClearingAllLinesAlert';
|
|
import { clearAllPaymentEntries } from './utils';
|
|
|
|
/**
|
|
* Payment receive form alerts.
|
|
*/
|
|
export default function PaymentReceiveFormAlerts() {
|
|
const { values: { entries }, setFieldValue } = useFormikContext();
|
|
|
|
const handleClearingAllLines = () => {
|
|
const newEntries = clearAllPaymentEntries(entries);
|
|
setFieldValue('entries', newEntries);
|
|
setFieldValue('full_amount', '');
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<ClearingAllLinesAlert
|
|
name={'clear-all-lines-payment-receive'}
|
|
onConfirm={handleClearingAllLines}
|
|
/>
|
|
</>
|
|
);
|
|
}
|