import React from 'react';
import { Icon, Modal, message, Spin, Steps } from 'antd';
import './patent.less';

const PatentDesc = React.createClass({
    getInitialState() {
        return {
            visible: false,
            loading: false
        };
    },
    showModal() {
        this.setState({
            visible: true,
        });
    },
    handleOk() {
        this.setState({
            visible: false,
        });
        this.props.closeDesc(false);
    },
    componentWillReceiveProps(nextProps) {
        this.state.visible = nextProps.showDesc
    },
    handleCancel(e) {
        this.setState({
            visible: false,
        });
        this.props.closeDesc(false);
    },
    render() {
        const Step = Steps.Step;
        const theData = this.props.data;
        if (this.props.data) {
            return (
                <div className="patent-desc">
                    <Spin spinning={this.state.loading} className='spin-box'>
                        <Modal title="专利详情" visible={this.state.visible}
                            onOk={this.handleOk} onCancel={this.handleCancel}
                            width='800px'
                            footer=''
                            className="patent-desc-content">
                            <div>
                                <p className="widthHalf"><span>编号：</span>{theData.number}</p>
                                <p className="widthHalf"><span>申请号/专利号：</span>{theData.patentNum}</p>
                            </div>
                            <div>
                                <p className="widthHalf"><span>专利名称：</span>{theData.patentName}</p>
                                <p className="widthHalf"><span>专利类型：</span>{theData.patentType}</p>
                            </div>
                            <div>
                                <p className="widthHalf"><span>专利状态：</span>{theData.patentState}</p>
                                <p className="widthHalf"><span>专利领域：</span>{theData.patentField}</p>
                            </div>
                            <div>
                                <span>简介：</span>{theData.patentDes}
                            </div>
                            <div>
                                <span>专利相关材料：</span>{theData.number}
                            </div>
                            <div>
                                <span>专利申请日：</span>{theData.number}
                            </div>
                            <div>
                                <span>专利授权日：</span>{theData.number}
                            </div>
                            <div>
                                <span>每年年费缴费截止日：</span>{theData.number}
                            </div>
                            <div>
                                <p>第一发明人：</p>
                                <p><span>姓名：</span>{theData.firstInventorName}</p>
                                <p><span>身份证：</span>{theData.firstInventorIdNumber}</p>
                            </div>
                            <div style={theData.secondInventorName === '' ? { display: 'none' } : {}}>
                                <p>第二发明人：</p>
                                <p><span>姓名：</span>{theData.secondInventorName}</p>
                            </div>
                            <div style={theData.thirdInventorName === '' ? { display: 'none' } : {}}>
                                <p>第三发明人：</p>
                                <p><span>姓名：</span>{theData.thirdInventorName}</p>
                            </div>
                            <Steps direction="vertical" size="small" current={1}>
                                <Step title="Finished" description="This is a description." />
                                <Step title="In Progress" description="This is a description." />
                                <Step title="Waiting" description="This is a description." />
                            </Steps>
                        </Modal>
                    </Spin>
                </div>
            );
        } else {
            return <div></div>
        }
    },
});
export default PatentDesc;