Add save button to TSCM report

- Add Save Report button next to Print button
- Downloads report as HTML file with date-stamped filename
- Style both buttons consistently with flex container

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Smittix
2026-01-14 20:37:43 +00:00
parent 9f39f1cc2f
commit 77b4bc9ad4

View File

@@ -9224,10 +9224,15 @@
.recommendations li {
margin-bottom: 8px;
}
.print-btn {
.report-actions {
position: fixed;
top: 20px;
right: 20px;
display: flex;
gap: 10px;
z-index: 1000;
}
.report-btn {
padding: 12px 24px;
background: #4a9eff;
color: #000;
@@ -9236,11 +9241,16 @@
font-weight: 600;
cursor: pointer;
font-size: 14px;
z-index: 1000;
}
.print-btn:hover {
.report-btn:hover {
background: #6bb3ff;
}
.report-btn.save {
background: #22c55e;
}
.report-btn.save:hover {
background: #2ecc71;
}
@media print {
body { background: #fff; color: #000; padding: 20px; }
.report-container { box-shadow: none; }
@@ -9250,14 +9260,17 @@
.section-title { color: #1a1a2e; }
th { background: #f0f0f0; color: #333; }
td { border-color: #ddd; }
.print-btn { display: none; }
.report-actions { display: none; }
.device-row.high_interest { background: rgba(255, 51, 51, 0.1); }
.device-row.review { background: rgba(255, 204, 0, 0.1); }
}
</style>
</head>
<body>
<button class="print-btn" onclick="window.print()">🖨️ Print Report</button>
<div class="report-actions">
<button class="report-btn save" onclick="saveReport()">💾 Save Report</button>
<button class="report-btn" onclick="window.print()">🖨️ Print Report</button>
</div>
<div class="report-container">
<div class="report-header">
@@ -9420,8 +9433,18 @@
</div>
<scr` + `ipt>
// Auto-focus print on load (optional)
// window.onload = () => window.print();
function saveReport() {
const html = document.documentElement.outerHTML;
const blob = new Blob([html], { type: 'text/html' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'TSCM_Report_${startTime.toISOString().split('T')[0]}.html';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
</scr` + `ipt>
</body>
</html>