import React from 'react';
import { Button, Radio } from 'antd';
import './content.less';
import { getTime } from '../../../../tools';

import Intellectual from './intellectual';
import Activity from './activity';
import Standard from './standard';
import ActivityCostList from './activityCostList';
import TechProduct from './techProduct';
import Ratepay from './ratepay';
import Finance from './finance';
import Achievement from './achievement';
import HonorList from './honorList';
import OrgTechCenter from './orgTechCenter';
import InnovationAbility from './ablt';
import HrSituation from './hrSituation';


const Content = React.createClass({
    getInitialState() {
        return {
            loading: false,
            radioKey: 'hrSituation',
        };
    },
    componentWillMount() {
    },
    returnFoster() {
        this.props.returnBtn();
    },
    onChange(e) {
        this.setState({
            radioKey: e.target.value
        });
    },
    render() {
        if (this.props.data) {
            return (
                <div className="foster-desc" style={{ display: this.props.style }}>
                    <div className="content-tabs">
                        <div className="foster-title">
                            <span className="company-name">{this.props.data.unitName}</span>
                            <span className="company-number">{this.props.data.certificateNumber || ''}</span>
                            {this.props.data.issuingDate ?
                                <span className="company-time"> 有效期 {getTime(this.props.data.issuingDate)} 至 {getTime(this.props.data.issuingDate, 36)} </span> : ''
                            }
                            <Button className="foster-return" type="primary" onClick={this.returnFoster}>返回高企培育列表</Button>
                        </div>
                        <div className="clearfix foster-component">
                            <Radio.Group onChange={this.onChange} defaultValue="orgTechCenter">
                                <Radio.Button value="orgTechCenter">技术中心</Radio.Button>
                                <Radio.Button value="activity">研发活动</Radio.Button>
                                <Radio.Button value="activityCostList">研发活动费用详情</Radio.Button>
                                <Radio.Button value="techProduct">高新技术产品</Radio.Button>
                                <Radio.Button value="intellectual">知识产权</Radio.Button>
                                <Radio.Button value="achievement">科技成果转化</Radio.Button>
                                <Radio.Button value="ratepay">企业纳税申报</Radio.Button>
                                <Radio.Button value="finance">财务报表</Radio.Button>
                                <Radio.Button value="hrSituation">企业人员情况</Radio.Button>
                                <Radio.Button value="honorList">企业荣誉及其他证明材料</Radio.Button>
                                <Radio.Button value="standard">标准制定情况</Radio.Button>
                                <Radio.Button value="innovationAbility">企业创新能力</Radio.Button>
                            </Radio.Group>
                        </div>
                    </div>
                    <div className="content-desc">
                        {(() => {
                            switch (this.state.radioKey) {
                                case 'orgTechCenter':
                                    return <OrgTechCenter data={this.props.data} />;
                                case 'activity':
                                    return <Activity data={this.props.data} />;
                                case 'activityCostList':
                                    return <ActivityCostList data={this.props.data} />;
                                case 'techProduct':
                                    return <TechProduct data={this.props.data} />;
                                case 'intellectual':
                                    return <Intellectual data={this.props.data} />;
                                case 'achievement':
                                    return <Achievement data={this.props.data} />;
                                case 'ratepay':
                                    return <Ratepay data={this.props.data} />;
                                case 'finance':
                                    return <Finance data={this.props.data} />;
                                case 'hrSituation':
                                    return <HrSituation data={this.props.data} />;
                                case 'honorList':
                                    return <HonorList data={this.props.data} />;
                                case 'standard':
                                    return <Standard data={this.props.data} />;
                                case 'innovationAbility':
                                    return <InnovationAbility data={this.props.data} />;
                            };
                        })()}
                    </div>
                </div>
            )
        } else {
            return (
                <div></div>
            )
        }
    }
});

export default Content;