diff --git a/pdf/template.js b/pdf/template.js
index 9dd921e..02e67d6 100755
--- a/pdf/template.js
+++ b/pdf/template.js
@@ -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
+ ? `
+ Context: ${v.details}
+
`
+ : '';
+
return `
@@ -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;
+ }
@@ -157,12 +173,17 @@ function buildHtml(v, score) {
${row('Violation Type', `${v.violation_name}`)}
${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', `${v.details}`) : ''}
${row('Submitted By', v.submitted_by || 'System')}
+
+ ${v.details ? `
+
+ Incident Details:
+ ${v.details}
+
` : ''}