import React from 'react';
import { FastField, ErrorMessage } from 'formik';
import {
Classes,
FormGroup,
RadioGroup,
Radio,
InputGroup,
Position,
} from '@blueprintjs/core';
import { DateInput } from '@blueprintjs/datetime';
import classNames from 'classnames';
import { FormattedMessage as T } from 'components';
import intl from 'react-intl-universal';
import {
inputIntent,
momentFormatter,
tansformDateValue,
handleDateChange,
handleStringChange,
} from 'utils';
import { FieldRequiredHint, ListSelect } from 'components';
import { CLASSES } from 'common/classes';
import allocateLandedCostType from 'common/allocateLandedCostType';
import AccountsSuggestField from 'components/AccountsSuggestField';
import AllocateLandedCostFormBody from './AllocateLandedCostFormBody';
/**
* Allocate landed cost form fields.
*/
export default function AllocateLandedCostFormFields() {
return (
{/*------------Transaction type -----------*/}
{({
form: { values, setFieldValue },
field: { value },
meta: { error, touched },
}) => (
}
labelInfo={}
helperText={}
intent={inputIntent({ error, touched })}
inline={true}
className={classNames(CLASSES.FILL, 'form-group--transaction_type')}
>
{
setFieldValue('transaction_type', type.value);
}}
filterable={false}
selectedItem={value}
selectedItemProp={'value'}
textProp={'name'}
popoverProps={{ minimal: true }}
/>
)}
{/*------------Transaction date -----------*/}
{({ form, field: { value }, meta: { error, touched } }) => (
}
// labelInfo={}
intent={inputIntent({ error, touched })}
helperText={}
minimal={true}
className={classNames(CLASSES.FILL, 'form-group--transaction_date')}
inline={true}
>
{
form.setFieldValue('transaction_date', formattedDate);
})}
value={tansformDateValue(value)}
popoverProps={{
position: Position.BOTTOM,
minimal: true,
}}
/>
)}
{/*------------ Transaction -----------*/}
{({ form, field, meta: { error, touched } }) => (
}
// labelInfo={}
intent={inputIntent({ error, touched })}
helperText={}
className={'form-group--transaction_id'}
inline={true}
>
form.setFieldValue('transaction_id', id)
}
inputProps={{
placeholder: intl.get('select_transaction'),
}}
/>
)}
{/*------------ Transaction line -----------*/}
{({ form, field, meta: { error, touched } }) => (
}
intent={inputIntent({ error, touched })}
helperText={}
className={'form-group--transaction_entry_id'}
inline={true}
>
)}
{/*------------ Amount -----------*/}
{({ form, field, meta: { error, touched } }) => (
}
intent={inputIntent({ error, touched })}
helperText={}
className={'form-group--amount'}
inline={true}
>
)}
{/*------------ Allocation method -----------*/}
{({ form, field: { value }, meta: { touched, error } }) => (
}
labelInfo={}
className={'form-group--allocation_method'}
intent={inputIntent({ error, touched })}
helperText={}
inline={true}
>
{
form.setFieldValue('allocation_method', _value);
})}
selectedValue={value}
inline={true}
>
} value="quantity" />
} value="valuation" />
)}
{/*------------ Allocate Landed cost Table -----------*/}
);
}