All checks were successful
Deploy to K8s / deploy (push) Successful in 8s
- Extract AssembleAdults(ctx) from ServeAdults so HTML and JSON API share one reconcile path. - HTMLHandler gains *api.Handler; ServeAdults loads real data and renders adults.tmpl. - AdultsPageData view model + qrHref/qrHrefAll funcMap (URL-encode /qr params, YYYY-MM→MM/YYYY). - adults.tmpl: full reconcile table, per-cell status classes + cell-unpaid-current, Pay button hrefs, totals row, credits/debts/unmatched sections, filter controls, sheet links. - static/js/filters.js: NFD-normalize name filter + month-range column hiding; future months hidden by default. - TestAdultsPage asserts member name and cell text against fixture data. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
package web
|
|
|
|
import (
|
|
"fuj-management/go/internal/web/api"
|
|
"net/http"
|
|
)
|
|
|
|
// HTMLHandler serves the Go-native HTML frontend.
|
|
type HTMLHandler struct {
|
|
renderer *Renderer
|
|
build BuildInfo
|
|
apiHandler *api.Handler
|
|
}
|
|
|
|
// NewHTMLHandler constructs an HTMLHandler.
|
|
func NewHTMLHandler(r *Renderer, b BuildInfo, ah *api.Handler) *HTMLHandler {
|
|
return &HTMLHandler{renderer: r, build: b, apiHandler: ah}
|
|
}
|
|
|
|
func (h *HTMLHandler) ServeAdults(w http.ResponseWriter, r *http.Request) {
|
|
data, err := h.apiHandler.AssembleAdults(r.Context())
|
|
if err != nil {
|
|
h.renderer.Render(w, "adults", AdultsPageData{
|
|
PageData: PageData{Active: "adults", Build: h.build},
|
|
Error: err.Error(),
|
|
})
|
|
return
|
|
}
|
|
h.renderer.Render(w, "adults", AdultsPageData{
|
|
PageData: PageData{Active: "adults", Build: h.build},
|
|
Data: data,
|
|
})
|
|
}
|
|
|
|
func (h *HTMLHandler) ServeJuniors(w http.ResponseWriter, r *http.Request) {
|
|
h.renderer.Render(w, "juniors", PageData{Active: "juniors", Build: h.build})
|
|
}
|
|
|
|
func (h *HTMLHandler) ServePayments(w http.ResponseWriter, r *http.Request) {
|
|
h.renderer.Render(w, "payments", PageData{Active: "payments", Build: h.build})
|
|
}
|
|
|
|
func (h *HTMLHandler) ServeSync(w http.ResponseWriter, r *http.Request) {
|
|
h.renderer.Render(w, "sync", PageData{Active: "sync", Build: h.build})
|
|
}
|
|
|
|
func (h *HTMLHandler) ServeFlushCache(w http.ResponseWriter, r *http.Request) {
|
|
h.renderer.Render(w, "flush_cache", PageData{Active: "flush", Build: h.build})
|
|
}
|