aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/templates/coins-mintages.html.tmpl
blob: e5fa5f1d8dd53c51fabb76d351cdb399a4ff5104 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
{{ define "header" }}
{{ template "header-navbar" . }}

<style>
	.mintage-table {
		white-space: nowrap;

        tr :is(th, td):first-child {
            position: sticky;
            left: 0;
        }

		.striped :is(th, td) {
			background-color: var(--pico-table-row-stripped-background-color);
		}
	}

	label[for="country-dd"] { display: none; }
	label[for="year-dd"]    { display: none; }

	form {
		&:has(#country:checked) {
			label[for="country-dd"] { display: unset; }
		}
		&:has(#year:checked) {
			label[for="year-dd"] { display: unset; }
		}
	}
</style>
{{ end }}

{{ define "content" }}
<header class="container">
	{{ template "navbar" . }}
	<h1>{{ .Get "Euro Coin Mintages" }}</h1>
</header>
<main class="container">
	<p>
		{{ .Get "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 eq .Code "nl" }}
	<h2>{{ .Get "Additional Notes" }}</h2>
	<ul>
		<li>
			{{ .Get "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, {Link:l}click here{-:E}."
				(map "Link" "#TODO") }}
		</li>
	</ul>
	{{ end }}
	<form>
		<div class="grid">
			<fieldset>
				<legend>{{ .GetC "Filter Method" "Header/Label" }}</legend>
				{{ template "mintages/filter-radio"
					(tuple .FilterBy "country" (.GetC "Country" "Header/Label")) }}
				{{ template "mintages/filter-radio"
					(tuple .FilterBy "year" (.GetC "Year" "Header/Label")) }}
			</fieldset>

			<label for="country-dd">
				{{ .GetC "Country" "Header/Label" }}
				<select id="country-dd" name="country">
					{{ $code := .Code }}
					{{ range .Countries }}
						<option
							value="{{ .Code }}"
							{{ if eq .Code $code }}
								selected
							{{ end }}
						>
							{{ .Name }}
						</option>
					{{ end }}
				</select>
			</label>

			<label for="year-dd">
				{{ .GetC "Year" "Header/Label" }}
				<select id="year-dd" name="year">
					{{ $year := .Year }}
					{{ range years }}
						<option
							value="{{ . }}"
							{{ if eq . $year }}
								selected
							{{ end }}
						>
							{{ . }}
						</option>
					{{ end }}
				</select>
			</label>

			<fieldset>
				{{ template "mintages/coin-type-radio"
				   (tuple .Type "circ" (.Get "Circulation Coins")) }}
				{{ template "mintages/coin-type-radio"
				   (tuple .Type "nifc" (.Get "NIFC / BU Sets")) }}
				{{ template "mintages/coin-type-radio"
				   (tuple .Type "proof" (.Get "Proof Coins")) }}
			</fieldset>
		</div>
		<button type="submit">{{ .GetC "Filter" "Header/Label" }}</button>
	</form>

	{{ if and (eq .FilterBy "country")
	          (gt (len .CountryMintages.Standard) 0) }}
	<figure>
		<figcaption>{{ .Get "Standard Issue Coins" }}</figcaption>
		<div class="overflow-auto">
			<table class="mintage-table striped" role="grid">
				<thead>
					<th>{{ .GetC "Year" "Header/Label" }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.01 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.02 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.05 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.10 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.20 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.50 }}</th>
					<th data-numeric>{{ .Printer.Ftom 1.00 }}</th>
					<th data-numeric>{{ .Printer.Ftom 2.00 }}</th>
				</thead>
				<tbody>
					{{ $p := .Printer }}
					{{ range .CountryMintages.Standard }}
						<tr>
							<th scope="row">
								{{- .Year -}}
								{{- if .Mintmark.Valid -}}
									&nbsp;<sub><small>{{ .Mintmark.V }}</small></sub>
								{{- end -}}
							</th>
							{{ range .Mintages }}
							{{ template "mintages/mintage-cell" (tuple . $p) }}
							{{ end }}
						</tr>
					{{ end }}
				</tbody>
			</table>
		</div>
	</figure>

	{{ else if and (eq .FilterBy "year")
	               (gt (len .YearMintages.Standard) 0) }}

	<figure>
		<figcaption>{{ .Get "Standard Issue Coins" }}</figcaption>
		<div class="overflow-auto">
			<table class="mintage-table striped" role="grid">
				<thead>
					<th>{{ .GetC "Country" "Header/Label" }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.01 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.02 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.05 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.10 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.20 }}</th>
					<th data-numeric>{{ .Printer.Ftom 0.50 }}</th>
					<th data-numeric>{{ .Printer.Ftom 1.00 }}</th>
					<th data-numeric>{{ .Printer.Ftom 2.00 }}</th>
				</thead>
				<tbody>
					{{ $p := .Printer }}
					{{ range .YearMintages.Standard }}
					<tr>
						<th scope="row">
							{{- .Country -}}
							{{- if .Mintmark.Valid -}}
							&nbsp;<sub><small>{{ .Mintmark.V }}</small></sub>
							{{- end -}}
						</th>
						{{ range .Mintages }}
						{{ template "mintages/mintage-cell" (tuple . $p) }}
						{{ end }}
					</tr>
					{{ end }}
				</tbody>
			</table>
		</div>
	</figure>
	{{ end }}

	{{ if eq .FilterBy "country" }}
		{{ if ne (len .CountryMintages.Commemorative) 0 }}
		<figure>
			<figcaption>{{ .Get "Commemorative Coins" }}</figcaption>
			<table class="mintage-table" role="grid">
				<thead>
					<th>{{ .GetC "Year" "Header/Label" }}</th>
					<th>{{ .GetC "Commemorated Topic" "Header/Label" }}</th>
					<th data-numeric>{{ .GetC "Mintage" "Header/Label" }}</th>
				</thead>
				<tbody>
					{{ $p := .Printer }}
					{{ range $i, $ := .CountryMintages.Commemorative }}
					{{ $y := .Year }}
					{{ $mm := .Mintmark }}
					{{ $ccs := .CCs }}
					{{ range $j, $cc := .CCs }}
					<tr {{ if evenp $i }}class="striped"{{ end }}>
						{{ if eq $j 0 }}
						<th scope="row" rowspan="{{ len $ccs }}">
							{{- $y -}}
							{{- if $mm.Valid -}}
							&nbsp;<sub><small>{{ $mm.V }}</small></sub>
							{{- end -}}
						</th>
						{{ end }}
						<td>{{ $p.GetC .Name "CC Name" }}</td>
						{{ template "mintages/mintage-cell" (tuple .Mintage $p) }}
					</tr>
					{{ end }}
					{{ end }}
				</tbody>
			</table>
		</figure>
		{{ end }}

	{{ else if eq .FilterBy "year" }}

		{{ if ne (len .YearMintages.Commemorative) 0 }}
		<figure>
			<figcaption>{{ .Get "Commemorative Coins" }}</figcaption>
			<table class="mintage-table" role="grid">
				<thead>
					<th>{{ .GetC "Country" "Header/Label" }}</th>
					<th>{{ .GetC "Commemorated Topic" "Header/Label" }}</th>
					<th data-numeric>{{ .GetC "Mintage" "Header/Label" }}</th>
				</thead>
				<tbody>
					{{ $p := .Printer }}
					{{ range $i, $ := .YearMintages.Commemorative }}
					{{ $c := .Country }}
					{{ $mm := .Mintmark }}
					{{ $ccs := .CCs }}
					{{ range $j, $cc := .CCs }}
					<tr {{ if evenp $i }}class="striped"{{ end }}>
						{{ if eq $j 0 }}
						<th scope="row" rowspan="{{ len $ccs }}">
							{{- $c -}}
							{{- if $mm.Valid -}}
							&nbsp;<sub><small>{{ $mm.V }}</small></sub>
							{{- end -}}
						</th>
						{{ end }}
						<td>{{ $p.GetC .Name "CC Name" }}</td>
						{{ template "mintages/mintage-cell" (tuple .Mintage $p) }}
					</tr>
					{{ end }}
					{{ end }}
				</tbody>
			</table>
		</figure>
		{{ end }}
	{{ end }}
</main>
{{ end }}

{{ define "mintages/coin-type-radio" }}
<label for="{{ index . 1 }}">
	<input
		id="{{ index . 1 }}"
		name="type"
		type="radio"
		value="{{ index . 1 }}"
		{{ if eq (index . 0) (index . 1) }}
		checked
		{{ end }}
	/>
	{{ index . 2 }}
</label>
{{ end }}

{{ define "mintages/filter-radio" }}
{{ $v := index . 1 }}
<label for="{{ $v }}">
	<input
		name="filter-by"
		type="radio"
		value="{{ $v }}"
		id="{{ $v }}"
		{{ if eq (index . 0) $v }}
		checked
		{{ end }}
	>
	{{ index . 2 }}
</label>
{{ end }}

{{ define "mintages/mintage-cell" }}
{{ $v := index . 0 }}
{{ $p := index . 1 }}
{{ if not $v.Valid }}
	<td data-numeric>{{ $p.GetC "Unknown" "Header/Label" }}</td>
{{ else if eq $v.V 0 }}
	<td data-numeric>—</td>
{{ else }}
	<td data-numeric>{{ $p.Itoa $v.V }}</td>
{{ end }}
{{ end }}