worktree-citti-arkiver-tur #10
@@ -40,6 +40,10 @@
|
|||||||
.offer { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 0.55rem 1rem; border-bottom: 1px solid var(--border); }
|
.offer { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 0.55rem 1rem; border-bottom: 1px solid var(--border); }
|
||||||
.offer:last-child { border-bottom: none; }
|
.offer:last-child { border-bottom: none; }
|
||||||
.offer.picked { background: var(--green-light); }
|
.offer.picked { background: var(--green-light); }
|
||||||
|
.offer.picked { box-shadow: inset 3px 0 0 var(--green); }
|
||||||
|
.on-list { display: none; font-size: 10px; font-weight: 700; color: #fff; background: var(--green); border-radius: 4px; padding: 1px 6px; vertical-align: middle; white-space: nowrap; }
|
||||||
|
.offer.picked .on-list { display: inline-block; }
|
||||||
|
.btn.only-picked.active { background: var(--green); color: #fff; border-color: var(--green); }
|
||||||
.offer input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; }
|
.offer input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; }
|
||||||
.o-name { font-size: 14px; }
|
.o-name { font-size: 14px; }
|
||||||
.o-de { font-size: 10px; color: #b0aba3; font-style: italic; margin-top: 1px; }
|
.o-de { font-size: 10px; color: #b0aba3; font-style: italic; margin-top: 1px; }
|
||||||
@@ -78,6 +82,7 @@
|
|||||||
|
|
||||||
<div class="toolbar">
|
<div class="toolbar">
|
||||||
<input class="search" id="search" type="search" placeholder="Søg i tilbud (tysk navn)…" oninput="filterOffers()">
|
<input class="search" id="search" type="search" placeholder="Søg i tilbud (tysk navn)…" oninput="filterOffers()">
|
||||||
|
<button class="btn only-picked" id="only-picked-btn" onclick="toggleOnlyPicked()">✓ Kun valgte</button>
|
||||||
<span class="pick-count" id="pick-count">{{ picked_count }} på seddel</span>
|
<span class="pick-count" id="pick-count">{{ picked_count }} på seddel</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -95,7 +100,7 @@
|
|||||||
<label class="offer{% if o.picked %} picked{% endif %}" data-name="{{ o.heading|lower }}">
|
<label class="offer{% if o.picked %} picked{% endif %}" data-name="{{ o.heading|lower }}">
|
||||||
<input type="checkbox" {% if o.picked %}checked{% endif %} onchange="togglePick(this, '{{ o.id }}')">
|
<input type="checkbox" {% if o.picked %}checked{% endif %} onchange="togglePick(this, '{{ o.id }}')">
|
||||||
<div>
|
<div>
|
||||||
<div class="o-name">{{ o.heading_da or o.heading }}</div>
|
<div class="o-name">{{ o.heading_da or o.heading }} <span class="on-list">✓ på seddel</span></div>
|
||||||
{% if o.heading_da and o.heading_da != o.heading %}<div class="o-de">🇩🇪 {{ o.heading }}</div>{% endif %}
|
{% if o.heading_da and o.heading_da != o.heading %}<div class="o-de">🇩🇪 {{ o.heading }}</div>{% endif %}
|
||||||
<div class="o-meta">
|
<div class="o-meta">
|
||||||
{% if o.page %}s. {{ o.page }}{% endif %}
|
{% if o.page %}s. {{ o.page }}{% endif %}
|
||||||
@@ -138,6 +143,7 @@ async function togglePick(cb, id) {
|
|||||||
cb.closest('.offer').classList.toggle('picked', picked);
|
cb.closest('.offer').classList.toggle('picked', picked);
|
||||||
pickCount += picked ? 1 : -1;
|
pickCount += picked ? 1 : -1;
|
||||||
updatePick();
|
updatePick();
|
||||||
|
if (onlyPicked) filterOffers(); // keep the "only selected" view in sync
|
||||||
try {
|
try {
|
||||||
await (window.cittiFetch || fetch)('/api/offers/pick', {
|
await (window.cittiFetch || fetch)('/api/offers/pick', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -152,12 +158,20 @@ async function togglePick(cb, id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let onlyPicked = false;
|
||||||
|
function toggleOnlyPicked() {
|
||||||
|
onlyPicked = !onlyPicked;
|
||||||
|
document.getElementById('only-picked-btn').classList.toggle('active', onlyPicked);
|
||||||
|
filterOffers();
|
||||||
|
}
|
||||||
|
|
||||||
function filterOffers() {
|
function filterOffers() {
|
||||||
const q = document.getElementById('search').value.trim().toLowerCase();
|
const q = document.getElementById('search').value.trim().toLowerCase();
|
||||||
document.querySelectorAll('[data-cat]').forEach(cat => {
|
document.querySelectorAll('[data-cat]').forEach(cat => {
|
||||||
let any = false;
|
let any = false;
|
||||||
cat.querySelectorAll('.offer').forEach(o => {
|
cat.querySelectorAll('.offer').forEach(o => {
|
||||||
const match = !q || o.dataset.name.includes(q);
|
const match = (!q || o.dataset.name.includes(q))
|
||||||
|
&& (!onlyPicked || o.classList.contains('picked'));
|
||||||
o.classList.toggle('hidden', !match);
|
o.classList.toggle('hidden', !match);
|
||||||
if (match) any = true;
|
if (match) any = true;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user