<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Export Tabel — {{table_name}}</title>
<style>
:root {
--bg: #f0f4f8;
--card-bg: #ffffff;
--text: #1a202c;
--text-secondary: #4a5568;
--border: #e2e8f0;
--th-bg: #edf2f7;
--th-text: #2d3748;
--accent: #4f6ef7;
--accent-light: #eef1ff;
--zebra: #f7fafc;
--hover: #ebf4ff;
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
--shadow-md: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.05);
--shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0, 0, 0, 0.06);
--radius-sm: 8px;
--radius: 14px;
--radius-lg: 18px;
--transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
padding: 1.5rem;
background: var(--bg);
background-image:
radial-gradient(ellipse at 20% 20%, rgba(79, 110, 247, 0.03) 0%, transparent 60%),
radial-gradient(ellipse at 80% 80%, rgba(99, 179, 237, 0.04) 0%, transparent 60%);
min-height: 100vh;
color: var(--text);
line-height: 1.6;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.container {
max-width: 1300px;
margin: 0 auto;
background: var(--card-bg);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-lg);
padding: 2rem 2rem 1.5rem;
border: 1px solid var(--border);
animation: fadeSlideIn 0.45s ease-out;
}
@keyframes fadeSlideIn {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.header {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 1rem;
margin-bottom: 1.75rem;
padding-bottom: 1.25rem;
border-bottom: 2px solid var(--border);
}
.header-left {
display: flex;
align-items: center;
gap: 1rem;
flex-wrap: wrap;
}
.icon-wrapper {
width: 44px;
height: 44px;
border-radius: var(--radius-sm);
background: var(--accent-light);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.icon-wrapper svg {
width: 22px;
height: 22px;
color: var(--accent);
}
.title-group h1 {
font-size: 1.6rem;
font-weight: 700;
letter-spacing: -0.02em;
color: var(--text);
line-height: 1.2;
margin: 0;
}
.title-group .subtitle {
font-size: 0.875rem;
color: var(--text-secondary);
margin-top: 2px;
}
.meta-badges {
display: flex;
flex-wrap: wrap;
gap: 0.6rem;
align-items: center;
}
.badge {
display: inline-flex;
align-items: center;
gap: 0.4rem;
font-size: 0.8rem;
font-weight: 500;
padding: 0.4rem 0.85rem;
border-radius: 999px;
background: #f7fafc;
color: #4a5568;
border: 1px solid #e2e8f0;
white-space: nowrap;
letter-spacing: 0.01em;
}
.badge .dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: #48bb78;
flex-shrink: 0;
}
.badge.accent {
background: var(--accent-light);
color: var(--accent);
border-color: #d6dcff;
font-weight: 600;
}
.table-wrapper {
overflow-x: auto;
border-radius: var(--radius);
border: 1px solid var(--border);
box-shadow: var(--shadow-sm);
-webkit-overflow-scrolling: touch;
scroll-behavior: smooth;
}
.table-wrapper::-webkit-scrollbar {
height: 7px;
}
.table-wrapper::-webkit-scrollbar-track {
background: #f1f5f9;
border-radius: 0 0 var(--radius) var(--radius);
}
.table-wrapper::-webkit-scrollbar-thumb {
background: #cbd5e0;
border-radius: 10px;
}
.table-wrapper::-webkit-scrollbar-thumb:hover {
background: #a0aec0;
}
table {
width: 100%;
border-collapse: collapse;
font-size: 0.925rem;
min-width: 600px;
white-space: nowrap;
}
thead th {
background: var(--th-bg);
color: var(--th-text);
font-weight: 700;
font-size: 0.8rem;
text-transform: uppercase;
letter-spacing: 0.04em;
padding: 0.85rem 1rem;
border-bottom: 2px solid #dde4ed;
position: sticky;
top: 0;
z-index: 2;
text-align: left;
white-space: nowrap;
user-select: none;
}
thead th:first-child {
border-radius: var(--radius-sm) 0 0 0;
}
thead th:last-child {
border-radius: 0 var(--radius-sm) 0 0;
}
tbody td {
padding: 0.7rem 1rem;
border-bottom: 1px solid #edf2f7;
color: var(--text);
transition: background var(--transition);
vertical-align: middle;
}
tbody tr {
transition: background var(--transition), box-shadow var(--transition);
}
tbody tr:nth-child(even) {
background-color: var(--zebra);
}
tbody tr:hover {
background-color: var(--hover) !important;
box-shadow: inset 3px 0 0 var(--accent);
}
.row-num {
text-align: center;
font-weight: 500;
color: #a0aec0;
font-size: 0.8rem;
width: 50px;
min-width: 50px;
user-select: none;
}
tbody tr:hover .row-num {
color: var(--accent);
font-weight: 600;
}
tbody tr:last-child td {
border-bottom: none;
}
.empty-state {
text-align: center;
padding: 3rem 1rem;
color: #a0aec0;
}
.empty-state svg {
width: 48px;
height: 48px;
margin-bottom: 0.75rem;
opacity: 0.5;
}
.empty-state p {
font-size: 0.95rem;
margin: 0;
}
.footer {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
margin-top: 1.25rem;
padding-top: 0.75rem;
font-size: 0.8rem;
color: #a0aec0;
gap: 0.75rem;
}
.footer .row-count {
font-weight: 600;
color: var(--text-secondary);
background: #f7fafc;
padding: 0.3rem 0.75rem;
border-radius: 999px;
border: 1px solid #edf2f7;
}
@media print {
body {
background: #fff;
padding: 0;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
.container {
box-shadow: none;
border: none;
border-radius: 0;
padding: 0.5cm;
max-width: 100%;
animation: none;
}
.table-wrapper {
box-shadow: none;
border: 1px solid #ccc;
border-radius: 0;
overflow-x: visible;
}
.table-wrapper::-webkit-scrollbar {
display: none;
}
thead th {
background: #e2e8f0 !important;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
tbody tr:nth-child(even) {
background-color: #f7fafc !important;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
.footer {
color: #666;
}
.badge {
border: 1px solid #ccc;
}
@page {
margin: 0.5cm;
size: A4 landscape;
}
}
@media (max-width: 768px) {
body {
padding: 0.5rem;
}
.container {
padding: 1rem 0.75rem 1rem;
border-radius: var(--radius);
}
.header {
flex-direction: column;
align-items: flex-start;
}
.title-group h1 {
font-size: 1.3rem;
}
table {
font-size: 0.8rem;
}
thead th,
tbody td {
padding: 0.5rem 0.6rem;
}
.meta-badges {
gap: 0.4rem;
}
.badge {
font-size: 0.7rem;
padding: 0.3rem 0.6rem;
}
}
@media (max-width: 480px) {
.container {
padding: 0.75rem 0.5rem;
border-radius: 10px;
}
.title-group h1 {
font-size: 1.1rem;
}
.icon-wrapper {
width: 34px;
height: 34px;
}
.icon-wrapper svg {
width: 17px;
height: 17px;
}
table {
font-size: 0.72rem;
min-width: 400px;
}
thead th,
tbody td {
padding: 0.4rem 0.5rem;
}
.row-num {
width: 32px;
min-width: 32px;
font-size: 0.7rem;
}
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="header-left">
<div class="icon-wrapper" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
<line x1="3" y1="9" x2="21" y2="9"></line>
<line x1="3" y1="15" x2="21" y2="15"></line>
<line x1="9" y1="3" x2="9" y2="21"></line>
<line x1="15" y1="3" x2="15" y2="21"></line>
</svg>
</div>
<div class="title-group">
<h1>{{table_name}}</h1>
<p class="subtitle">Laporan data • Diekspor pada <span id="exportDate"></span></p>
</div>
</div>
<div class="meta-badges">
<span class="badge accent" id="rowCountBadge">📊 <span id="rowCountLabel">0</span> baris</span>
<span class="badge"><span class="dot"></span> Data terkini</span>
</div>
</div>
<div class="table-wrapper">
{{table_content}}
</div>
<div class="footer">
<span>© <span id="currentYear"></span> • Dibuat dengan HTML Export Engine</span>
<span class="row-count" id="footerRowCount">Total: 0 baris</span>
</div>
</div>
<script>
(function () {
const now = new Date();
const dateOptions = {
day: 'numeric',
month: 'long',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
timeZoneName: 'short'
};
const dateEl = document.getElementById('exportDate');
if (dateEl) {
dateEl.textContent = now.toLocaleDateString('id-ID', dateOptions);
}
const yearEl = document.getElementById('currentYear');
if (yearEl) {
yearEl.textContent = now.getFullYear();
}
function countDataRows() {
const table = document.querySelector('.table-wrapper table');
if (!table) return 0;
const tbody = table.querySelector('tbody');
if (!tbody) return 0;
const rows = tbody.querySelectorAll('tr');
let count = 0;
rows.forEach(row => {
const cells = row.querySelectorAll('td');
if (cells.length === 1 && cells[0].classList.contains('empty-state')) {
return;
}
count++;
});
return count;
}
function updateRowCounts() {
const count = countDataRows();
const labelEl = document.getElementById('rowCountLabel');
const badgeEl = document.getElementById('rowCountBadge');
const footerEl = document.getElementById('footerRowCount');
if (labelEl) labelEl.textContent = count;
if (footerEl) footerEl.textContent = 'Total: ' + count + ' baris';
if (badgeEl && count === 0) {
badgeEl.textContent = '📭 0 baris';
} else if (badgeEl && count > 0) {
badgeEl.textContent = '📊 ' + count + ' baris';
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', updateRowCounts);
} else {
updateRowCounts();
}
function addRowNumbers() {
const table = document.querySelector('.table-wrapper table');
if (!table) return;
const tbody = table.querySelector('tbody');
if (!tbody) return;
const rows = tbody.querySelectorAll('tr');
rows.forEach((row, index) => {
const cells = row.querySelectorAll('td');
if (cells.length === 1 && cells[0].classList.contains('empty-state')) return;
const firstCell = row.querySelector('td:first-child');
if (firstCell && firstCell.classList.contains('row-num')) return;
const numCell = document.createElement('td');
numCell.classList.add('row-num');
numCell.textContent = index + 1;
row.insertBefore(numCell, row.firstChild);
});
const thead = table.querySelector('thead');
if (thead) {
const headerRow = thead.querySelector('tr');
if (headerRow && !headerRow.querySelector('th.row-num')) {
const numHeader = document.createElement('th');
numHeader.classList.add('row-num');
numHeader.textContent = '#';
numHeader.style.textAlign = 'center';
headerRow.insertBefore(numHeader, headerRow.firstChild);
}
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => {
addRowNumbers();
updateRowCounts();
});
} else {
addRowNumbers();
updateRowCounts();
}
})();
</script>
</body>
</html>