Compare commits

...

2 Commits

View File

@@ -51,6 +51,17 @@ function buildHtml(v, score) {
dateStyle: 'full', timeStyle: 'short' 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> return `<!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@@ -120,6 +131,11 @@ function buildHtml(v, score) {
background: #e7f3ff; border-left: 4px solid #2196F3; background: #e7f3ff; border-left: 4px solid #2196F3;
padding: 10px 14px; margin: 16px 0; font-size: 12px; 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> </style>
</head> </head>
<body> <body>
@@ -157,12 +173,17 @@ function buildHtml(v, score) {
<table> <table>
${row('Violation Type', `<strong>${v.violation_name}</strong>`)} ${row('Violation Type', `<strong>${v.violation_name}</strong>`)}
${row('Category', v.category)} ${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))} ${row('Incident Date / Time', formatDateTime(v.incident_date, v.incident_time))}
${v.location ? row('Location / Context', v.location) : ''} ${v.location ? row('Location / Context', v.location) : ''}
${v.details ? row('Incident Details', `<em>${v.details}</em>`) : ''}
${row('Submitted By', v.submitted_by || 'System')} ${row('Submitted By', v.submitted_by || 'System')}
</table> </table>
${v.details ? `
<div class="policy-context">
<strong>Incident Details:</strong><br />
${v.details}
</div>` : ''}
</div> </div>
<!-- CPAS Point Assessment --> <!-- CPAS Point Assessment -->