Files
accounting/pkg/invoice/report/qrbill/html.go
schreifuchs 9a5ea229bf
All checks were successful
Go / build (push) Successful in 14s
feat/user-templates (#9)
feat: user templates
2025-12-03 21:27:46 +01:00

36 lines
591 B
Go

package qrbill
import (
"bytes"
"html/template"
_ "embed"
)
//go:embed assets/ch-cross.svg
var chCross template.HTML
//go:embed assets/scissors.svg
var scissors template.HTML
//go:embed assets/template.html
var htmlTemplate string
type tmpler struct {
Invoice
Cross template.HTML
Scissors template.HTML
}
func (i Invoice) HTML() (html template.HTML, err error) {
tmpl := template.Must(template.New("invoice").Parse(htmlTemplate))
data := tmpler{i, chCross, scissors}
buf := new(bytes.Buffer)
err = tmpl.Execute(buf, data)
html = template.HTML(buf.String())
return
}