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
<!DOCTYPE html>
<html lang=en>
<head>
{{ template "html/_head.html" }}
<title>CMS | Billing</title>
</head>
<body class='page bg-light'>
<style>{{ template "css/main.css" }}</style>
<main>
{{ template "html/_header.html" $ }}
<div class="pricing-header px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center">
<h1 class="display-4">Billing</h1>
</div>
{{if .User}}
<div class='container'>
<div class='row'>
<div class="col-12 col-md-6 mb-5">
<div class='text-center'>
{{if .User.HasEmail}}
<p>Update your email.</p>
{{else}}
<p>Set your email in case you get locked out of your account.</p>
{{end}}
</div>
<form action='/user/update/email' method=POST>
<label for=email>Email</label>
<input id=email name=email type=email class="mb-3 form-control" placeholder="email" required {{if .User.HasEmail}}value="{{.User.Email}}"{{end}}>
<button type="submit" class="btn btn-primary">Go</button>
</form>
</div>
<div class="col-12 col-md-6 mb-5">
{{if .User | paid}}
<form action='/user/cancel/billing' method=POST class="text-center">
<p class='mb-5'>Cancel your {{.User.Org.Tier.Name}} subscription.</p>
<div class="d-inline-block">
<input type=hidden name=tier value="{{.User.Org.Tier.Name}}" />
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">{{.User.Org.Tier.Name}}</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">{{.User.Org.Tier.Price}} <small class="text-muted">/ {{.User.Org.Tier.TimeUnit}}</small></h1>
<ul class="list-unstyled mt-3 mb-4">
{{range .User.Org.Tier.Opts}}
<li>{{.Text}}</li>
{{end}}
</ul>
<button type="submit" class="btn btn-primary w-100">Cancel</button>
</div>
</div>
</form>
{{else}}
<p class='text-center mb-5'>Upgrade to a paid tier.<br>Get more access.</p>
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 mb-5 text-center">
{{range .Tiers}}
{{if not (.|isFree)}}
<form action='/user/update/billing' method=POST class="col">
<input type=hidden name=tier value="{{.Name}}" />
<div class="card mb-4 shadow-sm">
<div class="card-header">
<h4 class="my-0 font-weight-normal">{{.Name}}</h4>
</div>
<div class="card-body">
<h1 class="card-title pricing-card-title">{{.Price}} <small class="text-muted">/ {{.TimeUnit}}</small></h1>
<ul class="list-unstyled mt-3 mb-4">
{{range .Opts}}
<li>{{.Text}}</li>
{{end}}
</ul>
<button type="submit" class="btn btn-primary w-100">Go</button>
</div>
</form>
</div>
{{end}}
{{end}}
</div>
{{end}}
</div>
</div>
</div>
{{else}}
<div class='container'>
<div class='row'>
<div class="col-12">
<h1>Oops</h1>
<p>Sorry, our developers are lazy. This should really redirect you.</p>
</div>
</div>
</div>
{{end}}
{{ template "html/_footer.html" $ }}
</main>
{{ template "html/_scripts.html" }}
</body>
</html>