import {
	inject,
	observer,
} from 'mobx-react'
import {
	toJS
} from 'mobx'
import {
	WeaTableEdit,
} from 'ecCom'
import {
	Spin,
} from 'antd'
import {
	i18n
} from '../../public/i18n';

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

	componentDidMount() {
		this.props.hrmRecruitInfo.getSchedule();
	}

	componentWillUnmount() {
		this.props.hrmRecruitInfo.resetSchedule();
	}

	render() {
		const {
			hrmRecruitInfo
		} = this.props, {
			schedule,
			setScheduleDatas,
		} = hrmRecruitInfo, {
			columns,
			datas,
			loading,
		} = schedule;

		if (loading) {
			return (
				<div className='hrm-loading-center-small'>
                    <Spin spinning={loading}></Spin>
                </div>
			)
		} else {
			return (
				<WeaTableEdit
		    		title={i18n.label.recruitSchedule()}
		    		columns={toJS(columns)}
		    		datas={toJS(datas)}
		    		onChange={datas => setScheduleDatas(datas)}
		  		/>
			)
		}



	}
}