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

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

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

        setForm(form);
        initFormField();
    }

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

        setTextFormParams(form.getFieldsValue());
    }

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

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

export default Form.create()(CongratulationSet);