nidus-sync/htmlpage/public-reports/page.go
Eli Ribble b35c9496b6
Add the ability to register for updates on quick reports
At this point it also appears that I'm correctly capturing the GPS
location as both PostGIS data and as an H3 cell.
2026-01-08 15:34:48 +00:00

50 lines
1.4 KiB
Go

package publicreports
import (
"embed"
"fmt"
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
)
//go:embed template/*
var embeddedFiles embed.FS
//go:embed static/*
var EmbeddedStaticFS embed.FS
type ContextNuisance struct{}
type ContextPool struct{}
type ContextQuick struct{}
type ContextQuickSubmitComplete struct {
ReportID string
}
type ContextRegisterNotificationsComplete struct {
ReportID string
}
type ContextRoot struct{}
type ContextStatus struct{}
var (
Nuisance = buildTemplate("nuisance", "base")
Pool = buildTemplate("pool", "base")
Quick = buildTemplate("quick", "base")
QuickSubmitComplete = buildTemplate("quick-submit-complete", "base")
RegisterNotificationsComplete = buildTemplate("register-notifications-complete", "base")
Root = buildTemplate("root", "base")
Status = buildTemplate("status", "base")
)
var components = [...]string{"footer"}
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
subdir := "htmlpage/public-reports"
full_files := make([]string, 0)
for _, f := range files {
full_files = append(full_files, fmt.Sprintf("%s/template/%s.html", subdir, f))
}
for _, c := range components {
full_files = append(full_files, fmt.Sprintf("%s/template/component/%s.html", subdir, c))
}
return htmlpage.NewBuiltTemplate(embeddedFiles, "htmlpage/public-reports/", full_files...)
}