import React from 'react'; import { Form, FastField, useFormikContext } from 'formik'; import { FormGroup, RadioGroup, Radio, Checkbox, Button, Intent, } from '@blueprintjs/core'; import { useHistory } from 'react-router-dom'; import intl from 'react-intl-universal'; import { FormattedMessage as T, AccountsSelectList, FieldRequiredHint, } from 'components'; import { handleStringChange, inputIntent } from 'utils'; import { ACCOUNT_TYPE } from 'common/accountTypes'; import { useAccountantFormContext } from './AccountantFormProvider'; /** * Accountant form. */ export default function AccountantForm() { const history = useHistory(); const { isSubmitting } = useFormikContext(); const handleCloseClick = () => { history.go(-1); }; const { accounts } = useAccountantFormContext(); return (
{/* ----------- Accounts ----------- */} } className={'accounts-checkbox'} > {/*------------ account code required -----------*/} {({ field }) => ( } name={'account_code_required'} {...field} /> )} {/*------------ account code unique -----------*/} {({ field }) => ( } name={'account_code_unique'} {...field} /> )} {/* ----------- Accounting basis ----------- */} {({ form: { setFieldValue }, field: { value }, meta: { error, touched }, }) => ( } intent={inputIntent({ error, touched })} label={ } > { setFieldValue('accounting_basis', _value); })} > )} {/* ----------- Deposit customer account ----------- */} {({ form: { values, setFieldValue }, field: { value }, meta: { error, touched }, }) => ( } helperText={ } labelInfo={} intent={inputIntent({ error, touched })} > { setFieldValue('preferred_deposit_account', id); }} selectedAccountId={value} defaultSelectText={} filterByTypes={[ ACCOUNT_TYPE.CASH, ACCOUNT_TYPE.BANK, ACCOUNT_TYPE.OTHER_CURRENT_ASSET, ]} /> )} {/* ----------- Withdrawal vendor account ----------- */} {({ form: { values, setFieldValue }, field: { value }, meta: { error, touched }, }) => ( } helperText={ } labelInfo={} intent={inputIntent({ error, touched })} > { setFieldValue('withdrawal_account', id); }} selectedAccountId={value} defaultSelectText={} filterByTypes={[ ACCOUNT_TYPE.CASH, ACCOUNT_TYPE.BANK, ACCOUNT_TYPE.OTHER_CURRENT_ASSET, ]} /> )} {/* ----------- Withdrawal customer account ----------- */} {({ form: { values, setFieldValue }, field: { value }, meta: { error, touched }, }) => ( } helperText={ } labelInfo={} intent={inputIntent({ error, touched })} > { setFieldValue('preferred_advance_deposit', id); }} selectedAccountId={value} defaultSelectText={} // filterByParentTypes={[ACCOUNT_PARENT_TYPE.CURRENT_ASSET]} /> )}
); }