carlos / platform Public

console: billing page renders every sold currency's prices and shows the checked one; refused currencies are never defaulted (plans 6b task 8 review)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev d05c3dd9a67be68cda2e0f8e1cde598a378f9f1b parent 443ed18
4 files changed, +244 −126
  • internal/console/billingpage.go +46 −30
  • internal/console/billingpage_copy.go +2 −3
  • internal/console/billingpage_test.go +180 −79
  • internal/console/templates/billing.html +16 −14
diff --git a/internal/console/billingpage.go b/internal/console/billingpage.go
index 957e493ba..8e341705e 100644
--- a/internal/console/billingpage.go
+++ b/internal/console/billingpage.go
@@ -210,27 +210,33 @@ type billingOffers struct {
type billingField struct{ Name, Value string }
// billingBuyView is the first purchase: the paid plans, a quantity per
-// offered pack, and the currency. Currency is the one every price is
-// rendered in, and the purchase form posts exactly it. The radios are a
-// separate GET form back to the page (PlanQuery carries a chosen paid
-// plan), so choosing a currency reloads the prices; an account's fixed
-// currency shows as text with no radios.
+// offered pack, and the currency, all in one form. Every currency the form
+// can submit has its prices on the page: with radios, each plan, team
+// total and pack carries one price per sold currency (Currencies), and
+// CSS shows only the checked one's (nothing is hidden while none is
+// checked); a fixed currency (Call 3) is text and a hidden field, with
+// prices in it alone.
type billingBuyView struct {
Plans []billingPlanOption
Packs []billingPackInput
- Currency string
Currencies []billingCurrencyOption
FixedCurrency string
- PlanQuery string
}
+// billingPrice is one price as the page shows it, in one currency.
+type billingPrice struct{ Code, Text string }
+
type billingPlanOption struct {
- Name, Label, Price, Total string
- Checked bool
+ Name, Label string
+ Checked bool
+ // Prices and, on a team plan, Totals: one per currency the form can
+ // submit.
+ Prices, Totals []billingPrice
}
type billingPackInput struct {
- Name, Price string
+ Name, Price string // Price: the change form's, in the subscription's currency
+ Prices []billingPrice // the purchase form's, one per currency it can submit
Max, Value int
}
@@ -396,20 +402,23 @@ func (s *Server) billingViewFor(r *http.Request, in billingPageInput, st billing
}
// billingBuy is the purchase form. The currency: an account's fixed one
-// (Call 3) as text; else an explicit sold code, else the visitor's
-// country's, else the book's default; an explicit code not sold is
-// refused with nothing preselected (Call 2).
+// (Call 3) as text; else radios for the book's currencies, preselecting an
+// explicit sold code, else the visitor's country's, else the book's
+// default. An explicit code not sold is refused with nothing preselected
+// (Call 2), and the required radios make the owner choose one.
func (s *Server) billingBuy(r *http.Request, book *plans.PriceBook, b *billingAccount, members int, notice *string) *billingBuyView {
cat := s.cfg.PlanCatalog
buy := &billingBuyView{}
raw := r.URL.Query().Get("currency")
- display, chosen := book.DefaultCurrency, ""
+ codes, order := book.Currencies, book.DefaultCurrency
if b != nil && b.Currency != "" {
- buy.FixedCurrency, display = b.Currency, b.Currency
+ buy.FixedCurrency = b.Currency
+ codes, order = []string{b.Currency}, b.Currency
if raw != "" && raw != b.Currency {
*notice = fmt.Sprintf(billingCopy["currency.fixed"], b.Currency)
}
} else {
+ chosen := ""
code, refused, shown := currencyQuery(raw, book)
switch {
case refused && shown != "":
@@ -423,29 +432,30 @@ func (s *Server) billingBuy(r *http.Request, book *plans.PriceBook, b *billingAc
chosen = c
}
}
- if chosen != "" {
- display = chosen
- }
for _, c := range book.Currencies {
buy.Currencies = append(buy.Currencies, billingCurrencyOption{Code: c, Checked: c == chosen})
}
}
- buy.Currency = display
+ // The plans in the order of their lowest yearly total in one currency
+ // (the book prices every paid plan in every sold currency), so the
+ // order doesn't move with the radios.
want := r.URL.Query().Get("plan")
- if p, ok := cat.Plans[want]; ok && p.Paid {
- buy.PlanQuery = want
- }
seen := map[string]bool{}
- for _, name := range paidPlansByTotal(cat, book, display) {
+ for _, name := range paidPlansByTotal(cat, book, order) {
p := cat.Plans[name]
- price, _ := book.PlanPrice(name, display)
opt := billingPlanOption{Name: name, Label: planLabel(name), Checked: name == want}
- if p.Team != nil {
- opt.Price = fmt.Sprintf(billingCopy["team.price"], plans.FormatMinor(display, price), p.Team.MinMembers)
- opt.Total = fmt.Sprintf(billingCopy["team.total"], plans.FormatMinor(display, price*int64(p.Team.Billed(members))))
- } else {
- opt.Price = fmt.Sprintf(billingCopy["plan.price"], plans.FormatMinor(display, price))
+ for _, c := range codes {
+ price, ok := book.PlanPrice(name, c)
+ if !ok {
+ continue
+ }
+ if p.Team != nil {
+ opt.Prices = append(opt.Prices, billingPrice{c, fmt.Sprintf(billingCopy["team.price"], plans.FormatMinor(c, price), p.Team.MinMembers)})
+ opt.Totals = append(opt.Totals, billingPrice{c, fmt.Sprintf(billingCopy["team.total"], plans.FormatMinor(c, price*int64(p.Team.Billed(members))))})
+ } else {
+ opt.Prices = append(opt.Prices, billingPrice{c, fmt.Sprintf(billingCopy["plan.price"], plans.FormatMinor(c, price))})
+ }
}
buy.Plans = append(buy.Plans, opt)
for _, pk := range p.Packs {
@@ -453,7 +463,13 @@ func (s *Server) billingBuy(r *http.Request, book *plans.PriceBook, b *billingAc
continue
}
seen[pk] = true
- buy.Packs = append(buy.Packs, packInput(cat, book, pk, display, 0))
+ in := billingPackInput{Name: pk, Max: cat.Packs[pk].MaxQuantity}
+ for _, c := range codes {
+ if price, ok := book.PackPrice(pk, c); ok {
+ in.Prices = append(in.Prices, billingPrice{c, fmt.Sprintf(billingCopy["pack.price"], plans.FormatMinor(c, price))})
+ }
+ }
+ buy.Packs = append(buy.Packs, in)
}
}
return buy
diff --git a/internal/console/billingpage_copy.go b/internal/console/billingpage_copy.go
index 81097f50d..fcc2912d8 100644
--- a/internal/console/billingpage_copy.go
+++ b/internal/console/billingpage_copy.go
@@ -62,9 +62,8 @@ var billingCopy = map[string]string{
"button.upgrade": "Upgrade to %s",
"button.stop": "Stop renewal",
"button.resume": "Turn renewal back on",
- // Review fix round 1: the currency form's button, the eyebrow, the
- // not-owner page's link and the read errors.
- "currency.show": "Show prices",
+ // Review fix round 1: the eyebrow, the not-owner page's link and the
+ // read errors.
"page.eyebrow": "Account · %s",
"upgrade.new_account": "Create an account",
"error.title": "Error",
diff --git a/internal/console/billingpage_test.go b/internal/console/billingpage_test.go
index f0e93b1f1..41de921f6 100644
--- a/internal/console/billingpage_test.go
+++ b/internal/console/billingpage_test.go
@@ -2,6 +2,7 @@ package console
import (
"fmt"
+ "html"
"net/http"
"net/http/httptest"
"net/url"
@@ -112,7 +113,7 @@ func TestDecideBillingPage(t *testing.T) {
"team.members", "renews", "button.confirm", "button.continue", "button.start_over", "button.match_seats",
"button.portal", "upgrade.not_owner_title", "upgrade.not_owner", "pick.title",
// Task 8's own labels and messages (no wording outside the map).
- "page.eyebrow", "page.read_failed", "upgrade.read_failed", "error.title", "currency.show", "upgrade.new_account"} {
+ "page.eyebrow", "page.read_failed", "upgrade.read_failed", "error.title", "upgrade.new_account"} {
if billingCopy[k] == "" {
t.Errorf("billingCopy has no %q", k)
}
@@ -673,109 +674,209 @@ func htmlForm(body, open string) string {
}
var (
- currencyField = regexp.MustCompile(`<input type="([a-z]+)" name="currency" value="([^"]*)"`)
- hiddenField = regexp.MustCompile(`<input type="hidden" name="([^"]+)" value="([^"]*)"`)
+ radioField = regexp.MustCompile(`<input type="radio" name="currency" value="([^"]*)"([^>]*)>`)
+ hiddenCcy = regexp.MustCompile(`<input type="hidden" name="currency" value="([^"]*)">`)
+ planBlock = regexp.MustCompile(`(?s)<p data-plan="([^"]+)">(.*?)</p>`)
+ packBlock = regexp.MustCompile(`(?s)<tr data-pack="([^"]+)">(.*?)</tr>`)
+ priceSpan = regexp.MustCompile(`<span class="small price price-([a-z0-9]+)( total)?" data-currency="([a-z0-9]+)">([^<]*)</span>`)
+ anyPriceTag = regexp.MustCompile(`class="[^"]*\bprice\b`)
)
-// TestBillingPagePricesFollowShownCurrency: the purchase form submits the
-// currency its prices are rendered in, for an absent, sold or refused
-// query; the currency radios are their own GET form back to the page, so
-// choosing one reloads the prices, keeping the chosen plan.
-func TestBillingPagePricesFollowShownCurrency(t *testing.T) {
- pf := newBillingPageFixture(t)
- book := pf.srv.billing.cfg.Book
- buyOpen := `<form method="post" action="/a/` + pf.acct.Sqid + `/billing/checkout">`
- radiosOpen := `<form method="get" action="/a/` + pf.acct.Sqid + `/billing">`
+// buyFormPrices is the purchase form the billing page renders, parsed: the
+// currencies it can submit (each radio, or the fixed hidden field), which
+// radios are checked and required, and every price element by plan or
+// pack, currency and kind ("price" or "total").
+type buyFormPrices struct {
+ submits, checked []string
+ allRequired bool
+ prices map[string]map[string]map[string]string // plan or "pack:<name>" -> currency -> kind -> text
+}
- // check is the page at query: its purchase form posts priced, once, as
- // a hidden field, and shows personal's price in priced.
- check := func(t *testing.T, query, priced string) string {
- t.Helper()
- _, body := pf.page(t, query)
- buy := htmlForm(body, buyOpen)
- if buy == "" {
- t.Fatalf("?%s: no purchase form:\n%s", query, body)
- }
- fields := currencyField.FindAllStringSubmatch(buy, -1)
- if len(fields) != 1 || fields[0][1] != "hidden" || fields[0][2] != priced {
- t.Fatalf("?%s: the purchase form's currency fields = %q, want one hidden %q", query, fields, priced)
- }
- price, ok := book.PlanPrice("personal", priced)
- if !ok {
- t.Fatalf("no personal price in %s", priced)
+func parseBuyForm(t *testing.T, form string) buyFormPrices {
+ t.Helper()
+ got := buyFormPrices{allRequired: true, prices: map[string]map[string]map[string]string{}}
+ for _, m := range radioField.FindAllStringSubmatch(form, -1) {
+ got.submits = append(got.submits, m[1])
+ if strings.Contains(m[2], " checked") {
+ got.checked = append(got.checked, m[1])
}
- if want := esc(fmt.Sprintf(billingCopy["plan.price"], plans.FormatMinor(priced, price))); !strings.Contains(buy, want) {
- t.Errorf("?%s: the purchase form is not priced in %s (%q):\n%s", query, priced, want, buy)
+ if !strings.Contains(m[2], " required") {
+ got.allRequired = false
}
- for _, other := range book.Currencies {
- if other == priced {
- continue
+ }
+ for _, m := range hiddenCcy.FindAllStringSubmatch(form, -1) {
+ got.submits = append(got.submits, m[1])
+ }
+ spans := 0
+ add := func(owner, body string) {
+ for _, m := range priceSpan.FindAllStringSubmatch(body, -1) {
+ spans++
+ if m[1] != m[3] {
+ t.Errorf("%s: a price tagged price-%s carries data-currency %s", owner, m[1], m[3])
+ }
+ kind := "price"
+ if m[2] != "" {
+ kind = "total"
+ }
+ if got.prices[owner] == nil {
+ got.prices[owner] = map[string]map[string]string{}
}
- if p, ok := book.PlanPrice("personal", other); ok && strings.Contains(buy, esc(plans.FormatMinor(other, p))+" ") {
- t.Errorf("?%s: a %s price shows beside a %s purchase", query, other, priced)
+ if got.prices[owner][m[1]] == nil {
+ got.prices[owner][m[1]] = map[string]string{}
}
+ if _, dup := got.prices[owner][m[1]][kind]; dup {
+ t.Errorf("%s: two %s %s elements", owner, m[1], kind)
+ }
+ got.prices[owner][m[1]][kind] = html.UnescapeString(m[4])
}
- return body
}
- for _, c := range []struct{ query, priced string }{
- {"", book.DefaultCurrency}, // no country: the book's default
- {"currency=gbp", "gbp"},
- {"currency=eur", "eur"},
- {"currency=jpy", book.DefaultCurrency}, // refused: nothing preselected, priced as shown
- {"currency=" + url.QueryEscape("<script>"), book.DefaultCurrency},
- {"currency=USD", book.DefaultCurrency},
- } {
- t.Run(c.query, func(t *testing.T) { check(t, c.query, c.priced) })
+ for _, m := range planBlock.FindAllStringSubmatch(form, -1) {
+ add(m[1], m[2])
+ }
+ for _, m := range packBlock.FindAllStringSubmatch(form, -1) {
+ add("pack:"+m[1], m[2])
}
+ // No price outside a plan or pack, and none untagged.
+ if n := len(anyPriceTag.FindAllString(form, -1)); n != spans {
+ t.Errorf("the purchase form has %d price elements, %d of them tagged by plan or pack and currency", n, spans)
+ }
+ return got
+}
- // The radios: a GET form to the page itself, a radio per sold
- // currency, its own button, and none of them inside the purchase form.
- body := check(t, "plan=community", book.DefaultCurrency)
- radios := htmlForm(body, radiosOpen)
- if radios == "" {
- t.Fatalf("no currency GET form %q:\n%s", radiosOpen, body)
+// assertBuyFormPriced is the guard: every currency the purchase form can
+// submit has a price for every offered plan (and a total on a team plan)
+// and every offered pack, each the book's; no price is in a currency the
+// form can't submit; and with radios, a CSS rule per sold currency hides
+// every price but the checked currency's.
+func assertBuyFormPriced(t *testing.T, pf *billingPageFixture, body string, members int) buyFormPrices {
+ t.Helper()
+ cat, book := pf.srv.cfg.PlanCatalog, pf.srv.billing.cfg.Book
+ form := htmlForm(body, `<form class="buy" method="post" action="/a/`+pf.acct.Sqid+`/billing/checkout">`)
+ if form == "" {
+ t.Fatalf("no purchase form:\n%s", body)
+ }
+ got := parseBuyForm(t, form)
+ if len(got.submits) == 0 {
+ t.Fatalf("the purchase form submits no currency:\n%s", form)
+ }
+ var paid, packs []string
+ for name, p := range cat.Plans {
+ if !p.Paid {
+ continue
+ }
+ paid = append(paid, name)
+ for _, pk := range p.Packs {
+ if !slices.Contains(packs, pk) {
+ packs = append(packs, pk)
+ }
+ }
}
- for _, code := range book.Currencies {
- if !strings.Contains(radios, `<input type="radio" name="currency" value="`+code+`"`) {
- t.Errorf("the currency form has no %s radio", code)
+ for _, c := range got.submits {
+ for _, name := range paid {
+ p := cat.Plans[name]
+ price, _ := book.PlanPrice(name, c)
+ want := map[string]string{"price": fmt.Sprintf(billingCopy["plan.price"], plans.FormatMinor(c, price))}
+ if p.Team != nil {
+ want = map[string]string{
+ "price": fmt.Sprintf(billingCopy["team.price"], plans.FormatMinor(c, price), p.Team.MinMembers),
+ "total": fmt.Sprintf(billingCopy["team.total"], plans.FormatMinor(c, price*int64(p.Team.Billed(members)))),
+ }
+ }
+ for kind, w := range want {
+ if g := got.prices[name][c][kind]; g != w {
+ t.Errorf("plan %s, %s %s = %q, want %q", name, c, kind, g, w)
+ }
+ }
+ }
+ for _, pk := range packs {
+ price, _ := book.PackPrice(pk, c)
+ if g, w := got.prices["pack:"+pk][c]["price"], fmt.Sprintf(billingCopy["pack.price"], plans.FormatMinor(c, price)); g != w {
+ t.Errorf("pack %s, %s price = %q, want %q", pk, c, g, w)
+ }
}
}
- if !strings.Contains(radios, esc(billingCopy["currency.show"])) {
- t.Error("the currency form has no button")
+ for owner, byCcy := range got.prices {
+ for c := range byCcy {
+ if !slices.Contains(got.submits, c) {
+ t.Errorf("%s shows a %s price, which the form can't submit (%v)", owner, c, got.submits)
+ }
+ }
}
- if strings.Contains(htmlForm(body, buyOpen), `type="radio" name="currency"`) {
- t.Error("a currency radio sits inside the purchase form")
+ rule := func(c string) string {
+ return `.buy:has(input[name=currency][value=` + c + `]:checked) .price:not(.price-` + c + `){display:none}`
}
-
- // Choosing gbp: submit the radio form as a browser would, its hidden
- // fields plus the chosen radio. The plan stays chosen and the prices
- // and the posted currency are gbp.
- q := url.Values{}
- for _, m := range hiddenField.FindAllStringSubmatch(radios, -1) {
- q.Add(m[1], m[2])
+ // With radios, one rule per sold currency and no other price rule, so
+ // nothing is hidden while no radio is checked; a fixed currency has
+ // none.
+ fixed := len(hiddenCcy.FindAllString(form, -1)) > 0
+ for _, c := range book.Currencies {
+ if has := strings.Contains(body, rule(c)); has == fixed {
+ t.Errorf("fixed %v: the CSS rule for %s present = %v", fixed, c, has)
+ }
}
- if q.Get("plan") != "community" {
- t.Fatalf("the currency form drops the chosen plan: %v", q)
+ if n, want := strings.Count(body, " .price"), len(book.Currencies); !fixed && n != want || fixed && n != 0 {
+ t.Errorf("%d CSS rules name .price, want one per sold currency (fixed %v)", n, fixed)
}
- q.Set("currency", "gbp")
- body = check(t, q.Encode(), "gbp")
- if !strings.Contains(body, `name="plan" value="community" checked`) || !strings.Contains(body, `name="currency" value="gbp" checked`) {
- t.Errorf("after choosing gbp, community or gbp is not chosen:\n%s", body)
+ return got
+}
+
+// TestBillingPagePricesFollowShownCurrency: the purchase form can only
+// submit a currency whose prices are on the page, and shows the checked
+// one's. Absent query: the default preselected; sold code: it; refused:
+// nothing checked and the radios required, so the owner must choose a
+// sold one; fixed: text, a hidden field and its prices alone.
+func TestBillingPagePricesFollowShownCurrency(t *testing.T) {
+ pf := newBillingPageFixture(t)
+ book := pf.srv.billing.cfg.Book
+ for _, c := range []struct {
+ query string
+ checked []string
+ }{
+ {"", []string{book.DefaultCurrency}}, // no country: the book's default
+ {"currency=gbp", []string{"gbp"}},
+ {"currency=eur", []string{"eur"}},
+ {"currency=jpy", nil},
+ {"currency=" + url.QueryEscape("<script>"), nil},
+ {"currency=USD", nil},
+ {"plan=community&currency=gbp", []string{"gbp"}},
+ } {
+ t.Run(c.query, func(t *testing.T) {
+ _, body := pf.page(t, c.query)
+ got := assertBuyFormPriced(t, pf, body, 1)
+ if !slices.Equal(got.submits, book.Currencies) {
+ t.Errorf("radios = %v, want the book's %v", got.submits, book.Currencies)
+ }
+ if !slices.Equal(got.checked, c.checked) {
+ t.Errorf("checked = %v, want %v", got.checked, c.checked)
+ }
+ if !got.allRequired {
+ t.Error("the currency radios are not required")
+ }
+ if strings.Contains(body, `<form method="get" action="/a/`+pf.acct.Sqid+`/billing">`) {
+ t.Error("a separate currency form is back")
+ }
+ })
}
- // A plan the catalog doesn't sell is not carried.
- _, body = pf.page(t, "plan="+url.QueryEscape("../x"))
- if strings.Contains(htmlForm(body, radiosOpen), `name="plan"`) {
- t.Error("the currency form carried an unknown plan")
+
+ // Team totals follow the member count in every currency.
+ for i := 0; i < 11; i++ {
+ if err := pf.st.AddMember(pf.acct.ID, fmt.Sprintf("t%d@example.com", i), RoleMember, time.Now()); err != nil {
+ t.Fatal(err)
+ }
}
+ _, body := pf.page(t, "")
+ assertBuyFormPriced(t, pf, body, 12)
- // A fixed currency: text and the hidden field, no currency form.
+ // A fixed currency: text and the hidden field, its prices alone, no
+ // radios and no rules.
if err := pf.st.PutBillingState(billingAccount{AccountID: pf.acct.ID, Subscription: "sub_old", State: billing.StateEnded,
Currency: "eur", PaidPacks: map[string]int{}}); err != nil {
t.Fatal(err)
}
- body = check(t, "currency=gbp", "eur")
- if htmlForm(body, radiosOpen) != "" {
- t.Error("a fixed currency still offers the currency form")
+ _, body = pf.page(t, "currency=gbp")
+ got := assertBuyFormPriced(t, pf, body, 12)
+ if !slices.Equal(got.submits, []string{"eur"}) || len(got.checked) != 0 {
+ t.Errorf("fixed eur: submits %v, checked %v", got.submits, got.checked)
}
}
diff --git a/internal/console/templates/billing.html b/internal/console/templates/billing.html
index 01308d4b4..7504b6164 100644
--- a/internal/console/templates/billing.html
+++ b/internal/console/templates/billing.html
@@ -38,28 +38,30 @@
</form></div>{{end}}
{{if eq . "buy"}}{{with $.Billing.Buy}}
<h2>{{billingText "buy.title"}}</h2>
-{{if .FixedCurrency}}<p>{{.FixedCurrency}}</p>
-{{else}}<form method="get" action="{{$.Base}}/billing">
- {{if .PlanQuery}}<input type="hidden" name="plan" value="{{.PlanQuery}}">{{end}}
- <p>{{billingText "currency.legend"}}:
- {{range .Currencies}}<label><input type="radio" name="currency" value="{{.Code}}"{{if .Checked}} checked{{end}}> {{.Code}}</label>
- {{end}}<button class="linkish" type="submit">{{billingText "currency.show"}}</button>
- </p>
-</form>{{end}}
-<form method="post" action="{{$.Base}}/billing/checkout">
+{{if .Currencies}}<style>
+{{range .Currencies}}.buy:has(input[name=currency][value={{.Code}}]:checked) .price:not(.price-{{.Code}}){display:none}
+{{end}}</style>{{end}}
+<form class="buy" method="post" action="{{$.Base}}/billing/checkout">
<input type="hidden" name="csrf" value="{{$.CSRF}}">
- <input type="hidden" name="currency" value="{{.Currency}}">
- {{range .Plans}}<p>
+ {{if .FixedCurrency}}<p>{{.FixedCurrency}}<input type="hidden" name="currency" value="{{.FixedCurrency}}"></p>
+ {{else}}<p>{{billingText "currency.legend"}}:
+ {{range .Currencies}}<label><input type="radio" name="currency" value="{{.Code}}"{{if .Checked}} checked{{end}} required> {{.Code}}</label>
+ {{end}}
+ </p>{{end}}
+ {{range .Plans}}<p data-plan="{{.Name}}">
<label><input type="radio" name="plan" value="{{.Name}}"{{if .Checked}} checked{{end}} required> {{.Label}}</label>
- <span class="small">{{.Price}}{{if .Total}} {{.Total}}{{end}}</span>
+ {{range .Prices}}<span class="small price price-{{.Code}}" data-currency="{{.Code}}">{{.Text}}</span>
+ {{end}}{{range .Totals}}<span class="small price price-{{.Code}} total" data-currency="{{.Code}}">{{.Text}}</span>
+ {{end}}
</p>
{{end}}
<div class="tablewrap">
<table>
- {{range .Packs}}<tr>
+ {{range .Packs}}<tr data-pack="{{.Name}}">
<td><label for="pack-{{.Name}}">{{.Name}}</label></td>
<td><input type="number" id="pack-{{.Name}}" name="pack_{{.Name}}" min="0" max="{{.Max}}" step="1" value="{{.Value}}"></td>
- <td class="small">{{.Price}}</td>
+ <td>{{range .Prices}}<span class="small price price-{{.Code}}" data-currency="{{.Code}}">{{.Text}}</span>
+ {{end}}</td>
</tr>
{{end}}
</table>