Filters.tsx 1.63 KB
Newer Older
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
1
import * as React from 'react';
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
2
import {translate} from 'react-i18next';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
3 4
import { reduxForm } from 'redux-form';

5
import { INSTITUTE_FILTERFORM } from 'institutes/constants';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
6 7 8 9 10

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';
11
import BooleanFilter from 'ui/common/filter/BooleanFilter';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
12

Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
13
const AccessionFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => {
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
14 15
  // console.log('AccessionFilters', initialValues);
  return (
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
16 17
    <FiltersBlock title={ t('institutes.public.f.title') } handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
      <CollapsibleComponentSearch title={ t('institutes.common.accessionsInGenesys') }>
Matija Obreza's avatar
Matija Obreza committed
18 19
        <BooleanFilter name="accessions"/>
      </CollapsibleComponentSearch>
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
20 21 22
      <CollapsibleComponentSearch title={ t('common:f.textSearch') }>
        <StringArrFilter name="code" label={ t('institutes.common.instituteCode') } placeholder="NGA039"/>
        <StringFilter name="name" label={ t('institutes.public.f.instituteName') } searchType="contains" placeholder="Plant Genetic Resources Unit"/>
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
23
      </CollapsibleComponentSearch>
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
24 25
      <CollapsibleComponentSearch title={ t('geo.common.location') }>
        <StringArrFilter name="country.iso3" label="geo.common.country" placeholder="SVN"/>
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
26 27 28 29 30
      </CollapsibleComponentSearch>
    </FiltersBlock>
  );
};

Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
31
export default translate()(reduxForm({
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
32 33
    enableReinitialize: true,
    form: INSTITUTE_FILTERFORM,
Viacheslav Pavlov's avatar
i18n  
Viacheslav Pavlov committed
34
})(AccessionFilters));