NextExpense/templates/dashboard.html
cclohmar 4593dd1f66 refactor: replace currency dropdowns with simple text inputs
- Currency ISO3 dropdowns replaced with <input type="text" maxlength="3">
- Users can type any currency code (KES, USD, EUR, etc.)
- No need to maintain a long list of currencies
- Exchange rate is user-defined so validation is unnecessary
- All currency inputs have text-transform: uppercase for consistency
2026-06-01 23:14:16 +00:00

105 lines
5.9 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-row">
<div class="form-group">
<label class="form-label">Claim Currency</label>
<input type="text" id="base_currency" name="base_currency" value="USD" placeholder="USD, EUR, KES…" required maxlength="3" style="text-transform: uppercase;">
</div>
</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">
<label class="form-label">Receipt Amount</label>
<input type="number" id="sample_receipt_amount" name="sample_receipt_amount" step="0.01" min="0.01" placeholder="e.g. 1000" required>
</div>
<div class="form-group" style="flex: 0 0 110px;">
<label class="form-label">Currency</label>
<input type="text" id="sample_receipt_currency" name="sample_receipt_currency" value="KES" placeholder="KES" required maxlength="3" style="text-transform: uppercase;">
</div>
</div>
<div class="form-group">
<label class="form-label">What you were charged (claim currency)</label>
<input type="number" id="sample_claim_amount" name="sample_claim_amount" step="0.01" min="0.01" placeholder="e.g. 7.73" 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>