Fill out the form and click “Update Preview” to see changes.
`;
}
}
// Programs
const programs = document.getElementById('programs').value;
if (programs) {
html += `
Academic Programs
`;
html += `
${programs.split('\n\n').map(program =>
program ? `
${program.replace(/\n/g, ' ')}
` : ''
).join('')}
`;
}
// Facilities
const facilities = document.getElementById('facilities').value;
if (facilities) {
html += `
Our Facilities
`;
html += `
${facilities.replace(/\n/g, ' ')}
`;
}
// Achievements
const achievements = document.getElementById('achievements').value;
if (achievements) {
html += `
Achievements
`;
html += `
${achievements.replace(/\n/g, ' ')}
`;
}
// Staff
const staffMembers = document.querySelectorAll('.staff-member');
if (staffMembers.length > 0) {
let hasStaffData = false;
staffMembers.forEach(member => {
if (member.querySelector('.staff-name').value ||
member.querySelector('.staff-photo').files[0]) {
hasStaffData = true;
}
});
if (hasStaffData) {
html += `
Our Staff
`;
html += `
`;
staffMembers.forEach(member => {
const name = member.querySelector('.staff-name').value;
const position = member.querySelector('.staff-position').value;
const qualification = member.querySelector('.staff-qualification').value;
const statement = member.querySelector('.staff-statement').value;
const photoFile = member.querySelector('.staff-photo').files[0];
if (name || photoFile) {
html += `
`;
if (photoFile) {
const photoUrl = URL.createObjectURL(photoFile);
html += ``;
}
if (name) html += `
${name}
`;
if (position) html += `
${position}
`;
if (qualification) html += `
${qualification}
`;
if (statement) html += `
${statement}
`;
html += `
`;
}
});
html += `
`;
}
}
// Gallery
const galleryFiles = document.getElementById('galleryImages').files;
if (galleryFiles.length > 0) {
html += `
Gallery
`;
html += `
`;
for (let i = 0; i < Math.min(galleryFiles.length, 6); i++) {
const imgUrl = URL.createObjectURL(galleryFiles[i]);
html += ``;
}
if (galleryFiles.length > 6) {
html += `