fix: remove parent category.

This commit is contained in:
elforjani3
2020-12-02 18:48:34 +02:00
parent 2b24467b23
commit 14d9f6c74d
3 changed files with 0 additions and 62 deletions

View File

@@ -30,34 +30,6 @@ export default function ItemCategoryForm({
}) {
const categoryNameFieldRef = useAutofocus();
// Filters Item Categories list.
const filterItemCategories = useCallback(
(query, category, _index, exactMatch) => {
const normalizedTitle = category.name.toLowerCase();
const normalizedQuery = query.toLowerCase();
if (exactMatch) {
return normalizedTitle === normalizedQuery;
} else {
return normalizedTitle.indexOf(normalizedQuery) >= 0;
}
},
[],
);
const parentCategoryItem = useCallback(
(category, { handleClick, modifiers, query }) => {
return (
<MenuItem
text={category.name}
key={category.id}
onClick={handleClick}
/>
);
},
[],
);
return (
<Form>
<div className={Classes.DIALOG_BODY}>
@@ -81,38 +53,6 @@ export default function ItemCategoryForm({
)}
</FastField>
{/* ----------- Parent Category ----------- */}
<FastField name={'parent_category_id'}>
{({ form, field: { value }, meta: { error, touched } }) => (
<FormGroup
label={<T id={'parent_category'} />}
labelInfo={Hint}
className={classNames(
'form-group--select-list',
'form-group--parent-category',
Classes.FILL,
)}
inline={true}
helperText={<ErrorMessage name="parent_category_id" />}
intent={inputIntent({ error, touched })}
>
<ListSelect
items={categoriesList}
noResults={<MenuItem disabled={true} text="No results." />}
itemRenderer={parentCategoryItem}
itemPredicate={filterItemCategories}
popoverProps={{ minimal: true }}
onItemSelect={(parentCategory) => {
form.setFieldValue('parent_category_id', parentCategory.id);
}}
selectedItem={value}
selectedItemProp={'id'}
defaultText={<T id={'select_parent_category'} />}
labelProp={'name'}
/>
</FormGroup>
)}
</FastField>
{/* ----------- Description ----------- */}
<FastField name={'description'}>

View File

@@ -23,7 +23,6 @@ import { compose, transformToForm } from 'utils';
const defaultInitialValues = {
name: '',
description: '',
parent_category_id: '',
cost_account_id: '',
sell_account_id: '',
inventory_account_id: '',

View File

@@ -7,7 +7,6 @@ const Schema = Yup.object().shape({
.required()
.max(DATATYPES_LENGTH.STRING)
.label(formatMessage({ id: 'category_name_' })),
parent_category_id: Yup.number().nullable(),
cost_account_id: Yup.number().nullable(),
sell_account_id: Yup.number().nullable(),
inventory_account_id: Yup.number().nullable(),