NextExpense/templates/dashboard.html
cclohmar dcb43b08a0 feat: send receipt images as ZIP attachment with report
- Email now includes both report (CSV/PDF) + ZIP of all receipt images
- ZIP images named {event-name}-{index}.{ext} matching list order
- Uses Go's archive/zip (stdlib, no external deps)
- Sender.SendReport now accepts []*Attachment for multiple files
- Gracefully skips missing image files with warnings
2026-05-30 13:38:23 +00:00

113 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#10b981">
<title>ReceiptNext</title>
<link rel="icon" type="image/svg+xml" href="/static/favicon.svg">
<link rel="alternate icon" href="/static/icons/icon-192.png">
<link rel="manifest" href="/manifest.json">
<link rel="stylesheet" href="/static/css/style.css?v=4">
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
</head>
<body>
<div class="app-shell">
<header class="app-header">
<h1 class="app-title"><img src="/static/favicon.svg" width="24" height="24" alt="" style="vertical-align: middle; margin-right: 0.5rem;">ReceiptNext</h1>
</header>
<main class="main-content">
<div class="dashboard-header">
<h2>My Events</h2>
<button class="btn btn-primary btn-sm"
onclick="document.getElementById('create-event-form').classList.toggle('hidden')">
+ New
</button>
</div>
<div id="create-event-form" class="hidden" style="margin-bottom: 1rem;">
<div class="card" style="padding: 1rem;">
<form hx-post="/events" hx-target="body" hx-push-url="true">
<div class="form-group">
<input type="text" id="name" name="name" placeholder="Event name, e.g. WebSummit 2026" required>
</div>
<div class="form-group">
<select id="base_currency" name="base_currency" required>
<option value="EUR">EUR - Euro</option>
<option value="USD" selected>USD - US Dollar</option>
<option value="GBP">GBP - British Pound</option>
<option value="KES">KES - Kenyan Shilling</option>
<option value="CHF">CHF - Swiss Franc</option>
<option value="SEK">SEK - Swedish Krona</option>
<option value="NOK">NOK - Norwegian Krone</option>
<option value="PLN">PLN - Polish Zloty</option>
</select>
</div>
<div style="background: #064e3b; border: 1px solid #065f46; border-radius: 0.5rem; padding: 0.75rem; margin-bottom: 0.5rem;">
<div style="font-size: 0.8rem; font-weight: 600; color: #6ee7b7; margin-bottom: 0.5rem;">Conversion Sample</div>
<p style="font-size: 0.75rem; color: var(--color-text-muted); margin-bottom: 0.5rem;">
From a payment notification: receipt amount and what you were charged.
</p>
<div class="form-row">
<div class="form-group">
<input type="number" id="sample_receipt_amount" name="sample_receipt_amount" step="0.01" min="0.01" placeholder="Receipt amount" required>
</div>
<div class="form-group" style="flex: 0 0 100px;">
<select id="sample_receipt_currency" name="sample_receipt_currency" required>
<option value="KES" selected>KES</option>
<option value="USD">USD</option>
<option value="EUR">EUR</option>
<option value="GBP">GBP</option>
</select>
</div>
</div>
<div class="form-group">
<input type="number" id="sample_claim_amount" name="sample_claim_amount" step="0.01" min="0.01" placeholder="What you were charged" required>
</div>
</div>
<button type="submit" class="btn btn-primary btn-block">Create Event</button>
</form>
</div>
</div>
<div id="event-list">
{{if .Events}}
<div style="display: flex; flex-direction: column; gap: 0.5rem;">
{{range .Events}}
<div style="display: flex; align-items: center; justify-content: space-between; background: var(--color-card); border: 1px solid var(--color-border); border-radius: 0.5rem; padding: 0.75rem 1rem;">
<div>
<div style="font-weight: 500; color: var(--color-text);">{{.Name}}</div>
<div style="font-size: 0.75rem; color: var(--color-text-muted);">
{{.BaseCurrency}} · {{printf "%.6f" .ExchangeRate}} rate
</div>
</div>
<div style="display: flex; gap: 0.5rem;">
<a href="/events/{{.ID}}/expenses" class="btn btn-primary btn-sm"
hx-get="/events/{{.ID}}/expenses" hx-target="body" hx-push-url="true"
style="text-decoration: none;">
Open
</a>
{{if eq .Status "closed"}}
<button class="btn btn-secondary btn-sm"
hx-put="/events/{{.ID}}/reopen"
hx-target="body"
hx-push-url="true"
style="font-size: 0.75rem;">
Reopen
</button>
{{end}}
</div>
</div>
{{end}}
</div>
{{else}}
<div class="empty-state" style="text-align: center; padding: 3rem; color: #94a3b8;">
<p>No events yet. Create one to get started.</p>
</div>
{{end}}
</div>
</main>
</div>
</body>
</html>