feat: custom template
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/report"
|
||||
)
|
||||
|
||||
func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate float64, repos []Repo, config *Options) (document io.ReadCloser, r *report.Report, err error) {
|
||||
func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate float64, repos []Repo, config *Options) (document io.ReadCloser, r report.Report, err error) {
|
||||
if config == nil {
|
||||
config = &DefaultOptions
|
||||
}
|
||||
@@ -26,7 +26,7 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
return nil, r, err
|
||||
}
|
||||
|
||||
is = append(is, iss...)
|
||||
@@ -40,6 +40,10 @@ func (s *Service) Generate(creditor model.Entity, deptor *model.Entity, rate flo
|
||||
deptor,
|
||||
rate,
|
||||
)
|
||||
|
||||
if len(config.CustomTemplate) > 1 {
|
||||
r = r.WithTemplate(config.CustomTemplate)
|
||||
}
|
||||
html, err := r.ToHTML()
|
||||
if err != nil {
|
||||
return document, r, err
|
||||
|
||||
Reference in New Issue
Block a user