Files
2026-09-09 17:49:01 +01:00

34 lines
1.2 KiB
HTML

{# Expects: events, csrf, old, errors (all optional) #}
{% if events %}
<table class="events-table">
<thead>
<tr><th>When</th><th>Type</th><th>Miles</th><th>Cost</th><th>Notes</th><th></th></tr>
</thead>
<tbody>
{% for ev in events %}
<tr>
<td>{{ ev.event_date }}</td>
<td><span class="tag tag-{{ ev.type }}">{{ ev.type }}</span></td>
<td>{% if ev.mileage is not none %}{{ ev.mileage | money }}{% else %}-{% endif %}</td>
<td>{{ ev.cost | money if ev.cost is not none else '-' }}</td>
<td class="notes">{{ ev.notes or '' }}</td>
<td class="row-actions">
<form method="post" action="/events/{{ ev.id }}/delete"
onsubmit="if(!confirm('Delete this event?'))return false;">
<input type="hidden" name="csrf" value="{{ csrf }}">
<button class="btn btn-link btn-danger" type="submit" aria-label="Delete event">&times;</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="muted">No events yet. Log your first one below.</p>
{% endif %}
{% if errors %}
<div class="alert alert-error" style="margin-top:1rem">
{% for key, val in errors.items() %}<div>{{ val }}</div>{% endfor %}
</div>
{% endif %}