MapAccessionsFilters.tsx 5.63 KB
Newer Older
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import * as React from 'react';
import { reduxForm } from 'redux-form';
import {translate} from 'react-i18next';

import { ACCESSION_MAP_FILTERFORM } from 'accessions/constants';

import FiltersBlock from 'ui/common/filter/FiltersBlock';
import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSearch';
import BooleanFilter from 'ui/common/filter/BooleanFilter';
import NumberFilter from 'ui/common/filter/NumberFilter';
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
import Accession from 'model/accession/Accession';
import DateFilter from 'ui/common/filter/DateFilter';
import CropFilter from 'crop/ui/c/CropFilter';

const MapAccessionsFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => {
  // console.log('AccessionFilters', initialValues);
  return (
    <FiltersBlock title={ t('accessions.public.f.filtersTitle') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
      <CollapsibleComponentSearch title={ t('accessions.public.f.historic') }>
        <BooleanFilter name="historic"/>
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('common:f.textSearch') }>
        <StringArrFilter name="holder.code" label={ t('accessions.common.instituteCode') } placeholder="NGA039"/>
        <StringFilter name="acceNumb" searchType="contains" label={ t('accessions.common.acceNumb') } placeholder="IRGC"/>
        <NumberFilter name="seqNo" label={ t('accessions.public.f.seqNumber') } />
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('common:f.dateSearch') }>
        <DateFilter name="lastModifiedDate" label={ t('common:f.lastModifiedDate') }/>
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.public.f.crop') }>
        <CropFilter/>
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.common.taxonomy') }>
        <StringArrFilter name="taxa.genus" label={ t('accessions.common.genus') } placeholder="Hordeum"/>
        <StringArrFilter name="taxa.species" label={ t('accessions.common.species') } placeholder="vulgare"/>
        <StringFilter name="taxa.subtaxa" searchType="contains" label={ t('accessions.public.f.subtaxon') } placeholder=""/>
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.public.f.originOfMaterial') }>
        <StringArrFilter name="origin.iso3" label={ t('accessions.common.countryOfOrigin') } placeholder="SVN"/>
        <NumberFilter name="geo.latitude" label={ t('geo.common.latitude') } />
        <NumberFilter name="geo.longitude" label={ t('geo.common.longitude') } />
        <NumberFilter name="geo.elevation" label={ t('accessions.public.f.elevation') } />
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.public.f.climate') }>
        <NumberFilter name="geo.climate.bio1" label={ t('accessions.climate.bio1') } />
        <NumberFilter name="geo.climate.bio2" label={ t('accessions.climate.bio2') } />
        <NumberFilter name="geo.climate.bio3" label={ t('accessions.climate.bio3') } />
        <NumberFilter name="geo.climate.bio4" label={ t('accessions.climate.bio4') } />
        <NumberFilter name="geo.climate.bio5" label={ t('accessions.climate.bio5') } />
        <NumberFilter name="geo.climate.bio6" label={ t('accessions.climate.bio6') } />
        <NumberFilter name="geo.climate.bio7" label={ t('accessions.climate.bio7') } />
        <NumberFilter name="geo.climate.bio8" label={ t('accessions.climate.bio8') } />
        <NumberFilter name="geo.climate.bio9" label={ t('accessions.climate.bio9') } />
        <NumberFilter name="geo.climate.bio10" label={ t('accessions.climate.bio10') } />
        <NumberFilter name="geo.climate.bio11" label={ t('accessions.climate.bio11') } />
        <NumberFilter name="geo.climate.bio12" label={ t('accessions.climate.bio12') } />
        <NumberFilter name="geo.climate.bio13" label={ t('accessions.climate.bio13') } />
        <NumberFilter name="geo.climate.bio14" label={ t('accessions.climate.bio14') } />
        <NumberFilter name="geo.climate.bio15" label={ t('accessions.climate.bio15') } />
        <NumberFilter name="geo.climate.bio16" label={ t('accessions.climate.bio16') } />
        <NumberFilter name="geo.climate.bio17" label={ t('accessions.climate.bio17') } />
        <NumberFilter name="geo.climate.bio18" label={ t('accessions.climate.bio18') } />
        <NumberFilter name="geo.climate.bio19" label={ t('accessions.climate.bio19') } />
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.common.sampStat') }>
        <StringArrFilter name="sampStat" options={ Accession.SAMPSTAT } />
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.common.storageType') }>
        <StringArrFilter name="storage" options={ Accession.STORAGE } />
      </CollapsibleComponentSearch>
      <CollapsibleComponentSearch title={ t('accessions.public.f.status') }>
        <BooleanFilter name="historic" label={ t('accessions.public.f.historic') } />
        <BooleanFilter name="available" label={ t('accessions.public.f.available') } />
        <BooleanFilter name="mlsStatus" label={ t('accessions.public.f.mlsStatus') } />
        <BooleanFilter name="sgsv" label={ t('accessions.public.f.sgsv') } />
        <BooleanFilter name="images" label={ t('accessions.public.f.images') } />
      </CollapsibleComponentSearch>
    </FiltersBlock>
  );
};

export default translate()(reduxForm({
    enableReinitialize: true,
    destroyOnUnmount: false,
    form: ACCESSION_MAP_FILTERFORM,
})(MapAccessionsFilters));