trc-client-core
Version:
The core of the TRC Client
60 lines (54 loc) • 2.23 kB
JSX
import React from 'react';
import _ from 'lodash';
import {LEARNING_PLAN} from 'trc-client-core/src/constants/Curriculum';
import {Link} from 'react-router';
var CurriculumBadges = React.createClass({
displayName: 'CurriculumBadges',
render() {
return (
<div>
{this.renderCurriculumList()}
</div>
);
},
renderCurriculumList () {
var careerData = this.props.careerData;
var user = this.props.user;
var productPlan = null;
var techPlan = null;
var defaultPathwayType = LEARNING_PLAN;
if (this.props.all) {
defaultPathwayType = null;
}
if (careerData) {
var careerPathway = careerData
.filter(item => item.pathwayType !== defaultPathwayType)
.map(function(pathway){
return <Link
key={pathway.careerPlanId}
to={`/portal/learning-plan/${pathway.careerPlanId}`}
className={`Button Button-small w100 Button-${pathway.department}`}
query={{participantId: user.participantId}}
title={`${pathway.displayName} Learning Plan`}>
{pathway.displayName}
</Link>;
});
if(_.contains(user.departmentCategory, "sales")){
productPlan = <a className="Button Button-small Button-product w100" href={`/#/portal/learning-plan/product_training_plan?participantId=${user.participantId}`} title="Product Plan">Product Plan</a>;
}
if(_.contains(user.departmentCategory, "service")){
techPlan = <Link className="Button Button-small Button-technical w100" to={`/learning-plan/technical_career_plan`} query={{participantId: user.participantId}} title="Technical Career Plan">Tech Career Plan</Link>;
}
return (
<div>
{careerPathway}
{productPlan}
{techPlan}
</div>
);
} else {
return null;
}
}
});
module.exports = CurriculumBadges;