import React, { useMemo } from 'react'; import { FormGroup, Intent, InputGroup, RadioGroup, Classes, Radio, Position, Tooltip, } from '@blueprintjs/core'; import { FormattedMessage as T, useIntl } from 'react-intl'; import { CategoriesSelectList, ErrorMessage, Hint, Col, Row, FieldRequiredHint, } from 'components'; import classNames from 'classnames'; import { CLASSES } from 'common/classes'; import withItemCategories from 'containers/Items/withItemCategories'; import withAccounts from 'containers/Accounts/withAccounts'; import { compose, handleStringChange } from 'utils'; /** * Item form primary section. */ function ItemFormPrimarySection({ getFieldProps, setFieldValue, errors, touched, values, // #withItemCategories categoriesList, }) { const itemTypeHintContent = ( <>
{'Service: '}{'Services that you provide to customers. '}
{'Inventory: '}{'Products you buy and/or sell and that you track quantities of.'}
{'Non-Inventory: '}{'Products you buy and/or sell but don’t need to (or can’t) track quantities of, for example, nuts and bolts used in an installation.'}
); return (
{/*----------- Item type ----------*/} } labelInfo={ } className={'form-group--item-type'} intent={errors.type && touched.type && Intent.DANGER} helperText={} inline={true} > { setFieldValue('type', value); })} selectedValue={values.type} > } value="service" /> } value="inventory" /> } value="non_inventory" /> {/*----------- Item name ----------*/} } labelInfo={} className={'form-group--item-name'} intent={errors.name && touched.name && Intent.DANGER} helperText={} inline={true} > {/*----------- SKU ----------*/} } labelInfo={} className={'form-group--item-sku'} intent={errors.sku && touched.sku && Intent.DANGER} helperText={} inline={true} > {/*----------- Item category ----------*/} } labelInfo={} inline={true} intent={errors.category_id && touched.category_id && Intent.DANGER} helperText={ } className={classNames( 'form-group--select-list', 'form-group--category', Classes.FILL, )} > { setFieldValue('item_category_id', category.id); }} popoverProps={{ minimal: true }} /> {/* */}
); } export default compose( withAccounts(({ accountsList }) => ({ accountsList, })), withItemCategories(({ categoriesList }) => ({ categoriesList, })), )(ItemFormPrimarySection);