Commit 7839e978 authored by Matija Obreza's avatar Matija Obreza
Browse files

Extra autocompleters

parent a8cf4d24
...@@ -35,9 +35,16 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode, ...@@ -35,9 +35,16 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
name="institute.code" name="institute.code"
terms={ terms && terms.get('institute.code') } terms={ terms && terms.get('institute.code') }
label={ t('accessions.common.instituteCode') } label={ t('accessions.common.instituteCode') }
placeholder="NGA039" placeholder="NGA039, IITA, International"
/>
<AutocompleteFilter
filterCode={ filterCode }
autocomplete={ autocomplete }
name="institute.country.code3"
terms={ terms && terms.get('institute.country.iso3') }
label={ t('accessions.model.institute.country.iso3') }
placeholder="NGA, Nigeria"
/> />
<StringArrFilter name="institute.country.code3" label={ t('accessions.model.institute.country.iso3') } placeholder="NGA"/>
<StringFilter name="accessionNumber" searchType="contains" label={ t('accessions.common.acceNumb') } placeholder="IRGC"/> <StringFilter name="accessionNumber" searchType="contains" label={ t('accessions.common.acceNumb') } placeholder="IRGC"/>
<NumberFilter name="seqNo" label={ t('accessions.public.f.seqNumber') } /> <NumberFilter name="seqNo" label={ t('accessions.public.f.seqNumber') } />
</CollapsibleComponentSearch> </CollapsibleComponentSearch>
...@@ -81,7 +88,14 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode, ...@@ -81,7 +88,14 @@ const AccessionFilters = ({handleSubmit, initialValues, initialize, filterCode,
<StringFilter name="taxonomy.subtaxa" searchType="contains" label={ t('accessions.public.f.subtaxon') } placeholder=""/> <StringFilter name="taxonomy.subtaxa" searchType="contains" label={ t('accessions.public.f.subtaxon') } placeholder=""/>
</CollapsibleComponentSearch> </CollapsibleComponentSearch>
<CollapsibleComponentSearch title={ t('accessions.public.f.originOfMaterial') }> <CollapsibleComponentSearch title={ t('accessions.public.f.originOfMaterial') }>
<StringArrFilter name="countryOfOrigin.code3" terms={ terms && terms.get('countryOfOrigin.code3') } label={ t('accessions.common.countryOfOrigin') } placeholder="SVN"/> <AutocompleteFilter
filterCode={ filterCode }
autocomplete={ autocomplete }
name="countryOfOrigin.code3"
terms={ terms && terms.get('countryOfOrigin.code3') }
label={ t('accessions.common.countryOfOrigin') }
placeholder="SVN, Slovenia"
/>
<NumberFilter name="geo.latitude" label={ t('geo.common.latitude') } /> <NumberFilter name="geo.latitude" label={ t('geo.common.latitude') } />
<NumberFilter name="geo.longitude" label={ t('geo.common.longitude') } /> <NumberFilter name="geo.longitude" label={ t('geo.common.longitude') } />
<NumberFilter name="geo.elevation" label={ t('accessions.public.f.elevation') } /> <NumberFilter name="geo.elevation" label={ t('accessions.public.f.elevation') } />
......
import * as React from 'react'; import * as React from 'react';
import { Fields, change, Field } from 'redux-form'; import { Fields, Field } from 'redux-form';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import { translate } from 'react-i18next'; import { translate } from 'react-i18next';
import * as _ from 'lodash'; import * as _ from 'lodash';
...@@ -230,7 +228,7 @@ class AutocompleteFilterInternal extends React.Component<IAutocompleteFilterInte ...@@ -230,7 +228,7 @@ class AutocompleteFilterInternal extends React.Component<IAutocompleteFilterInte
} }
public render() { public render() {
const { placeholder, label, t, names, name, terms, classes } = this.props; const { placeholder, label, t, names, terms, classes } = this.props;
const { input } = _.get(this.props, names[0]); const { input } = _.get(this.props, names[0]);
const { input: notInput } = _.get(this.props, names[1]); const { input: notInput } = _.get(this.props, names[1]);
const { values, notValues } = this.state; const { values, notValues } = this.state;
...@@ -238,7 +236,7 @@ class AutocompleteFilterInternal extends React.Component<IAutocompleteFilterInte ...@@ -238,7 +236,7 @@ class AutocompleteFilterInternal extends React.Component<IAutocompleteFilterInte
return ( return (
<div> <div>
<Field <Field
name={ `${name}` } name={ `auto-${names[0]}` }
component={ MaterialAutosuggest } component={ MaterialAutosuggest }
label={ label } label={ label }
placeholder={ placeholder } placeholder={ placeholder }
...@@ -306,8 +304,4 @@ class AutocompleteFilter extends React.Component<IAutocompleteFilter, any> { ...@@ -306,8 +304,4 @@ class AutocompleteFilter extends React.Component<IAutocompleteFilter, any> {
} }
} }
const mapDispatchToProps = (dispatch) => bindActionCreators({ export default translate()(AutocompleteFilter);
change,
}, dispatch);
export default connect(null, mapDispatchToProps)(translate()(AutocompleteFilter));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment