mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
refactoring: payment receive form.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user