diff --git a/go/internal/cmc/pdf/invoice_builder.go b/go/internal/cmc/pdf/invoice_builder.go index c0ca026b..cdea972f 100644 --- a/go/internal/cmc/pdf/invoice_builder.go +++ b/go/internal/cmc/pdf/invoice_builder.go @@ -108,18 +108,27 @@ func (g *HTMLDocumentGenerator) BuildInvoiceHTML(data *InvoicePDFData, totalPage } // Parse and execute template - // Try multiple possible paths to find the template - possiblePaths := []string{ - filepath.Join("internal", "cmc", "pdf", "templates", "invoice.html"), - filepath.Join("go", "internal", "cmc", "pdf", "templates", "invoice.html"), - "/app/go/internal/cmc/pdf/templates/invoice.html", + // Try multiple possible path sets to find the invoice and shared header templates together + possiblePathSets := [][]string{ + { + filepath.Join("internal", "cmc", "pdf", "templates", "invoice.html"), + filepath.Join("internal", "cmc", "pdf", "templates", "header.html"), + }, + { + filepath.Join("go", "internal", "cmc", "pdf", "templates", "invoice.html"), + filepath.Join("go", "internal", "cmc", "pdf", "templates", "header.html"), + }, + { + "/app/go/internal/cmc/pdf/templates/invoice.html", + "/app/go/internal/cmc/pdf/templates/header.html", + }, } var tmpl *template.Template var err error - for _, tmplPath := range possiblePaths { - tmpl, err = template.New("invoice.html").Funcs(funcMap).ParseFiles(tmplPath) + for _, pathSet := range possiblePathSets { + tmpl, err = template.New("invoice.html").Funcs(funcMap).ParseFiles(pathSet...) if err == nil { break } diff --git a/go/internal/cmc/pdf/quote_builder.go b/go/internal/cmc/pdf/quote_builder.go index 0a17137d..2c1904e2 100644 --- a/go/internal/cmc/pdf/quote_builder.go +++ b/go/internal/cmc/pdf/quote_builder.go @@ -158,18 +158,27 @@ func (g *HTMLDocumentGenerator) BuildQuoteHTML(data *QuotePDFData, totalPages in } // Parse and execute template - // Try multiple possible paths to find the template - possiblePaths := []string{ - filepath.Join("internal", "cmc", "pdf", "templates", "quote.html"), - filepath.Join("go", "internal", "cmc", "pdf", "templates", "quote.html"), - "/app/go/internal/cmc/pdf/templates/quote.html", + // Try multiple possible path sets to find the quote and shared header templates together + possiblePathSets := [][]string{ + { + filepath.Join("internal", "cmc", "pdf", "templates", "quote.html"), + filepath.Join("internal", "cmc", "pdf", "templates", "header.html"), + }, + { + filepath.Join("go", "internal", "cmc", "pdf", "templates", "quote.html"), + filepath.Join("go", "internal", "cmc", "pdf", "templates", "header.html"), + }, + { + "/app/go/internal/cmc/pdf/templates/quote.html", + "/app/go/internal/cmc/pdf/templates/header.html", + }, } var tmpl *template.Template var err error - for _, tmplPath := range possiblePaths { - tmpl, err = template.New("quote.html").Funcs(funcMap).ParseFiles(tmplPath) + for _, pathSet := range possiblePathSets { + tmpl, err = template.New("quote.html").Funcs(funcMap).ParseFiles(pathSet...) if err == nil { break } diff --git a/go/internal/cmc/pdf/templates/header.html b/go/internal/cmc/pdf/templates/header.html new file mode 100644 index 00000000..9425b328 --- /dev/null +++ b/go/internal/cmc/pdf/templates/header.html @@ -0,0 +1,26 @@ +{{define "CompanyHeader"}} + +
PTY LIMITED ACN: 085 991 224 ABN: 47 085 991 224
+PTY LIMITED ACN: 085 991 224 ABN: 47 085 991 224
-PTY LIMITED ACN: 085 991 224 ABN: 47 085 991 224
-