import {
	observer,
} from 'mobx-react';
import {
	Form,
} from 'antd';
import SetupForm from "../../form/index.js"

@observer
class DateSet extends React.Component {
	componentDidMount() {
		this.init();
	}

	init = () => {
		const {
			store,
			form
		} = this.props, {
			setForm,
			initFormField
		} = store;

		setForm(form);
		initFormField();
	}

	componentDidUpdate(prevProps, prevState) {
		const {
			store,
			form
		} = this.props;

		store.setDateFormParams(form.getFieldsValue());
	}

	render() {
		const {
			form,
			store
		} = this.props, {
			form_gene_datas,
		} = store;

		return (
			<div className="date-set">
				<SetupForm ecId={`${this && this.props && this.props.ecId || ''}_SetupForm@7dpegs`} datas={form_gene_datas} form={form}/>
			</div>
		);
	}
}

export default Form.create()(DateSet);