diff --git a/assets/styles/invoice.css b/assets/styles/invoice.css index e1bacf2..c5c288b 100644 --- a/assets/styles/invoice.css +++ b/assets/styles/invoice.css @@ -1,115 +1,140 @@ header { - width: 100%; - display: flex; - flex-flow: row wrap; - border-bottom: 0.5px solid #E5E7EB; -} -header div.details { - flex: 1; - border-right: 0.5px solid #E5E7EB; -} -header div.contacts { - flex: 1; - /*display: flex; - flex-flow: column wrap;*/ + width: 100%; + display: flex; + flex-flow: row wrap; + border-bottom: 0.5px solid #e5e7eb; +} +header.regular div.details { + flex: 1; + border-right: 0.5px solid #e5e7eb; +} +header.regular > div.contacts { + flex: 1; +} +header.regular section.supplier { + padding: 6mm; + padding-top: 0mm; +} +header.regular section.customer { + padding: 6mm; + border-top: 0.5px solid #e5e7eb; +} +header.with-qr > section.qr { + display: flex; + justify-content: center; + align-items: center; + flex-basis: 50%; + padding-bottom: 24px; +} +header.with-qr > div.details { + flex-basis: 50%; + box-sizing: border-box; + border-right: 0.5px solid #e5e7eb; +} +header.with-qr div.contacts { + flex-basis: 100%; + display: flex; + border-top: 0.5px solid #e5e7eb; +} +header.with-qr section.supplier { + padding-top: 6mm; + padding-bottom: 6mm; +} +header.with-qr section.customer { + padding-left: 6mm; + padding-top: 6mm; + padding-bottom: 6mm; } section { - padding: 0mm; - /* width: 100%; */ - flex: 100%; + padding: 0mm; + /* width: 100%; */ + flex: 100%; } section.title { - padding-top: 0mm; - padding-bottom: 6mm; + padding-top: 0mm; + padding-bottom: 6mm; } section.title .hero { - margin-bottom: 6mm; + margin-bottom: 6mm; } section.title .alias { - font-size: 16pt; - font-weight: bold; - color: #030712; + font-size: 16pt; + font-weight: bold; + color: #030712; } section.title .hero img { - max-width: 100%; - /* max-height: 10mm; */ + max-width: 100%; + /* max-height: 10mm; */ } section.title span.paid { - font-size: 9pt; - font-weight: 400; - vertical-align: text-bottom; - padding: 0.5mm 1.5mm; - border-radius: 1mm; - background-color: #0290621A; - border: 1px solid #02906233; - color: #008852; - margin-left: 2mm; - text-wrap: nowrap; + font-size: 9pt; + font-weight: 400; + vertical-align: text-bottom; + padding: 0.5mm 1.5mm; + border-radius: 1mm; + background-color: #0290621a; + border: 1px solid #02906233; + color: #008852; + margin-left: 2mm; + text-wrap: nowrap; } section.title h2.code { - font-size: 12pt; - color: #030712; - font-weight: 600; + font-size: 12pt; + color: #030712; + font-weight: 600; } section.summary { - padding-right: 6mm; - padding-top: 0mm; - padding-bottom: 0mm; + padding-right: 6mm; + padding-top: 0mm; + padding-bottom: 0mm; } section.summary h2.title { - display: none; + display: none; } section.summary ul { - list-style-type: none; - margin: 0; - padding: 0; - display: flex; - flex-flow: row wrap; + list-style-type: none; + margin: 0; + padding: 0; + display: flex; + flex-flow: row wrap; } section.summary li { - margin-bottom: 6mm; - flex: 50%; + margin-bottom: 6mm; + flex: 50%; } section.summary span.label { - display: block; - font-weight: 500; + display: block; + font-weight: 500; } section.summary span.value { - display: block; - color: #030712; -} -section.supplier { - padding: 6mm; - padding-top: 0mm; -} -section.customer { - padding: 6mm; - border-top: 0.5px solid #E5E7EB; + display: block; + color: #030712; } section.lines { - order: 5; - padding-top: 6mm; - padding-bottom: 0mm; + order: 5; + padding-top: 6mm; + padding-bottom: 0mm; } section.lines h2 { - display: none; + display: none; } section.lines table { - width: 100%; + width: 100%; } -section.lines th, section.lines td { - text-align: left; - border-bottom: 0.5px solid #E5E7EB; - padding: 1.5mm 2mm; - margin: 0px; +section.lines th, +section.lines td { + text-align: left; + border-bottom: 0.5px solid #e5e7eb; + padding: 1.5mm 2mm; + margin: 0px; } section.lines th { - font-weight: 600; - background-color: #F3F4F6; + font-weight: 600; + background-color: #f3f4f6; } section.lines .i, section.lines .ref { - width: fit-content; + width: fit-content; } section.lines .price, section.lines .quantity, @@ -117,173 +142,175 @@ section.lines .tax, section.lines .discount, section.lines .charge, section.lines .total { - text-align: right; - width: fit-content; - white-space: nowrap; + text-align: right; + width: fit-content; + white-space: nowrap; } section.lines .description, section.lines .reason { - white-space: wrap; + white-space: wrap; } section.lines .label { - font-weight: 500; + font-weight: 500; } section.lines .description .extensions { - display: block; + display: block; } section.lines .description .extensions .label { - font-weight: 500; + font-weight: 500; } section.lines .alt-price { - display: block; - font-style: italic; + display: block; + font-style: italic; } section.lines .alt-price:before { - content: '('; + content: "("; } section.lines .alt-price:after { - content: ')'; + content: ")"; } div.totals { - order: 8; - display: flex; - flex-wrap: row; - width: 100%; - padding-top: 6mm; - border-bottom: 0.5px solid #E5E7EB; - padding-bottom: 4mm; -} -div.totals td, div.totals th { - padding: 1.5mm 2mm; + order: 8; + display: flex; + flex-wrap: row; + width: 100%; + padding-top: 6mm; + border-bottom: 0.5px solid #e5e7eb; + padding-bottom: 4mm; +} +div.totals td, +div.totals th { + padding: 1.5mm 2mm; } section.totals { - order: 2; - flex: 1; + order: 2; + flex: 1; } section.totals h2 { - display: none; + display: none; } section.totals table { - padding-right: 1cm; - padding-left: 1cm; - width: auto; - margin-right: 0; - margin-left: auto; + padding-right: 1cm; + padding-left: 1cm; + width: auto; + margin-right: 0; + margin-left: auto; } section.totals th { - text-align: right; - border-bottom: 0.5px solid #E5E7EB; - font-weight: normal; + text-align: right; + border-bottom: 0.5px solid #e5e7eb; + font-weight: normal; } section.totals td { - text-align: right; - border-bottom: 0.5px solid #E5E7EB; + text-align: right; + border-bottom: 0.5px solid #e5e7eb; } section.totals tr:last-child th, section.totals tr:last-child td { - border-bottom: 0; + border-bottom: 0; } section.totals tr.strong th, section.totals tr.strong td { - font-weight: 600; + font-weight: 600; } section.totals .exchange-rate { - font-style: italic; + font-style: italic; } section.taxes { - order: 1; - flex: 1; + order: 1; + flex: 1; } section.taxes h2 { - display: none; + display: none; } section.taxes table { - padding-right: 1cm; - padding-left: 1cm; - margin-left: 0; - width: 90%; + padding-right: 1cm; + padding-left: 1cm; + margin-left: 0; + width: 90%; } -section.taxes th, section.taxes td { - text-align: right; - padding: 1.5mm 2mm; +section.taxes th, +section.taxes td { + text-align: right; + padding: 1.5mm 2mm; } section.taxes th { - background-color: #F3F4F6; - font-weight: 600; + background-color: #f3f4f6; + font-weight: 600; } section.taxes td { - border-bottom: 0.5px solid #E5E7EB; + border-bottom: 0.5px solid #e5e7eb; } section.taxes tr:last-child td { - border-bottom: 0; + border-bottom: 0; } section.taxes th.category, section.taxes td.category { - text-align: left; + text-align: left; } section.payment { - border-bottom: 0.5px solid #E5E7EB; - padding: 6mm 0mm; - order: 10; - display: flex; - flex-flow: row; - break-inside: avoid; + border-bottom: 0.5px solid #e5e7eb; + padding: 6mm 0mm; + order: 10; + display: flex; + flex-flow: row; + break-inside: avoid; } section.payment h2.title { - display: none; + display: none; } section.payment ul { - list-style-type: none; - margin: 0; - padding: 0; + list-style-type: none; + margin: 0; + padding: 0; } section.payment ul.instructions { - margin-right: 6mm; + margin-right: 6mm; } section.payment li { - margin-bottom: 3mm; + margin-bottom: 3mm; } section.payment li:last-child { - margin-bottom: 0; + margin-bottom: 0; } section.payment span.label { - display: block; - font-weight: 500; + display: block; + font-weight: 500; } section.payment span.value { - display: block; + display: block; } section.payment table td { - padding-right: 3mm; + padding-right: 3mm; } section.payment .due-dates span.percent:before { - content: "(" + content: "("; } section.payment .due-dates span.percent:after { - content: ")" + content: ")"; } section.notes { - padding-top: 6mm; - padding-bottom: 6mm; - border-bottom: 0.5px solid #E5E7EB; - break-inside: avoid; + padding-top: 6mm; + padding-bottom: 6mm; + border-bottom: 0.5px solid #e5e7eb; + break-inside: avoid; } section.notes .note { - margin-bottom: 0mm; + margin-bottom: 0mm; } .extensions section { - break-inside: avoid; - padding-top: 6mm; - padding-bottom: 6mm; - border-bottom: 0.5px solid #E5E7EB; + break-inside: avoid; + padding-top: 6mm; + padding-bottom: 6mm; + border-bottom: 0.5px solid #e5e7eb; } .extensions:empty { - display: none; + display: none; } .org-party .name { - font-weight: 600; - font-size: 12pt; - line-height: 20pt; - color: #030712; -} \ No newline at end of file + font-weight: 600; + font-size: 12pt; + line-height: 20pt; + color: #030712; +} diff --git a/components/bill/invoice/customer_templ.go b/components/bill/invoice/customer_templ.go index cb3ab17..9e4d6c9 100644 --- a/components/bill/invoice/customer_templ.go +++ b/components/bill/invoice/customer_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -17,9 +17,6 @@ import ( func customer(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -70,5 +67,3 @@ func customer(inv *bill.Invoice) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/invoice.templ b/components/bill/invoice/invoice.templ index 1a06651..5afbf8d 100644 --- a/components/bill/invoice/invoice.templ +++ b/components/bill/invoice/invoice.templ @@ -23,11 +23,14 @@ import ( templ Invoice(env *gobl.Envelope, inv *bill.Invoice) { // Footer needs to be at the top to show on all pages
-
+
@title(inv) @summary(inv)
+ // Spanish QRs + @es.VerifactuQR(env) + @es.TicketBAIQR(env)
@supplier(inv) if inv.Customer != nil { @@ -44,7 +47,6 @@ templ Invoice(env *gobl.Envelope, inv *bill.Invoice) { @notes(inv)
// Region specific information - @es.TicketBAIQR(env) @co.DIANQR(env, inv) @mx.CFDI(env, inv) @pl.KSeFQR(env) @@ -120,3 +122,15 @@ func code(series, code cbc.Code) string { } return fmt.Sprintf("%s-%s", series, code) } + +func hasHeaderQR(env *gobl.Envelope) bool { + return es.HasVerifactuQR(env) || es.HasTicketBAIQR(env) +} + +func headerClass(env *gobl.Envelope) string { + if hasHeaderQR(env) { + return "with-qr" + } + + return "regular" +} diff --git a/components/bill/invoice/invoice_templ.go b/components/bill/invoice/invoice_templ.go index 9172a68..01851b0 100644 --- a/components/bill/invoice/invoice_templ.go +++ b/components/bill/invoice/invoice_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -31,9 +31,6 @@ import ( func Invoice(env *gobl.Envelope, inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -49,7 +46,29 @@ func Invoice(env *gobl.Envelope, inv *bill.Invoice) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var2 = []any{headerClass(env)} + templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -61,7 +80,19 @@ func Invoice(env *gobl.Envelope, inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = es.VerifactuQR(env).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = es.TicketBAIQR(env).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -111,10 +142,6 @@ func Invoice(env *gobl.Envelope, inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = es.TicketBAIQR(env).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } templ_7745c5c3_Err = co.DIANQR(env, inv).Render(ctx, templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -146,9 +173,6 @@ func Invoice(env *gobl.Envelope, inv *bill.Invoice) templ.Component { func title(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -159,12 +183,12 @@ func title(inv *bill.Invoice) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Var2 := templ.GetChildren(ctx) - if templ_7745c5c3_Var2 == nil { - templ_7745c5c3_Var2 = templ.NopComponent + templ_7745c5c3_Var4 := templ.GetChildren(ctx) + if templ_7745c5c3_Var4 == nil { + templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_Var5 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { @@ -185,12 +209,12 @@ func title(inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var4 string - templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(img.URL) + var templ_7745c5c3_Var6 string + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(img.URL) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 62, Col: 23} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 64, Col: 23} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -198,12 +222,12 @@ func title(inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var5 string - templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(img.Label) + var templ_7745c5c3_Var7 string + templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(img.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 62, Col: 41} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 64, Col: 41} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -211,12 +235,12 @@ func title(inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(logoHeight(img)) + var templ_7745c5c3_Var8 string + templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(logoHeight(img)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 62, Col: 68} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 64, Col: 68} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -229,12 +253,12 @@ func title(inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var7 string - templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(supplierAlias(inv)) + var templ_7745c5c3_Var9 string + templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(supplierAlias(inv)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 65, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 67, Col: 26} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -255,12 +279,12 @@ func title(inv *bill.Invoice) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - var templ_7745c5c3_Var8 string - templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(code(inv.Series, inv.Code)) + var templ_7745c5c3_Var10 string + templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(code(inv.Series, inv.Code)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 73, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/invoice.templ`, Line: 75, Col: 32} } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -288,7 +312,7 @@ func title(inv *bill.Invoice) templ.Component { } return templ_7745c5c3_Err }) - templ_7745c5c3_Err = t.Scope("billing.invoice.title").Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer) + templ_7745c5c3_Err = t.Scope("billing.invoice.title").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -336,4 +360,14 @@ func code(series, code cbc.Code) string { return fmt.Sprintf("%s-%s", series, code) } -var _ = templruntime.GeneratedTemplate +func hasHeaderQR(env *gobl.Envelope) bool { + return es.HasVerifactuQR(env) || es.HasTicketBAIQR(env) +} + +func headerClass(env *gobl.Envelope) string { + if hasHeaderQR(env) { + return "with-qr" + } + + return "regular" +} diff --git a/components/bill/invoice/line_support.go b/components/bill/invoice/line_support.go index 5673a21..4be2ab0 100644 --- a/components/bill/invoice/line_support.go +++ b/components/bill/invoice/line_support.go @@ -41,12 +41,12 @@ func prepareLineSupport(inv *bill.Invoice) *lineSupport { } } for _, row := range inv.Discounts { - if row.Ref != "" { + if row.Code != "" { ls.refs = true } } for _, row := range inv.Charges { - if row.Ref != "" { + if row.Code != "" { ls.refs = true } } diff --git a/components/bill/invoice/lines.templ b/components/bill/invoice/lines.templ index 7163ad2..98c2fb4 100644 --- a/components/bill/invoice/lines.templ +++ b/components/bill/invoice/lines.templ @@ -2,10 +2,9 @@ package invoice import ( "fmt" - - "github.com/invopop/gobl/bill" - "github.com/invopop/gobl.html/components/t" "github.com/invopop/gobl.html/components/regimes/mx" + "github.com/invopop/gobl.html/components/t" + "github.com/invopop/gobl/bill" ) templ lines(inv *bill.Invoice) { @@ -191,8 +190,8 @@ templ discountRow(row *bill.Discount, ls *lineSupport) { if ls.refs { - if row.Ref != "" { - { row.Ref } + if row.Code != "" { + { row.Code.String() } } else { } @@ -262,8 +261,8 @@ templ chargeRow(row *bill.Charge, ls *lineSupport) { if ls.refs { - if row.Ref != "" { - { row.Ref } + if row.Code != "" { + { row.Code.String() } } else { } diff --git a/components/bill/invoice/lines_templ.go b/components/bill/invoice/lines_templ.go index b076d3c..4db5a50 100644 --- a/components/bill/invoice/lines_templ.go +++ b/components/bill/invoice/lines_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -10,7 +10,6 @@ import templruntime "github.com/a-h/templ/runtime" import ( "fmt" - "github.com/invopop/gobl.html/components/regimes/mx" "github.com/invopop/gobl.html/components/t" "github.com/invopop/gobl/bill" @@ -19,9 +18,6 @@ import ( func lines(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -66,9 +62,6 @@ func lines(inv *bill.Invoice) templ.Component { func linesWithSupport(inv *bill.Invoice, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -172,7 +165,7 @@ func linesWithSupport(inv *bill.Invoice, ls *lineSupport) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(cat.Name.In(t.Lang(ctx))) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 49, Col: 33} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 48, Col: 33} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -246,9 +239,6 @@ func linesWithSupport(inv *bill.Invoice, ls *lineSupport) templ.Component { func linesBody(inv *bill.Invoice, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -285,9 +275,6 @@ func linesBody(inv *bill.Invoice, ls *lineSupport) templ.Component { func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -310,7 +297,7 @@ func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(l.Index)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 85, Col: 24} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 84, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -329,7 +316,7 @@ func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { var templ_7745c5c3_Var8 string templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(l.Item.Ref) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 90, Col: 17} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 89, Col: 17} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) if templ_7745c5c3_Err != nil { @@ -353,7 +340,7 @@ func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(l.Item.Name) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 97, Col: 22} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 96, Col: 22} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -371,7 +358,7 @@ func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(l.Item.Description) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 100, Col: 31} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 99, Col: 31} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -407,7 +394,7 @@ func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(string(l.Item.Unit)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 110, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 109, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -515,9 +502,6 @@ func line(_ *bill.Invoice, l *bill.Line, ls *lineSupport) templ.Component { func lineItemAltPrices(l *bill.Line) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -554,9 +538,6 @@ func lineItemAltPrices(l *bill.Line) templ.Component { func lineGroupDiscounts(l *bill.Line) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -592,9 +573,6 @@ func lineGroupDiscounts(l *bill.Line) templ.Component { func lineGroupCharges(l *bill.Line) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -630,9 +608,6 @@ func lineGroupCharges(l *bill.Line) templ.Component { func discountsBody(inv *bill.Invoice, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -671,9 +646,6 @@ func discountsBody(inv *bill.Invoice, ls *lineSupport) templ.Component { func discountRow(row *bill.Discount, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -696,7 +668,7 @@ func discountRow(row *bill.Discount, ls *lineSupport) templ.Component { var templ_7745c5c3_Var17 string templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("D%d", row.Index)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 190, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 189, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17)) if templ_7745c5c3_Err != nil { @@ -711,11 +683,11 @@ func discountRow(row *bill.Discount, ls *lineSupport) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if row.Ref != "" { + if row.Code != "" { var templ_7745c5c3_Var18 string - templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(row.Ref) + templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(row.Code.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 195, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 194, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18)) if templ_7745c5c3_Err != nil { @@ -739,7 +711,7 @@ func discountRow(row *bill.Discount, ls *lineSupport) templ.Component { var templ_7745c5c3_Var19 string templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(row.Reason) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 202, Col: 15} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 201, Col: 15} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) if templ_7745c5c3_Err != nil { @@ -833,9 +805,6 @@ func discountRow(row *bill.Discount, ls *lineSupport) templ.Component { func chargesBody(inv *bill.Invoice, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -874,9 +843,6 @@ func chargesBody(inv *bill.Invoice, ls *lineSupport) templ.Component { func chargeRow(row *bill.Charge, ls *lineSupport) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -899,7 +865,7 @@ func chargeRow(row *bill.Charge, ls *lineSupport) templ.Component { var templ_7745c5c3_Var22 string templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("C%d", row.Index)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 261, Col: 34} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 260, Col: 34} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) if templ_7745c5c3_Err != nil { @@ -914,11 +880,11 @@ func chargeRow(row *bill.Charge, ls *lineSupport) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - if row.Ref != "" { + if row.Code != "" { var templ_7745c5c3_Var23 string - templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(row.Ref) + templ_7745c5c3_Var23, templ_7745c5c3_Err = templ.JoinStringErrs(row.Code.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 266, Col: 14} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 265, Col: 24} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var23)) if templ_7745c5c3_Err != nil { @@ -942,7 +908,7 @@ func chargeRow(row *bill.Charge, ls *lineSupport) templ.Component { var templ_7745c5c3_Var24 string templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(row.Reason) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 273, Col: 15} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/lines.templ`, Line: 272, Col: 15} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) if templ_7745c5c3_Err != nil { @@ -1032,5 +998,3 @@ func chargeRow(row *bill.Charge, ls *lineSupport) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/notes_templ.go b/components/bill/invoice/notes_templ.go index 9cb714a..3cb3cbe 100644 --- a/components/bill/invoice/notes_templ.go +++ b/components/bill/invoice/notes_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -41,9 +41,6 @@ func init() { func notes(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -130,9 +127,6 @@ func notes(inv *bill.Invoice) templ.Component { func noteRegSummary(reg *org.Registration) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -381,5 +375,3 @@ func registrationCapital(ctx context.Context, reg *org.Registration) string { } return "" } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/payment.templ b/components/bill/invoice/payment.templ index c60884e..5b51ea7 100644 --- a/components/bill/invoice/payment.templ +++ b/components/bill/invoice/payment.templ @@ -47,7 +47,7 @@ templ paymentInstructions(inst *pay.Instructions) { @t.T(".ref") - { inst.Ref } + { inst.Ref.String() } } diff --git a/components/bill/invoice/payment_templ.go b/components/bill/invoice/payment_templ.go index ba86eec..376ed3e 100644 --- a/components/bill/invoice/payment_templ.go +++ b/components/bill/invoice/payment_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -21,9 +21,6 @@ import ( func payment(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -94,9 +91,6 @@ func payment(inv *bill.Invoice) templ.Component { func paymentInstructions(inst *pay.Instructions) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -169,9 +163,9 @@ func paymentInstructions(inst *pay.Instructions) templ.Component { return templ_7745c5c3_Err } var templ_7745c5c3_Var6 string - templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inst.Ref) + templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(inst.Ref.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/payment.templ`, Line: 50, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/payment.templ`, Line: 50, Col: 25} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -341,9 +335,6 @@ func renderPaymentNotes(txt string) string { func paymentCreditTransferRow(ct *pay.CreditTransfer) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -430,9 +421,6 @@ func paymentCreditTransferRow(ct *pay.CreditTransfer) templ.Component { func paymentTerms(terms *pay.Terms) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -557,9 +545,6 @@ func paymentTerms(terms *pay.Terms) templ.Component { func paymentDueDates(terms *pay.Terms) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -692,5 +677,3 @@ func paymentTermsKeyName(ctx context.Context, terms *pay.Terms) string { return i18n.T(ctx, ".na") } } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/summary.templ b/components/bill/invoice/summary.templ index 8c3b918..f5d983c 100644 --- a/components/bill/invoice/summary.templ +++ b/components/bill/invoice/summary.templ @@ -8,7 +8,6 @@ import ( "github.com/invopop/gobl/cal" "github.com/invopop/gobl/cbc" "github.com/invopop/gobl/currency" - "github.com/invopop/gobl/tax" "strings" ) @@ -150,7 +149,7 @@ func currencyName(ctx context.Context, cur currency.Code) string { return i18n.T(ctx, "billing.invoice.summary.currency_value", i18n.M{"desc": name, "code": cur}) } -func mapTaxExtension(ctx context.Context, k cbc.Key, v tax.ExtValue) string { +func mapTaxExtension(ctx context.Context, k cbc.Key, v cbc.Code) string { // find the key translation label := i18n.T(ctx, ".ext_map."+k.String()) if strings.HasPrefix(label, "!") { // if match found diff --git a/components/bill/invoice/summary_templ.go b/components/bill/invoice/summary_templ.go index ccffa03..c50bf6f 100644 --- a/components/bill/invoice/summary_templ.go +++ b/components/bill/invoice/summary_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -16,16 +16,12 @@ import ( "github.com/invopop/gobl/cal" "github.com/invopop/gobl/cbc" "github.com/invopop/gobl/currency" - "github.com/invopop/gobl/tax" "strings" ) func summary(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -96,7 +92,7 @@ func summary(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(currencyName(ctx, inv.Currency)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 35, Col: 39} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 34, Col: 39} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -166,7 +162,7 @@ func summary(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(code(pre.Series, pre.Code)) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 64, Col: 35} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 63, Col: 35} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -198,7 +194,7 @@ func summary(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var5 string templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(pre.Reason) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 73, Col: 20} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 72, Col: 20} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) if templ_7745c5c3_Err != nil { @@ -230,7 +226,7 @@ func summary(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var6 string templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 86, Col: 16} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 85, Col: 16} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) if templ_7745c5c3_Err != nil { @@ -243,7 +239,7 @@ func summary(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var7 string templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(v.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 89, Col: 21} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 88, Col: 21} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) if templ_7745c5c3_Err != nil { @@ -277,9 +273,6 @@ func summary(inv *bill.Invoice) templ.Component { func summaryOrderingRows(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -311,7 +304,7 @@ func summaryOrderingRows(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var9 string templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(inv.Ordering.Code.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 107, Col: 32} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 106, Col: 32} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) if templ_7745c5c3_Err != nil { @@ -337,7 +330,7 @@ func summaryOrderingRows(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var10 string templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(ident.Label) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 118, Col: 18} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 117, Col: 18} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) if templ_7745c5c3_Err != nil { @@ -350,7 +343,7 @@ func summaryOrderingRows(inv *bill.Invoice) templ.Component { var templ_7745c5c3_Var11 string templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(ident.Code.String()) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 121, Col: 26} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/bill/invoice/summary.templ`, Line: 120, Col: 26} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) if templ_7745c5c3_Err != nil { @@ -369,9 +362,6 @@ func summaryOrderingRows(inv *bill.Invoice) templ.Component { func summaryOrderPeriodRows(p *cal.Period) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -428,7 +418,7 @@ func currencyName(ctx context.Context, cur currency.Code) string { return i18n.T(ctx, "billing.invoice.summary.currency_value", i18n.M{"desc": name, "code": cur}) } -func mapTaxExtension(ctx context.Context, k cbc.Key, v tax.ExtValue) string { +func mapTaxExtension(ctx context.Context, k cbc.Key, v cbc.Code) string { // find the key translation label := i18n.T(ctx, ".ext_map."+k.String()) if strings.HasPrefix(label, "!") { // if match found @@ -436,5 +426,3 @@ func mapTaxExtension(ctx context.Context, k cbc.Key, v tax.ExtValue) string { } return label } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/supplier_templ.go b/components/bill/invoice/supplier_templ.go index 4071a9b..896f99a 100644 --- a/components/bill/invoice/supplier_templ.go +++ b/components/bill/invoice/supplier_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -17,9 +17,6 @@ import ( func supplier(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -70,5 +67,3 @@ func supplier(inv *bill.Invoice) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/taxes_templ.go b/components/bill/invoice/taxes_templ.go index 5113128..5fe94ee 100644 --- a/components/bill/invoice/taxes_templ.go +++ b/components/bill/invoice/taxes_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -19,9 +19,6 @@ import ( func taxes(inv *bill.Invoice, taxes *tax.Total) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -128,9 +125,6 @@ func taxes(inv *bill.Invoice, taxes *tax.Total) templ.Component { func taxRateRow(inv *bill.Invoice, cat *tax.CategoryTotal, rate *tax.RateTotal, span int) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -290,5 +284,3 @@ func taxExemptionCode(ext tax.Extensions) string { } return "" } - -var _ = templruntime.GeneratedTemplate diff --git a/components/bill/invoice/totals.templ b/components/bill/invoice/totals.templ index 9fbd61f..946c278 100644 --- a/components/bill/invoice/totals.templ +++ b/components/bill/invoice/totals.templ @@ -99,18 +99,6 @@ templ totalsBaseRows(inv *bill.Invoice, totals *bill.Totals) { } templ totalsPayableRows(inv *bill.Invoice, totals *bill.Totals) { - if totals.Outlays != nil { - for _, o := range inv.Outlays { - - - @t.T(".outlay", i18n.M{"i": o.Index, "txt": outlayText(o)}) - - - @t.LM(o.Amount) - - - } - } if inv.Type.In(bill.InvoiceTypeCreditNote) { @@ -204,14 +192,3 @@ func advanceMap(adv *pay.Advance) i18n.M { } return i18n.M{"date": date, "txt": txt} } - -func outlayText(outlay *bill.Outlay) string { - txt := outlay.Description - if outlay.Code != "" { - txt = outlay.Code + " " + txt - } - if outlay.Date != nil { - txt += " " + outlay.Date.String() - } - return txt -} diff --git a/components/bill/invoice/totals_templ.go b/components/bill/invoice/totals_templ.go index 449c6dc..08e32b3 100644 --- a/components/bill/invoice/totals_templ.go +++ b/components/bill/invoice/totals_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package invoice //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -21,9 +21,6 @@ import ( func totals(inv *bill.Invoice, totals *bill.Totals) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -100,9 +97,6 @@ func totals(inv *bill.Invoice, totals *bill.Totals) templ.Component { func totalsBaseRows(inv *bill.Invoice, totals *bill.Totals) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -277,9 +271,6 @@ func totalsBaseRows(inv *bill.Invoice, totals *bill.Totals) templ.Component { func totalsPayableRows(inv *bill.Invoice, totals *bill.Totals) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -295,30 +286,6 @@ func totalsPayableRows(inv *bill.Invoice, totals *bill.Totals) templ.Component { templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - if totals.Outlays != nil { - for _, o := range inv.Outlays { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = t.T(".outlay", i18n.M{"i": o.Index, "txt": outlayText(o)}).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = t.LM(o.Amount).Render(ctx, templ_7745c5c3_Buffer) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - } - } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err @@ -379,9 +346,6 @@ func totalsPayableRows(inv *bill.Invoice, totals *bill.Totals) templ.Component { func totalsDueRows(inv *bill.Invoice, totals *bill.Totals) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -505,16 +469,3 @@ func advanceMap(adv *pay.Advance) i18n.M { } return i18n.M{"date": date, "txt": txt} } - -func outlayText(outlay *bill.Outlay) string { - txt := outlay.Description - if outlay.Code != "" { - txt = outlay.Code + " " + txt - } - if outlay.Date != nil { - txt += " " + outlay.Date.String() - } - return txt -} - -var _ = templruntime.GeneratedTemplate diff --git a/components/envelope_templ.go b/components/envelope_templ.go index c35d594..b780dd5 100644 --- a/components/envelope_templ.go +++ b/components/envelope_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -27,9 +27,6 @@ import ( func Envelope(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -98,9 +95,6 @@ func Envelope(env *gobl.Envelope) templ.Component { func stylesheets() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -185,5 +179,3 @@ func stylesheetData() []string { } return list } - -var _ = templruntime.GeneratedTemplate diff --git a/components/footer_templ.go b/components/footer_templ.go index 2d76a84..5c04e99 100644 --- a/components/footer_templ.go +++ b/components/footer_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package components //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -21,9 +21,6 @@ import ( func footerPrint(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -66,9 +63,6 @@ func footerPrint(env *gobl.Envelope) templ.Component { func footerScreen(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -107,9 +101,6 @@ func footerScreen(env *gobl.Envelope) templ.Component { func footerPage() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -144,9 +135,6 @@ func footerPage() templ.Component { func footerNotes(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -183,9 +171,6 @@ func footerNotes(env *gobl.Envelope) templ.Component { func footerGOBLLogo() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -238,5 +223,3 @@ func footerNotesText(ctx context.Context, env *gobl.Envelope) string { } return strings.Join(out, " · ") } - -var _ = templruntime.GeneratedTemplate diff --git a/components/images/gobl_templ.go b/components/images/gobl_templ.go index db7a5cf..c0d8488 100644 --- a/components/images/gobl_templ.go +++ b/components/images/gobl_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package images //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -23,9 +23,6 @@ var Content embed.FS func GOBL() templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -70,5 +67,3 @@ func goblImage() string { str := base64.StdEncoding.EncodeToString(data) return "data:image/svg+xml;base64," + str } - -var _ = templruntime.GeneratedTemplate diff --git a/components/images/images_templ.go b/components/images/images_templ.go index 9f2dfd5..8a128a1 100644 --- a/components/images/images_templ.go +++ b/components/images/images_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package images //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -12,9 +12,6 @@ import templruntime "github.com/a-h/templ/runtime" func QR(code string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -52,5 +49,3 @@ func QR(code string) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/notes/message_templ.go b/components/notes/message_templ.go index 80871d8..3c0040e 100644 --- a/components/notes/message_templ.go +++ b/components/notes/message_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package notes //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -15,9 +15,6 @@ import ( func Message(msg *note.Message) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -76,5 +73,3 @@ func Message(msg *note.Message) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/org/address.templ b/components/org/address.templ index 18159d8..a116943 100644 --- a/components/org/address.templ +++ b/components/org/address.templ @@ -1,11 +1,10 @@ package org import ( - "strings" - "github.com/invopop/ctxi18n/i18n" - "github.com/invopop/gobl/org" "github.com/invopop/gobl.html/components/t" + "github.com/invopop/gobl/org" + "strings" ) templ Address(addr *org.Address) { @@ -52,7 +51,7 @@ func buildAddressLines(addr *org.Address) []string { lines = append(lines, addr.Region) } if addr.Code != "" { - lines = append(lines, addr.Code) + lines = append(lines, addr.Code.String()) } return lines } diff --git a/components/org/address_templ.go b/components/org/address_templ.go index 506bd2c..09e8c33 100644 --- a/components/org/address_templ.go +++ b/components/org/address_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package org //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -9,19 +9,15 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "strings" - "github.com/invopop/ctxi18n/i18n" "github.com/invopop/gobl.html/components/t" "github.com/invopop/gobl/org" + "strings" ) func Address(addr *org.Address) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -56,9 +52,6 @@ func Address(addr *org.Address) templ.Component { func AddressWithLabel(addr *org.Address) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -107,9 +100,6 @@ func AddressWithLabel(addr *org.Address) templ.Component { func addressLines(addr *org.Address) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -133,7 +123,7 @@ func addressLines(addr *org.Address) templ.Component { var templ_7745c5c3_Var4 string templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(txt) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/org/address.templ`, Line: 32, Col: 8} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/org/address.templ`, Line: 31, Col: 8} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { @@ -173,7 +163,7 @@ func buildAddressLines(addr *org.Address) []string { lines = append(lines, addr.Region) } if addr.Code != "" { - lines = append(lines, addr.Code) + lines = append(lines, addr.Code.String()) } return lines } @@ -199,5 +189,3 @@ func addrNumberFirst(addr *org.Address) bool { return false } } - -var _ = templruntime.GeneratedTemplate diff --git a/components/org/party.templ b/components/org/party.templ index 1ee7f07..9435847 100644 --- a/components/org/party.templ +++ b/components/org/party.templ @@ -196,7 +196,7 @@ func taxIDCode(party *org.Party) string { } } -func mapPartyExtension(ctx context.Context, k cbc.Key, v tax.ExtValue) string { +func mapPartyExtension(ctx context.Context, k cbc.Key, v cbc.Code) string { // find the key translation label := i18n.T(ctx, ".ext_map."+k.String()) if !strings.HasPrefix(label, "!") { // if match found diff --git a/components/org/party_templ.go b/components/org/party_templ.go index dd827a6..5d9d23b 100644 --- a/components/org/party_templ.go +++ b/components/org/party_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package org //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -26,9 +26,6 @@ import ( func Party(party *org.Party) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -183,9 +180,6 @@ func Party(party *org.Party) templ.Component { func taxID(party *org.Party) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -222,9 +216,6 @@ func taxID(party *org.Party) templ.Component { func people(people []*org.Person) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -270,9 +261,6 @@ func people(people []*org.Person) templ.Component { func addresses(addrs []*org.Address) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -301,9 +289,6 @@ func addresses(addrs []*org.Address) templ.Component { func telephones(tels []*org.Telephone) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -347,9 +332,6 @@ func telephones(tels []*org.Telephone) templ.Component { func emails(emails []*org.Email) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -386,9 +368,6 @@ func emails(emails []*org.Email) templ.Component { func websites(websites []*org.Website) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -432,9 +411,6 @@ func websites(websites []*org.Website) templ.Component { func identities(idents []*org.Identity) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -471,9 +447,6 @@ func identities(idents []*org.Identity) templ.Component { func partyExtensions(party *org.Party) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -596,7 +569,7 @@ func taxIDCode(party *org.Party) string { } } -func mapPartyExtension(ctx context.Context, k cbc.Key, v tax.ExtValue) string { +func mapPartyExtension(ctx context.Context, k cbc.Key, v cbc.Code) string { // find the key translation label := i18n.T(ctx, ".ext_map."+k.String()) if !strings.HasPrefix(label, "!") { // if match found @@ -615,5 +588,3 @@ func extensionKeys(ext tax.Extensions) []cbc.Key { }) return keys } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/co/dian.templ b/components/regimes/co/dian.templ index 113f2b8..dfc4f1b 100644 --- a/components/regimes/co/dian.templ +++ b/components/regimes/co/dian.templ @@ -1,14 +1,13 @@ package co import ( - "regexp" - - "github.com/invopop/gobl" - "github.com/invopop/gobl/bill" - "github.com/invopop/gobl/regimes/co" - "github.com/invopop/gobl.html/components/t" "github.com/invopop/ctxi18n/i18n" + "github.com/invopop/gobl" "github.com/invopop/gobl.html/components/images" + "github.com/invopop/gobl.html/components/t" + "github.com/invopop/gobl/addons/co/dian" + "github.com/invopop/gobl/bill" + "regexp" ) var dianQRHTTPRegexp = regexp.MustCompile(`https.+`) @@ -70,7 +69,7 @@ func dianURL(qr string) string { func dianCUDE(env *gobl.Envelope) string { for _, stamp := range env.Head.Stamps { switch stamp.Provider { - case co.StampProviderDIANCUDE: + case dian.StampCUDE: return stamp.Value } } @@ -83,7 +82,7 @@ func dianPrecedingCUDE(inv *bill.Invoice) string { } for _, stamp := range inv.Preceding[0].Stamps { switch stamp.Provider { - case co.StampProviderDIANCUDE: + case dian.StampCUDE: return stamp.Value } } @@ -93,7 +92,7 @@ func dianPrecedingCUDE(inv *bill.Invoice) string { func dianQR(env *gobl.Envelope) string { for _, stamp := range env.Head.Stamps { switch stamp.Provider { - case co.StampProviderDIANQR: + case dian.StampQR: return stamp.Value } } diff --git a/components/regimes/co/dian_templ.go b/components/regimes/co/dian_templ.go index 6d29a33..1634c45 100644 --- a/components/regimes/co/dian_templ.go +++ b/components/regimes/co/dian_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package co //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -9,14 +9,13 @@ import "github.com/a-h/templ" import templruntime "github.com/a-h/templ/runtime" import ( - "regexp" - "github.com/invopop/ctxi18n/i18n" "github.com/invopop/gobl" "github.com/invopop/gobl.html/components/images" "github.com/invopop/gobl.html/components/t" + "github.com/invopop/gobl/addons/co/dian" "github.com/invopop/gobl/bill" - "github.com/invopop/gobl/regimes/co" + "regexp" ) var dianQRHTTPRegexp = regexp.MustCompile(`https.+`) @@ -24,9 +23,6 @@ var dianQRHTTPRegexp = regexp.MustCompile(`https.+`) func DIANQR(env *gobl.Envelope, inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -57,9 +53,6 @@ func DIANQR(env *gobl.Envelope, inv *bill.Invoice) templ.Component { func generateQR(inv *bill.Invoice, code, qr string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -146,7 +139,7 @@ func dianURL(qr string) string { func dianCUDE(env *gobl.Envelope) string { for _, stamp := range env.Head.Stamps { switch stamp.Provider { - case co.StampProviderDIANCUDE: + case dian.StampCUDE: return stamp.Value } } @@ -159,7 +152,7 @@ func dianPrecedingCUDE(inv *bill.Invoice) string { } for _, stamp := range inv.Preceding[0].Stamps { switch stamp.Provider { - case co.StampProviderDIANCUDE: + case dian.StampCUDE: return stamp.Value } } @@ -169,11 +162,9 @@ func dianPrecedingCUDE(inv *bill.Invoice) string { func dianQR(env *gobl.Envelope) string { for _, stamp := range env.Head.Stamps { switch stamp.Provider { - case co.StampProviderDIANQR: + case dian.StampQR: return stamp.Value } } return "" } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/es/ticketbai.templ b/components/regimes/es/ticketbai.templ index a6a4de9..049796f 100644 --- a/components/regimes/es/ticketbai.templ +++ b/components/regimes/es/ticketbai.templ @@ -2,8 +2,8 @@ package es import ( "github.com/invopop/gobl" - "github.com/invopop/gobl/addons/es/tbai" "github.com/invopop/gobl.html/components/images" + "github.com/invopop/gobl/addons/es/tbai" ) // TicketBAIQR generates a QR code area for the TicketBAI code in the given envelope. @@ -15,6 +15,17 @@ templ TicketBAIQR(env *gobl.Envelope) { } } +// HasTicketBAIQR returns a boolean indicating whether the envelope has a TicketBAI QR or not. +func HasTicketBAIQR(env *gobl.Envelope) bool { + if code := ticketbaiCode(env); code != "" { + if qr := ticketbaiQR(env); qr != "" { + return true + } + } + + return false +} + templ generateTicketBAIQR(code, qr string) { -
+
{ code } diff --git a/components/regimes/es/ticketbai_templ.go b/components/regimes/es/ticketbai_templ.go index 25be591..f5a17e9 100644 --- a/components/regimes/es/ticketbai_templ.go +++ b/components/regimes/es/ticketbai_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package es //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -18,9 +18,6 @@ import ( func TicketBAIQR(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -48,12 +45,20 @@ func TicketBAIQR(env *gobl.Envelope) templ.Component { }) } +// HasTicketBAIQR returns a boolean indicating whether the envelope has a TicketBAI QR or not. +func HasTicketBAIQR(env *gobl.Envelope) bool { + if code := ticketbaiCode(env); code != "" { + if qr := ticketbaiQR(env); qr != "" { + return true + } + } + + return false +} + func generateTicketBAIQR(code, qr string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -69,14 +74,14 @@ func generateTicketBAIQR(code, qr string) templ.Component { templ_7745c5c3_Var2 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } var templ_7745c5c3_Var3 string templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(code) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/regimes/es/ticketbai.templ`, Line: 41, Col: 10} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `components/regimes/es/ticketbai.templ`, Line: 52, Col: 10} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) if templ_7745c5c3_Err != nil { @@ -126,5 +131,3 @@ func ticketbaiQR(env *gobl.Envelope) string { } return "" } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/es/verifactu.templ b/components/regimes/es/verifactu.templ new file mode 100644 index 0000000..c99788d --- /dev/null +++ b/components/regimes/es/verifactu.templ @@ -0,0 +1,75 @@ +package es + +import ( + "github.com/invopop/gobl" + "github.com/invopop/gobl.html/components/images" + "github.com/invopop/gobl/addons/es/verifactu" + "github.com/invopop/gobl/head" +) + +// VerifactuQR generates a QR code area for the Verifactu code in the given envelope. +templ VerifactuQR(env *gobl.Envelope) { + if qr := verifactuQR(env); qr != "" { + @generateVerifactuQR(qr) + } +} + +// HasVerifactuQR returns a boolean indicating whether the envelope has a Verifactu QR or not. +func HasVerifactuQR(env *gobl.Envelope) bool { + if qr := verifactuQR(env); qr != "" { + return true + } + return false +} + +templ generateVerifactuQR(qr string) { + +
+
+

+ QR tributario: +

+ +
+ VERI*FACTU +
+
+
+} + +func verifactuQR(env *gobl.Envelope) string { + stamp := head.GetStamp(env.Head.Stamps, verifactu.StampQR) + if stamp != nil { + return stamp.Value + } + return "" +} diff --git a/components/regimes/es/verifactu_templ.go b/components/regimes/es/verifactu_templ.go new file mode 100644 index 0000000..a082b5d --- /dev/null +++ b/components/regimes/es/verifactu_templ.go @@ -0,0 +1,104 @@ +// Code generated by templ - DO NOT EDIT. + +// templ: version: v0.2.747 +package es + +//lint:file-ignore SA4006 This context is only used if a nested component is present. + +import "github.com/a-h/templ" +import templruntime "github.com/a-h/templ/runtime" + +import ( + "github.com/invopop/gobl" + "github.com/invopop/gobl.html/components/images" + "github.com/invopop/gobl/addons/es/verifactu" + "github.com/invopop/gobl/head" +) + +// VerifactuQR generates a QR code area for the Verifactu code in the given envelope. +func VerifactuQR(env *gobl.Envelope) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var1 := templ.GetChildren(ctx) + if templ_7745c5c3_Var1 == nil { + templ_7745c5c3_Var1 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + if qr := verifactuQR(env); qr != "" { + templ_7745c5c3_Err = generateVerifactuQR(qr).Render(ctx, templ_7745c5c3_Buffer) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + } + return templ_7745c5c3_Err + }) +} + +// HasVerifactuQR returns a boolean indicating whether the envelope has a Verifactu QR or not. +func HasVerifactuQR(env *gobl.Envelope) bool { + if qr := verifactuQR(env); qr != "" { + return true + } + return false +} + +func generateVerifactuQR(qr string) templ.Component { + return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { + templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context + templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) + if !templ_7745c5c3_IsBuffer { + defer func() { + templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) + if templ_7745c5c3_Err == nil { + templ_7745c5c3_Err = templ_7745c5c3_BufErr + } + }() + } + ctx = templ.InitializeContext(ctx) + templ_7745c5c3_Var2 := templ.GetChildren(ctx) + if templ_7745c5c3_Var2 == nil { + templ_7745c5c3_Var2 = templ.NopComponent + } + ctx = templ.ClearChildren(ctx) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + return templ_7745c5c3_Err + }) +} + +func verifactuQR(env *gobl.Envelope) string { + stamp := head.GetStamp(env.Head.Stamps, verifactu.StampQR) + if stamp != nil { + return stamp.Value + } + return "" +} diff --git a/components/regimes/gr/iapr_templ.go b/components/regimes/gr/iapr_templ.go index 33a2d85..9525b03 100644 --- a/components/regimes/gr/iapr_templ.go +++ b/components/regimes/gr/iapr_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package gr //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -17,9 +17,6 @@ import ( func IAPR(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -155,5 +152,3 @@ func IAPR(env *gobl.Envelope) templ.Component { func hasStamps(env *gobl.Envelope) bool { return env.Head.GetStamp(gr.StampIAPRQR) != nil } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/mx/cfdi_templ.go b/components/regimes/mx/cfdi_templ.go index 1868de2..03e6df9 100644 --- a/components/regimes/mx/cfdi_templ.go +++ b/components/regimes/mx/cfdi_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package mx //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -16,9 +16,6 @@ import ( func CFDI(env *gobl.Envelope, inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -47,5 +44,3 @@ func CFDI(env *gobl.Envelope, inv *bill.Invoice) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/mx/complements_templ.go b/components/regimes/mx/complements_templ.go index 5e999eb..b2cb11c 100644 --- a/components/regimes/mx/complements_templ.go +++ b/components/regimes/mx/complements_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package mx //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -24,9 +24,6 @@ import ( func complements(inv *bill.Invoice) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -63,9 +60,6 @@ func complements(inv *bill.Invoice) templ.Component { func foodVouchers(fv *cfdi.FoodVouchers) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -219,9 +213,6 @@ func foodVouchers(fv *cfdi.FoodVouchers) templ.Component { func fuelAccountBalance(b *cfdi.FuelAccountBalance) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -468,5 +459,3 @@ func fuelAccountTax(taxes []*cfdi.FuelAccountTax, code cbc.Code) *num.Amount { } return nil } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/mx/line_templ.go b/components/regimes/mx/line_templ.go index 7ee0530..18f40ad 100644 --- a/components/regimes/mx/line_templ.go +++ b/components/regimes/mx/line_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package mx //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -17,9 +17,6 @@ import ( func LineExtensions(line *bill.Line) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -57,5 +54,3 @@ func LineExtensions(line *bill.Line) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/mx/signatures_templ.go b/components/regimes/mx/signatures_templ.go index f413e07..6b6be99 100644 --- a/components/regimes/mx/signatures_templ.go +++ b/components/regimes/mx/signatures_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package mx //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -19,9 +19,6 @@ import ( func signatures(h *head.Header) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -228,5 +225,3 @@ func satURL(h *head.Header) string { func hasSignatures(env *gobl.Envelope) bool { return env.Head.GetStamp(mx.StampSATChain) != nil } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/pl/ksef_templ.go b/components/regimes/pl/ksef_templ.go index 9d6eb46..2c7129f 100644 --- a/components/regimes/pl/ksef_templ.go +++ b/components/regimes/pl/ksef_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package pl //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -23,9 +23,6 @@ var dianQRHTTPRegexp = regexp.MustCompile(`https.+`) func KSeFQR(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -56,9 +53,6 @@ func KSeFQR(env *gobl.Envelope) templ.Component { func generateQR(id, qr string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -126,5 +120,3 @@ func ksefID(env *gobl.Envelope) string { } return "" } - -var _ = templruntime.GeneratedTemplate diff --git a/components/regimes/pt/at_templ.go b/components/regimes/pt/at_templ.go index dc98d5c..09ae7e3 100644 --- a/components/regimes/pt/at_templ.go +++ b/components/regimes/pt/at_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package pt //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -15,9 +15,6 @@ import ( func ATQR(env *gobl.Envelope) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -48,9 +45,6 @@ func ATQR(env *gobl.Envelope) templ.Component { func generateATQR(atcud, qr string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -99,5 +93,3 @@ func generateATQR(atcud, qr string) templ.Component { return templ_7745c5c3_Err }) } - -var _ = templruntime.GeneratedTemplate diff --git a/components/t/i18n_templ.go b/components/t/i18n_templ.go index 8de3694..82c11fd 100644 --- a/components/t/i18n_templ.go +++ b/components/t/i18n_templ.go @@ -1,6 +1,6 @@ // Code generated by templ - DO NOT EDIT. -// templ: version: v0.2.793 +// templ: version: v0.2.747 package t //lint:file-ignore SA4006 This context is only used if a nested component is present. @@ -23,9 +23,6 @@ import ( func T(key string, args ...any) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -58,9 +55,6 @@ func T(key string, args ...any) templ.Component { func N(key string, n int, args ...any) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -94,9 +88,6 @@ func N(key string, n int, args ...any) templ.Component { func L(a any) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -129,9 +120,6 @@ func L(a any) templ.Component { func LM(a num.Amount) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -165,9 +153,6 @@ func LM(a num.Amount) templ.Component { func LC(a num.Amount, cur currency.Code) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -201,9 +186,6 @@ func LC(a num.Amount, cur currency.Code) templ.Component { func LCD(a num.Amount, cur currency.Code) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -236,9 +218,6 @@ func LCD(a num.Amount, cur currency.Code) templ.Component { func Scope(key string) templ.Component { return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context - if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { - return templ_7745c5c3_CtxErr - } templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) if !templ_7745c5c3_IsBuffer { defer func() { @@ -304,5 +283,3 @@ func LocalizeCurrency(_ context.Context, a num.Amount, cur currency.Code, opts . f := cur.Def().Formatter(opts...) return f.Amount(a) } - -var _ = templruntime.GeneratedTemplate diff --git a/examples/invoice-es-verifactu.json b/examples/invoice-es-verifactu.json new file mode 100644 index 0000000..e67805a --- /dev/null +++ b/examples/invoice-es-verifactu.json @@ -0,0 +1,126 @@ +{ + "$schema": "https://gobl.org/draft-0/envelope", + "head": { + "uuid": "92be0222-1d7d-11ed-8719-b24117999d50", + "dig": { + "alg": "sha256", + "val": "fa7d32955ad750b75685944aea34b14daaa59cd5c54a37b9c4b4a5c4bb7d394a" + }, + "stamps": [ + { + "prv": "verifactu-qr", + "val": "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR?nif=89890001K&numserie=12345678-G33&fecha=01-09-2024&importe=241.4" + } + ] + }, + "doc": { + "$schema": "https://gobl.org/draft-0/bill/invoice", + "type": "standard", + "code": "001", + "series": "SAMPLE", + "currency": "EUR", + "issue_date": "2022-02-01", + "supplier": { + "tax_id": { + "country": "ES", + "zone": "BI", + "code": "B98602642" + }, + "name": "Provide One S.L.", + "addresses": [ + { + "num": "42", + "street": "Calle Pradillo", + "locality": "Bilbao", + "region": "Vizcaya", + "code": "48001", + "country": "ES" + } + ], + "emails": [ + { + "addr": "billing@example.com" + } + ] + }, + "customer": { + "tax_id": { + "country": "ES", + "code": "54387763P" + }, + "name": "Sample Consumer", + "addresses": [ + { + "num": "42", + "street": "Calle Pradillo", + "locality": "Madrid", + "region": "Madrid", + "code": "28002", + "country": "ES" + } + ] + }, + "lines": [ + { + "i": 1, + "quantity": "20", + "item": { + "name": "Development services", + "price": "90.00", + "unit": "h" + }, + "sum": "1800.00", + "taxes": [ + { + "cat": "VAT", + "rate": "standard", + "percent": "21.0%" + } + ], + "total": "1800.00" + }, + { + "i": 2, + "quantity": "1", + "item": { + "name": "Out of hours support", + "price": "120.00" + }, + "sum": "120.00", + "taxes": [ + { + "cat": "VAT", + "rate": "standard", + "percent": "21.0%" + } + ], + "total": "120.00" + } + ], + "totals": { + "sum": "1920.00", + "total": "1920.00", + "taxes": { + "categories": [ + { + "code": "VAT", + "rates": [ + { + "key": "standard", + "base": "1920.00", + "percent": "21.0%", + "amount": "403.20" + } + ], + "base": "1920.00", + "amount": "403.20" + } + ], + "sum": "403.20" + }, + "tax": "403.20", + "total_with_tax": "2323.20", + "payable": "2323.20" + } + } +} diff --git a/examples/out/credit-note-es-es-tbai.html b/examples/out/credit-note-es-es-tbai.html index da34a90..d5bd8a7 100644 --- a/examples/out/credit-note-es-es-tbai.html +++ b/examples/out/credit-note-es-es-tbai.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/full-invoice.html b/examples/out/full-invoice.html index 9ac61ab..17294c0 100644 --- a/examples/out/full-invoice.html +++ b/examples/out/full-invoice.html @@ -31,7 +31,7 @@
-
+
@@ -345,14 +345,6 @@

€5.986,88 - - - Outlay 1: Something paid for by us - - - €200,00 - - Total to pay diff --git a/examples/out/gr-invoice.html b/examples/out/gr-invoice.html index c85411b..d8de4ce 100644 --- a/examples/out/gr-invoice.html +++ b/examples/out/gr-invoice.html @@ -31,7 +31,7 @@

-
+
diff --git a/examples/out/invoice-es-simplified.html b/examples/out/invoice-es-simplified.html index e54b7c3..63b71a0 100644 --- a/examples/out/invoice-es-simplified.html +++ b/examples/out/invoice-es-simplified.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/invoice-es-ticketbai.html b/examples/out/invoice-es-ticketbai.html index 20125e4..186d32c 100644 --- a/examples/out/invoice-es-ticketbai.html +++ b/examples/out/invoice-es-ticketbai.html @@ -31,7 +31,7 @@
-
+
@@ -70,6 +70,37 @@

+ +
+
+
+ TBAI-B98602642-010222-LrNMp23wKPLjx-112 +
+
+ + + +
+
+

@@ -270,39 +301,7 @@

-
- -
-
-
- TBAI-B98602642-010222-LrNMp23wKPLjx-112 -
-
- - - -
-
-
-
+
-
+
diff --git a/examples/out/invoice-es-verifactu.html b/examples/out/invoice-es-verifactu.html new file mode 100644 index 0000000..a1ddb51 --- /dev/null +++ b/examples/out/invoice-es-verifactu.html @@ -0,0 +1,325 @@ + + + + GOBL HTML Generator + + + + + + + + + + +
+
+ + Page + + 1 + + of + + 1 + + + +
+
+
+
+
+
+
+ Provide One S.L. +
+
+

+ Invoice +

+

+ SAMPLE-001 +

+
+
+

+ Summary +

+
    +
  • + + Issue Date + + + 2022-02-01 + +
  • +
  • + + Currency + + + Euro (EUR) + +
  • +
+
+
+ +
+
+

+ QR tributario: +

+
+ + + +
+
+ VERI*FACTU +
+
+
+
+
+

+ Supplier +

+
+
+ Provide One S.L. +
+
+ + Calle Pradillo 42, Bilbao, Vizcaya, 48001 (Spain) + +
+
+ Email: billing@example.com +
+
+ NIF: (ES) B98602642 +
+
+
+
+

+ Customer +

+
+
+ Sample Consumer +
+
+ + Calle Pradillo 42, Madrid, Madrid, 28002 (Spain) + +
+
+ NIF: (ES) 54387763P +
+
+
+
+
+
+

+ Lines +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ # + + Description + + Qty. + + Unit + + Price + + VAT + + Total +
+ 1 + + + Development services + + + 20 + + h + + €90,00 + + 21,0% + + €1.800,00 +
+ 2 + + + Out of hours support + + + 1 + + + + €120,00 + + 21,0% + + €120,00 +
+
+
+
+

+ Totals +

+ + + + + + + + + + + + + + + +
+ Sum + + €1.920,00 +
+ Tax + + €403,20 +
+ Total to pay + + €2.323,20 +
+
+
+

+ Taxes +

+ + + + + + + + + + + + + + + + + +
+ Tax + + Base + + Rate + + Amount +
+ VAT + + €1.920,00 + + 21,0% + + €403,20 +
+
+
+
+
+ +
+ + \ No newline at end of file diff --git a/examples/out/invoice-limited-company.html b/examples/out/invoice-limited-company.html index 74637d7..783b50a 100644 --- a/examples/out/invoice-limited-company.html +++ b/examples/out/invoice-limited-company.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/invoice-mx.html b/examples/out/invoice-mx.html index 0894b61..849a9db 100644 --- a/examples/out/invoice-mx.html +++ b/examples/out/invoice-mx.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/invoice-pl.html b/examples/out/invoice-pl.html index 008a49f..6b4666e 100644 --- a/examples/out/invoice-pl.html +++ b/examples/out/invoice-pl.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/invoice-tax-included.html b/examples/out/invoice-tax-included.html index 852faa1..f8d4f9b 100644 --- a/examples/out/invoice-tax-included.html +++ b/examples/out/invoice-tax-included.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/invoice-zw-usd.html b/examples/out/invoice-zw-usd.html index 8ab62b5..98aea62 100644 --- a/examples/out/invoice-zw-usd.html +++ b/examples/out/invoice-zw-usd.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/invoice.env.html b/examples/out/invoice.env.html index 137793e..a517b2b 100644 --- a/examples/out/invoice.env.html +++ b/examples/out/invoice.env.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/it-hotel-b2c.html b/examples/out/it-hotel-b2c.html index fffe4df..d6671c6 100644 --- a/examples/out/it-hotel-b2c.html +++ b/examples/out/it-hotel-b2c.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/mx-food-voucher.html b/examples/out/mx-food-voucher.html index 613cd1b..6bc9953 100644 --- a/examples/out/mx-food-voucher.html +++ b/examples/out/mx-food-voucher.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/mx-fuel-balance.html b/examples/out/mx-fuel-balance.html index 7bc4bb3..f4052d1 100644 --- a/examples/out/mx-fuel-balance.html +++ b/examples/out/mx-fuel-balance.html @@ -31,7 +31,7 @@
-
+
diff --git a/examples/out/pt-invoice-exempt.html b/examples/out/pt-invoice-exempt.html index 82f4d2c..9c4162c 100644 --- a/examples/out/pt-invoice-exempt.html +++ b/examples/out/pt-invoice-exempt.html @@ -37,7 +37,7 @@
-
+
diff --git a/examples/out/us-invoice.html b/examples/out/us-invoice.html index f6621f0..539867d 100644 --- a/examples/out/us-invoice.html +++ b/examples/out/us-invoice.html @@ -31,7 +31,7 @@
-
+
diff --git a/go.mod b/go.mod index 33c3a1e..be66145 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/a-h/templ v0.2.793 github.com/go-resty/resty/v2 v2.12.0 github.com/invopop/ctxi18n v0.9.0 - github.com/invopop/gobl v0.200.0 + github.com/invopop/gobl v0.207.0 github.com/invopop/princepdf v0.0.0-20240408123340-585be3cab91a github.com/labstack/echo/v4 v4.12.0 github.com/piglig/go-qr v0.2.4 diff --git a/go.sum b/go.sum index 883ec67..92e9f9a 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,6 @@ cloud.google.com/go v0.110.2 h1:sdFPBr6xG9/wkBbfhmUz/JmZC7X6LavQgcrVINrKiVA= cloud.google.com/go v0.110.2/go.mod h1:k04UEeEtb6ZBRTv3dZz4CeJC3jKGxyhl0sAiVVquxiw= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= -github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg= -github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4= github.com/a-h/templ v0.2.793 h1:Io+/ocnfGWYO4VHdR0zBbf39PQlnzVCVVD+wEEs6/qY= github.com/a-h/templ v0.2.793/go.mod h1:lq48JXoUvuQrU0VThrK31yFwdRjTCnIE5bcPCM9IP1w= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= @@ -26,12 +24,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/invopop/ctxi18n v0.6.0 h1:Qm3ZL/kK4EKvmLI3U2ETN2rWrtSTaxXrcA6ZUY9aVGE= -github.com/invopop/ctxi18n v0.6.0/go.mod h1:1Osw+JGYA+anHt0Z4reF36r5FtGHYjGQ+m1X7keIhPc= github.com/invopop/ctxi18n v0.9.0 h1:BIia4u4OngaHVn/7gvK0w6lccOXVtad8xU0KgJ+mnVA= github.com/invopop/ctxi18n v0.9.0/go.mod h1:1Osw+JGYA+anHt0Z4reF36r5FtGHYjGQ+m1X7keIhPc= -github.com/invopop/gobl v0.200.0 h1:C3KD1tXS9xaI2Gl0UGi4E6/kCsfOh2++aphyjtbr5iE= -github.com/invopop/gobl v0.200.0/go.mod h1:DmPohPel8b3ta4nDKnXRNzWQlB89cN74e0/WwPUEZUU= +github.com/invopop/gobl v0.207.0 h1:Gv6aUYKLdwuAw9HOhkk8eUztsYXPbPy6e/DBoBUDXmI= +github.com/invopop/gobl v0.207.0/go.mod h1:DmPohPel8b3ta4nDKnXRNzWQlB89cN74e0/WwPUEZUU= github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI= github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0= github.com/invopop/princepdf v0.0.0-20240408123340-585be3cab91a h1:xt18LlIfizLkFgLi+vK/m2SWOsAbQwVwQgbkzxKY0eU=