Filters.tsx 2.5 KB
Newer Older
1
2
3
4
5
6
7
8
import * as React from 'react';
import { reduxForm } from 'redux-form';

import FiltersBlock from 'ui/common/filter/FiltersBlock';
import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSearch';
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
import BooleanFilter from 'ui/common/filter/BooleanFilter';
9
import TextFilter from 'ui/common/filter/TextFilter';
10
11
12
import CropFilter from 'ui/catalog/crop/CropFilter';
import {DESCRIPTOR_FILTER_FORM} from 'constants/filter';
import {Descriptor} from 'model/descriptor.model';
13
import DescriptorListPicker from './DescriptorListPicker';
14

15
16
17
18
19
20
21
22
23
24
// <CollapsibleComponentSearch title="Descriptions">
//     <StringFilter name="title" searchType="contains" label="Descriptor title" placeholder="Title"/>
//     <StringFilter name="description" searchType="contains" label="Descriptor description" placeholder="Descriptor description"/>
//     <StringArrFilter name="publisher" label="Publisher" placeholder="Publisher"/>
//     <StringFilter name="bibliographicCitation" searchType="contains" label="Bibliographic citation" placeholder="1997"/>
//     <StringFilter name="list.title" searchType="contains" label="Descriptor list" placeholder="Title"/>
//     <StringFilter name="list.description" searchType="contains" label="Descriptor list description" placeholder=""/>
// </CollapsibleComponentSearch>


25
const DescriptorFilters = ({handleSubmit, initialize, ...other}) => (
Maxim Babichev's avatar
Maxim Babichev committed
26
  <FiltersBlock title="Descriptors" handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
27
      <TextFilter name="_text" label="Keyword search" placeholder="mardi rice" className="p-20" />
28
      <DescriptorListPicker name="list" label="Select descriptor list" className="p-20" />
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
      <CollapsibleComponentSearch title="Crop">
          <CropFilter />
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title="Descriptor category">
          <StringArrFilter name="category" options={ Descriptor.CATEGORIES } />
      </CollapsibleComponentSearch>

      <CollapsibleComponentSearch title="Tidbits">
          <BooleanFilter name="key" label="Key crop descriptor"/>
          <StringFilter name="columnName" searchType="contains" label="Column name" placeholder="Column name"/>
          <StringArrFilter name="uom" label="UOM" placeholder="Language"/>
      </CollapsibleComponentSearch>
  </FiltersBlock>
);

export default reduxForm({
    enableReinitialize: true,
    form: DESCRIPTOR_FILTER_FORM,
})(DescriptorFilters);