Upload files to "pdf"

This commit is contained in:
2026-03-06 15:00:27 -06:00
parent accb24a286
commit cb8c56adfa

View File

@@ -16,10 +16,7 @@ function formatDate(d) {
return dt.toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: 'America/Chicago' });
}
function formatDateTime(d, t) {
const date = formatDate(d);
return t ? `${date} at ${t}` : date;
}
function formatDateTime(d, t) { const date = formatDate(d); return t ? `${date} at ${t}` : date; }
function row(label, value) {
return `
@@ -30,11 +27,11 @@ function row(label, value) {
}
function buildHtml(v, score) {
const activePts = score.active_points || 0;
const tier = getTier(activePts);
const newTotal = activePts + v.points;
const priorPts = score.active_points || 0; // snapshot at time of logging
const priorTier= getTier(priorPts);
const newTotal = priorPts + v.points; // math always based on stored snapshot
const newTier = getTier(newTotal);
const tierChange= tier.label !== newTier.label;
const tierChange = priorTier.label !== newTier.label;
const generatedAt = new Date().toLocaleString('en-US', { timeZone: 'America/Chicago', dateStyle: 'full', timeStyle: 'short' });
@@ -84,10 +81,7 @@ function buildHtml(v, score) {
<p>Message Point Media — Comprehensive Professional Accountability System</p>
</div>
</div>
<div class="doc-id">
Document ID: CPAS-${v.id.toString().padStart(5,'0')}<br />
Generated: ${generatedAt}
</div>
<div class="doc-id">Document ID: CPAS-${v.id.toString().padStart(5,'0')}<br />Generated: ${generatedAt}</div>
</div>
<div style="padding: 0 4px;">
@@ -122,9 +116,9 @@ function buildHtml(v, score) {
<div class="points-display"><div class="pts">${v.points}</div><div class="lbl">Points Assessed — This Violation</div></div>
<div class="score-box">
<div class="score-cell">
<div class="score-num" style="color:${tier.color};">${activePts}</div>
<div class="score-num" style="color:${priorTier.color};">${priorPts}</div>
<div class="score-lbl">Active Points (Prior)</div>
<div style="margin-top:6px;"><span class="tier-badge" style="color:${tier.color};">${tier.label}</span></div>
<div style="margin-top:6px;"><span class="tier-badge" style="color:${priorTier.color};">${priorTier.label}</span></div>
</div>
<div class="score-cell" style="font-size:28px; font-weight:300; color:#ccc; line-height:1.8;">+</div>
<div class="score-cell">
@@ -138,7 +132,7 @@ function buildHtml(v, score) {
<div style="margin-top:6px;"><span class="tier-badge" style="color:${newTier.color};">${newTier.label}</span></div>
</div>
</div>
${tierChange ? `<div class="tier-change"><strong>⚠ Tier Escalation:</strong> This violation advances the employee from <strong>${tier.label}</strong> to <strong>${newTier.label}</strong>.</div>` : ''}
${tierChange ? `<div class="tier-change"><strong>⚠ Tier Escalation:</strong> This violation advances the employee from <strong>${priorTier.label}</strong> to <strong>${newTier.label}</strong>.</div>` : ''}
</div>
<div class="section">