const RtfGeneratorHelper = require('./RtfGeneratorHelper');
/**
* UTILITY METHODS
*/
function plainLine(text) {
var content = RtfGeneratorHelper.setContent(text);
return RtfGeneratorHelper.createLine(content);
}
function boldLine(text) {
var content = RtfGeneratorHelper.setContent(text);
content = RtfGeneratorHelper.setBold(content);
return RtfGeneratorHelper.createLine(content);
}
/**
* GENERATORS
*/
function getProfileRtfContent(profile) {
var lines = [];
if(profile) {
lines.push(boldLine('PROFILE SUMMARY'));
if(profile.fullname) {
lines.push(plainLine('Full Name: ' + profile.fullname));
}
if(profile.designation) {
lines.push(plainLine('Designation: ' + profile.designation));
}
if(profile.emailId) {
lines.push(plainLine('Email ID:' + profile.emailId));
}
if(profile.contactNo) {
lines.push(plainLine('Contact No: ' + profile.contactNo));
}
if(profile.gender) {
lines.push(plainLine('Gender: ' + profile.gender));
}
return lines;
}
else {
return [];
}
}
function getEducationRtfContent(educations) {
var lines = [];
lines.push(boldLine('EDUCATION SUMMARY'));
educations.forEach(function (education, index) {
if(educations.length > 1) {
lines.push(boldLine('Education ' + (index + 1)));
}
if(education.educationTitle) {
lines.push(plainLine('Education Title: ' + education.educationTitle));
}
if(education.studiedFrom) {
lines.push(plainLine('Studied From: ' + education.studiedFrom));
}
if(education.startDate) {
lines.push(plainLine('Start Date:' + education.startDate));
}
if(education.endDate) {
lines.push(plainLine('End Date: ' + education.endDate));
}
if(education.specialization) {
lines.push(plainLine('Specialization: ' + education.specialization));
}
if(education.score) {
lines.push(plainLine('Score: ' + education.score));
}
});
return lines;
}
function getWorkExpRtfContent(companies) {
var lines = [];
lines.push(boldLine('WORK EXPERIENCE'));
companies.forEach(function (company, index) {
if(companies.length > 1) {
lines.push(boldLine('Company ' + (index + 1)));
}
if(company.companyName) {
lines.push(plainLine('Company Name: ' + company.companyName));
}
if(company.jobTitle) {
lines.push(plainLine('Job Title: ' + company.jobTitle));
}
if(company.startDate) {
lines.push(plainLine('Start Date: ' + company.startDate));
}
if(company.endDate) {
lines.push(plainLine('End Date: ' + company.endDate));
}
if(company.projects && company.projects.length) {
lines.push.apply(lines, getWorkProjectRtfContent(company.projects));
}
});
return lines;
}
function getWorkProjectRtfContent(projects) {
var lines = [];
projects.forEach(function (project, index) {
if(projects.length > 1) {
lines.push(boldLine('Project ' + (index + 1)));
}
if(project.projectName) {
lines.push(plainLine('Project Name: ' + project.projectName));
}
if(project.jobTitle) {
lines.push(plainLine('Job Title: ' + project.jobTitle));
}
if(project.startDate) {
lines.push(plainLine('Start Date:' + project.startDate));
}
if(project.endDate) {
lines.push(plainLine('End Date: ' + project.endDate));
}
});
return lines;
}
function getSkillsRtfContent(skills) {
var lines = [];
lines.push(boldLine('PROFESSIONAL SKILLS'));
skills.forEach(function (skill, index) {
if(skills.length > 1) {
lines.push(boldLine('Skill ' + (index + 1)));
}
if(skill.skillName) {
lines.push(plainLine('Skill Name: ' + skill.skillName));
}
if(skill.totalExp) {
lines.push(plainLine('Total Experience: ' + skill.totalExp));
}
if(skill.versionNo) {
lines.push(plainLine('Version:' + skill.versionNo));
}
if(skill.studiedFrom) {
lines.push(plainLine('Studied From: ' + skill.studiedFrom));
}
if(skill.selfRating) {
lines.push(plainLine('Self Rating: ' + skill.selfRating));
}
});
return lines;
}
function getProfessionalExpRtfContent(experiences) {
var lines = [];
lines.push(boldLine('PROFESSIONAL EXPERIENCE'));
experiences.forEach(function (company, index) {
if(company.description) {
lines.push(plainLine(company.description));
}
});
return lines;
}
function getActivitiesRtfContent(activities) {
var lines = [];
lines.push(boldLine('ACCOMPLISHMENTS'));
activities.forEach(function (activity, index) {
if(activity.description) {
lines.push(plainLine(activity.description));
}
});
return lines;
}
function getObjectiveRtfContent(objective) {
var lines = [];
if(objective) {
lines.push(boldLine('CAREER OBJECTIVE'));
if(objective.description) {
lines.push(plainLine(objective.description));
}
return lines;
}
else {
return [];
}
}
module.exports = {
getProfileRtfContent: getProfileRtfContent,
getEducationRtfContent: getEducationRtfContent,
getWorkExpRtfContent: getWorkExpRtfContent,
getWorkProjectRtfContent: getWorkProjectRtfContent,
getSkillsRtfContent: getSkillsRtfContent,
getProfessionalExpRtfContent: getProfessionalExpRtfContent,
getActivitiesRtfContent: getActivitiesRtfContent,
getObjectiveRtfContent: getObjectiveRtfContent
};