2026-01-08 16:05:50 +00:00
|
|
|
package publicreport
|
2026-01-07 18:36:20 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"embed"
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"github.com/Gleipnir-Technology/nidus-sync/htmlpage"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
//go:embed template/*
|
|
|
|
|
var embeddedFiles embed.FS
|
|
|
|
|
|
2026-01-07 20:47:55 +00:00
|
|
|
//go:embed static/*
|
|
|
|
|
var EmbeddedStaticFS embed.FS
|
|
|
|
|
|
2026-01-08 15:34:48 +00:00
|
|
|
type ContextRegisterNotificationsComplete struct {
|
|
|
|
|
ReportID string
|
|
|
|
|
}
|
2026-01-07 21:47:33 +00:00
|
|
|
type ContextRoot struct{}
|
2026-01-07 18:36:20 +00:00
|
|
|
|
|
|
|
|
var (
|
2026-01-08 15:34:48 +00:00
|
|
|
RegisterNotificationsComplete = buildTemplate("register-notifications-complete", "base")
|
|
|
|
|
Root = buildTemplate("root", "base")
|
2026-01-07 18:36:20 +00:00
|
|
|
)
|
|
|
|
|
|
2026-01-09 19:43:19 +00:00
|
|
|
var components = [...]string{"footer", "location-geocode", "location-geocode-header", "photo-upload", "photo-upload-header"}
|
2026-01-07 18:36:20 +00:00
|
|
|
|
|
|
|
|
func buildTemplate(files ...string) *htmlpage.BuiltTemplate {
|
2026-01-08 16:05:50 +00:00
|
|
|
subdir := "public-report"
|
2026-01-07 18:36:20 +00:00
|
|
|
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 {
|
2026-01-07 21:47:33 +00:00
|
|
|
full_files = append(full_files, fmt.Sprintf("%s/template/component/%s.html", subdir, c))
|
2026-01-07 18:36:20 +00:00
|
|
|
}
|
2026-01-08 16:05:50 +00:00
|
|
|
return htmlpage.NewBuiltTemplate(embeddedFiles, "public-report/", full_files...)
|
2026-01-07 18:36:20 +00:00
|
|
|
}
|