Skip to content

Commit c9ca5e1

Browse files
committed
Add print-friendly scenario cards with transposed table data
1 parent 8d0ea96 commit c9ca5e1

File tree

1 file changed

+155
-10
lines changed

1 file changed

+155
-10
lines changed

checklist.html

Lines changed: 155 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,13 @@
461461
}
462462
}
463463

464+
/* =======================
465+
PRINT CARDS (Hidden on screen)
466+
======================= */
467+
.print-cards {
468+
display: none;
469+
}
470+
464471
/* =======================
465472
PRINT STYLES
466473
======================= */
@@ -473,27 +480,88 @@
473480

474481
#navbar-placeholder,
475482
.nav-home,
476-
.legend {
483+
.legend,
484+
.table-container {
477485
display: none !important;
478486
}
479487

480-
.header-card,
481-
.table-container {
488+
.header-card {
482489
box-shadow: none !important;
483-
border: 1px solid #ccc !important;
490+
border: 1px solid #bfbfbf !important;
484491
page-break-inside: avoid;
492+
margin-bottom: 1.5rem;
485493
}
486494

487-
.requirements-table thead {
488-
background: #333 !important;
495+
/* Show print cards */
496+
.print-cards {
497+
display: block !important;
498+
max-width: 800px;
499+
margin: 0 auto;
489500
}
490501

491-
.requirements-table tbody th {
492-
background: #f0f0f0 !important;
502+
.scenario-card {
503+
border: 2px solid #000;
504+
border-radius: 8px;
505+
margin-bottom: 1.5rem;
506+
page-break-inside: avoid;
507+
overflow: hidden;
508+
}
509+
510+
.scenario-card-header {
511+
background: #111;
512+
color: #fff;
513+
padding: 0.75rem 1rem;
514+
font-weight: 700;
515+
font-size: 1.1rem;
516+
border-bottom: 2px solid #000;
517+
}
518+
519+
.scenario-card-body {
520+
padding: 0.5rem 1rem 0.75rem 1rem;
521+
background: white;
522+
}
523+
524+
.document-item {
525+
display: flex;
526+
justify-content: space-between;
527+
padding: 0.4rem 0;
528+
border-bottom: 1px dotted #ccc;
529+
font-size: 0.95rem;
530+
}
531+
532+
.document-item:last-child {
533+
border-bottom: none;
534+
}
535+
536+
.document-name {
537+
font-weight: 500;
538+
color: #000;
539+
flex: 1;
540+
padding-right: 1rem;
541+
}
542+
543+
.document-status {
544+
font-weight: 600;
545+
white-space: nowrap;
546+
color: #000;
547+
}
548+
549+
.document-status.required {
550+
color: #000;
493551
}
494552

495-
.check-icon {
496-
color: #000 !important;
553+
.document-status.conditional {
554+
color: #555;
555+
font-style: italic;
556+
}
557+
558+
.document-status.review {
559+
color: #555;
560+
font-style: italic;
561+
}
562+
563+
.document-status.not-required {
564+
color: #999;
497565
}
498566
}
499567
</style>
@@ -666,6 +734,9 @@ <h3><i class="fas fa-info-circle"></i> How to Use This Checklist</h3>
666734
</table>
667735
</div>
668736

737+
<!-- Print-only scenario cards (generated by JavaScript) -->
738+
<div class="print-cards" id="print-cards"></div>
739+
669740
<!-- Navigation -->
670741
<div class="nav-home">
671742
<a href="/">← Return to Home</a>
@@ -683,5 +754,79 @@ <h3><i class="fas fa-info-circle"></i> How to Use This Checklist</h3>
683754
document.getElementById('navbar-placeholder').innerHTML = data;
684755
});
685756
</script>
757+
758+
<!-- Generate print-friendly scenario cards -->
759+
<script>
760+
document.addEventListener('DOMContentLoaded', function () {
761+
const table = document.querySelector('.requirements-table');
762+
const printCardsContainer = document.getElementById('print-cards');
763+
764+
if (!table || !printCardsContainer) return;
765+
766+
// Extract scenario headers (column headers, excluding first "Required Document/Action")
767+
const headerCells = Array.from(table.querySelectorAll('thead th'));
768+
const scenarios = headerCells.slice(1).map(th => {
769+
// Extract text from potentially linked headers
770+
return th.textContent.replace(/\s+/g, ' ').trim();
771+
});
772+
773+
// Extract document names and their status for each scenario
774+
const documentRows = Array.from(table.querySelectorAll('tbody tr'));
775+
const documents = documentRows.map(row => {
776+
const docNameCell = row.querySelector('th');
777+
const docName = docNameCell.textContent.trim();
778+
779+
// Get status for each scenario
780+
const statusCells = Array.from(row.querySelectorAll('td'));
781+
const statuses = statusCells.map(cell => {
782+
if (cell.querySelector('.check-icon')) {
783+
return { text: 'Required', class: 'required' };
784+
} else if (cell.querySelector('.conditional-icon')) {
785+
return { text: 'Conditional', class: 'conditional' };
786+
} else if (cell.querySelector('.review-icon')) {
787+
return { text: 'Review if Out of Date', class: 'review' };
788+
} else {
789+
return { text: '-', class: 'not-required' };
790+
}
791+
});
792+
793+
return { name: docName, statuses: statuses };
794+
});
795+
796+
// Generate scenario cards
797+
scenarios.forEach((scenario, scenarioIdx) => {
798+
const card = document.createElement('div');
799+
card.className = 'scenario-card';
800+
801+
const header = document.createElement('div');
802+
header.className = 'scenario-card-header';
803+
header.textContent = scenario;
804+
805+
const body = document.createElement('div');
806+
body.className = 'scenario-card-body';
807+
808+
documents.forEach(doc => {
809+
const item = document.createElement('div');
810+
item.className = 'document-item';
811+
812+
const name = document.createElement('div');
813+
name.className = 'document-name';
814+
name.textContent = doc.name;
815+
816+
const status = document.createElement('div');
817+
status.className = `document-status ${doc.statuses[scenarioIdx].class}`;
818+
status.textContent = doc.statuses[scenarioIdx].text;
819+
820+
item.appendChild(name);
821+
item.appendChild(status);
822+
body.appendChild(item);
823+
});
824+
825+
card.appendChild(header);
826+
card.appendChild(body);
827+
printCardsContainer.appendChild(card);
828+
});
829+
});
830+
</script>
686831
</body>
687832
</html>

0 commit comments

Comments
 (0)