Filters.tsx 1.76 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';
12
import PartnerFilter from 'partners/ui/c/PartnerFilter';
Viacheslav Pavlov's avatar
Viacheslav Pavlov committed
13

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

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