var React = require('react');
var _ = require('lodash');
var Icon = require('trc-client-core/src/components/Icon');
import {LEARNING_PLAN} from 'trc-client-core/src/constants/Curriculum';
import {Link} from 'react-router';

var CareerPathwayButtons = React.createClass({
    displayName: 'CareerPathwayButtons',
    render() {
        return (
            <div>
                {this.renderCareerPathwayButton()}
            </div>
        );
    },
    renderCareerPathwayButton(){
        let {careerData, user} = this.props;
        if(careerData){
            return careerData
                .filter(item => item.pathwayType === LEARNING_PLAN)
                .map(pathway => <Link 
                        key={pathway.careerPlanId}
                        to={`/portal/learning-plan/${pathway.careerPlanId}`}
                        query={{participantId: user.participantId}}
                        title={`${pathway.displayName} Learning Plan`}>
                        <Icon className={`t-${user.department.toLowerCase()}`} hexCode="E423" />
                    </Link>);
        }
    }
});

module.exports = CareerPathwayButtons;
