Upload files to "pdf"

This commit is contained in:
2026-03-06 14:12:00 -06:00
parent 2383e3cc94
commit 066f95cc88

View File

@@ -1,7 +1,4 @@
/** /** PDF template with MPM logo from /static/mpm-logo.png */
* Builds the full HTML string for a CPAS violation PDF document.
* Matches the styling of the original HTML violation form.
*/
const TIERS = [ const TIERS = [
{ min: 0, max: 4, label: 'Tier 0-1 — Elite Standing', color: '#28a745' }, { min: 0, max: 4, label: 'Tier 0-1 — Elite Standing', color: '#28a745' },
@@ -59,16 +56,28 @@ function buildHtml(v, score) {
* { box-sizing: border-box; margin: 0; padding: 0; } * { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px; color: #222; background: #fff; } body { font-family: 'Segoe UI', Arial, sans-serif; font-size: 13px; color: #222; background: #fff; }
.header { background: linear-gradient(135deg, #2c3e50, #34495e); color: white; padding: 28px 32px; } .header {
.header h1 { font-size: 22px; letter-spacing: 0.5px; } background: linear-gradient(135deg, #000000, #111217);
.header p { font-size: 12px; opacity: 0.8; margin-top: 4px; } color: white;
padding: 22px 32px;
display: flex;
align-items: center;
justify-content: space-between;
}
.header-left { display: flex; align-items: center; }
.logo {
height: 28px;
margin-right: 12px;
}
.header h1 { font-size: 20px; letter-spacing: 0.5px; }
.header p { font-size: 11px; opacity: 0.85; margin-top: 3px; }
.doc-id { float: right; text-align: right; font-size: 11px; opacity: 0.75; } .doc-id { text-align: right; font-size: 11px; opacity: 0.8; }
.section { margin: 20px 0; } .section { margin: 20px 0; }
.section-title { .section-title {
font-size: 14px; font-weight: 700; color: white; font-size: 14px; font-weight: 700; color: white;
background: #34495e; padding: 8px 14px; background: #000000; padding: 8px 14px;
border-radius: 4px 4px 0 0; margin-bottom: 0; border-radius: 4px 4px 0 0; margin-bottom: 0;
} }
table { width: 100%; border-collapse: collapse; border: 1px solid #ddd; border-top: none; } table { width: 100%; border-collapse: collapse; border: 1px solid #ddd; border-top: none; }
@@ -97,7 +106,7 @@ function buildHtml(v, score) {
background: #fff3cd; border: 2px solid #ffc107; background: #fff3cd; border: 2px solid #ffc107;
border-radius: 6px; padding: 16px; margin: 16px 0; text-align: center; border-radius: 6px; padding: 16px; margin: 16px 0; text-align: center;
} }
.points-display .pts { font-size: 36px; font-weight: 800; color: #667eea; } .points-display .pts { font-size: 36px; font-weight: 800; color: #d4af37; }
.points-display .lbl { font-size: 12px; color: #666; } .points-display .lbl { font-size: 12px; color: #666; }
.sig-section { margin-top: 40px; page-break-inside: avoid; } .sig-section { margin-top: 40px; page-break-inside: avoid; }
@@ -108,7 +117,7 @@ function buildHtml(v, score) {
.footer-bar { .footer-bar {
margin-top: 40px; padding: 10px 0; margin-top: 40px; padding: 10px 0;
border-top: 2px solid #2c3e50; border-top: 2px solid #000000;
font-size: 10px; color: #888; text-align: center; font-size: 10px; color: #888; text-align: center;
} }
.confidential { .confidential {
@@ -130,14 +139,18 @@ function buildHtml(v, score) {
</head> </head>
<body> <body>
<!-- Header -->
<div class="header"> <div class="header">
<div class="header-left">
<img src="/static/mpm-logo.png" class="logo" />
<div>
<h1>CPAS Individual Violation Record</h1>
<p>Message Point Media — Comprehensive Professional Accountability System</p>
</div>
</div>
<div class="doc-id"> <div class="doc-id">
Document ID: CPAS-${v.id.toString().padStart(5,'0')}<br /> Document ID: CPAS-${v.id.toString().padStart(5,'0')}<br />
Generated: ${generatedAt} Generated: ${generatedAt}
</div> </div>
<h1>CPAS Individual Violation Record</h1>
<p>Message Point Media — Confidential HR Document</p>
</div> </div>
<div style="padding: 0 4px;"> <div style="padding: 0 4px;">
@@ -146,7 +159,6 @@ function buildHtml(v, score) {
⚠ CONFIDENTIAL — For authorized HR and management use only ⚠ CONFIDENTIAL — For authorized HR and management use only
</div> </div>
<!-- Employee Information -->
<div class="section"> <div class="section">
<div class="section-title">Employee Information</div> <div class="section-title">Employee Information</div>
<table> <table>
@@ -157,7 +169,6 @@ function buildHtml(v, score) {
</table> </table>
</div> </div>
<!-- Violation Details -->
<div class="section"> <div class="section">
<div class="section-title">Violation Details</div> <div class="section-title">Violation Details</div>
<table> <table>
@@ -168,7 +179,6 @@ function buildHtml(v, score) {
${v.location ? row('Location / Context', v.location) : ''} ${v.location ? row('Location / Context', v.location) : ''}
${row('Submitted By', v.submitted_by || 'System')} ${row('Submitted By', v.submitted_by || 'System')}
</table> </table>
${v.details ? ` ${v.details ? `
<div class="policy-context"> <div class="policy-context">
<strong>Incident Details:</strong><br /> <strong>Incident Details:</strong><br />
@@ -176,15 +186,12 @@ function buildHtml(v, score) {
</div>` : ''} </div>` : ''}
</div> </div>
<!-- CPAS Point Assessment -->
<div class="section"> <div class="section">
<div class="section-title">CPAS Point Assessment</div> <div class="section-title">CPAS Point Assessment</div>
<div class="points-display"> <div class="points-display">
<div class="pts">${v.points}</div> <div class="pts">${v.points}</div>
<div class="lbl">Points Assessed — This Violation</div> <div class="lbl">Points Assessed — This Violation</div>
</div> </div>
<div class="score-box"> <div class="score-box">
<div class="score-cell"> <div class="score-cell">
<div class="score-num" style="color:${tier.color};">${activePts}</div> <div class="score-num" style="color:${tier.color};">${activePts}</div>
@@ -195,7 +202,7 @@ function buildHtml(v, score) {
</div> </div>
<div class="score-cell" style="font-size:28px; font-weight:300; color:#ccc; line-height:1.8;">+</div> <div class="score-cell" style="font-size:28px; font-weight:300; color:#ccc; line-height:1.8;">+</div>
<div class="score-cell"> <div class="score-cell">
<div class="score-num" style="color:#667eea;">${v.points}</div> <div class="score-num" style="color:#d4af37;">${v.points}</div>
<div class="score-lbl">Points — This Violation</div> <div class="score-lbl">Points — This Violation</div>
</div> </div>
<div class="score-cell" style="font-size:28px; font-weight:300; color:#ccc; line-height:1.8;">=</div> <div class="score-cell" style="font-size:28px; font-weight:300; color:#ccc; line-height:1.8;">=</div>
@@ -207,16 +214,13 @@ function buildHtml(v, score) {
</div> </div>
</div> </div>
</div> </div>
${tierChange ? ` ${tierChange ? `
<div class="tier-change"> <div class="tier-change">
<strong>⚠ Tier Escalation:</strong> This violation advances the employee from <strong>⚠ Tier Escalation:</strong> This violation advances the employee from
<strong>${tier.label}</strong> to <strong>${newTier.label}</strong>. <strong>${tier.label}</strong> to <strong>${newTier.label}</strong>.
Review associated tier consequences per the Employee Handbook.
</div>` : ''} </div>` : ''}
</div> </div>
<!-- CPAS Tier Reference -->
<div class="section"> <div class="section">
<div class="section-title">CPAS Tier Reference</div> <div class="section-title">CPAS Tier Reference</div>
<table> <table>
@@ -232,16 +236,13 @@ function buildHtml(v, score) {
</table> </table>
</div> </div>
<!-- Notice -->
<div class="notice"> <div class="notice">
<strong>Employee Notice:</strong> CPAS points remain active for a rolling 90-day period from the date of each incident. <strong>Employee Notice:</strong> 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, Accumulation of points may result in tier escalation and associated consequences as outlined in the Employee Handbook.
Chapter 4, Section 5. This document should be reviewed with the employee and signed by all parties.
</div> </div>
<!-- Signatures — EXPANDED VERTICAL SPACING -->
<div class="sig-section"> <div class="sig-section">
<div class="section-title" style="background:#34495e; color:white; padding:8px 14px; border-radius:4px; font-size:14px; font-weight:700;">Acknowledgement & Signatures</div> <div class="section-title" style="background:#000000;">Acknowledgement & Signatures</div>
<div style="padding: 16px 0;"> <div style="padding: 16px 0;">
<p style="font-size:12px; color:#555; margin-bottom:28px; line-height:1.6;"> <p style="font-size:12px; color:#555; margin-bottom:28px; line-height:1.6;">
By signing below, the employee acknowledges receipt of this violation record. By signing below, the employee acknowledges receipt of this violation record.
@@ -250,20 +251,12 @@ function buildHtml(v, score) {
</p> </p>
<div class="sig-grid"> <div class="sig-grid">
<div> <div>
<div class="sig-block"> <div class="sig-block"><div class="sig-label">Employee Signature</div></div>
<div class="sig-label">Employee Signature</div> <div class="sig-date-block"><div class="sig-label">Date</div></div>
</div>
<div class="sig-date-block">
<div class="sig-label">Date</div>
</div>
</div> </div>
<div> <div>
<div class="sig-block"> <div class="sig-block"><div class="sig-label">Supervisor / Documenting Officer Signature</div></div>
<div class="sig-label">Supervisor / Documenting Officer Signature</div> <div class="sig-date-block"><div class="sig-label">Date</div></div>
</div>
<div class="sig-date-block">
<div class="sig-label">Date</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -275,7 +268,7 @@ function buildHtml(v, score) {
Message Point Media Internal Use Only Message Point Media Internal Use Only
</div> </div>
</div><!-- /padding --> </div>
</body> </body>
</html>`; </html>`;
} }