Merge pull request 'Upload files to "pdf"' (#5) from p3 into master

Reviewed-on: http://10.2.0.2:3000/jason/cpas/pulls/5
This commit was merged in pull request #5.
This commit is contained in:
2026-03-06 12:36:59 -06:00

View File

@@ -51,6 +51,17 @@ function buildHtml(v, score) {
dateStyle: 'full', timeStyle: 'short'
});
// Map violation_type to handbook chapter reference (loaded from violations.js in frontend)
// Since we're in backend, we'll reconstruct key descriptions from the violation_name
// The database already stores violation_name (e.g., "Tardy Core Hours") and category
// Build a contextual description block
const contextBlock = v.details
? `<div style="background:#f8f9fa; border-left:3px solid #667eea; padding:12px 16px; margin:12px 0; font-size:12px; color:#444;">
<strong>Context:</strong> ${v.details}
</div>`
: '';
return `<!DOCTYPE html>
<html lang="en">
<head>
@@ -120,6 +131,11 @@ function buildHtml(v, score) {
background: #e7f3ff; border-left: 4px solid #2196F3;
padding: 10px 14px; margin: 16px 0; font-size: 12px;
}
.policy-context {
background: #f8f9fa; border-left: 3px solid #667eea;
padding: 12px 16px; margin: 12px 0; font-size: 12px; color: #444;
border-radius: 4px;
}
</style>
</head>
<body>
@@ -157,12 +173,17 @@ function buildHtml(v, score) {
<table>
${row('Violation Type', `<strong>${v.violation_name}</strong>`)}
${row('Category', v.category)}
${row('Policy Reference', v.violation_type.replace(/_/g,' ').replace(/\w/g,c=>c.toUpperCase()))}
${row('Policy Reference', 'Chapter 4, Section 5 — Comprehensive Professional Accountability System (CPAS)')}
${row('Incident Date / Time', formatDateTime(v.incident_date, v.incident_time))}
${v.location ? row('Location / Context', v.location) : ''}
${v.details ? row('Incident Details', `<em>${v.details}</em>`) : ''}
${row('Submitted By', v.submitted_by || 'System')}
</table>
${v.details ? `
<div class="policy-context">
<strong>Incident Details:</strong><br />
${v.details}
</div>` : ''}
</div>
<!-- CPAS Point Assessment -->