summaryrefslogtreecommitdiffhomepage
path: root/template/coins_mintages.templ
blob: 47940e1651d8be085bc537de6ebc6fa167a599f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package template

import (
	"strconv"

	"git.thomasvoss.com/euro-cash.eu/lib"
	"git.thomasvoss.com/euro-cash.eu/lib/mintage"
)

const muntrolpakketLinkStart = `<a href="#TODO">`

var denoms = [...]float64{
	0.01, 0.02, 0.05, 0.10,
	0.20, 0.50, 1.00, 2.00,
}

templ CoinsMintages() {
	{{
		code := ctx.Value("code").(string)
		table := ctx.Value("table").([]mintage.Row)
		p := ctx.Value("printer").(lib.Printer)
	}}
	<header>
		@navbar()
		<h1>{ p.T("Euro Coin Mintages") }</h1>
	</header>
	<main>
		<p>
			{ p.T("Here you’ll be able to view all the known mintages for all coins. You’ll also be able to filter on country, denomination, etc. If you have any mintage data that’s missing from our site, feel free to contact us.") }
		</p>
		<hr/>
		if code == "nl" {
			<h2>{ p.T("Additional Notes") }</h2>
			<ul>
				<li>
					@templ.Raw(p.T("Most coins from the years 2003–2016 are listed as NIFC coins while other popular sources such as Numista claim they were minted for circulation. For more information on why others are wrong, %sclick here%s.", muntrolpakketLinkStart, linkEnd))
				</li>
				<li>
					{ p.T("In 2003 Numista calculated a total of %d coins issued for coin sets per denomination. Our own calculations found only %d. Numista also forgot to include the many hundred thousand coins from the coin roll sets that were produced.", 217503, 177003) }
				</li>
			</ul>
		}
		<section>
			<form>
				<div class="grid">
					<label for="country-dd">
						{ p.T("Country") }
						<select id="country-dd" name="code">
							for _, c := range ctx.Value("countries").
								([]lib.Country) {
								<option
									value={ c.Code }
									selected?={ c.Code == code }
								>
									{ c.Name }
								</option>
							}
						</select>
					</label>
					<fieldset>
						@coinTypeRadio("circ", p.T("Circulation Coins"))
						@coinTypeRadio("nifc", p.T("NIFC / BU Sets"))
						@coinTypeRadio("proof", p.T("Proof Coins"))
					</fieldset>
				</div>
				<button type="submit">{ p.T("Filter") }</button>
			</form>
			<figure>
				<table class="mintage-table" role="grid">
					<thead>
						<th>{ p.T("Year") }</th>
						for _, x := range denoms {
							<th>{ p.Money(x, false) }</th>
						}
					</thead>
					<tbody>
						for _, row := range table {
							<tr>
								<th scope="col">
									if row.Mintmark != "" {
										{ strconv.Itoa(row.Year) }&nbsp;<sub><small>{ row.Mintmark }</small></sub>
									} else {
										{ strconv.Itoa(row.Year) }
									}
								</th>
								for _, col := range row.Cols {
									switch col {
										case mintage.Unknown:
											<td>{ p.T("Unknown") }</td>
										case 0:
											<td>—</td>
										default:
											<td>{ p.N(col) }</td>
									}
								}
							</tr>
						}
					</tbody>
				</table>
			</figure>
		</section>
	</main>
}

templ coinTypeRadio(short, long string) {
	<label for={ "compact-" + short }>
		<input
			id={ "compact-" + short }
			type="radio"
			name="type"
			value={ short }
			checked?={ ctx.Value("type").(string) == short }
		/>
		{ long }
	</label>
}