From 792b2bd299b611e378679e5a269cc249e079c60e Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 12 Aug 2024 14:56:37 +0200 Subject: Use a new mintage format --- template/coins_mintages.templ | 44 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'template') diff --git a/template/coins_mintages.templ b/template/coins_mintages.templ index 47940e1..3446644 100644 --- a/template/coins_mintages.templ +++ b/template/coins_mintages.templ @@ -17,7 +17,8 @@ var denoms = [...]float64{ templ CoinsMintages() { {{ code := ctx.Value("code").(string) - table := ctx.Value("table").([]mintage.Row) + data := ctx.Value("mintages").(mintage.Data) + ctype := ctx.Value("type").(string) p := ctx.Value("printer").(lib.Printer) }}
@@ -58,14 +59,15 @@ templ CoinsMintages() {
- @coinTypeRadio("circ", p.T("Circulation Coins")) - @coinTypeRadio("nifc", p.T("NIFC / BU Sets")) - @coinTypeRadio("proof", p.T("Proof Coins")) + @coinTypeRadio(ctype, "circ", p.T("Circulation Coins")) + @coinTypeRadio(ctype, "nifc", p.T("NIFC / BU Sets")) + @coinTypeRadio(ctype, "proof", p.T("Proof Coins"))
+
{ p.T("Standard Issue Coins") }
@@ -74,16 +76,16 @@ templ CoinsMintages() { } - for _, row := range table { + for _, row := range data.Standard { - for _, col := range row.Cols { + for _, col := range row.Mintages[strToCtype(ctype)] { switch col { case mintage.Unknown: @@ -98,19 +100,43 @@ templ CoinsMintages() {
{ p.T("Year") }
- if row.Mintmark != "" { + if len(row.Mintmark) != 0 { { strconv.Itoa(row.Year) } { row.Mintmark } } else { { strconv.Itoa(row.Year) } } { p.T("Unknown") }
+
+
{ p.T("Commemorative Coins") }
+ + + + + + +
{ p.T("Year") }{ p.T("Commemorated Issue") }{ p.T("Mintage") }
+
} -templ coinTypeRadio(short, long string) { +templ coinTypeRadio(ctype, short, long string) { } + +func strToCtype(s string) int { + switch s { + case "circ": + return mintage.TypeCirc + case "nifc": + return mintage.TypeNIFC + case "proof": + return mintage.TypeProof + } + + /* Should never happen, but just incase */ + return mintage.TypeCirc +} -- cgit v1.2.3