worktree-citti-arkiver-tur #8

Merged
hjess merged 3 commits from worktree-citti-arkiver-tur into main 2026-10-30 12:53:39 +01:00
Showing only changes of commit a5279bb01d - Show all commits

View File

@@ -117,14 +117,27 @@
{% endfor %}
</div>
<a class="golist" id="golist" href="/"
style="display:none;position:fixed;right:14px;bottom:14px;z-index:9999;padding:11px 18px;border-radius:24px;background:#2d6a4f;color:#fff;text-decoration:none;font:600 14px/1 var(--sans);box-shadow:0 3px 12px rgba(0,0,0,.28)">🛒 <b id="golist-n">0</b> valgt · Gå til seddel →</a>
<script>
let pickCount = {{ picked_count }};
// Picking is instant — a tick adds the offer to the shopping list right away
// (it shows in the "Lübeck-tilbud" section there). This just mirrors the count
// and the "go to list" button.
function updatePick() {
document.getElementById('pick-count').textContent = pickCount + ' på seddel';
document.getElementById('golist-n').textContent = pickCount;
document.getElementById('golist').style.display = pickCount > 0 ? 'block' : 'none';
}
async function togglePick(cb, id) {
const picked = cb.checked;
cb.closest('.offer').classList.toggle('picked', picked);
pickCount += picked ? 1 : -1;
document.getElementById('pick-count').textContent = pickCount + ' på seddel';
updatePick();
try {
await (window.cittiFetch || fetch)('/api/offers/pick', {
method: 'POST',
@@ -135,7 +148,7 @@ async function togglePick(cb, id) {
cb.checked = !picked;
cb.closest('.offer').classList.toggle('picked', !picked);
pickCount += picked ? -1 : 1;
document.getElementById('pick-count').textContent = pickCount + ' på seddel';
updatePick();
}
}
@@ -166,6 +179,8 @@ async function refreshOffers() {
btn.textContent = '⟳ Opdater'; btn.disabled = false;
}
}
updatePick();
</script>
</body>
</html>