refactoring: payment receive form.

This commit is contained in:
a.bouhuolia
2021-02-17 19:45:18 +02:00
parent 95cccfd13b
commit e36817cb88
46 changed files with 775 additions and 325 deletions

View File

@@ -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}
/>
</>
);
}