feat(trips): archive current list and start a fresh one
Add a "Arkivér & ny liste" button that snapshots the current trip (checked items, prices, quantities, extras and custom categories) into a new trips table, then clears the mutable state so the list resets to the fresh catalog. - New trips table in init_db() storing a self-contained JSON snapshot plus computed totals and item count - POST /api/archive with a no-op guard against archiving an empty list - /historik list view and /historik/<id> read-only detail view - Photo files are kept so archived trips can still show them
This commit is contained in:
74
templates/historik.html
Normal file
74
templates/historik.html
Normal file
@@ -0,0 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="da">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Citti Historik</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;600&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f5f2ed; --card: #ffffff; --border: #e2ddd6; --text: #1a1814;
|
||||
--muted: #8a857c; --accent: #c84b2f; --green: #2d6a4f;
|
||||
--mono: 'DM Mono', monospace; --sans: 'DM Sans', sans-serif;
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; padding: 1.5rem 1rem 4rem; }
|
||||
.page { max-width: 860px; margin: 0 auto; }
|
||||
header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 2px solid var(--text); }
|
||||
h1 { font-size: 1.75rem; font-weight: 600; letter-spacing: -0.03em; }
|
||||
h1 span { color: var(--accent); }
|
||||
.btn-back { background: var(--text); color: white; border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px; font-family: var(--sans); cursor: pointer; text-decoration: none; display: inline-block; font-weight: 500; }
|
||||
|
||||
.trip-list { display: flex; flex-direction: column; gap: 10px; }
|
||||
.trip-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1rem 1.25rem; text-decoration: none; color: inherit; transition: border-color 0.15s ease; }
|
||||
.trip-card:active { border-color: var(--accent); }
|
||||
.trip-label { font-size: 1.1rem; font-weight: 600; }
|
||||
.trip-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
|
||||
.trip-totals { text-align: right; white-space: nowrap; }
|
||||
.trip-actual { font-size: 1.25rem; font-weight: 600; font-family: var(--mono); color: var(--green); letter-spacing: -0.02em; }
|
||||
.trip-est { font-size: 12px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
|
||||
.chev { color: var(--muted); font-size: 20px; margin-left: 4px; }
|
||||
|
||||
.empty-state { padding: 3rem 2rem; text-align: center; color: var(--muted); font-size: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page">
|
||||
|
||||
<header>
|
||||
<div>
|
||||
<h1>Citti <span>Historik</span></h1>
|
||||
<div style="font-size:12px;color:var(--muted);margin-top:4px">Gemte indkøbsture</div>
|
||||
</div>
|
||||
<a href="/" class="btn-back">← Indkøbsseddel</a>
|
||||
</header>
|
||||
|
||||
{% if trips %}
|
||||
<div class="trip-list">
|
||||
{% for t in trips %}
|
||||
<a href="/historik/{{ t.id }}" class="trip-card">
|
||||
<div>
|
||||
<div class="trip-label">{{ t.label }}</div>
|
||||
<div class="trip-meta">{{ t.item_count }} varer</div>
|
||||
</div>
|
||||
<div style="display:flex;align-items:center">
|
||||
<div class="trip-totals">
|
||||
{% if t.total_actual %}
|
||||
<div class="trip-actual">{{ "{:,.0f}".format(t.total_actual).replace(",",".") }} kr.</div>
|
||||
{% else %}
|
||||
<div class="trip-actual" style="color:var(--muted)">—</div>
|
||||
{% endif %}
|
||||
<div class="trip-est">est. {{ "{:,.0f}".format(t.total_est or 0).replace(",",".") }} kr.</div>
|
||||
</div>
|
||||
<span class="chev">›</span>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="empty-state">Ingen gemte ture endnu. Tryk "🗂 Arkivér & ny liste" på indkøbssedlen for at gemme en tur her.</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user