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 SerialSetting extends Component{
    render(){
		// const {FormInfo} = window.weaHrmComsPublic;
        const {
            store
        } = this.props;
        const {
            formTarget,
            custLabelCol,
            itemRender,
            childrenComponents,
            serialDialogParams
        } = store;
        const {
            shiftSchedulceForm: form,
            shiftSchedulceFormFields: fields
        } = formTarget;
        const generateDialogParams = () =>{
            const props = {...serialDialogParams};
            let buttons = [<Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ia1n1n`} type='primary' op='create' onClick={() => store.saveSerial()}>{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@pe32n6`} {...generateDialogParams()}>
                <WeaNewScroll ecId={`${this && this.props && this.props.ecId || ''}_WeaNewScroll@514we0`} height={'100%'}>
                    <FormInfo ecId={`${this && this.props && this.props.ecId || ''}_FormInfo@7ncxfc`} 
                        className='formComponent serialSetting' 
                        form={form} 
                        formFields={fields} 
                        itemRender={itemRender}
                        childrenComponents={childrenComponents()}/>
                </WeaNewScroll>
            </WeaDialog>
        )
    }
}