// @ts-nocheck import React from 'react'; import { useFormikContext, FastField, ErrorMessage } from 'formik'; import { FormGroup, Classes, TextArea, Checkbox, ControlGroup, } from '@blueprintjs/core'; import { AccountsSelect, MoneyInputGroup, Col, Row, Hint, InputPrependText, FFormGroup, } from '@/components'; import { FormattedMessage as T } from '@/components'; import { useItemFormContext } from './ItemFormProvider'; import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization'; import { ACCOUNT_PARENT_TYPE } from '@/constants/accountTypes'; import { sellDescriptionFieldShouldUpdate, sellAccountFieldShouldUpdate, sellPriceFieldShouldUpdate, costPriceFieldShouldUpdate, costAccountFieldShouldUpdate, purchaseDescFieldShouldUpdate, } from './utils'; import { compose, inputIntent } from '@/utils'; /** * Item form body. */ function ItemFormBody({ organization: { base_currency } }) { const { accounts } = useItemFormContext(); const { values } = useFormikContext(); return (
{/*------------- Purchasable checbox ------------- */} {({ form, field }) => ( } name={'sellable'} {...field} /> )} {/*------------- Selling price ------------- */} {({ form, field: { value }, meta: { error, touched } }) => ( } className={'form-group--sell_price'} intent={inputIntent({ error, touched })} helperText={} inline={true} > { form.setFieldValue('sell_price', unformattedValue); }} /> )} {/*------------- Selling account ------------- */} } name={'sell_account_id'} labelInfo={ } /> } inline={true} items={accounts} sellable={values.sellable} shouldUpdate={sellAccountFieldShouldUpdate} fastField={true} > } disabled={!values.sellable} filterByParentTypes={[ACCOUNT_PARENT_TYPE.INCOME]} fill={true} allowCreate={true} fastField={true} /> {({ form: { values }, field, meta: { error, touched } }) => ( } className={'form-group--sell-description'} intent={inputIntent({ error, touched })} helperText={} inline={true} >