This commit is contained in:
2025-03-24 19:17:39 +00:00
commit cf8cd691dc
10 changed files with 232 additions and 0 deletions

29
templates/index.html Normal file
View File

@@ -0,0 +1,29 @@
{{ define "index" }}
<a href="/new">+ Add New Draw</a>
{{ if . }}
<table>
<tr>
<th>Date</th>
<th>Numbers</th>
<th>Spend (£)</th>
<th>Return (£)</th>
<th>Profit/Loss (£)</th>
</tr>
{{ range . }}
<tr>
<td>{{ .Date }}</td>
<td>{{ .Numbers }}</td>
<td>{{ printf "%.2f" .Spend }}</td>
<td>{{ printf "%.2f" .Return }}</td>
<td>{{ printf "%.2f" .ProfitLoss }}</td>
</tr>
{{ else }}
<tr><td colspan="5">No draws recorded yet.</td></tr>
{{ end }}
</table>
{{ else }}
<p>No draws recorded yet. <a href="/new">Add your first draw</a></p>
{{ end }}
{{ end }}

26
templates/layout.html Normal file
View File

@@ -0,0 +1,26 @@
{{ define "layout" }}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Lotto Tracker</title>
<style>
body { font-family: Arial, sans-serif; margin: 40px; }
table { border-collapse: collapse; width: 100%; margin-top: 20px; }
th, td { padding: 8px 12px; border: 1px solid #ddd; text-align: center; }
th { background-color: #f5f5f5; }
.form-section { margin-bottom: 20px; }
</style>
</head>
<body>
<h1>Lotto Tracker</h1>
{{ if eq .Page "index" }}
{{ template "index" .Data }}
{{ else if eq .Page "new_draw" }}
{{ template "new_draw" .Data }}
{{ end }}
</body>
</html>
{{ end }}

19
templates/new_draw.html Normal file
View File

@@ -0,0 +1,19 @@
{{ define "new_draw" }}
<a href="/">← Back to Overview</a>
<h2>New Draw Entry</h2>
<form action="/submit" method="POST">
<div class="form-section">
<label>Date: <input type="date" name="date" required></label>
</div>
<div class="form-section">
<label>Numbers: <input type="text" name="numbers" required></label>
</div>
<div class="form-section">
<label>Spend (£): <input type="number" step="0.01" name="spend" required></label>
</div>
<div class="form-section">
<label>Return (£): <input type="number" step="0.01" name="return" required></label>
</div>
<button type="submit">Save</button>
</form>
{{ end }}