Allow users to edit checkins

This commit is contained in:
Peter Stockings
2026-02-24 20:57:45 +11:00
parent 10256a1283
commit 1c935a64be
3 changed files with 91 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
<tr id="checkin-{{ c.id }}" class="editing-row">
<td>{{ c.checked_in_at | sydney }}</td>
<td>
<input type="number" name="weight_kg" class="edit-input" step="0.1" value="{{ '%.1f' % (c.weight_kg | float) }}"
required autofocus>
</td>
<td style="color: var(--text-muted); font-size: 0.8rem;">auto</td>
<td>
<input type="text" name="notes" class="edit-input" placeholder="Notes" value="{{ c.notes or '' }}">
</td>
<td>
<div class="checkin-actions">
<button class="btn-icon btn-icon-success" hx-put="/checkin/{{ c.id }}" hx-target="#checkin-{{ c.id }}"
hx-swap="outerHTML" hx-include="closest tr" title="Save"></button>
<button class="btn-icon" hx-get="/checkin/{{ c.id }}/view" hx-target="#checkin-{{ c.id }}"
hx-swap="outerHTML" title="Cancel"></button>
</div>
</td>
</tr>

View File

@@ -4,7 +4,11 @@
<td>{{ '%.1f' % (c.bmi | float) if c.bmi else '—' }}</td>
<td>{{ c.notes or '—' }}</td>
<td>
<button class="btn-icon" hx-delete="/checkin/{{ c.id }}" hx-target="#checkin-{{ c.id }}" hx-swap="outerHTML"
hx-confirm="Delete this check-in?">🗑️</button>
<div class="checkin-actions">
<button class="btn-icon" hx-get="/checkin/{{ c.id }}/edit" hx-target="#checkin-{{ c.id }}"
hx-swap="outerHTML" title="Edit">✏️</button>
<button class="btn-icon" hx-delete="/checkin/{{ c.id }}" hx-target="#checkin-{{ c.id }}" hx-swap="outerHTML"
hx-confirm="Delete this check-in?" title="Delete">🗑️</button>
</div>
</td>
</tr>