`:""}
${esc(d.fullName||"Your Name")}
${d.headline?`
${esc(d.headline)}
`:""}
${hContactLine(d)}
${hLinks(d)}
${d.summary?`Professional Summary
${esc(d.summary)}
`:""}
Experience
${hExperience(d)}
Projects
${hProjects(d)}
Education
${hEducation(d)}
Skills
${hSkills(d)}
Languages
${hLangs(d)}
Certifications
${hCerts(d)}
`;
}
/* Template: Corporate */
function renderCorporate(d){
return `
${d.summary?`
Professional Summary
${esc(d.summary)}
`:""}
Experience
${hExperience(d)}
Projects
${hProjects(d)}
Education
${hEducation(d)}
`;
}
/* Template: Creative */
function renderCreative(d){
return `
${esc(d.fullName||"Your Name")}
${d.headline?`
${esc(d.headline)}
`:""}
${photoDataURL?`
`:""}
${hContactLine(d)}
${hLinks(d)}
${d.summary?`Profile
${esc(d.summary)}
`:""}
Experience
${hExperience(d)}
Selected Projects
${hProjects(d)}
Education
${hEducation(d)}
Skills & Tools
${hSkills(d)}
Languages
${hLangs(d)}
Certifications
${hCerts(d)}
`;
}
/* Generate + PDF + Reset handlers */
document.getElementById("generateBtn").addEventListener("click",buildResume);
document.getElementById("pdfBtn").addEventListener("click",()=>{
buildResume(); // ensure updated
const element=document.getElementById("resumeRoot");
const opt={
margin:0,
filename:'resume.pdf',
image:{type:'jpeg',quality:0.98},
html2canvas:{scale:2,useCORS:true},
jsPDF:{unit:'mm',format:'a4',orientation:'portrait'}
};
html2pdf().set(opt).from(element).save();
});
document.getElementById("resetBtn").addEventListener("click",()=>{
if(!confirm("Clear all fields?"))return;
document.getElementById("formPanel").querySelectorAll("input,textarea").forEach(el=>{
if(el.type==="color") return; // keep accent
el.value="";
});
document.getElementById("photoInput").value="";
photoDataURL="";
document.getElementById("expRepeater").innerHTML="";
document.getElementById("eduRepeater").innerHTML="";
addExperience();
addEducation();
buildResume();
});
/* Initial seed rows */
addExperience();
addEducation();
buildResume();