From 7330e296e44970863a5c93dc34dbb83e4532de89 Mon Sep 17 00:00:00 2001 From: dreamer Date: Tue, 13 Oct 2026 18:29:02 +0200 Subject: [PATCH] add sold-out badge and show final tickets when close to the start time --- fdhview/static/info.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fdhview/static/info.js b/fdhview/static/info.js index 15b2a35..e818c4f 100644 --- a/fdhview/static/info.js +++ b/fdhview/static/info.js @@ -15,6 +15,15 @@ function kijkwijzerIcons(codes) { function renderFilms(films) { document.getElementById("films").innerHTML = films.map(f => { const isBoutique = f.screen === "6"; + const ratio = f.seats_sold / f.seats_total; + const start = new Date(f.start); // "2026-10-13T18:00:00" parses as local time + const minsUntil = (start - new Date()) / 60000; + const badge = ratio >= 1 + ? '
Uitverkocht
' + : ratio > 0.85 || minsUntil <= 15 && minsUntil > 0 + ? '
Laatste kaarten
' + : "
"; + return `
${hhmm(f.start)}
${hhmm(f.end)}
@@ -28,7 +37,7 @@ function renderFilms(films) { ${f.en_subs ? "EN subs" : ""}
- ${f.seats_sold / f.seats_total > 0.85 ? '
Laatste kaarten
' : "
"} + ${badge} `; }).join(""); }