<!DOCTYPE html><html lang="nl"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title><%= invoice.number %> — Mek-Tech</title><link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet"><link rel="stylesheet" href="/css/style.css"><link rel="stylesheet" href="/css/dynamic.css"><link rel="icon" href="/img/favicon.svg"><script src="https://unpkg.com/lucide@latest"></script>
<style>.invoice-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:2rem;flex-wrap:wrap;gap:.5rem}.invoice-org h2{font-size:1.2rem;color:var(--text)}.invoice-client{text-align:right}.invoice-client h3{font-size:1rem;color:var(--text)}.invoice-meta{color:var(--text-muted);font-size:.8rem}.invoice-total-box{background:var(--bg-card);border:1px solid var(--border);border-radius:var(--radius);padding:1rem;text-align:right;margin-top:1rem}.invoice-total-box .amount{font-size:1.8rem;font-weight:700;color:var(--accent)}.alert-sent{background:var(--green-bg);border:1px solid var(--green);color:var(--green);padding:.5rem .75rem;border-radius:var(--radius);font-size:.8rem;margin-bottom:.75rem;display:flex;align-items:center;gap:.4rem}.alert-err{background:var(--red-bg);border:1px solid var(--red);color:var(--red);padding:.5rem .75rem;border-radius:var(--radius);font-size:.8rem;margin-bottom:.75rem}</style></head><body>
<nav class="navbar"><div class="nav-inner"><a href="/" class="nav-brand"><img src="/img/logo.svg" class="nav-logo" alt="Mek-Tech"></a><div style="display:flex;align-items:center;gap:.4rem"><a href="/" class="nav-icon-btn" title="Dashboard"><i data-lucide="layout-dashboard" style="width:15px;height:15px"></i> Dashboard</a><button class="theme-toggle" id="themeToggle" onclick="toggleTheme()"></button><a href="/auth/logout" class="nav-icon-btn" style="color:var(--red)"><i data-lucide="log-out" style="width:15px;height:15px"></i> Uitloggen</a></div></div></nav>
<div class="container" style="max-width:800px">
<% if (sent) { %><div class="alert-sent"><i data-lucide="check-circle" style="width:16px;height:16px"></i> Factuur verzonden per email!</div><% } %>
<% if (error) { %><div class="alert-err"><%= error %></div><% } %>
<a href="javascript:history.back()" class="back-link"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg> Terug</a>
<div class="invoice-header">
<div class="invoice-org"><h2>Mek-Tech Consulting</h2><p class="invoice-meta"><%= invoice.contact_email %><br><%= invoice.website || '' %></p></div>
<div class="invoice-client"><h3><%= invoice.client_name %></h3><p class="invoice-meta"><%= invoice.contact_name || '' %><br><%= invoice.contact_email || '' %><br><%= invoice.contact_phone || '' %></p></div>
</div>
<div class="detail-grid">
<div class="detail-card"><h3>Factuur</h3><p style="color:var(--text);font-size:1.1rem;font-weight:600"><%= invoice.number %></p><p style="color:var(--text-muted);font-size:.8rem">Datum: <%= invoice.date %><br>Vervaldatum: <%= invoice.due_date || '-' %></p></div>
<div class="detail-card"><h3>Status</h3><form method="POST" action="/invoices/<%= invoice.id %>/status" class="status-form">
<select name="status">
<option value="draft" <%= invoice.status==='draft'?'selected':'' %>>Concept</option>
<option value="sent" <%= invoice.status==='sent'?'selected':'' %>>Verzonden</option>
<option value="paid" <%= invoice.status==='paid'?'selected':'' %>>Betaald</option>
<option value="overdue" <%= invoice.status==='overdue'?'selected':'' %>>Overdue</option>
<option value="cancelled" <%= invoice.status==='cancelled'?'selected':'' %>>Geannuleerd</option>
</select>
<button class="btn-small">Bijwerken</button>
</form></div>
</div>
<div style="display:flex;gap:.35rem;margin-bottom:1rem;flex-wrap:wrap">
<form method="POST" action="/invoices/<%= invoice.id %>/send-email"><button class="btn btn-primary" style="font-size:.78rem;padding:.35rem .7rem"><i data-lucide="send" style="width:14px;height:14px"></i> Verstuur per email</button></form>
<a href="/invoices" class="btn btn-secondary" style="font-size:.78rem;padding:.35rem .7rem"><i data-lucide="list" style="width:14px;height:14px"></i> Alle facturen</a>
</div>
<table class="data-table"><thead><tr><th>Omschrijving</th><th>Aantal</th><th>Prijs</th><th>Totaal</th></tr></thead><tbody>
<% items.forEach(function(item){ %>
<tr><td><%= item.description %></td><td><%= item.quantity %></td><td>€<%= (item.unit_price || 0).toFixed(2) %></td><td>€<%= (item.total || 0).toFixed(2) %></td></tr>
<% }) %>
<tr style="font-weight:600"><td colspan="3" style="text-align:right">Subtotaal</td><td>€<%= (invoice.subtotal || 0).toFixed(2) %></td></tr>
<tr style="font-weight:600"><td colspan="3" style="text-align:right">BTW</td><td>€<%= (invoice.tax || 0).toFixed(2) %></td></tr>
</tbody></table>
<div class="invoice-total-box"><div class="amount">€<%= (invoice.total || 0).toFixed(2) %></div><div class="invoice-meta">Totaal inclusief BTW</div></div>
<% if (invoice.notes) { %><div class="detail-card" style="margin-top:1rem"><h3>Notities</h3><p style="color:var(--text);font-size:.85rem"><%= invoice.notes %></p></div><% } %>
</div>
<script>lucide.createIcons()</script><script src="/js/theme.js"></script></body></html>
