Add the country name to the footer’s address
Customer requested it
This commit is contained in:
parent
907d9844d3
commit
b6c4eb790f
|
@ -54,7 +54,7 @@ func (p *PublicPage) Setup(r *http.Request, user *auth.User, company *auth.Compa
|
|||
`, user.Locale.Language, company.ID),
|
||||
}
|
||||
|
||||
if err := p.CompanyAddress.FillFromDatabase(r.Context(), conn, company); err != nil {
|
||||
if err := p.CompanyAddress.FillFromDatabase(r.Context(), conn, user, company); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
@ -105,30 +105,35 @@ type address struct {
|
|||
PostalCode string
|
||||
Province string
|
||||
City string
|
||||
Country string
|
||||
Phone string
|
||||
Email string
|
||||
RTCNumber string
|
||||
}
|
||||
|
||||
func (addr *address) FillFromDatabase(ctx context.Context, conn *database.Conn, company *auth.Company) error {
|
||||
func (addr *address) FillFromDatabase(ctx context.Context, conn *database.Conn, user *auth.User, company *auth.Company) error {
|
||||
row := conn.QueryRow(ctx, `
|
||||
select trade_name
|
||||
, address
|
||||
, postal_code
|
||||
, province
|
||||
, city
|
||||
, coalesce(country_i18n.name, country.name) as country_name
|
||||
, phone::text
|
||||
, email::text
|
||||
, rtc_number
|
||||
from company
|
||||
join country using (country_code)
|
||||
left join country_i18n on country.country_code = country_i18n.country_code and country_i18n.lang_tag = $2
|
||||
where company_id = $1
|
||||
`, company.ID)
|
||||
`, company.ID, user.Locale.Language)
|
||||
return row.Scan(
|
||||
&addr.TradeName,
|
||||
&addr.Address,
|
||||
&addr.PostalCode,
|
||||
&addr.Province,
|
||||
&addr.City,
|
||||
&addr.Country,
|
||||
&addr.Phone,
|
||||
&addr.Email,
|
||||
&addr.RTCNumber,
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
<address>
|
||||
{{ .Address }}<br>
|
||||
{{ .PostalCode}} · {{ .City }} · {{ .Province }}<br>
|
||||
{{ .Country }}<br>
|
||||
<abbr>T</abbr> <a href="tel:{{ replaceAll .Phone " " "" }}">{{ .Phone }}</a><br>
|
||||
<a href="mailto:{{ .Email }}">{{ .Email }}</a>
|
||||
</address>
|
||||
|
|
Loading…
Reference in New Issue