aboutsummaryrefslogtreecommitdiff
path: root/cmd/sklad/series.tmpl
blob: 0e31e0f8d49f2e9106792a9534223d84c8374149 (plain)
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
{{ define "Title" }}{{ or .Prefix "Řady" }}{{ end }}
{{ define "Content" }}

{{ if .ErrorInvalidPrefix }}
<p>Chyba: Neplatný prefix.
{{ else if .ErrorSeriesAlreadyExists }}
<p>Chyba: Řada s tímto prefixem už existuje.
{{ else if .ErrorCannotChangePrefix }}
<p>Chyba: Prefix nelze měnit.
{{ else if .ErrorNoSuchSeries }}
<p>Chyba: Řada neexistuje.
{{ else if .ErrorSeriesInUse }}
<p>Chyba: Řada se používá.
{{ else if .Error }}
<p>Chyba: {{ .Error }}
{{ end }}

{{ if .Prefix }}
<h2>{{ .Prefix }}</h2>

{{ if .Description }}
<p>{{ .Description }}
{{ end }}
{{ else }}

<section>
<form method=post action="/series">
<header>
	<h3>Nová řada</h3>
	<input type=text name=prefix placeholder="Prefix řady">
	<input type=text name=description placeholder="Popis řady"
	><input type=submit value="Uložit">
	</form>
</header>
</form>
</section>

{{ range .AllSeries }}
<section>
<header>
	<h3><a href="/series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
{{ with $count := len .Containers }}
{{ if eq $count 1 }}
	<p>{{ $count }} obal
{{ else if and (ge $count 2) (le $count 4) }}
	<p>{{ $count }} obaly
{{ else if gt $count 0 }}
	<p>{{ $count }} obalů
{{ end }}
{{ end }}
	<form method=post action="/series?prefix={{ .Prefix }}">
	<input type=text name=description value="{{ .Description }}"
	><input type=submit value="Uložit">
	</form>
	<form method=post action="/series?prefix={{ .Prefix }}&amp;remove">
	<input type=submit value="Odstranit">
	</form>
</header>
</section>
{{ else }}
<p>Nejsou žádné řady.
{{ end }}

{{ end }}

{{ end }}