(function (root, factory) { if (typeof module === 'object' && module.exports) { module.exports = factory(); } else { root.ISMIStools = Object.assign(root.ISMIStools || {}, factory()); } })(typeof self !== 'undefined' ? self : this, function () { 'use strict'; function escapeHtml(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c])); } // Builds a printable HTML document replicating the official ISMIS Study Load // layout (Letter size, 8.5in x 11in). Auto-triggers window.print() on load so // the user can print or "Save as PDF" at the official dimensions. function buildStudyLoadHtml(data) { const header = data.header || {}; const courses = data.courses || []; const rows = courses.map((c) => '' + '' + escapeHtml(c.group) + '' + '' + escapeHtml(c.courseCode) + '' + '' + escapeHtml(c.description) + (c.schedule ? '
' + escapeHtml(c.schedule) + '
' : '') + '' + '' + escapeHtml(c.teacher) + '' + '' + escapeHtml(c.units) + '' + '' + escapeHtml(c.status) + '' + '' ).join('\n'); const studentLine = [ header.studentId ? '' + escapeHtml(header.studentId) + '' : '', escapeHtml(header.fullName || ''), escapeHtml(header.program || ''), header.yearLevel ? 'Year Level: ' + escapeHtml(header.yearLevel) : '' ].filter(Boolean).join('   '); const semester = header.semester ? '
' + escapeHtml(header.semester) + '
\n' : ''; const dateRange = header.dateRange ? '
' + escapeHtml(header.dateRange) + '
\n' : ''; const dateEnrolled = header.dateEnrolled ? '
Date Enrolled: ' + escapeHtml(header.dateEnrolled) + '
\n' : ''; const printedBy = 'Printed by: ' + (header.studentId || '') + ' on ' + new Date().toLocaleDateString(); return '\n\n\n\n' + 'Student\'s Study Load\n\n\n\n' + '
STUDENT\'S STUDY LOAD
\n' + semester + dateRange + dateEnrolled + '
' + studentLine + '
\n' + '\n' + '' + '\n\n' + rows + '\n' + '\n\n
GROUPCOURSECOURSE DESCRIPTIONTEACHERUNITSNOTE
' + escapeHtml(data.totalUnits || '') + '
\n' + '
' + escapeHtml(printedBy) + '
\n' + '\n' + '\n'; } return { buildStudyLoadHtml }; });