{{/* abono-plan-picker — the plans on sale, as cards grouped by interval: the monthly plans, then the yearly ones. A plan appears in a group only when it has a price sold at that interval (every month or every year: an unsupported price is never shown). With only one interval on sale there is one group and no switch label; with nothing on sale the picker renders nothing. The groups are all on the page, not toggled by script, so the picker works without JavaScript and every price is readable at once. Keys: Offers []abono.Offer, required — from Service.Offers Action string, required — where each card's buy form posts L *ui.Localizer */}} {{define "abono-plan-picker"}}{{$L := localizer $}}{{$action := .Action}}{{$month := false}}{{$year := false}}{{range .Offers}}{{range .Prices}}{{if and .Sold (not .Unsupported)}}{{if eq .Interval "month"}}{{$month = true}}{{else if eq .Interval "year"}}{{$year = true}}{{end}}{{end}}{{end}}{{end}}{{if or $month $year}}{{range $iv := list "month" "year"}}{{if or (and (eq $iv "month") $month) (and (eq $iv "year") $year)}}
{{if and $month $year}}

{{if eq $iv "month"}}{{T $L "abono.price.monthly"}}{{else}}{{T $L "abono.price.yearly"}}{{end}}

{{end}}{{range $.Offers}}{{$has := false}}{{range .Prices}}{{if and .Sold (not .Unsupported) (eq .Interval $iv)}}{{$has = true}}{{end}}{{end}}{{if $has}}{{template "abono-plan-card" dict "L" $L "Offer" . "Interval" $iv "Action" $action}}{{end}}{{end}}
{{end}}{{end}}{{end}}{{end}}