import React from 'react'; import { FastField, ErrorMessage } from 'formik'; import { FormGroup } from '@blueprintjs/core'; import { AccountsSelectList, Col, Row } from 'components'; import { CLASSES } from 'common/classes'; import { FormattedMessage as T } from 'components'; import classNames from 'classnames'; import withSettings from 'containers/Settings/withSettings'; import { accountsFieldShouldUpdate } from './utils'; import { compose, inputIntent } from 'utils'; import { ACCOUNT_TYPE } from 'common/accountTypes'; import { useItemFormContext } from './ItemFormProvider'; /** * Item form inventory sections. */ function ItemFormInventorySection({ baseCurrency }) { const { accounts } = useItemFormContext(); return (

{/*------------- Inventory account ------------- */} {({ form, field: { value }, meta: { touched, error } }) => ( } inline={true} intent={inputIntent({ error, touched })} helperText={} className={classNames( 'form-group--item-inventory_account', 'form-group--select-list', CLASSES.FILL, )} > { form.setFieldValue('inventory_account_id', account.id); }} defaultSelectText={} selectedAccountId={value} filterByTypes={[ACCOUNT_TYPE.INVENTORY]} /> )}
); } export default compose( withSettings(({ organizationSettings }) => ({ baseCurrency: organizationSettings?.baseCurrency, })), )(ItemFormInventorySection);