Skip to content

Commit

Permalink
IT: adding codice fiscale label for party identities (#9)
Browse files Browse the repository at this point in the history
* IT: adding codice fiscale label for party identities

* Adding missing italian example
  • Loading branch information
samlown authored Jul 18, 2024
1 parent b38de21 commit 142def7
Show file tree
Hide file tree
Showing 16 changed files with 493 additions and 22 deletions.
4 changes: 2 additions & 2 deletions components/org/address.templ
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ templ AddressWithLabel(addr *org.Address) {
<div class="org-address">
if addr.Label != "" {
<span class="label">
@t.T("organizing.address.label", i18n.M{"label": addr.Label})
@t.T("org.address.label", i18n.M{"label": addr.Label})
&nbsp;
</span>
}
Expand All @@ -31,7 +31,7 @@ templ addressLines(addr *org.Address) {
<span>
{ strings.Join(buildAddressLines(addr), ", ") }
if addr.Country != "" {
@t.T("organizing.address.country", i18n.M{"country": i18n.T(ctx, "country_names."+addr.Country.String())})
@t.T("org.address.country", i18n.M{"country": i18n.T(ctx, "country_names."+addr.Country.String())})
}
</span>
}
Expand Down
4 changes: 2 additions & 2 deletions components/org/address_templ.go

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

9 changes: 8 additions & 1 deletion components/org/party.templ
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org

import (
"cmp"
"fmt"
"slices"
"strings"

Expand All @@ -16,7 +17,7 @@ import (

templ Party(party *org.Party) {
<div class="org-party">
@t.Scope("organizing.party") {
@t.Scope("org.party") {
<div class="name">{ party.Name }</div>
if party.Alias != "" {
<div class="alias">{ party.Alias }</div>
Expand Down Expand Up @@ -120,6 +121,12 @@ func identityLabel(ctx context.Context, ident *org.Identity) string {
if ident.Type != "" {
return ident.Type.String()
}
if ident.Key != "" {
label := i18n.T(ctx, fmt.Sprintf(".identity_labels.%s", ident.Key))
if !strings.HasPrefix(label, "!") {
return label
}
}
return i18n.T(ctx, ".identity_code")
}

Expand Down
15 changes: 11 additions & 4 deletions components/org/party_templ.go

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

145 changes: 145 additions & 0 deletions examples/it-hotel-b2c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"$schema": "https://gobl.org/draft-0/envelope",
"head": {
"uuid": "8a51fd30-2a27-11ee-be56-0242ac120002",
"dig": {
"alg": "sha256",
"val": "277eb3247d67ce9de6feef8bec4d710e1a1f10feae546ab9da138e62dd6b1cc1"
},
"draft": true
},
"doc": {
"$schema": "https://gobl.org/draft-0/bill/invoice",
"uuid": "3aea7b56-59d8-4beb-90bd-f8f280d852a0",
"type": "standard",
"series": "SAMPLE",
"code": "002",
"issue_date": "2023-05-21",
"currency": "EUR",
"tax": {
"prices_include": "VAT"
},
"supplier": {
"name": "Hotel California",
"tax_id": {
"country": "IT",
"code": "12345678903"
},
"addresses": [
{
"num": "102",
"street": "Via California",
"locality": "Palermo",
"region": "PA",
"code": "33213",
"country": "IT"
}
],
"registration": {
"capital": "50000.00",
"currency": "EUR",
"office": "RM",
"entry": "123456"
}
},
"customer": {
"name": "Mela S.r.l.",
"tax_id": {
"country": "IT"
},
"identities": [
{
"key": "it-fiscal-code",
"code": "RSSGNN60R30H501U"
}
],
"inboxes": [
{
"key": "it-sdi-code",
"code": "M5UXCR5"
}
],
"addresses": [
{
"num": "23",
"street": "Via dei Mille",
"locality": "Firenze",
"region": "FI",
"code": "00100",
"country": "IT"
}
]
},
"lines": [
{
"i": 1,
"quantity": "1",
"item": {
"name": "Tassa di Soggiorno",
"price": "1.00"
},
"sum": "1.00",
"taxes": [
{
"cat": "VAT",
"rate": "exempt",
"ext": {
"it-sdi-nature": "N4"
}
}
],
"total": "1.00"
},
{
"i": 2,
"quantity": "1",
"item": {
"name": "Camera Matrimoniale",
"price": "125.00"
},
"sum": "125.00",
"taxes": [
{
"cat": "VAT",
"rate": "intermediate",
"percent": "10.0%"
}
],
"total": "125.00"
}
],
"totals": {
"sum": "126.00",
"tax_included": "11.36",
"total": "114.64",
"taxes": {
"categories": [
{
"code": "VAT",
"rates": [
{
"key": "exempt",
"ext": {
"it-sdi-nature": "N4"
},
"base": "1.00",
"amount": "0.00"
},
{
"key": "intermediate",
"base": "113.64",
"percent": "10.0%",
"amount": "11.36"
}
],
"amount": "11.36"
}
],
"sum": "11.36"
},
"tax": "11.36",
"total_with_tax": "126.00",
"payable": "126.00"
}
}
}
Loading

0 comments on commit 142def7

Please sign in to comment.