feat(invoice): add send route

This commit is contained in:
2025-08-26 20:30:48 +02:00
parent 958979c62b
commit 788571162d
35 changed files with 451 additions and 193 deletions

View File

@@ -0,0 +1,42 @@
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
//go:embed assets/style.css
var style template.CSS
type tmpler struct {
Invoice
Cross template.HTML
Scissors template.HTML
}
func (i Invoice) CSS() template.CSS {
return style
}
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
}