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) {| Points | -Tier | -
|---|---|
| ${t.min === 30 ? '30+' : t.min + '–' + t.max} | -${t.label} | -
| Points | Tier |
| ${t.min === 30 ? '30+' : t.min + '–' + t.max} | ${t.label} |
- 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.