diff --git a/pdf/template.js b/pdf/template.js index 76da038..7034b80 100755 --- a/pdf/template.js +++ b/pdf/template.js @@ -1,5 +1,3 @@ -/** PDF template with MPM logo from /static/mpm-logo.png */ - const TIERS = [ { min: 0, max: 4, label: 'Tier 0-1 — Elite Standing', color: '#28a745' }, { min: 5, max: 9, label: 'Tier 1 — Realignment', color: '#856404' }, @@ -10,17 +8,12 @@ const TIERS = [ { min: 30, max: 999,label: 'Tier 6 — Separation', color: '#721c24' }, ]; -function getTier(points) { - return TIERS.find(t => points >= t.min && points <= t.max) || TIERS[0]; -} +function getTier(points) { return TIERS.find(t => points >= t.min && points <= t.max) || TIERS[0]; } function formatDate(d) { if (!d) return '—'; const dt = new Date(d + 'T12:00:00'); - return dt.toLocaleDateString('en-US', { - weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', - timeZone: 'America/Chicago' - }); + return dt.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: 'America/Chicago' }); } function formatDateTime(d, t) { @@ -37,16 +30,13 @@ function row(label, value) { } function buildHtml(v, score) { - const activePts = score.active_points || 0; - const tier = getTier(activePts); - const newTotal = activePts + v.points; - const newTier = getTier(newTotal); - const tierChange = tier.label !== newTier.label; + const activePts = score.active_points || 0; + const tier = getTier(activePts); + const newTotal = activePts + v.points; + const newTier = getTier(newTotal); + const tierChange= tier.label !== newTier.label; - const generatedAt = new Date().toLocaleString('en-US', { - timeZone: 'America/Chicago', - dateStyle: 'full', timeStyle: 'short' - }); + const generatedAt = new Date().toLocaleString('en-US', { timeZone: 'America/Chicago', dateStyle: 'full', timeStyle: 'short' }); return ` @@ -55,86 +45,33 @@ function buildHtml(v, score) { @@ -155,9 +92,7 @@ function buildHtml(v, score) {
-
- ⚠ CONFIDENTIAL — For authorized HR and management use only -
+
⚠ CONFIDENTIAL — For authorized HR and management use only
Employee Information
@@ -179,26 +114,17 @@ function buildHtml(v, score) { ${v.location ? row('Location / Context', v.location) : ''} ${row('Submitted By', v.submitted_by || 'System')} - ${v.details ? ` -
- Incident Details:
- ${v.details} -
` : ''} + ${v.details ? `
Incident Details:
${v.details}
` : ''}
CPAS Point Assessment
-
-
${v.points}
-
Points Assessed — This Violation
-
+
${v.points}
Points Assessed — This Violation
${activePts}
Active Points (Prior)
-
- ${tier.label} -
+
${tier.label}
+
@@ -209,46 +135,26 @@ function buildHtml(v, score) {
${newTotal}
New Active Total
-
- ${newTier.label} -
+
${newTier.label}
- ${tierChange ? ` -
- ⚠ Tier Escalation: This violation advances the employee from - ${tier.label} to ${newTier.label}. -
` : ''} + ${tierChange ? `
⚠ Tier Escalation: This violation advances the employee from ${tier.label} to ${newTier.label}.
` : ''}
CPAS Tier Reference
- - - - - ${TIERS.map(t => ` - - - - `).join('')} + + ${TIERS.map(t => ``).join('')}
PointsTier
${t.min === 30 ? '30+' : t.min + '–' + t.max}${t.label}
PointsTier
${t.min === 30 ? '30+' : t.min + '–' + t.max}${t.label}
-
- Employee Notice: CPAS points remain active for a rolling 90-day period from the date of each incident. - Accumulation of points may result in tier escalation and associated consequences as outlined in the Employee Handbook. -
+
Employee Notice: CPAS points remain active for a rolling 90-day period from the date of each incident. Accumulation of points may result in tier escalation and associated consequences as outlined in the Employee Handbook.
Acknowledgement & Signatures
-
-

- By signing below, the employee acknowledges receipt of this violation record. - Acknowledgement does not imply agreement. The employee may submit a written - response within 5 business days. -

+
+

By signing below, the employee acknowledges receipt of this violation record. Acknowledgement does not imply agreement. The employee may submit a written response within 5 business days.

Employee Signature
@@ -262,11 +168,7 @@ function buildHtml(v, score) {
- +