| 1 | {{/* abono-account: the membership section of your own account page, not |
| 2 | a page of its own. Each holding as a plan and a status line, a |
| 3 | billing button for each Stripe customer the reader pays through, a link to the |
| 4 | plans for one who holds nothing that grants, and the problem the |
| 5 | billing button came back with. |
| 6 | |
| 7 | Call it from your account page with AbonoPages.Account(r) as data: |
| 8 | {{template "abono-account" (withL .Abono $L)}} |
| 9 | |
| 10 | Data: |
| 11 | Holdings []abono.Holding, newest first |
| 12 | Now time.Time, the moment they are described at |
| 13 | Manage bool, there is billing to manage |
| 14 | Customers []string, the reader's Stripe customers, one button each |
| 15 | Granted bool, something grants access now |
| 16 | BillingAction string, where the billing button posts |
| 17 | PlansURL string, the pricing page |
| 18 | Error string, a message key, or "" |
| 19 | L the request's localizer */}} |
| 20 | {{define "abono-account"}}{{$L := localizer $}}<section rst-box aria-labelledby="abono-account-title"> |
| 21 | <h2 id="abono-account-title">{{T $L "abono.pages.account_title"}}</h2> |
| 22 | {{with .Error}}{{template "callout" dict "L" $L "Tone" "negative" "Focus" true "Body" (T $L .)}}{{end}} |
| 23 | {{if .Holdings}}<ul> |
| 24 | {{range .Holdings}}<li><strong>{{.Plan}}</strong> {{template "abono-status" dict "L" $L "Holding" . "Now" $.Now}}</li> |
| 25 | {{end}}</ul> |
| 26 | {{else}}<p>{{T $L "abono.pages.account_none"}}</p> |
| 27 | {{end}} |
| 28 | {{if .Manage}}<p>{{T $L "abono.pages.account_manage_help"}}</p> |
| 29 | {{range .Customers}}{{template "abono-billing-button" dict "L" $L "Action" $.BillingAction "Customer" .}} |
| 30 | {{end}}{{end}} |
| 31 | {{if not .Granted}}<p><a rst-btn="primary" href="{{.PlansURL}}">{{T $L "abono.button.see_plans"}}</a></p> |
| 32 | {{end}} |
| 33 | </section>{{end}} |
| 34 | |