54 lines
1.6 KiB
HTML
54 lines
1.6 KiB
HTML
{{define "content"}}
|
|
{{$d := .}}
|
|
<h1 style="margin-bottom: 24px;">Accounts</h1>
|
|
|
|
<div class="card">
|
|
<form method="POST" class="flex flex-wrap" style="gap: 12px; align-items: end;">
|
|
<div class="form-group" style="margin-bottom: 0; flex: 1;">
|
|
<label>Account Name</label>
|
|
<input type="text" name="name" placeholder="e.g. CGD Current Account" required>
|
|
</div>
|
|
<div class="form-group" style="margin-bottom: 0; flex: 1;">
|
|
<label>Type</label>
|
|
<select name="type">
|
|
<option value="checking">Checking</option>
|
|
<option value="savings">Savings</option>
|
|
<option value="credit">Credit Card</option>
|
|
<option value="securities">Securities</option>
|
|
</select>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Add Account</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="table-wrap">
|
|
<table>
|
|
<thead>
|
|
<tr><th>Name</th><th>Type</th><th></th></tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range $d.Accounts}}
|
|
<tr>
|
|
<td>{{.Name}}</td>
|
|
<td><span class="badge">{{.Type}}</span></td>
|
|
<td>
|
|
<button class="btn btn-danger btn-sm" onclick="delAccount('{{.ID}}')">Delete</button>
|
|
</td>
|
|
</tr>
|
|
{{else}}
|
|
<tr><td colspan="3" class="text-center text-muted">No accounts yet.</td></tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function delAccount(id) {
|
|
if (!confirm('Delete this account?')) return;
|
|
fetch('/accounts/' + id, {method: 'DELETE'}).then(() => location.reload());
|
|
}
|
|
</script>
|
|
{{end}}
|