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

import {
	Spin,
	message,
} from 'antd'

import Editor from './Editor'

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

	componentWillMount() {
		const {
			hrmSingleWorkNatureFormStore
		} = this.props, {
			setWorkNatureId
		} = hrmSingleWorkNatureFormStore;

		setWorkNatureId(this.props.location.query.id);
	}

	componentDidMount() {
		const {
			hrmSingleWorkNatureFormStore
		} = this.props, {
			getRight,
			setParentHideMthd,
		} = hrmSingleWorkNatureFormStore;

		getRight();
		this.props.onRef && this.props.onRef(this);
		setParentHideMthd(this.props.hide)
	}

	save = () => {
		const {
			hrmSingleWorkNatureFormStore
		} = this.props, {
			saveWorkNatureForm,
		} = hrmSingleWorkNatureFormStore;

		saveWorkNatureForm();
	}

	render() {
		const {
			hrmSingleWorkNatureFormStore
		} = this.props, {
			workNature,
			date,
		} = hrmSingleWorkNatureFormStore;

		return (
			<div>
				<Editor {...workNature} isFormInit={workNature.form.isFormInit} />
			</div>
		)

	}
}