import {
  inject,
  observer,
} from 'mobx-react';

import {
  WeaRadioGroup,
} from 'ecCom'

import React from 'react'
import * as mobx from 'mobx'

const toJS = mobx.toJS;

@inject('hrmChangeReport')

@observer
class RadioGroupWrapper extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    const {
      hrmChangeReport
    } = this.props;
    hrmChangeReport.getSearchCondition('radioGroup');
  }

  render() {
    const {
      hrmChangeReport
    } = this.props;
    const {
      condition
    } = hrmChangeReport;
    let arr = toJS(condition);

    return (
      <div style={{padding: '16px 16px 8px 16px'}}>
            { (arr.length > 0) ? <WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@pgkl0g`}
                                  config={arr}
                                  onChange = {
                                    (params) => {
                                      hrmChangeReport.setParamsThenGetData(params)
                                    }
                                  }
                                 />
                               : ''
             }
          </div>
    )
  }
}

export default RadioGroupWrapper