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

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

import {
	Spin,
	message,
} from 'antd'

import Editor from './Editor'

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

	componentWillMount() {
		const {
			hrmSingleEducationFormStore
		} = this.props, {
			setEducationId
		} = hrmSingleEducationFormStore;

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

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

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

	save = () => {
		const {
			hrmSingleEducationFormStore
		} = this.props, {
			saveEducationForm,
		} = hrmSingleEducationFormStore;

		saveEducationForm();
	}

	render() {
		const {
			hrmSingleEducationFormStore
		} = this.props, {
			education,
			date,
		} = hrmSingleEducationFormStore;

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

	}
}