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

@inject('hrmStaffPayrollSummary')
@observer
export default class RadioGroup extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidMount() {
    this.props.hrmStaffPayrollSummary.getRadioGroupDatas();
  }

  componentWillUnmount() {
    this.props.hrmStaffPayrollSummary.resetRadioGroup();
  }

  render() {
    const {
      hrmStaffPayrollSummary
    } = this.props, {
      radioGroup,
      radioGroupCallBack
    } = hrmStaffPayrollSummary, {
      config
    } = radioGroup;

    return (config.length > 0 && <WeaRadioGroup ecId={`${this && this.props && this.props.ecId || ''}_WeaRadioGroup@mk7shf`}
              config={ config}
              onChange={params => radioGroupCallBack(params)}
            />)
  }
}