feat(go): M6.6.1 — QR payment popup modal on /adults and /juniors
All checks were successful
Deploy to K8s / deploy (push) Successful in 9s

Replace bare <a href=/qr> Pay buttons with <button data-*> elements that
open an in-page #qrModal (matching Python's showPayQR UX), driven by a
new payment-qr.js vanilla-JS IIFE module.  Remove the now-dead qrHref /
qrHrefAll template helpers from render.go.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-08 14:49:35 +02:00
parent fe935235e8
commit 919845518c
7 changed files with 501 additions and 38 deletions

View File

@@ -6,8 +6,6 @@ import (
"html/template"
"log/slog"
"net/http"
"net/url"
"strconv"
)
// PageData is the view model passed to every HTML template.
@@ -58,36 +56,7 @@ type Renderer struct {
var pageNames = []string{"adults", "juniors", "payments", "sync", "flush_cache"}
// qrHref builds the /qr query URL for a single-month Pay button.
// rawMonth is "YYYY-MM"; it is converted to "MM/YYYY" in the QR message.
func qrHref(account string, amount int, name, rawMonth string) string {
// Convert "YYYY-MM" → "MM/YYYY" to match Python's showPayQR JS.
if len(rawMonth) == 7 && rawMonth[4] == '-' {
rawMonth = rawMonth[5:] + "/" + rawMonth[:4]
}
msg := name + ": " + rawMonth
return "/qr?" + url.Values{
"account": {account},
"amount": {strconv.Itoa(amount)},
"message": {msg},
}.Encode()
}
// qrHrefAll builds the /qr query URL for a Pay-All button.
// rawPeriods is the "+" -joined MM/YYYY string from MemberRow.RawUnpaidPeriods.
func qrHrefAll(account string, amount int, name, rawPeriods string) string {
msg := name + ": " + rawPeriods
return "/qr?" + url.Values{
"account": {account},
"amount": {strconv.Itoa(amount)},
"message": {msg},
}.Encode()
}
var tmplFuncs = template.FuncMap{
"qrHref": qrHref,
"qrHrefAll": qrHrefAll,
}
var tmplFuncs = template.FuncMap{}
// NewRenderer parses all templates from the embedded FS.
// A parse failure should be treated as a startup-time fatal error.