import React, {Component} from 'react';
import {observer} from 'mobx-react';
import {WeaNewScroll, WeaDialog} from 'ecCom';
import {Button} from 'antd';
import {i18n} from '../../../public/i18n';
// import {FormInfo} from 'weaHrmComsPublic';
import {FormInfo} from '../../../../hrmComsPublic/index';

@observer
export default class WifiEdit extends Component{
    render(){
		// const {FormInfo} = window.weaHrmComsPublic;
        const {
            store
        } = this.props;
        const {
            formTarget,
            custLabelCol,
            itemRender,
            wifiDialogParams
        } = store;
        const {
            wifiForm: form,
            wifiFormFields: fields
        } = formTarget;
        const generateDialogParams = () =>{
            const props = {...wifiDialogParams};
            let buttons = [<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@y01xb8`} type='primary' op='create' onClick={() => store.saveWifi()}>{i18n.label.save()}</Button>];
            Object.assign(props, {
                buttons,
                moreBtn: {datas: store.convertToMenus(buttons)},
                // key: new Date().getTime()
            })
            return props;
        }

        return (
            <WeaDialog ecId={`${this && this.props && this.props.ecId || ''}_WeaDialog@ifctwp`} {...generateDialogParams()}>
                {
                    wifiDialogParams.visible && 
                    <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@nsp6u1`} height={'100%'}>
                        <FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@p297rs`} 
                            className='formComponent' 
                            center={false} 
                            custLabelCol={custLabelCol} 
                            form={form} 
                            formFields={fields} 
                            itemRender={itemRender}/>
                    </WeaNewScroll>
                }
            </WeaDialog>
        )
    }
}