- Rename Go module from github.com/cclohmar/ReceiptNext to NextExpense - Update all import paths across 7 Go source files - Update templates (titles, headings, branding) - Update static files (manifest.json, sw.js, CSS) - Update config (Makefile, install.sh, .env.example) - Update README with new name and URLs - Rename service file receiptnext.service -> nextexpense.service - Update install paths, service names, log paths in install.sh
131 lines
7.9 KiB
HTML
131 lines
7.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>NextExpense</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;">NextExpense</h1>
|
|
<div style="display: flex; gap: 0.5rem;">
|
|
<button class="btn btn-secondary btn-sm" style="font-size: 0.75rem;"
|
|
hx-get="/profile" hx-target="body" hx-push-url="true">Profile</button>
|
|
<button class="btn btn-secondary btn-sm" style="font-size: 0.75rem;"
|
|
hx-post="/logout" hx-target="body" hx-push-url="true">Logout</button>
|
|
</div>
|
|
</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;">
|
|
{{if .Editing}}
|
|
<h3 style="margin-bottom: 1rem;">Edit Event</h3>
|
|
<form hx-put="/events/{{.Event.ID}}" hx-target="body" hx-push-url="true">
|
|
{{else}}
|
|
<form hx-post="/events" hx-target="body" hx-push-url="true">
|
|
{{end}}
|
|
<div class="form-group">
|
|
<label class="form-label">{{if .Editing}}Event{{else}}Event Name{{end}}</label>
|
|
<input type="text" id="name" name="name" placeholder="Event name" value="{{.Event.Name}}" {{if not .Editing}}required{{end}}>
|
|
</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="{{if .Editing}}{{.Event.BaseCurrency}}{{else}}USD{{end}}" 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;">
|
|
{{if .Editing}}Update the sample to recalculate the rate.{{else}}From a payment notification: receipt amount and what you were charged.{{end}}
|
|
</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="{{if .Editing}}{{.Event.BaseCurrency}}{{else}}KES{{end}}" placeholder="KES" required maxlength="3" style="text-transform: uppercase;">
|
|
</div>
|
|
</div>
|
|
<div class="form-group">
|
|
<label class="form-label">{{if .Editing}}Converted amount{{else}}What you were charged (claim currency){{end}}</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">{{if .Editing}}Save Changes{{else}}Create Event{{end}}</button>
|
|
{{if .Editing}}
|
|
<a href="/dashboard" class="btn btn-secondary btn-block" style="display: block; text-align: center; margin-top: 0.5rem;"
|
|
hx-get="/dashboard" hx-target="body" hx-push-url="true">Cancel</a>
|
|
{{end}}
|
|
</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 "open"}}
|
|
<button class="btn btn-secondary btn-sm"
|
|
hx-get="/events/{{.ID}}/edit"
|
|
hx-target="#create-event-form"
|
|
hx-swap="innerHTML"
|
|
onclick="document.getElementById('create-event-form').classList.remove('hidden')"
|
|
style="font-size: 0.75rem;">
|
|
Edit
|
|
</button>
|
|
{{end}}
|
|
{{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>
|