 import React from 'react';
 import Col from 'trc-client-core/src/components/Col';
 import Icon from 'trc-client-core/src/components/Icon';
 import UserStore from 'trc-client-core/src/user/UserStore';
 
 var Certification = React.createClass({
    render: function() {
        var details;
        var link;
        var status = "is-disabled";
        if(UserStore.isDepartment(this.props.department) && UserStore.is(this.props.role)){
            status = null;
            link = '/#/portal/learning-plan/' + this.props.certificationType.toLowerCase()+'_cert';
            details = <a href={link} className="Button row">Details</a>;
        }
        return (
            <Col>
                <a className={status} href={link}>
                    <div className={`Widget Widget-${this.props.certificationType.toLowerCase()} t-center`}>
                        <h3>{this.props.certificationType} Certification <Icon className="push-left Icon-large" hexCode={this.props.icon} /></h3>
                    </div>
                </a>
                <div className="Widget">
                    {this.props.children}
                    {details}
                </div>
            </Col>
        );
    }
 
 });
 
module.exports = Certification;