import React from 'react';
import { Icon } from 'antd';

class LicenseMessage extends React.Component {
    render() {
        const { message } = this.props;

        if (message == '1') {
            return (
                <div style={{ position: 'relative', top: '50%', left: '50%', width: '110px', height: '25px', lineHeight: '25px', marginTop: '-13px', marginLeft: '-55px', color: '#209e29', fontSize: '18px', textAlign: 'center' }}>
                    <Icon type="check-circle" />
                    <span style={{ marginLeft: '10px' }}>Success !</span>
                </div>
            );
        }

        let msgComp = <div />;
        if (message == '0') {
            msgComp = (
                <div>
                    <p>License信息错误，请检查启动脚本是否包含GBK字符集并重新启动Resin尝试，并且检查License是否正确(E8要求更换公司名称的授权必须清空ecology/license目录再重启Resin提交)！</p>
                    <p style={{ marginTop: '10px' }}>License message error, please check the start script contain 'GBK' and try to restart Resin and check if the License is correct(you must clear ecology/license and restart resin before you upload the difference conpanyname License in E8)!</p>
                </div>
            );
        } else if (message == '2') {
            msgComp = (
                <div>
                    <p>
                        数据库连接或者执行失败，请按下列步骤检查：<br />
                        1.检查数据库服务器是否正常；<br />
                        2.检查数据库驱动包是否存在；<br />
                        3.检查weaver.properies配置信息是否正确；<br />
                        4.检查ecology日志是否有异常！
                    </p>
                    <p style={{ marginTop: '10px' }}>
                        Failed to Connect Data Server, please check by step as below: <br />
                        1.checking the Data Server is OK; <br />
                        2.checking the SQL driver is exist; <br />
                        3.checking the message of the file 'weaver.properies' is right; <br />
                        4.Check ecology log exception!
                    </p>
                </div>
            );
        } else if (message == '3') {
            msgComp = (
                <div>
                    <p>License文件上传出错！</p>
                    <p style={{ marginTop: '10px' }}>License file uploading error!</p>
                </div>
            );
        } else if (message == '4') {
            msgComp = (
                <div>
                    <p>License信息错误，License已过期！</p>
                    <p style={{ marginTop: '10px' }}>License message error, license is overdue!</p>
                </div>
            );
        } else if (message == '5') {
            msgComp = (
                <div>
                    <p>License信息错误，已分配用户数大于License申请人数！</p>
                    <p style={{ marginTop: '10px' }}>License message error, the HRMs is larger than the apllied in the license!</p>
                </div>
            );
        } else if (message == '6') {
            msgComp = (
                <div>
                    <p>没有选择正确的License文件或者License文件不存在！</p>
                    <p style={{ marginTop: '10px' }}>Wrong choosing License file or License file is not exist!</p>
                </div>
            );
        } else if (message == '7') {
            msgComp = (
                <div>
                    <p>
                        1.验证码不得为空！<br />
                        2.系统设置表SystemSet字段filesystem值对应路径(默认为空)不存在或者没有写权限，详细见ecology/log/ecology日志！
                    </p>
                    <p style={{ marginTop: '10px' }}>
                        1.Verification code must not be empty! <br />
                        2.System error, detail to see the ecology log!
                    </p>
                </div>
            );
        } else {
            msgComp = <div>{message}</div>;
        }

        return <div style={{ margin: '20px', lineHeight: '20px', color: '#d62c2c', fontSize: '14px' }}>{msgComp}</div>;
    }
}

export default LicenseMessage;
