Filters.tsx 1.13 KB
Newer Older
Matija Obreza's avatar
Matija Obreza 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
import * as React from 'react';
import { reduxForm } from 'redux-form';

import { DASHBOARD_FILTERFORM } from 'constants/dashboard';

import FiltersBlock from 'ui/common/filter/FiltersBlock';
import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSearch';
import CropFilter from 'ui/catalog/crop/CropFilter';
import TextFilter from 'ui/common/filter/TextFilter';
import Authorize from 'ui/common/authorized/Authorize';
import PartnerFilter from 'ui/catalog/partner/PartnerFilter';

const DashboardFilters = ({handleSubmit, initialize, ...other}) => (
  <FiltersBlock title="Filters" handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
      <TextFilter name="_text" label="Keyword search" placeholder="mardi rice" className="p-20" />
      <Authorize role="ROLE_ADMINISTRATOR">
        <PartnerFilter name="owner" label="Select owner" className="p-20" />
      </Authorize>
      <CollapsibleComponentSearch title="Crop">
        <CropFilter />
      </CollapsibleComponentSearch>
  </FiltersBlock>
);

export default reduxForm({
    enableReinitialize: true,
    form: DASHBOARD_FILTERFORM,
})(DashboardFilters);