Add printer lifecycle fields and printer log

- Printer: bought_at, last_maintenance_at, decommissioned_at (all Date, nullable)
- PrinterLog: per-printer timestamped text entries (CASCADE delete)
- Migration 0003: adds columns + printer_logs table
- /printers/{id}: detail page showing lifecycle info + scrollable log
- POST /printers/{id}/log: add a log entry via modal form
- Printer names in list are now links to the detail page
- Add Printer modal includes optional purchase date

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Hohenberg
2026-06-18 21:47:48 +02:00
parent 750edbbcec
commit c78f8c91cd
7 changed files with 206 additions and 4 deletions

View File

@@ -38,7 +38,7 @@
<tbody>
{% for p in printers %}
<tr>
<td class="fw-medium text-white">{{ p.name }}</td>
<td><a href="/printers/{{ p.id }}" class="text-white text-decoration-none fw-medium">{{ p.name }}</a></td>
<td class="text-secondary">{{ p.printer_type.name if p.printer_type else '—' }}</td>
<td class="text-secondary small">
{% if p.printer_type %}
@@ -96,6 +96,11 @@
placeholder="e.g. Workshop, Shelf 2">
</div>
<div>
<label class="form-label text-secondary small">Purchase date</label>
<input type="date" name="bought_at" class="form-control bg-dark border-secondary text-white">
</div>
</div>
<div class="modal-footer border-secondary">
<button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">Cancel</button>