Skip to content

Commit

Permalink
Merge pull request #15 from invopop/paid-tag
Browse files Browse the repository at this point in the history
Adding "Paid" tag to invoice
  • Loading branch information
samlown authored Aug 27, 2024
2 parents 55ec103 + 74808c1 commit 16746ad
Show file tree
Hide file tree
Showing 45 changed files with 1,067 additions and 866 deletions.
13 changes: 13 additions & 0 deletions assets/styles/invoice.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ section.title .hero img {
max-width: 100%;
/* max-height: 10mm; */
}
section.title span.paid {
font-size: 9pt;
font-weight: 600;
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;
Expand Down Expand Up @@ -132,6 +144,7 @@ section.lines .alt-price:before {
section.lines .alt-price:after {
content: ')';
}

div.totals {
order: 8;
display: flex;
Expand Down
22 changes: 11 additions & 11 deletions components/bill/invoice/customer_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 32 additions & 24 deletions components/bill/invoice/invoice.templ
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package invoice

import (
"context"
"fmt"

"github.com/invopop/gobl"
"github.com/invopop/gobl/bill"
"github.com/invopop/gobl/org"
"github.com/invopop/gobl/tax"
"github.com/invopop/gobl.html/components/t"
"github.com/invopop/gobl.html/components/regimes/es"
"github.com/invopop/gobl.html/components/regimes/co"
"github.com/invopop/gobl.html/components/regimes/es"
"github.com/invopop/gobl.html/components/regimes/gr"
"github.com/invopop/gobl.html/components/regimes/mx"
"github.com/invopop/gobl.html/internal"
"github.com/invopop/gobl.html/components/regimes/pl"
"github.com/invopop/gobl.html/components/regimes/pt"
"github.com/invopop/gobl.html/components/regimes/gr"
"github.com/invopop/gobl.html/components/t"
"github.com/invopop/gobl.html/internal"
"github.com/invopop/gobl/bill"
"github.com/invopop/gobl/org"
"github.com/invopop/gobl/tax"
)

// Invoice renders a complete GOBL bill.Invoice object.
Expand Down Expand Up @@ -53,23 +54,30 @@ templ Invoice(env *gobl.Envelope, inv *bill.Invoice) {
}

templ title(inv *bill.Invoice) {
<section class="title">
<div class="hero">
if img := supplierLogo(ctx, inv); img != nil {
<img src={ img.URL } alt={ img.Label } height={ logoHeight(img) }/>
} else {
<div class="alias">
{ supplierAlias(inv) }
</div>
}
</div>
<h1 class="type">
@t.T("billing.invoice.title." + i18nTitleTag(inv))
</h1>
<h2 class="code">
{ code(inv.Series, inv.Code) }
</h2>
</section>
@t.Scope("billing.invoice.title") {
<section class="title">
<div class="hero">
if img := supplierLogo(ctx, inv); img != nil {
<img src={ img.URL } alt={ img.Label } height={ logoHeight(img) }/>
} else {
<div class="alias">
{ supplierAlias(inv) }
</div>
}
</div>
<h1 class="type">
@t.T("." + i18nTitleTag(inv))
</h1>
<h2 class="code">
{ code(inv.Series, inv.Code) }
if paid(inv) {
<span class="paid">
@t.T(".paid")
</span>
}
</h2>
</section>
}
}

func i18nTitleTag(inv *bill.Invoice) string {
Expand Down
Loading

0 comments on commit 16746ad

Please sign in to comment.