import React, {
	Component
} from 'react';

import {
	WeaFormItem
} from 'ecCom';

import {
	Row,
	Col
} from 'antd';

import {
	observer
} from 'mobx-react';

export default class CustomerFormItem extends Component {
	constructor(props) {
		super(props);
	}

	render() {
		const {
			form,
			fields,
			keys,
			children
		} = this.props;

		let errorMsg = [];
		keys && keys.map(f => {
			form.getError(f) && errorMsg.push(form.getError(f));
		})
		errorMsg = errorMsg.join(',');

		return (
			<Row>
                <Col span={21} offset={3}>
                    <WeaFormItem 
                    	error={errorMsg}
	                    label={`${fields.label}`}
	                    labelCol={{ span: fields.labelcol }}
	                    wrapperCol={{ span: fields.fieldcol }}
                    >
                    	{children}
                    </WeaFormItem>
                </Col>
            </Row>
		)
	}
}