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,
}) {
return (
{/*----------- Item type ----------*/}
}
labelInfo={}
className={'form-group--item-type'}
intent={errors.type && touched.type && Intent.DANGER}
helperText={}
inline={true}
>
{
setFieldValue('item_type', value);
})}
selectedValue={values.item_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);